ember-rails 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ minispade.register('ember-data/adapters/fixture_adapter', "(function() {minispade.require(\"ember-data/core\");\nminispade.require(\"ember-data/system/adapters\");\n\nDS.fixtureAdapter = DS.Adapter.create({\n find: function(store, type, id) {\n var fixtures = type.FIXTURES;\n\n Ember.assert(\"Unable to find fixtures for model type \"+type.toString(), !!fixtures);\n if (fixtures.hasLoaded) { return; }\n\n setTimeout(function() {\n store.loadMany(type, fixtures);\n fixtures.hasLoaded = true;\n }, 300);\n },\n\n findMany: function() {\n this.find.apply(this, arguments);\n },\n\n findAll: function(store, type) {\n var fixtures = type.FIXTURES;\n\n Ember.assert(\"Unable to find fixtures for model type \"+type.toString(), !!fixtures);\n\n var ids = fixtures.map(function(item, index, self){ return item.id; });\n store.loadMany(type, ids, fixtures);\n }\n\n});\n\n})();\n//@ sourceURL=ember-data/adapters/fixture_adapter");minispade.register('ember-data/adapters/rest_adapter', "(function() {minispade.require(\"ember-data/core\");\nminispade.require('ember-data/system/adapters');\n/*global jQuery*/\n\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath;\n\nDS.RESTAdapter = DS.Adapter.extend({\n bulkCommit: false,\n\t\n createRecord: function(store, type, record) {\n var root = this.rootForType(type);\n\n var data = {};\n data[root] = record.toJSON();\n\n this.ajax(this.buildURL(root), \"POST\", {\n data: data,\n success: function(json) {\n this.sideload(store, type, json, root);\n store.didCreateRecord(record, json[root]);\n }\n });\n },\n\n createRecords: function(store, type, records) {\n if (get(this, 'bulkCommit') === false) {\n return this._super(store, type, records);\n }\n\n var root = this.rootForType(type),\n plural = this.pluralize(root);\n\n var data = {};\n data[plural] = records.map(function(record) {\n return record.toJSON();\n });\n\n this.ajax(this.buildURL(root), \"POST\", {\n data: data,\n\n success: function(json) {\n this.sideload(store, type, json, plural);\n store.didCreateRecords(type, records, json[plural]);\n }\n });\n },\n\n updateRecord: function(store, type, record) {\n var id = get(record, 'id');\n var root = this.rootForType(type);\n\n var data = {};\n data[root] = record.toJSON();\n\n this.ajax(this.buildURL(root, id), \"PUT\", {\n data: data,\n success: function(json) {\n this.sideload(store, type, json, root);\n store.didUpdateRecord(record, json && json[root]);\n }\n });\n },\n\n updateRecords: function(store, type, records) {\n if (get(this, 'bulkCommit') === false) {\n return this._super(store, type, records);\n }\n\n var root = this.rootForType(type),\n plural = this.pluralize(root);\n\n var data = {};\n data[plural] = records.map(function(record) {\n return record.toJSON();\n });\n\n this.ajax(this.buildURL(root, \"bulk\"), \"PUT\", {\n data: data,\n success: function(json) {\n this.sideload(store, type, json, plural);\n store.didUpdateRecords(records, json[plural]);\n }\n });\n },\n\n deleteRecord: function(store, type, record) {\n var id = get(record, 'id');\n var root = this.rootForType(type);\n\n this.ajax(this.buildURL(root, id), \"DELETE\", {\n success: function(json) {\n if (json) { this.sideload(store, type, json); }\n store.didDeleteRecord(record);\n }\n });\n },\n\n deleteRecords: function(store, type, records) {\n if (get(this, 'bulkCommit') === false) {\n return this._super(store, type, records);\n }\n\n var root = this.rootForType(type),\n plural = this.pluralize(root);\n\n var data = {};\n data[plural] = records.map(function(record) {\n return get(record, 'id');\n });\n\n this.ajax(this.buildURL(root, 'bulk'), \"DELETE\", {\n data: data,\n success: function(json) {\n if (json) { this.sideload(store, type, json); }\n store.didDeleteRecords(records);\n }\n });\n },\n\n find: function(store, type, id) {\n var root = this.rootForType(type);\n\n this.ajax(this.buildURL(root, id), \"GET\", {\n success: function(json) {\n store.load(type, json[root]);\n this.sideload(store, type, json, root);\n }\n });\n },\n\n findMany: function(store, type, ids) {\n var root = this.rootForType(type), plural = this.pluralize(root);\n\n this.ajax(this.buildURL(root), \"GET\", {\n data: { ids: ids },\n success: function(json) {\n store.loadMany(type, json[plural]);\n this.sideload(store, type, json, plural);\n }\n });\n },\n\n findAll: function(store, type) {\n var root = this.rootForType(type), plural = this.pluralize(root);\n\n this.ajax(this.buildURL(root), \"GET\", {\n success: function(json) {\n store.loadMany(type, json[plural]);\n this.sideload(store, type, json, plural);\n }\n });\n },\n\n findQuery: function(store, type, query, recordArray) {\n var root = this.rootForType(type), plural = this.pluralize(root);\n\n this.ajax(this.buildURL(root), \"GET\", {\n data: query,\n success: function(json) {\n recordArray.load(json[plural]);\n this.sideload(store, type, json, plural);\n }\n });\n },\n\n // HELPERS\n\n plurals: {},\n\n // define a plurals hash in your subclass to define\n // special-case pluralization\n pluralize: function(name) {\n return this.plurals[name] || name + \"s\";\n },\n\n rootForType: function(type) {\n if (type.url) { return type.url; }\n\n // use the last part of the name as the URL\n var parts = type.toString().split(\".\");\n var name = parts[parts.length - 1];\n return name.replace(/([A-Z])/g, '_$1').toLowerCase().slice(1);\n },\n\n ajax: function(url, type, hash) {\n hash.url = url;\n hash.type = type;\n hash.dataType = 'json';\n hash.contentType = 'application/json; charset=utf-8';\n hash.context = this;\n\n if (hash.data && type !== 'GET') {\n hash.data = JSON.stringify(hash.data);\n }\n\n jQuery.ajax(hash);\n },\n\n sideload: function(store, type, json, root) {\n var sideloadedType, mappings;\n\n for (var prop in json) {\n if (!json.hasOwnProperty(prop)) { continue; }\n if (prop === root) { continue; }\n\n sideloadedType = type.typeForAssociation(prop);\n\n if (!sideloadedType) {\n mappings = get(this, 'mappings');\n Ember.assert(\"Your server returned a hash with the key \" + prop + \" but you have no mappings\", !!mappings);\n\n sideloadedType = get(mappings, prop);\n Ember.assert(\"Your server returned a hash with the key \" + prop + \" but you have no mapping for it\", !!sideloadedType);\n }\n\n this.loadValue(store, sideloadedType, json[prop]);\n }\n },\n\n loadValue: function(store, type, value) {\n if (value instanceof Array) {\n store.loadMany(type, value);\n } else {\n store.load(type, value);\n }\n },\n\n buildURL: function(record, suffix) {\n var url = [\"\"];\n\n Ember.assert(\"Namespace URL (\" + this.namespace + \") must not start with slash\", !this.namespace || this.namespace.toString().charAt(0) !== \"/\");\n Ember.assert(\"Record URL (\" + record + \") must not start with slash\", !record || record.toString().charAt(0) !== \"/\");\n Ember.assert(\"URL suffix (\" + suffix + \") must not start with slash\", !suffix || suffix.toString().charAt(0) !== \"/\");\n\n if (this.namespace !== undefined) {\n url.push(this.namespace);\n }\n\n url.push(this.pluralize(record));\n if (suffix !== undefined) {\n url.push(suffix);\n }\n\n return url.join(\"/\");\n }\n});\n\n\n})();\n//@ sourceURL=ember-data/adapters/rest_adapter");minispade.register('ember-data/core', "(function() {window.DS = Ember.Namespace.create({\n CURRENT_API_REVISION: 4\n});\n\n})();\n//@ sourceURL=ember-data/core");minispade.register('ember-data', "(function() {//Copyright (C) 2011 by Living Social, Inc.\n\n//Permission is hereby granted, free of charge, to any person obtaining a copy of\n//this software and associated documentation files (the \"Software\"), to deal in\n//the Software without restriction, including without limitation the rights to\n//use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n//of the Software, and to permit persons to whom the Software is furnished to do\n//so, subject to the following conditions:\n\n//The above copyright notice and this permission notice shall be included in all\n//copies or substantial portions of the Software.\n\n//THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n//SOFTWARE.\nminispade.require(\"ember-data/core\");\nminispade.require(\"ember-data/system/store\");\nminispade.require(\"ember-data/system/record_arrays\");\nminispade.require(\"ember-data/system/model\");\nminispade.require(\"ember-data/system/associations\");\nminispade.require(\"ember-data/system/adapters\");\nminispade.require(\"ember-data/system/application_ext\");\nminispade.require(\"ember-data/adapters/fixture_adapter\");\nminispade.require(\"ember-data/adapters/rest_adapter\");\n\n})();\n//@ sourceURL=ember-data");minispade.register('ember-data/system/adapters', "(function() {/**\n An adapter is an object that receives requests from a store and\n translates them into the appropriate action to take against your\n persistence layer. The persistence layer is usually an HTTP API, but may\n be anything, such as the browser's local storage.\n\n ### Creating an Adapter\n\n First, create a new subclass of `DS.Adapter`:\n\n App.MyAdapter = DS.Adapter.extend({\n // ...your code here\n });\n\n To tell your store which adapter to use, set its `adapter` property:\n\n App.store = DS.Store.create({\n revision: 3,\n adapter: App.MyAdapter.create()\n });\n\n `DS.Adapter` is an abstract base class that you should override in your\n application to customize it for your backend. The minimum set of methods\n that you should implement is:\n\n * `find()`\n * `createRecord()`\n * `updateRecord()`\n * `deleteRecord()`\n\n To improve the network performance of your application, you can optimize\n your adapter by overriding these lower-level methods:\n\n * `findMany()`\n * `createRecords()`\n * `updateRecords()`\n * `deleteRecords()`\n * `commit()`\n\n For more information about the adapter API, please see `README.md`.\n*/\n\nDS.Adapter = Ember.Object.extend({\n /**\n The `find()` method is invoked when the store is asked for a record that\n has not previously been loaded. In response to `find()` being called, you\n should query your persistence layer for a record with the given ID. Once\n found, you can asynchronously call the store's `load()` method to load\n the record.\n\n Here is an example `find` implementation:\n\n find: function(store, type, id) {\n var url = type.url;\n url = url.fmt(id);\n\n jQuery.getJSON(url, function(data) {\n // data is a Hash of key/value pairs. If your server returns a\n // root, simply do something like:\n // store.load(type, id, data.person)\n store.load(type, id, data);\n });\n }\n */\n find: null,\n\n /**\n If the globally unique IDs for your records should be generated on the client,\n implement the `generateIdForRecord()` method. This method will be invoked\n each time you create a new record, and the value returned from it will be\n assigned to the record's `primaryKey`.\n\n Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\n of the record will be set by the server, and your adapter will update the store\n with the new ID when it calls `didCreateRecord()`. Only implement this method if\n you intend to generate record IDs on the client-side.\n\n The `generateIdForRecord()` method will be invoked with the requesting store as\n the first parameter and the newly created record as the second parameter:\n\n generateIdForRecord: function(store, record) {\n var uuid = App.generateUUIDWithStatisticallyLowOddsOfCollision();\n return uuid;\n }\n */\n generateIdForRecord: null,\n\n commit: function(store, commitDetails) {\n commitDetails.updated.eachType(function(type, array) {\n this.updateRecords(store, type, array.slice());\n }, this);\n\n commitDetails.created.eachType(function(type, array) {\n this.createRecords(store, type, array.slice());\n }, this);\n\n commitDetails.deleted.eachType(function(type, array) {\n this.deleteRecords(store, type, array.slice());\n }, this);\n },\n\n createRecords: function(store, type, records) {\n records.forEach(function(record) {\n this.createRecord(store, type, record);\n }, this);\n },\n\n updateRecords: function(store, type, records) {\n records.forEach(function(record) {\n this.updateRecord(store, type, record);\n }, this);\n },\n\n deleteRecords: function(store, type, records) {\n records.forEach(function(record) {\n this.deleteRecord(store, type, record);\n }, this);\n },\n\n findMany: function(store, type, ids) {\n ids.forEach(function(id) {\n this.find(store, type, id);\n }, this);\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/adapters");minispade.register('ember-data/system/application_ext', "(function() {var set = Ember.set;\n\nEmber.onLoad('application', function(app) {\n app.registerInjection(function(app, stateManager, property) {\n if (property === 'Store') {\n set(stateManager, 'store', app[property].create());\n }\n });\n});\n\n})();\n//@ sourceURL=ember-data/system/application_ext");minispade.register('ember-data/system/associations', "(function() {minispade.require(\"ember-data/system/associations/belongs_to\");\nminispade.require(\"ember-data/system/associations/has_many\");\nminispade.require(\"ember-data/system/associations/ext\");\n\n})();\n//@ sourceURL=ember-data/system/associations");minispade.register('ember-data/system/associations/belongs_to', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath,\n none = Ember.none;\n\nvar embeddedFindRecord = function(store, type, data, key, one) {\n var association = get(data, key);\n return none(association) ? undefined : store.load(type, association).id;\n};\n\nvar referencedFindRecord = function(store, type, data, key, one) {\n return get(data, key);\n};\n\nvar hasAssociation = function(type, options, one) {\n options = options || {};\n\n var embedded = options.embedded,\n findRecord = embedded ? embeddedFindRecord : referencedFindRecord;\n\n var meta = { type: type, isAssociation: true, options: options, kind: 'belongsTo' };\n\n return Ember.computed(function(key, value) {\n var data = get(this, 'data'), ids, id, association,\n store = get(this, 'store');\n\n if (typeof type === 'string') {\n type = getPath(this, type, false) || getPath(window, type);\n }\n\n if (arguments.length === 2) {\n key = options.key || get(this, 'namingConvention').foreignKey(key);\n this.send('setAssociation', { key: key, value: value === null ? null : get(value, 'clientId') });\n //data.setAssociation(key, get(value, 'clientId'));\n // put the client id in `key` in the data hash\n return value;\n } else {\n // Embedded belongsTo associations should not look for\n // a foreign key.\n if (embedded) {\n key = options.key || get(this, 'namingConvention').keyToJSONKey(key);\n\n // Non-embedded associations should look for a foreign key.\n // For example, instead of person, we might look for person_id\n } else {\n key = options.key || get(this, 'namingConvention').foreignKey(key);\n }\n id = findRecord(store, type, data, key, true);\n association = id ? store.find(type, id) : null;\n }\n\n return association;\n }).property('data').cacheable().meta(meta);\n};\n\nDS.belongsTo = function(type, options) {\n Ember.assert(\"The type passed to DS.belongsTo must be defined\", !!type);\n return hasAssociation(type, options);\n};\n\n})();\n//@ sourceURL=ember-data/system/associations/belongs_to");minispade.register('ember-data/system/associations/ext', "(function() {var get = Ember.get, getPath = Ember.getPath;\n\nDS.Model.reopenClass({\n typeForAssociation: function(name) {\n var association = get(this, 'associationsByName').get(name);\n return association && association.type;\n },\n\n associations: Ember.computed(function() {\n var map = Ember.Map.create();\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAssociation) {\n var type = meta.type,\n typeList = map.get(type);\n\n if (typeof type === 'string') {\n type = getPath(this, type, false) || getPath(window, type);\n meta.type = type;\n }\n\n if (!typeList) {\n typeList = [];\n map.set(type, typeList);\n }\n\n typeList.push({ name: name, kind: meta.kind });\n }\n });\n\n return map;\n }).cacheable(),\n\n associationsByName: Ember.computed(function() {\n var map = Ember.Map.create(), type;\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAssociation) {\n meta.key = name;\n type = meta.type;\n\n if (typeof type === 'string') {\n type = getPath(this, type, false) || getPath(window, type);\n meta.type = type;\n }\n\n map.set(name, meta);\n }\n });\n\n return map;\n }).cacheable()\n});\n\n})();\n//@ sourceURL=ember-data/system/associations/ext");minispade.register('ember-data/system/associations/has_many', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath;\nminispade.require(\"ember-data/system/model/model\");\n\nvar embeddedFindRecord = function(store, type, data, key) {\n var association = get(data, key);\n return association ? store.loadMany(type, association).ids : [];\n};\n\nvar referencedFindRecord = function(store, type, data, key, one) {\n return get(data, key);\n};\n\nvar hasAssociation = function(type, options) {\n options = options || {};\n\n var embedded = options.embedded,\n findRecord = embedded ? embeddedFindRecord : referencedFindRecord;\n\n var meta = { type: type, isAssociation: true, options: options, kind: 'hasMany' };\n\n return Ember.computed(function(key, value) {\n var data = get(this, 'data'),\n store = get(this, 'store'),\n ids, id, association;\n\n if (typeof type === 'string') {\n type = getPath(this, type, false) || getPath(window, type);\n }\n\n key = options.key || get(this, 'namingConvention').keyToJSONKey(key);\n ids = findRecord(store, type, data, key);\n association = store.findMany(type, ids);\n set(association, 'parentRecord', this);\n\n return association;\n }).property().cacheable().meta(meta);\n};\n\nDS.hasMany = function(type, options) {\n Ember.assert(\"The type passed to DS.hasMany must be defined\", !!type);\n return hasAssociation(type, options);\n};\n\n})();\n//@ sourceURL=ember-data/system/associations/has_many");minispade.register('ember-data/system/model', "(function() {minispade.require(\"ember-data/system/model/model\");\nminispade.require(\"ember-data/system/model/states\");\nminispade.require(\"ember-data/system/model/attributes\");\nminispade.require(\"ember-data/system/model/data_proxy\");\n\n})();\n//@ sourceURL=ember-data/system/model");minispade.register('ember-data/system/model/attributes', "(function() {var get = Ember.get, getPath = Ember.getPath;\nminispade.require(\"ember-data/system/model/model\");\n\nDS.Model.reopenClass({\n attributes: Ember.computed(function() {\n var map = Ember.Map.create();\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAttribute) { map.set(name, meta); }\n });\n\n return map;\n }).cacheable(),\n\n processAttributeKeys: function() {\n if (this.processedAttributeKeys) { return; }\n\n var namingConvention = this.proto().namingConvention;\n\n this.eachComputedProperty(function(name, meta) {\n if (meta.isAttribute && !meta.options.key) {\n meta.options.key = namingConvention.keyToJSONKey(name, this);\n }\n }, this);\n }\n});\n\nDS.attr = function(type, options) {\n var transform = DS.attr.transforms[type];\n Ember.assert(\"Could not find model attribute of type \" + type, !!transform);\n\n var transformFrom = transform.from;\n var transformTo = transform.to;\n\n options = options || {};\n\n var meta = {\n type: type,\n isAttribute: true,\n options: options,\n\n // this will ensure that the key always takes naming\n // conventions into consideration.\n key: function(recordType) {\n recordType.processAttributeKeys();\n return options.key;\n }\n };\n\n return Ember.computed(function(key, value) {\n var data;\n\n key = meta.key(this.constructor);\n\n if (arguments.length === 2) {\n value = transformTo(value);\n this.setProperty(key, value);\n } else {\n data = get(this, 'data');\n value = get(data, key);\n\n if (value === undefined) {\n value = options.defaultValue;\n }\n }\n\n return transformFrom(value);\n // `data` is never set directly. However, it may be\n // invalidated from the state manager's setData\n // event.\n }).property('data').cacheable().meta(meta);\n};\n\nDS.attr.transforms = {\n string: {\n from: function(serialized) {\n return Ember.none(serialized) ? null : String(serialized);\n },\n\n to: function(deserialized) {\n return Ember.none(deserialized) ? null : String(deserialized);\n }\n },\n\n number: {\n from: function(serialized) {\n return Ember.none(serialized) ? null : Number(serialized);\n },\n\n to: function(deserialized) {\n return Ember.none(deserialized) ? null : Number(deserialized);\n }\n },\n\n 'boolean': {\n from: function(serialized) {\n return Boolean(serialized);\n },\n\n to: function(deserialized) {\n return Boolean(deserialized);\n }\n },\n\n date: {\n from: function(serialized) {\n var type = typeof serialized;\n\n if (type === \"string\" || type === \"number\") {\n return new Date(serialized);\n } else if (serialized === null || serialized === undefined) {\n // if the value is not present in the data,\n // return undefined, not null.\n return serialized;\n } else {\n return null;\n }\n },\n\n to: function(date) {\n if (date instanceof Date) {\n var days = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n var months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\n var pad = function(num) {\n return num < 10 ? \"0\"+num : \"\"+num;\n };\n\n var utcYear = date.getUTCFullYear(),\n utcMonth = date.getUTCMonth(),\n utcDayOfMonth = date.getUTCDate(),\n utcDay = date.getUTCDay(),\n utcHours = date.getUTCHours(),\n utcMinutes = date.getUTCMinutes(),\n utcSeconds = date.getUTCSeconds();\n\n\n var dayOfWeek = days[utcDay];\n var dayOfMonth = pad(utcDayOfMonth);\n var month = months[utcMonth];\n\n return dayOfWeek + \", \" + dayOfMonth + \" \" + month + \" \" + utcYear + \" \" +\n pad(utcHours) + \":\" + pad(utcMinutes) + \":\" + pad(utcSeconds) + \" GMT\";\n } else if (date === undefined) {\n return undefined;\n } else {\n return null;\n }\n }\n }\n};\n\n\n})();\n//@ sourceURL=ember-data/system/model/attributes");minispade.register('ember-data/system/model/data_proxy', "(function() {var get = Ember.get, set = Ember.set;\n\n// When a record is changed on the client, it is considered \"dirty\"--there are\n// pending changes that need to be saved to a persistence layer, such as a\n// server.\n//\n// If the record is rolled back, it re-enters a clean state, any changes are\n// discarded, and its attributes are reset back to the last known good copy\n// of the data that came from the server.\n//\n// If the record is committed, the changes are sent to the server to be saved,\n// and once the server confirms that they are valid, the record's \"canonical\"\n// data becomes the original canonical data plus the changes merged in.\n//\n// A DataProxy is an object that encapsulates this change tracking. It\n// contains three buckets:\n//\n// * `savedData` - the last-known copy of the data from the server\n// * `unsavedData` - a hash that contains any changes that have not yet\n// been committed\n// * `associations` - this is similar to `savedData`, but holds the client\n// ids of associated records\n//\n// When setting a property on the object, the value is placed into the\n// `unsavedData` bucket:\n//\n// proxy.set('key', 'value');\n//\n// // unsavedData:\n// {\n// key: \"value\"\n// }\n//\n// When retrieving a property from the object, it first looks to see\n// if that value exists in the `unsavedData` bucket, and returns it if so.\n// Otherwise, it returns the value from the `savedData` bucket.\n//\n// When the adapter notifies a record that it has been saved, it merges the\n// `unsavedData` bucket into the `savedData` bucket. If the record's\n// transaction is rolled back, the `unsavedData` hash is simply discarded.\n//\n// This object is a regular JS object for performance. It is only\n// used internally for bookkeeping purposes.\n\nvar DataProxy = DS._DataProxy = function(record) {\n this.record = record;\n\n this.unsavedData = {};\n\n this.associations = {};\n};\n\nDataProxy.prototype = {\n get: function(key) { return Ember.get(this, key); },\n set: function(key, value) { return Ember.set(this, key, value); },\n\n setAssociation: function(key, value) {\n this.associations[key] = value;\n },\n\n savedData: function() {\n var savedData = this._savedData;\n if (savedData) { return savedData; }\n\n var record = this.record,\n clientId = get(record, 'clientId'),\n store = get(record, 'store');\n\n if (store) {\n savedData = store.dataForRecord(record);\n this._savedData = savedData;\n return savedData;\n }\n },\n\n unknownProperty: function(key) {\n var unsavedData = this.unsavedData,\n associations = this.associations,\n savedData = this.savedData(),\n store;\n\n var value = unsavedData[key], association;\n\n // if this is a belongsTo association, this will\n // be a clientId.\n association = associations[key];\n\n if (association !== undefined) {\n store = get(this.record, 'store');\n return store.clientIdToId[association];\n }\n\n if (savedData && value === undefined) {\n value = savedData[key];\n }\n\n return value;\n },\n\n setUnknownProperty: function(key, value) {\n var record = this.record,\n unsavedData = this.unsavedData;\n\n unsavedData[key] = value;\n\n record.hashWasUpdated();\n\n return value;\n },\n\n commit: function() {\n this.saveData();\n\n this.record.notifyPropertyChange('data');\n },\n\n rollback: function() {\n this.unsavedData = {};\n\n this.record.notifyPropertyChange('data');\n },\n\n saveData: function() {\n var record = this.record;\n\n var unsavedData = this.unsavedData;\n var savedData = this.savedData();\n\n for (var prop in unsavedData) {\n if (unsavedData.hasOwnProperty(prop)) {\n savedData[prop] = unsavedData[prop];\n delete unsavedData[prop];\n }\n }\n },\n\n adapterDidUpdate: function() {\n this.unsavedData = {};\n }\n};\n\n})();\n//@ sourceURL=ember-data/system/model/data_proxy");minispade.register('ember-data/system/model/model', "(function() {minispade.require(\"ember-data/system/model/states\");\nminispade.require(\"ember-data/system/model/data_proxy\");\n\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath, none = Ember.none;\n\nvar retrieveFromCurrentState = Ember.computed(function(key) {\n return get(getPath(this, 'stateManager.currentState'), key);\n}).property('stateManager.currentState').cacheable();\n\nDS.Model = Ember.Object.extend(Ember.Evented, {\n isLoaded: retrieveFromCurrentState,\n isDirty: retrieveFromCurrentState,\n isSaving: retrieveFromCurrentState,\n isDeleted: retrieveFromCurrentState,\n isError: retrieveFromCurrentState,\n isNew: retrieveFromCurrentState,\n isPending: retrieveFromCurrentState,\n isValid: retrieveFromCurrentState,\n\n clientId: null,\n transaction: null,\n stateManager: null,\n pendingQueue: null,\n errors: null,\n\n // because unknownProperty is used, any internal property\n // must be initialized here.\n primaryKey: 'id',\n id: Ember.computed(function(key, value) {\n var primaryKey = get(this, 'primaryKey'),\n data = get(this, 'data');\n\n if (arguments.length === 2) {\n set(data, primaryKey, value);\n return value;\n }\n\n return data && get(data, primaryKey);\n }).property('primaryKey', 'data'),\n\n // The following methods are callbacks invoked by `toJSON`. You\n // can override one of the callbacks to override specific behavior,\n // or toJSON itself.\n //\n // If you override toJSON, you can invoke these callbacks manually\n // to get the default behavior.\n\n /**\n Add the record's primary key to the JSON hash.\n\n The default implementation uses the record's specified `primaryKey`\n and the `id` computed property, which are passed in as parameters.\n\n @param {Object} json the JSON hash being built\n @param {Number|String} id the record's id\n @param {String} key the primaryKey for the record\n */\n addIdToJSON: function(json, id, key) {\n if (id) { json[key] = id; }\n },\n\n /**\n Add the attributes' current values to the JSON hash.\n\n The default implementation gets the current value of each\n attribute from the `data`, and uses a `defaultValue` if\n specified in the `DS.attr` definition.\n\n @param {Object} json the JSON hash being build\n @param {Ember.Map} attributes a Map of attributes\n @param {DataProxy} data the record's data, accessed with `get` and `set`.\n */\n addAttributesToJSON: function(json, attributes, data) {\n attributes.forEach(function(name, meta) {\n var key = meta.key(this.constructor),\n value = get(data, key);\n\n if (value === undefined) {\n value = meta.options.defaultValue;\n }\n\n json[key] = value;\n }, this);\n },\n\n /**\n Add the value of a `hasMany` association to the JSON hash.\n\n The default implementation honors the `embedded` option\n passed to `DS.hasMany`. If embedded, `toJSON` is recursively\n called on the child records. If not, the `id` of each\n record is added.\n\n Note that if a record is not embedded and does not\n yet have an `id` (usually provided by the server), it\n will not be included in the output.\n\n @param {Object} json the JSON hash being built\n @param {DataProxy} data the record's data, accessed with `get` and `set`.\n @param {Object} meta information about the association\n @param {Object} options options passed to `toJSON`\n */\n addHasManyToJSON: function(json, data, meta, options) {\n var key = meta.key,\n manyArray = get(this, key),\n records = [], i, l,\n clientId, id;\n\n if (meta.options.embedded) {\n // TODO: Avoid materializing embedded hashes if possible\n manyArray.forEach(function(record) {\n records.push(record.toJSON(options));\n });\n } else {\n var clientIds = get(manyArray, 'content');\n\n for (i=0, l=clientIds.length; i<l; i++) {\n clientId = clientIds[i];\n id = get(this, 'store').clientIdToId[clientId];\n\n if (id !== undefined) {\n records.push(id);\n }\n }\n }\n\n key = meta.options.key || get(this, 'namingConvention').keyToJSONKey(key);\n json[key] = records;\n },\n\n /**\n Add the value of a `belongsTo` association to the JSON hash.\n\n The default implementation always includes the `id`.\n\n @param {Object} json the JSON hash being built\n @param {DataProxy} data the record's data, accessed with `get` and `set`.\n @param {Object} meta information about the association\n @param {Object} options options passed to `toJSON`\n */\n addBelongsToToJSON: function(json, data, meta, options) {\n var key = meta.key, value, id;\n\n if (meta.options.embedded) {\n key = meta.options.key || get(this, 'namingConvention').keyToJSONKey(key);\n value = get(data.record, key);\n json[key] = value ? value.toJSON(options) : null;\n } else {\n key = meta.options.key || get(this, 'namingConvention').foreignKey(key);\n id = data.get(key);\n json[key] = none(id) ? null : id;\n }\n },\n /**\n Create a JSON representation of the record, including its `id`,\n attributes and associations. Honor any settings defined on the\n attributes or associations (such as `embedded` or `key`).\n */\n toJSON: function(options) {\n var data = get(this, 'data'),\n result = {},\n type = this.constructor,\n attributes = get(type, 'attributes'),\n primaryKey = get(this, 'primaryKey'),\n id = get(this, 'id'),\n store = get(this, 'store'),\n associations;\n\n options = options || {};\n\n // delegate to `addIdToJSON` callback\n this.addIdToJSON(result, id, primaryKey);\n\n // delegate to `addAttributesToJSON` callback\n this.addAttributesToJSON(result, attributes, data);\n\n associations = get(type, 'associationsByName');\n\n // add associations, delegating to `addHasManyToJSON` and\n // `addBelongsToToJSON`.\n associations.forEach(function(key, meta) {\n if (options.associations && meta.kind === 'hasMany') {\n this.addHasManyToJSON(result, data, meta, options);\n } else if (meta.kind === 'belongsTo') {\n this.addBelongsToToJSON(result, data, meta, options);\n }\n }, this);\n\n return result;\n },\n\n data: Ember.computed(function() {\n return new DS._DataProxy(this);\n }).cacheable(),\n\n didLoad: Ember.K,\n didUpdate: Ember.K,\n didCreate: Ember.K,\n didDelete: Ember.K,\n becameInvalid: Ember.K,\n becameError: Ember.K,\n\n init: function() {\n var stateManager = DS.StateManager.create({\n record: this\n });\n\n set(this, 'pendingQueue', {});\n\n set(this, 'stateManager', stateManager);\n stateManager.goToState('empty');\n },\n\n destroy: function() {\n if (!get(this, 'isDeleted')) {\n this.deleteRecord();\n }\n this._super();\n },\n\n send: function(name, context) {\n return get(this, 'stateManager').send(name, context);\n },\n\n withTransaction: function(fn) {\n var transaction = get(this, 'transaction');\n if (transaction) { fn(transaction); }\n },\n\n setProperty: function(key, value) {\n this.send('setProperty', { key: key, value: value });\n },\n\n deleteRecord: function() {\n this.send('deleteRecord');\n },\n\n waitingOn: function(record) {\n this.send('waitingOn', record);\n },\n\n notifyHashWasUpdated: function() {\n var store = get(this, 'store');\n if (store) {\n store.hashWasUpdated(this.constructor, get(this, 'clientId'), this);\n }\n },\n\n unknownProperty: function(key) {\n var data = get(this, 'data');\n\n if (data && key in data) {\n Ember.assert(\"You attempted to access the \" + key + \" property on a record without defining an attribute.\", false);\n }\n },\n\n setUnknownProperty: function(key, value) {\n var data = get(this, 'data');\n\n if (data && key in data) {\n Ember.assert(\"You attempted to set the \" + key + \" property on a record without defining an attribute.\", false);\n } else {\n return this._super(key, value);\n }\n },\n\n namingConvention: {\n keyToJSONKey: function(key) {\n // TODO: Strip off `is` from the front. Example: `isHipster` becomes `hipster`\n return Ember.String.decamelize(key);\n },\n\n foreignKey: function(key) {\n return Ember.String.decamelize(key) + '_id';\n }\n },\n\n /** @private */\n hashWasUpdated: function() {\n // At the end of the run loop, notify record arrays that\n // this record has changed so they can re-evaluate its contents\n // to determine membership.\n Ember.run.once(this, this.notifyHashWasUpdated);\n },\n\n dataDidChange: Ember.observer(function() {\n var associations = get(this.constructor, 'associationsByName'),\n data = get(this, 'data'), store = get(this, 'store'),\n idToClientId = store.idToClientId,\n cachedValue;\n\n associations.forEach(function(name, association) {\n if (association.kind === 'hasMany') {\n cachedValue = this.cacheFor(name);\n\n if (cachedValue) {\n var key = association.options.key || name,\n ids = data.get(key) || [];\n var clientIds = Ember.ArrayUtils.map(ids, function(id) {\n return store.clientIdForId(association.type, id);\n });\n\n set(cachedValue, 'content', Ember.A(clientIds));\n cachedValue.fetch();\n }\n }\n }, this);\n }, 'data'),\n\n /**\n @private\n\n Override the default event firing from Ember.Evented to\n also call methods with the given name.\n */\n fire: function(name) {\n this[name].apply(this, [].slice.call(arguments, 1));\n this._super.apply(this, arguments);\n }\n});\n\n// Helper function to generate store aliases.\n// This returns a function that invokes the named alias\n// on the default store, but injects the class as the\n// first parameter.\nvar storeAlias = function(methodName) {\n return function() {\n var store = get(DS, 'defaultStore'),\n args = [].slice.call(arguments);\n\n args.unshift(this);\n return store[methodName].apply(store, args);\n };\n};\n\nDS.Model.reopenClass({\n find: storeAlias('find'),\n filter: storeAlias('filter'),\n\n _create: DS.Model.create,\n\n create: function() {\n throw new Ember.Error(\"You should not call `create` on a model. Instead, call `createRecord` with the attributes you would like to set.\");\n },\n\n createRecord: storeAlias('createRecord')\n});\n\n})();\n//@ sourceURL=ember-data/system/model/model");minispade.register('ember-data/system/model/states', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath, guidFor = Ember.guidFor;\n\n/**\n This file encapsulates the various states that a record can transition\n through during its lifecycle.\n\n ### State Manager\n\n A record's state manager explicitly tracks what state a record is in\n at any given time. For instance, if a record is newly created and has\n not yet been sent to the adapter to be saved, it would be in the\n `created.uncommitted` state. If a record has had local modifications\n made to it that are in the process of being saved, the record would be\n in the `updated.inFlight` state. (These state paths will be explained\n in more detail below.)\n\n Events are sent by the record or its store to the record's state manager.\n How the state manager reacts to these events is dependent on which state\n it is in. In some states, certain events will be invalid and will cause\n an exception to be raised.\n\n States are hierarchical. For example, a record can be in the\n `deleted.start` state, then transition into the `deleted.inFlight` state.\n If a child state does not implement an event handler, the state manager\n will attempt to invoke the event on all parent states until the root state is\n reached. The state hierarchy of a record is described in terms of a path\n string. You can determine a record's current state by getting its manager's\n current state path:\n\n record.getPath('stateManager.currentState.path');\n //=> \"created.uncommitted\"\n\n The `DS.Model` states are themselves stateless. What we mean is that,\n though each instance of a record also has a unique instance of a\n `DS.StateManager`, the hierarchical states that each of *those* points\n to is a shared data structure. For performance reasons, instead of each\n record getting its own copy of the hierarchy of states, each state\n manager points to this global, immutable shared instance. How does a\n state know which record it should be acting on? We pass a reference to\n the current state manager as the first parameter to every method invoked\n on a state.\n\n The state manager passed as the first parameter is where you should stash\n state about the record if needed; you should never store data on the state\n object itself. If you need access to the record being acted on, you can\n retrieve the state manager's `record` property. For example, if you had\n an event handler `myEvent`:\n\n myEvent: function(manager) {\n var record = manager.get('record');\n record.doSomething();\n }\n\n For more information about state managers in general, see the Ember.js\n documentation on `Ember.StateManager`.\n\n ### Events, Flags, and Transitions\n\n A state may implement zero or more events, flags, or transitions.\n\n #### Events\n\n Events are named functions that are invoked when sent to a record. The\n state manager will first look for a method with the given name on the\n current state. If no method is found, it will search the current state's\n parent, and then its grandparent, and so on until reaching the top of\n the hierarchy. If the root is reached without an event handler being found,\n an exception will be raised. This can be very helpful when debugging new\n features.\n\n Here's an example implementation of a state with a `myEvent` event handler:\n\n aState: DS.State.create({\n myEvent: function(manager, param) {\n console.log(\"Received myEvent with \"+param);\n }\n })\n\n To trigger this event:\n\n record.send('myEvent', 'foo');\n //=> \"Received myEvent with foo\"\n\n Note that an optional parameter can be sent to a record's `send()` method,\n which will be passed as the second parameter to the event handler.\n\n Events should transition to a different state if appropriate. This can be\n done by calling the state manager's `goToState()` method with a path to the\n desired state. The state manager will attempt to resolve the state path\n relative to the current state. If no state is found at that path, it will\n attempt to resolve it relative to the current state's parent, and then its\n parent, and so on until the root is reached. For example, imagine a hierarchy\n like this:\n\n * created\n * start <-- currentState\n * inFlight\n * updated\n * inFlight\n\n If we are currently in the `start` state, calling\n `goToState('inFlight')` would transition to the `created.inFlight` state,\n while calling `goToState('updated.inFlight')` would transition to\n the `updated.inFlight` state.\n\n Remember that *only events* should ever cause a state transition. You should\n never call `goToState()` from outside a state's event handler. If you are\n tempted to do so, create a new event and send that to the state manager.\n\n #### Flags\n\n Flags are Boolean values that can be used to introspect a record's current\n state in a more user-friendly way than examining its state path. For example,\n instead of doing this:\n\n var statePath = record.getPath('stateManager.currentState.path');\n if (statePath === 'created.inFlight') {\n doSomething();\n }\n\n You can say:\n\n if (record.get('isNew') && record.get('isSaving')) {\n doSomething();\n }\n\n If your state does not set a value for a given flag, the value will\n be inherited from its parent (or the first place in the state hierarchy\n where it is defined).\n\n The current set of flags are defined below. If you want to add a new flag,\n in addition to the area below, you will also need to declare it in the\n `DS.Model` class.\n\n #### Transitions\n\n Transitions are like event handlers but are called automatically upon\n entering or exiting a state. To implement a transition, just call a method\n either `enter` or `exit`:\n\n myState: DS.State.create({\n // Gets called automatically when entering\n // this state.\n enter: function(manager) {\n console.log(\"Entered myState\");\n }\n })\n\n Note that enter and exit events are called once per transition. If the\n current state changes, but changes to another child state of the parent,\n the transition event on the parent will not be triggered.\n*/\n\nvar stateProperty = Ember.computed(function(key) {\n var parent = get(this, 'parentState');\n if (parent) {\n return get(parent, key);\n }\n}).property();\n\nvar isEmptyObject = function(object) {\n for (var name in object) {\n if (object.hasOwnProperty(name)) { return false; }\n }\n\n return true;\n};\n\nvar hasDefinedProperties = function(object) {\n for (var name in object) {\n if (object.hasOwnProperty(name) && object[name]) { return true; }\n }\n\n return false;\n};\n\nDS.State = Ember.State.extend({\n isLoaded: stateProperty,\n isDirty: stateProperty,\n isSaving: stateProperty,\n isDeleted: stateProperty,\n isError: stateProperty,\n isNew: stateProperty,\n isValid: stateProperty,\n isPending: stateProperty,\n\n // For states that are substates of a\n // DirtyState (updated or created), it is\n // useful to be able to determine which\n // type of dirty state it is.\n dirtyType: stateProperty\n});\n\nvar setProperty = function(manager, context) {\n var key = context.key, value = context.value;\n\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n set(data, key, value);\n};\n\nvar setAssociation = function(manager, context) {\n var key = context.key, value = context.value;\n\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data.setAssociation(key, value);\n};\n\nvar didChangeData = function(manager) {\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data._savedData = null;\n record.notifyPropertyChange('data');\n};\n\n// The waitingOn event shares common functionality\n// between the different dirty states, but each is\n// treated slightly differently. This method is exposed\n// so that each implementation can invoke the common\n// behavior, and then implement the behavior specific\n// to the state.\nvar waitingOn = function(manager, object) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n objectGuid = guidFor(object);\n\n var observer = function() {\n if (get(object, 'id')) {\n manager.send('doneWaitingOn', object);\n Ember.removeObserver(object, 'id', observer);\n }\n };\n\n pendingQueue[objectGuid] = [object, observer];\n Ember.addObserver(object, 'id', observer);\n};\n\n// Implementation notes:\n//\n// Each state has a boolean value for all of the following flags:\n//\n// * isLoaded: The record has a populated `data` property. When a\n// record is loaded via `store.find`, `isLoaded` is false\n// until the adapter sets it. When a record is created locally,\n// its `isLoaded` property is always true.\n// * isDirty: The record has local changes that have not yet been\n// saved by the adapter. This includes records that have been\n// created (but not yet saved) or deleted.\n// * isSaving: The record's transaction has been committed, but\n// the adapter has not yet acknowledged that the changes have\n// been persisted to the backend.\n// * isDeleted: The record was marked for deletion. When `isDeleted`\n// is true and `isDirty` is true, the record is deleted locally\n// but the deletion was not yet persisted. When `isSaving` is\n// true, the change is in-flight. When both `isDirty` and\n// `isSaving` are false, the change has persisted.\n// * isError: The adapter reported that it was unable to save\n// local changes to the backend. This may also result in the\n// record having its `isValid` property become false if the\n// adapter reported that server-side validations failed.\n// * isNew: The record was created on the client and the adapter\n// did not yet report that it was successfully saved.\n// * isValid: No client-side validations have failed and the\n// adapter did not report any server-side validation failures.\n// * isPending: A record `isPending` when it belongs to an\n// association on another record and that record has not been\n// saved. A record in this state cannot be saved because it\n// lacks a \"foreign key\" that will be supplied by its parent\n// association when the parent record has been created. When\n// the adapter reports that the parent has saved, the\n// `isPending` property on all children will become `false`\n// and the transaction will try to commit the records.\n\n// This mixin is mixed into various uncommitted states. Make\n// sure to mix it in *after* the class definition, so its\n// super points to the class definition.\nvar Uncommitted = Ember.Mixin.create({\n setProperty: setProperty,\n setAssociation: setAssociation,\n});\n\n// These mixins are mixed into substates of the concrete\n// subclasses of DirtyState.\n\nvar CreatedUncommitted = Ember.Mixin.create({\n deleteRecord: function(manager) {\n var record = get(manager, 'record');\n this._super(manager);\n\n record.withTransaction(function(t) {\n t.recordBecameClean('created', record);\n });\n manager.goToState('deleted.saved');\n }\n});\n\nvar UpdatedUncommitted = Ember.Mixin.create({\n deleteRecord: function(manager) {\n this._super(manager);\n\n var record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameClean('updated', record);\n });\n\n manager.goToState('deleted');\n }\n});\n\n// The dirty state is a abstract state whose functionality is\n// shared between the `created` and `updated` states.\n//\n// The deleted state shares the `isDirty` flag with the\n// subclasses of `DirtyState`, but with a very different\n// implementation.\nvar DirtyState = DS.State.extend({\n initialState: 'uncommitted',\n\n // FLAGS\n isDirty: true,\n\n // SUBSTATES\n\n // When a record first becomes dirty, it is `uncommitted`.\n // This means that there are local pending changes,\n // but they have not yet begun to be saved.\n uncommitted: DS.State.extend({\n // TRANSITIONS\n enter: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameDirty(dirtyType, record);\n });\n },\n\n // EVENTS\n deleteRecord: Ember.K,\n\n waitingOn: function(manager, object) {\n waitingOn(manager, object);\n manager.goToState('pending');\n },\n\n willCommit: function(manager) {\n manager.goToState('inFlight');\n },\n\n becameInvalid: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameInFlight(dirtyType, record);\n });\n\n manager.goToState('invalid');\n },\n\n rollback: function(manager) {\n var record = get(manager, 'record'),\n dirtyType = get(this, 'dirtyType'),\n data = get(record, 'data');\n\n data.rollback();\n\n record.withTransaction(function(t) {\n t.recordBecameClean(dirtyType, record);\n });\n\n manager.goToState('loaded');\n }\n }, Uncommitted),\n\n // Once a record has been handed off to the adapter to be\n // saved, it is in the 'in flight' state. Changes to the\n // record cannot be made during this window.\n inFlight: DS.State.extend({\n // FLAGS\n isSaving: true,\n\n // TRANSITIONS\n enter: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameInFlight(dirtyType, record);\n });\n },\n\n // EVENTS\n didCommit: function(manager) {\n var dirtyType = get(this, 'dirtyType'),\n record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameClean('inflight', record);\n });\n\n manager.goToState('loaded');\n manager.send('invokeLifecycleCallbacks', dirtyType);\n },\n\n becameInvalid: function(manager, errors) {\n var record = get(manager, 'record');\n\n set(record, 'errors', errors);\n\n manager.goToState('invalid');\n manager.send('invokeLifecycleCallbacks');\n },\n\n becameError: function(manager) {\n manager.goToState('error');\n manager.send('invokeLifecycleCallbacks');\n },\n\n didChangeData: didChangeData\n }),\n\n // If a record becomes associated with a newly created\n // parent record, it will be `pending` until the parent\n // record has successfully persisted. Once this happens,\n // this record can use the parent's primary key as its\n // foreign key.\n //\n // If the record's transaction had already started to\n // commit, the record will transition to the `inFlight`\n // state. If it had not, the record will transition to\n // the `uncommitted` state.\n pending: DS.State.extend({\n initialState: 'uncommitted',\n\n // FLAGS\n isPending: true,\n\n // SUBSTATES\n\n // A pending record whose transaction has not yet\n // started to commit is in this state.\n uncommitted: DS.State.extend({\n // EVENTS\n deleteRecord: function(manager) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n tuple;\n\n // since we are leaving the pending state, remove any\n // observers we have registered on other records.\n for (var prop in pendingQueue) {\n if (!pendingQueue.hasOwnProperty(prop)) { continue; }\n\n tuple = pendingQueue[prop];\n Ember.removeObserver(tuple[0], 'id', tuple[1]);\n }\n },\n\n willCommit: function(manager) {\n manager.goToState('committing');\n },\n\n doneWaitingOn: function(manager, object) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n objectGuid = guidFor(object);\n\n delete pendingQueue[objectGuid];\n\n if (isEmptyObject(pendingQueue)) {\n manager.send('doneWaiting');\n }\n },\n\n doneWaiting: function(manager) {\n var dirtyType = get(this, 'dirtyType');\n manager.goToState(dirtyType + '.uncommitted');\n }\n }, Uncommitted),\n\n // A pending record whose transaction has started\n // to commit is in this state. Since it has not yet\n // been sent to the adapter, it is not `inFlight`\n // until all of its dependencies have been committed.\n committing: DS.State.extend({\n // FLAGS\n isSaving: true,\n\n // EVENTS\n doneWaitingOn: function(manager, object) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue'),\n objectGuid = guidFor(object);\n\n delete pendingQueue[objectGuid];\n\n if (isEmptyObject(pendingQueue)) {\n manager.send('doneWaiting');\n }\n },\n\n doneWaiting: function(manager) {\n var record = get(manager, 'record'),\n transaction = get(record, 'transaction');\n\n // Now that the record is no longer pending, schedule\n // the transaction to commit.\n Ember.run.once(transaction, transaction.commit);\n },\n\n willCommit: function(manager) {\n var record = get(manager, 'record'),\n pendingQueue = get(record, 'pendingQueue');\n\n if (isEmptyObject(pendingQueue)) {\n var dirtyType = get(this, 'dirtyType');\n manager.goToState(dirtyType + '.inFlight');\n }\n }\n })\n }),\n\n // A record is in the `invalid` state when its client-side\n // invalidations have failed, or if the adapter has indicated\n // the the record failed server-side invalidations.\n invalid: DS.State.extend({\n // FLAGS\n isValid: false,\n\n exit: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameClean('inflight', record);\n });\n },\n\n // EVENTS\n deleteRecord: function(manager) {\n manager.goToState('deleted');\n },\n\n setAssociation: setAssociation,\n\n setProperty: function(manager, context) {\n setProperty(manager, context);\n\n var record = get(manager, 'record'),\n errors = get(record, 'errors'),\n key = context.key;\n\n delete errors[key];\n\n if (!hasDefinedProperties(errors)) {\n manager.send('becameValid');\n }\n },\n\n rollback: function(manager) {\n manager.send('becameValid');\n manager.send('rollback');\n },\n\n becameValid: function(manager) {\n manager.goToState('uncommitted');\n },\n\n invokeLifecycleCallbacks: function(manager) {\n var record = get(manager, 'record');\n record.fire('becameInvalid', record);\n }\n })\n});\n\n// The created and updated states are created outside the state\n// chart so we can reopen their substates and add mixins as\n// necessary.\n\nvar createdState = DirtyState.create({\n dirtyType: 'created',\n\n // FLAGS\n isNew: true\n});\n\nvar updatedState = DirtyState.create({\n dirtyType: 'updated'\n});\n\n// The created.uncommitted state and created.pending.uncommitted share\n// some logic defined in CreatedUncommitted.\ncreatedState.states.uncommitted.reopen(CreatedUncommitted);\ncreatedState.states.pending.states.uncommitted.reopen(CreatedUncommitted);\n\n// The created.uncommitted state needs to immediately transition to the\n// deleted state if it is rolled back.\ncreatedState.states.uncommitted.reopen({\n rollback: function(manager) {\n this._super(manager);\n manager.goToState('deleted.saved');\n }\n});\n\n// The updated.uncommitted state and updated.pending.uncommitted share\n// some logic defined in UpdatedUncommitted.\nupdatedState.states.uncommitted.reopen(UpdatedUncommitted);\nupdatedState.states.pending.states.uncommitted.reopen(UpdatedUncommitted);\nupdatedState.states.inFlight.reopen({\n didSaveData: function(manager) {\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data.saveData();\n data.adapterDidUpdate();\n }\n});\n\nvar states = {\n rootState: Ember.State.create({\n // FLAGS\n isLoaded: false,\n isDirty: false,\n isSaving: false,\n isDeleted: false,\n isError: false,\n isNew: false,\n isValid: true,\n isPending: false,\n\n // SUBSTATES\n\n // A record begins its lifecycle in the `empty` state.\n // If its data will come from the adapter, it will\n // transition into the `loading` state. Otherwise, if\n // the record is being created on the client, it will\n // transition into the `created` state.\n empty: DS.State.create({\n // EVENTS\n loadingData: function(manager) {\n manager.goToState('loading');\n },\n\n didChangeData: function(manager) {\n didChangeData(manager);\n\n manager.goToState('loaded.created');\n }\n }),\n\n // A record enters this state when the store askes\n // the adapter for its data. It remains in this state\n // until the adapter provides the requested data.\n //\n // Usually, this process is asynchronous, using an\n // XHR to retrieve the data.\n loading: DS.State.create({\n // TRANSITIONS\n exit: function(manager) {\n var record = get(manager, 'record');\n record.fire('didLoad');\n },\n\n // EVENTS\n didChangeData: function(manager, data) {\n didChangeData(manager);\n manager.send('loadedData');\n },\n\n loadedData: function(manager) {\n manager.goToState('loaded');\n }\n }),\n\n // A record enters this state when its data is populated.\n // Most of a record's lifecycle is spent inside substates\n // of the `loaded` state.\n loaded: DS.State.create({\n initialState: 'saved',\n\n // FLAGS\n isLoaded: true,\n\n // SUBSTATES\n\n // If there are no local changes to a record, it remains\n // in the `saved` state.\n saved: DS.State.create({\n\n // EVENTS\n setProperty: function(manager, context) {\n setProperty(manager, context);\n manager.goToState('updated');\n },\n\n setAssociation: function(manager, context) {\n setAssociation(manager, context);\n manager.goToState('updated');\n },\n\n didChangeData: didChangeData,\n\n deleteRecord: function(manager) {\n manager.goToState('deleted');\n },\n\n waitingOn: function(manager, object) {\n waitingOn(manager, object);\n manager.goToState('updated.pending');\n },\n\n invokeLifecycleCallbacks: function(manager, dirtyType) {\n var record = get(manager, 'record');\n if (dirtyType === 'created') {\n record.fire('didCreate', record);\n } else {\n record.fire('didUpdate', record);\n }\n }\n }),\n\n // A record is in this state after it has been locally\n // created but before the adapter has indicated that\n // it has been saved.\n created: createdState,\n\n // A record is in this state if it has already been\n // saved to the server, but there are new local changes\n // that have not yet been saved.\n updated: updatedState\n }),\n\n // A record is in this state if it was deleted from the store.\n deleted: DS.State.create({\n // FLAGS\n isDeleted: true,\n isLoaded: true,\n isDirty: true,\n\n // TRANSITIONS\n enter: function(manager) {\n var record = get(manager, 'record'),\n store = get(record, 'store');\n\n store.removeFromRecordArrays(record);\n },\n\n // SUBSTATES\n\n // When a record is deleted, it enters the `start`\n // state. It will exit this state when the record's\n // transaction starts to commit.\n start: DS.State.create({\n // TRANSITIONS\n enter: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameDirty('deleted', record);\n });\n },\n\n // EVENTS\n willCommit: function(manager) {\n manager.goToState('inFlight');\n },\n\n rollback: function(manager) {\n var record = get(manager, 'record'),\n data = get(record, 'data');\n\n data.rollback();\n record.withTransaction(function(t) {\n t.recordBecameClean('deleted', record);\n });\n manager.goToState('loaded');\n }\n }),\n\n // After a record's transaction is committing, but\n // before the adapter indicates that the deletion\n // has saved to the server, a record is in the\n // `inFlight` substate of `deleted`.\n inFlight: DS.State.create({\n // FLAGS\n isSaving: true,\n\n // TRANSITIONS\n enter: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function (t) {\n t.recordBecameInFlight('deleted', record);\n });\n },\n\n // EVENTS\n didCommit: function(manager) {\n var record = get(manager, 'record');\n\n record.withTransaction(function(t) {\n t.recordBecameClean('inflight', record);\n });\n\n manager.goToState('saved');\n\n manager.send('invokeLifecycleCallbacks');\n }\n }),\n\n // Once the adapter indicates that the deletion has\n // been saved, the record enters the `saved` substate\n // of `deleted`.\n saved: DS.State.create({\n // FLAGS\n isDirty: false,\n\n invokeLifecycleCallbacks: function(manager) {\n var record = get(manager, 'record');\n record.fire('didDelete', record);\n }\n })\n }),\n\n // If the adapter indicates that there was an unknown\n // error saving a record, the record enters the `error`\n // state.\n error: DS.State.create({\n isError: true,\n\n // EVENTS\n\n invokeLifecycleCallbacks: function(manager) {\n var record = get(manager, 'record');\n record.fire('becameError', record);\n }\n })\n })\n};\n\nDS.StateManager = Ember.StateManager.extend({\n record: null,\n initialState: 'rootState',\n states: states\n});\n\n})();\n//@ sourceURL=ember-data/system/model/states");minispade.register('ember-data/system/record_arrays', "(function() {minispade.require('ember-data/system/record_arrays/record_array');\nminispade.require('ember-data/system/record_arrays/filtered_record_array');\nminispade.require('ember-data/system/record_arrays/adapter_populated_record_array');\nminispade.require('ember-data/system/record_arrays/many_array');\n\n})();\n//@ sourceURL=ember-data/system/record_arrays");minispade.register('ember-data/system/record_arrays/adapter_populated_record_array', "(function() {minispade.require(\"ember-data/system/record_arrays/record_array\");\n\nvar get = Ember.get, set = Ember.set;\n\nDS.AdapterPopulatedRecordArray = DS.RecordArray.extend({\n query: null,\n isLoaded: false,\n\n replace: function() {\n var type = get(this, 'type').toString();\n throw new Error(\"The result of a server query (on \" + type + \") is immutable.\");\n },\n\n load: function(array) {\n var store = get(this, 'store'), type = get(this, 'type');\n\n var clientIds = store.loadMany(type, array).clientIds;\n\n this.beginPropertyChanges();\n set(this, 'content', Ember.A(clientIds));\n set(this, 'isLoaded', true);\n this.endPropertyChanges();\n }\n});\n\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/adapter_populated_record_array");minispade.register('ember-data/system/record_arrays/filtered_record_array', "(function() {minispade.require(\"ember-data/system/record_arrays/record_array\");\n\nvar get = Ember.get;\n\nDS.FilteredRecordArray = DS.RecordArray.extend({\n filterFunction: null,\n\n replace: function() {\n var type = get(this, 'type').toString();\n throw new Error(\"The result of a client-side filter (on \" + type + \") is immutable.\");\n },\n\n updateFilter: Ember.observer(function() {\n var store = get(this, 'store');\n store.updateRecordArrayFilter(this, get(this, 'type'), get(this, 'filterFunction'));\n }, 'filterFunction')\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/filtered_record_array");minispade.register('ember-data/system/record_arrays/many_array', "(function() {minispade.require(\"ember-data/system/record_arrays/record_array\");\nminispade.require(\"ember-data/system/record_arrays/many_array_states\");\n\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath;\n\nDS.ManyArray = DS.RecordArray.extend({\n init: function() {\n set(this, 'stateManager', DS.ManyArrayStateManager.create({ manyArray: this }));\n\n return this._super();\n },\n\n parentRecord: null,\n\n isDirty: Ember.computed(function() {\n return getPath(this, 'stateManager.currentState.isDirty');\n }).property('stateManager.currentState').cacheable(),\n\n fetch: function() {\n var clientIds = get(this, 'content'),\n store = get(this, 'store'),\n type = get(this, 'type');\n\n var ids = clientIds.map(function(clientId) {\n return store.clientIdToId[clientId];\n });\n\n store.fetchMany(type, ids);\n },\n\n // Overrides Ember.Array's replace method to implement\n replace: function(index, removed, added) {\n var parentRecord = get(this, 'parentRecord');\n var pendingParent = parentRecord && !get(parentRecord, 'id');\n var stateManager = get(this, 'stateManager');\n\n // Map the array of record objects into an array of client ids.\n added = added.map(function(record) {\n Ember.assert(\"You can only add records of \" + (get(this, 'type') && get(this, 'type').toString()) + \" to this association.\", !get(this, 'type') || (get(this, 'type') === record.constructor));\n\n // If the record to which this many array belongs does not yet\n // have an id, notify the newly-added record that it must wait\n // for the parent to receive an id before the child can be\n // saved.\n if (pendingParent) {\n record.send('waitingOn', parentRecord);\n }\n\n this.assignInverse(record, parentRecord);\n\n stateManager.send('recordWasAdded', record);\n\n return record.get('clientId');\n }, this);\n\n var store = this.store;\n\n var len = index+removed, record;\n for (var i = index; i < len; i++) {\n // TODO: null out inverse FK\n record = this.objectAt(i);\n this.assignInverse(record, parentRecord, true);\n\n // If we put the child record into a pending state because\n // we were waiting on the parent record to get an id, we\n // can tell the child it no longer needs to wait.\n if (pendingParent) {\n record.send('doneWaitingOn', parentRecord);\n }\n\n stateManager.send('recordWasAdded', record);\n }\n\n this._super(index, removed, added);\n },\n\n assignInverse: function(record, parentRecord, remove) {\n var associationMap = get(record.constructor, 'associations'),\n possibleAssociations = associationMap.get(parentRecord.constructor),\n possible, actual;\n\n if (!possibleAssociations) { return; }\n\n for (var i = 0, l = possibleAssociations.length; i < l; i++) {\n possible = possibleAssociations[i];\n\n if (possible.kind === 'belongsTo') {\n actual = possible;\n break;\n }\n }\n\n if (actual) {\n set(record, actual.name, remove ? null : parentRecord);\n }\n },\n\n // Create a child record within the parentRecord\n createRecord: function(hash, transaction) {\n var parentRecord = get(this, 'parentRecord'),\n store = get(parentRecord, 'store'),\n type = get(this, 'type'),\n record;\n\n transaction = transaction || get(parentRecord, 'transaction');\n\n record = store.createRecord.call(store, type, hash, transaction);\n this.pushObject(record);\n\n return record;\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/many_array");minispade.register('ember-data/system/record_arrays/many_array_states', "(function() {var get = Ember.get, set = Ember.set, guidFor = Ember.guidFor;\n\nvar Set = function() {\n this.hash = {};\n this.list = [];\n};\n\nSet.prototype = {\n add: function(item) {\n var hash = this.hash,\n guid = guidFor(item);\n\n if (hash.hasOwnProperty(guid)) { return; }\n\n hash[guid] = true;\n this.list.push(item);\n },\n\n remove: function(item) {\n var hash = this.hash,\n guid = guidFor(item);\n\n if (!hash.hasOwnProperty(guid)) { return; }\n\n delete hash[guid];\n var list = this.list,\n index = Ember.ArrayUtils.indexOf(this, item);\n\n list.splice(index, 1);\n },\n\n isEmpty: function() {\n return this.list.length === 0;\n }\n};\n\nvar ManyArrayState = Ember.State.extend({\n recordWasAdded: function(manager, record) {\n var dirty = manager.dirty, observer;\n dirty.add(record);\n\n observer = function() {\n if (!get(record, 'isDirty')) {\n record.removeObserver('isDirty', observer);\n manager.send('childWasSaved', record);\n }\n };\n\n record.addObserver('isDirty', observer);\n },\n\n recordWasRemoved: function(manager, record) {\n var dirty = manager.dirty, observer;\n dirty.add(record);\n\n observer = function() {\n record.removeObserver('isDirty', observer);\n if (!get(record, 'isDirty')) { manager.send('childWasSaved', record); }\n };\n\n record.addObserver('isDirty', observer);\n }\n});\n\nvar states = {\n clean: ManyArrayState.create({\n isDirty: false,\n\n recordWasAdded: function(manager, record) {\n this._super(manager, record);\n manager.goToState('dirty');\n },\n\n update: function(manager, clientIds) {\n var manyArray = manager.manyArray;\n set(manyArray, 'content', clientIds);\n }\n }),\n\n dirty: ManyArrayState.create({\n isDirty: true,\n\n childWasSaved: function(manager, child) {\n var dirty = manager.dirty;\n dirty.remove(child);\n\n if (dirty.isEmpty()) { manager.send('arrayBecameSaved'); }\n },\n\n arrayBecameSaved: function(manager) {\n manager.goToState('clean');\n }\n }) \n};\n\nDS.ManyArrayStateManager = Ember.StateManager.extend({\n manyArray: null,\n initialState: 'clean',\n states: states,\n\n init: function() {\n this._super();\n this.dirty = new Set();\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/many_array_states");minispade.register('ember-data/system/record_arrays/record_array', "(function() {var get = Ember.get, set = Ember.set;\n\n/**\n A record array is an array that contains records of a certain type. The record\n array materializes records as needed when they are retrieved for the first\n time. You should not create record arrays yourself. Instead, an instance of\n DS.RecordArray or its subclasses will be returned by your application's store\n in response to queries.\n*/\n\nDS.RecordArray = Ember.ArrayProxy.extend({\n\n /**\n The model type contained by this record array.\n\n @type DS.Model\n */\n type: null,\n\n // The array of client ids backing the record array. When a\n // record is requested from the record array, the record\n // for the client id at the same index is materialized, if\n // necessary, by the store.\n content: null,\n\n // The store that created this record array.\n store: null,\n\n init: function() {\n set(this, 'recordCache', Ember.A([]));\n this._super();\n },\n\n arrayDidChange: function(array, index, removed, added) {\n var recordCache = get(this, 'recordCache');\n recordCache.replace(index, 0, new Array(added));\n\n this._super(array, index, removed, added);\n },\n\n arrayWillChange: function(array, index, removed, added) {\n this._super(array, index, removed, added);\n\n var recordCache = get(this, 'recordCache');\n recordCache.replace(index, removed);\n },\n\n objectAtContent: function(index) {\n var recordCache = get(this, 'recordCache');\n var record = recordCache.objectAt(index);\n\n if (!record) {\n var store = get(this, 'store');\n var content = get(this, 'content');\n\n var contentObject = content.objectAt(index);\n\n if (contentObject !== undefined) {\n record = store.findByClientId(get(this, 'type'), contentObject);\n recordCache.replace(index, 1, [record]);\n }\n }\n\n return record;\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/record_arrays/record_array");minispade.register('ember-data/system/store', "(function() {/*globals Ember*/\nminispade.require(\"ember-data/system/record_arrays\");\nminispade.require(\"ember-data/system/transaction\");\n\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt;\n\nvar DATA_PROXY = {\n get: function(name) {\n return this.savedData[name];\n }\n};\n\n// These values are used in the data cache when clientIds are\n// needed but the underlying data has not yet been loaded by\n// the server.\nvar UNLOADED = 'unloaded';\nvar LOADING = 'loading';\n\n// Implementors Note:\n//\n// The variables in this file are consistently named according to the following\n// scheme:\n//\n// * +id+ means an identifier managed by an external source, provided inside the\n// data hash provided by that source.\n// * +clientId+ means a transient numerical identifier generated at runtime by\n// the data store. It is important primarily because newly created objects may\n// not yet have an externally generated id.\n// * +type+ means a subclass of DS.Model.\n\n/**\n The store contains all of the hashes for records loaded from the server.\n It is also responsible for creating instances of DS.Model when you request one\n of these data hashes, so that they can be bound to in your Handlebars templates.\n\n Create a new store like this:\n\n MyApp.store = DS.Store.create();\n\n You can retrieve DS.Model instances from the store in several ways. To retrieve\n a record for a specific id, use the `find()` method:\n\n var record = MyApp.store.find(MyApp.Contact, 123);\n\n By default, the store will talk to your backend using a standard REST mechanism.\n You can customize how the store talks to your backend by specifying a custom adapter:\n\n MyApp.store = DS.Store.create({\n adapter: 'MyApp.CustomAdapter'\n });\n\n You can learn more about writing a custom adapter by reading the `DS.Adapter`\n documentation.\n*/\nDS.Store = Ember.Object.extend({\n\n /**\n Many methods can be invoked without specifying which store should be used.\n In those cases, the first store created will be used as the default. If\n an application has multiple stores, it should specify which store to use\n when performing actions, such as finding records by id.\n\n The init method registers this store as the default if none is specified.\n */\n init: function() {\n // Enforce API revisioning. See BREAKING_CHANGES.md for more.\n var revision = get(this, 'revision');\n\n if (revision !== DS.CURRENT_API_REVISION && !Ember.ENV.TESTING) {\n throw new Error(\"Error: The Ember Data library has had breaking API changes since the last time you updated the library. Please review the list of breaking changes at https://github.com/emberjs/data/blob/master/BREAKING_CHANGES.md, then update your store's `revision` property to \" + DS.CURRENT_API_REVISION);\n }\n\n if (!get(DS, 'defaultStore') || get(this, 'isDefaultStore')) {\n set(DS, 'defaultStore', this);\n }\n\n // internal bookkeeping; not observable\n this.typeMaps = {};\n this.recordCache = [];\n this.clientIdToId = {};\n this.recordArraysByClientId = {};\n\n set(this, 'defaultTransaction', this.transaction());\n\n return this._super();\n },\n\n /**\n Returns a new transaction scoped to this store.\n\n @see {DS.Transaction}\n @returns DS.Transaction\n */\n transaction: function() {\n return DS.Transaction.create({ store: this });\n },\n\n /**\n @private\n\n This is used only by the record's DataProxy. Do not use this directly.\n */\n dataForRecord: function(record) {\n var type = record.constructor,\n clientId = get(record, 'clientId'),\n typeMap = this.typeMapFor(type);\n\n return typeMap.cidToHash[clientId];\n },\n\n /**\n The adapter to use to communicate to a backend server or other persistence layer.\n\n This can be specified as an instance, a class, or a property path that specifies\n where the adapter can be located.\n\n @property {DS.Adapter|String}\n */\n adapter: null,\n\n /**\n @private\n\n This property returns the adapter, after resolving a possible String.\n\n @returns DS.Adapter\n */\n _adapter: Ember.computed(function() {\n var adapter = get(this, 'adapter');\n if (typeof adapter === 'string') {\n return getPath(this, adapter, false) || getPath(window, adapter);\n }\n return adapter;\n }).property('adapter').cacheable(),\n\n // A monotonically increasing number to be used to uniquely identify\n // data hashes and records.\n clientIdCounter: 1,\n\n // .....................\n // . CREATE NEW RECORD .\n // .....................\n\n /**\n Create a new record in the current store. The properties passed\n to this method are set on the newly created record.\n\n @param {subclass of DS.Model} type\n @param {Object} properties a hash of properties to set on the\n newly created record.\n @returns DS.Model\n */\n createRecord: function(type, properties, transaction) {\n properties = properties || {};\n\n // Create a new instance of the model `type` and put it\n // into the specified `transaction`. If no transaction is\n // specified, the default transaction will be used.\n //\n // NOTE: A `transaction` is specified when the\n // `transaction.createRecord` API is used.\n var record = type._create({\n store: this\n });\n\n transaction = transaction || get(this, 'defaultTransaction');\n transaction.adoptRecord(record);\n\n // Extract the primary key from the `properties` hash,\n // based on the `primaryKey` for the model type.\n var primaryKey = get(record, 'primaryKey'),\n id = properties[primaryKey] || null;\n\n // If the passed properties do not include a primary key,\n // give the adapter an opportunity to generate one.\n var adapter;\n if (Ember.none(id)) {\n adapter = get(this, 'adapter');\n if (adapter && adapter.generateIdForRecord) {\n id = adapter.generateIdForRecord(this, record);\n properties.id = id;\n }\n }\n\n var hash = {}, clientId;\n\n // Push the hash into the store. If present, associate the\n // extracted `id` with the hash.\n clientId = this.pushHash(hash, id, type);\n\n record.send('didChangeData');\n\n var recordCache = get(this, 'recordCache');\n\n // Now that we have a clientId, attach it to the record we\n // just created.\n set(record, 'clientId', clientId);\n\n // Store the record we just created in the record cache for\n // this clientId.\n recordCache[clientId] = record;\n\n // Set the properties specified on the record.\n record.setProperties(properties);\n\n this.updateRecordArrays(type, clientId, get(record, 'data'));\n\n return record;\n },\n\n // .................\n // . DELETE RECORD .\n // .................\n\n /**\n For symmetry, a record can be deleted via the store.\n\n @param {DS.Model} record\n */\n deleteRecord: function(record) {\n record.send('deleteRecord');\n },\n\n // ................\n // . FIND RECORDS .\n // ................\n\n /**\n This is the main entry point into finding records. The first\n parameter to this method is always a subclass of `DS.Model`.\n\n You can use the `find` method on a subclass of `DS.Model`\n directly if your application only has one store. For\n example, instead of `store.find(App.Person, 1)`, you could\n say `App.Person.find(1)`.\n\n ---\n\n To find a record by ID, pass the `id` as the second parameter:\n\n store.find(App.Person, 1);\n App.Person.find(1);\n\n If the record with that `id` had not previously been loaded,\n the store will return an empty record immediately and ask\n the adapter to find the data by calling the adapter's `find`\n method.\n\n The `find` method will always return the same object for a\n given type and `id`. To check whether the adapter has populated\n a record, you can check its `isLoaded` property.\n\n ---\n\n To find all records for a type, call `find` with no additional\n parameters:\n\n store.find(App.Person);\n App.Person.find();\n\n This will return a `RecordArray` representing all known records\n for the given type and kick off a request to the adapter's\n `findAll` method to load any additional records for the type.\n\n The `RecordArray` returned by `find()` is live. If any more\n records for the type are added at a later time through any\n mechanism, it will automatically update to reflect the change.\n\n ---\n\n To find a record by a query, call `find` with a hash as the\n second parameter:\n\n store.find(App.Person, { page: 1 });\n App.Person.find({ page: 1 });\n\n This will return a `RecordArray` immediately, but it will always\n be an empty `RecordArray` at first. It will call the adapter's\n `findQuery` method, which will populate the `RecordArray` once\n the server has returned results.\n\n You can check whether a query results `RecordArray` has loaded\n by checking its `isLoaded` property.\n */\n find: function(type, id, query) {\n if (id === undefined) {\n return this.findAll(type);\n }\n\n if (query !== undefined) {\n return this.findMany(type, id, query);\n } else if (Ember.typeOf(id) === 'object') {\n return this.findQuery(type, id);\n }\n\n if (Ember.isArray(id)) {\n return this.findMany(type, id);\n }\n\n var clientId = this.typeMapFor(type).idToCid[id];\n\n return this.findByClientId(type, clientId, id);\n },\n\n findByClientId: function(type, clientId, id) {\n var recordCache = get(this, 'recordCache'),\n dataCache = this.typeMapFor(type).cidToHash,\n record;\n\n // If there is already a clientId assigned for this\n // type/id combination, try to find an existing\n // record for that id and return. Otherwise,\n // materialize a new record and set its data to the\n // value we already have.\n if (clientId !== undefined) {\n record = recordCache[clientId];\n\n if (!record) {\n // create a new instance of the model type in the\n // 'isLoading' state\n record = this.materializeRecord(type, clientId);\n\n if (typeof dataCache[clientId] === 'object') {\n record.send('didChangeData');\n }\n }\n } else {\n clientId = this.pushHash(LOADING, id, type);\n\n // create a new instance of the model type in the\n // 'isLoading' state\n record = this.materializeRecord(type, clientId);\n\n // let the adapter set the data, possibly async\n var adapter = get(this, '_adapter');\n if (adapter && adapter.find) { adapter.find(this, type, id); }\n else { throw fmt(\"Adapter is either null or does not implement `find` method\", this); }\n }\n\n return record;\n },\n\n /**\n @private\n\n Ask the adapter to fetch IDs that are not already loaded.\n\n This method will convert `id`s to `clientId`s, filter out\n `clientId`s that already have a data hash present, and pass\n the remaining `id`s to the adapter.\n\n @param {Class} type A model class\n @param {Array} ids An array of ids\n @param {Object} query\n\n @returns {Array} An Array of all clientIds for the\n specified ids.\n */\n fetchMany: function(type, ids, query) {\n var typeMap = this.typeMapFor(type),\n idToClientIdMap = typeMap.idToCid,\n dataCache = typeMap.cidToHash,\n data = typeMap.cidToHash,\n needed;\n\n var clientIds = Ember.A([]);\n\n if (ids) {\n needed = [];\n\n ids.forEach(function(id) {\n // Get the clientId for the given id\n var clientId = idToClientIdMap[id];\n\n // If there is no `clientId` yet\n if (clientId === undefined) {\n // Create a new `clientId`, marking its data hash\n // as loading. Once the adapter returns the data\n // hash, it will be updated\n clientId = this.pushHash(LOADING, id, type);\n needed.push(id);\n\n // If there is a clientId, but its data hash is\n // marked as unloaded (this happens when a\n // hasMany association creates clientIds for its\n // referenced ids before they were loaded)\n } else if (clientId && data[clientId] === UNLOADED) {\n // change the data hash marker to loading\n dataCache[clientId] = LOADING;\n needed.push(id);\n }\n\n // this method is expected to return a list of\n // all of the clientIds for the specified ids,\n // unconditionally add it.\n clientIds.push(clientId);\n }, this);\n } else {\n needed = null;\n }\n\n // If there are any needed ids, ask the adapter to load them\n if ((needed && get(needed, 'length') > 0) || query) {\n var adapter = get(this, '_adapter');\n if (adapter && adapter.findMany) { adapter.findMany(this, type, needed, query); }\n else { throw fmt(\"Adapter is either null or does not implement `findMany` method\", this); }\n }\n\n return clientIds;\n },\n\n /** @private\n */\n findMany: function(type, ids, query) {\n var clientIds = this.fetchMany(type, ids, query);\n\n return this.createManyArray(type, clientIds);\n },\n\n findQuery: function(type, query) {\n var array = DS.AdapterPopulatedRecordArray.create({ type: type, content: Ember.A([]), store: this });\n var adapter = get(this, '_adapter');\n if (adapter && adapter.findQuery) { adapter.findQuery(this, type, query, array); }\n else { throw fmt(\"Adapter is either null or does not implement `findQuery` method\", this); }\n return array;\n },\n\n findAll: function(type) {\n\n var typeMap = this.typeMapFor(type),\n findAllCache = typeMap.findAllCache;\n\n if (findAllCache) { return findAllCache; }\n\n var array = DS.RecordArray.create({ type: type, content: Ember.A([]), store: this });\n this.registerRecordArray(array, type);\n\n var adapter = get(this, '_adapter');\n if (adapter && adapter.findAll) { adapter.findAll(this, type); }\n\n typeMap.findAllCache = array;\n return array;\n },\n\n filter: function(type, query, filter) {\n // allow an optional server query\n if (arguments.length === 3) {\n this.findQuery(type, query);\n } else if (arguments.length === 2) {\n filter = query;\n }\n\n var array = DS.FilteredRecordArray.create({ type: type, content: Ember.A([]), store: this, filterFunction: filter });\n\n this.registerRecordArray(array, type, filter);\n\n return array;\n },\n\n // ............\n // . UPDATING .\n // ............\n\n hashWasUpdated: function(type, clientId, record) {\n // Because hash updates are invoked at the end of the run loop,\n // it is possible that a record might be deleted after its hash\n // has been modified and this method was scheduled to be called.\n //\n // If that's the case, the record would have already been removed\n // from all record arrays; calling updateRecordArrays would just\n // add it back. If the record is deleted, just bail. It shouldn't\n // give us any more trouble after this.\n\n if (get(record, 'isDeleted')) { return; }\n this.updateRecordArrays(type, clientId, get(record, 'data'));\n },\n\n // ..............\n // . PERSISTING .\n // ..............\n\n commit: function() {\n var defaultTransaction = get(this, 'defaultTransaction');\n set(this, 'defaultTransaction', this.transaction());\n\n defaultTransaction.commit();\n },\n\n didUpdateRecords: function(array, hashes) {\n if (hashes) {\n array.forEach(function(record, idx) {\n this.didUpdateRecord(record, hashes[idx]);\n }, this);\n } else {\n array.forEach(function(record) {\n this.didUpdateRecord(record);\n }, this);\n }\n },\n\n didUpdateRecord: function(record, hash) {\n if (hash) {\n var clientId = get(record, 'clientId'),\n dataCache = this.typeMapFor(record.constructor).cidToHash;\n\n dataCache[clientId] = hash;\n record.send('didChangeData');\n record.hashWasUpdated();\n } else {\n record.send('didSaveData');\n }\n\n record.send('didCommit');\n },\n\n didDeleteRecords: function(array) {\n array.forEach(function(record) {\n record.send('didCommit');\n });\n },\n\n didDeleteRecord: function(record) {\n record.send('didCommit');\n },\n\n _didCreateRecord: function(record, hash, typeMap, clientId, primaryKey) {\n var recordData = get(record, 'data'), id, changes;\n\n if (hash) {\n typeMap.cidToHash[clientId] = hash;\n\n // If the server returns a hash, we assume that the server's version\n // of the data supercedes the local changes.\n record.beginPropertyChanges();\n record.send('didChangeData');\n recordData.adapterDidUpdate();\n record.hashWasUpdated();\n record.endPropertyChanges();\n\n id = hash[primaryKey];\n\n typeMap.idToCid[id] = clientId;\n this.clientIdToId[clientId] = id;\n } else {\n recordData.commit();\n }\n\n record.send('didCommit');\n },\n\n\n didCreateRecords: function(type, array, hashes) {\n var primaryKey = type.proto().primaryKey,\n typeMap = this.typeMapFor(type),\n clientId;\n\n for (var i=0, l=get(array, 'length'); i<l; i++) {\n var record = array[i], hash = hashes[i];\n clientId = get(record, 'clientId');\n\n this._didCreateRecord(record, hash, typeMap, clientId, primaryKey);\n }\n },\n\n didCreateRecord: function(record, hash) {\n var type = record.constructor,\n typeMap = this.typeMapFor(type),\n clientId, primaryKey;\n\n // The hash is optional, but if it is not provided, the client must have\n // provided a primary key.\n\n primaryKey = type.proto().primaryKey;\n\n // TODO: Make Ember.assert more flexible\n if (hash) {\n Ember.assert(\"The server must provide a primary key: \" + primaryKey, get(hash, primaryKey));\n } else {\n Ember.assert(\"The server did not return data, and you did not create a primary key (\" + primaryKey + \") on the client\", get(get(record, 'data'), primaryKey));\n }\n\n clientId = get(record, 'clientId');\n\n this._didCreateRecord(record, hash, typeMap, clientId, primaryKey);\n },\n\n recordWasInvalid: function(record, errors) {\n record.send('becameInvalid', errors);\n },\n\n // .................\n // . RECORD ARRAYS .\n // .................\n\n registerRecordArray: function(array, type, filter) {\n var recordArrays = this.typeMapFor(type).recordArrays;\n\n recordArrays.push(array);\n\n this.updateRecordArrayFilter(array, type, filter);\n },\n\n createManyArray: function(type, clientIds) {\n var array = DS.ManyArray.create({ type: type, content: clientIds, store: this });\n\n clientIds.forEach(function(clientId) {\n var recordArrays = this.recordArraysForClientId(clientId);\n recordArrays.add(array);\n }, this);\n\n return array;\n },\n\n updateRecordArrayFilter: function(array, type, filter) {\n var typeMap = this.typeMapFor(type),\n dataCache = typeMap.cidToHash,\n clientIds = typeMap.clientIds,\n clientId, hash, proxy;\n\n var recordCache = get(this, 'recordCache'), record;\n\n for (var i=0, l=clientIds.length; i<l; i++) {\n clientId = clientIds[i];\n\n hash = dataCache[clientId];\n if (typeof hash === 'object') {\n if (record = recordCache[clientId]) {\n proxy = get(record, 'data');\n } else {\n DATA_PROXY.savedData = hash;\n proxy = DATA_PROXY;\n }\n\n this.updateRecordArray(array, filter, type, clientId, proxy);\n }\n }\n },\n\n updateRecordArrays: function(type, clientId, dataProxy) {\n var recordArrays = this.typeMapFor(type).recordArrays,\n filter;\n\n recordArrays.forEach(function(array) {\n filter = get(array, 'filterFunction');\n this.updateRecordArray(array, filter, type, clientId, dataProxy);\n }, this);\n },\n\n updateRecordArray: function(array, filter, type, clientId, dataProxy) {\n var shouldBeInArray;\n\n if (!filter) {\n shouldBeInArray = true;\n } else {\n shouldBeInArray = filter(dataProxy);\n }\n\n var content = get(array, 'content');\n var alreadyInArray = content.indexOf(clientId) !== -1;\n\n var recordArrays = this.recordArraysForClientId(clientId);\n\n if (shouldBeInArray && !alreadyInArray) {\n recordArrays.add(array);\n content.pushObject(clientId);\n } else if (!shouldBeInArray && alreadyInArray) {\n recordArrays.remove(array);\n content.removeObject(clientId);\n }\n },\n\n removeFromRecordArrays: function(record) {\n var clientId = get(record, 'clientId');\n var recordArrays = this.recordArraysForClientId(clientId);\n\n recordArrays.forEach(function(array) {\n var content = get(array, 'content');\n content.removeObject(clientId);\n });\n },\n\n // ............\n // . INDEXING .\n // ............\n\n recordArraysForClientId: function(clientId) {\n var recordArrays = get(this, 'recordArraysByClientId');\n var ret = recordArrays[clientId];\n\n if (!ret) {\n ret = recordArrays[clientId] = Ember.OrderedSet.create();\n }\n\n return ret;\n },\n\n typeMapFor: function(type) {\n var typeMaps = get(this, 'typeMaps');\n var guidForType = Ember.guidFor(type);\n\n var typeMap = typeMaps[guidForType];\n\n if (typeMap) {\n return typeMap;\n } else {\n return (typeMaps[guidForType] =\n {\n idToCid: {},\n clientIds: [],\n cidToHash: {},\n recordArrays: []\n });\n }\n },\n\n /** @private\n\n For a given type and id combination, returns the client id used by the store.\n If no client id has been assigned yet, one will be created and returned.\n\n @param {DS.Model} type\n @param {String|Number} id\n */\n clientIdForId: function(type, id) {\n var clientId = this.typeMapFor(type).idToCid[id];\n\n if (clientId !== undefined) { return clientId; }\n\n return this.pushHash(UNLOADED, id, type);\n },\n\n // ................\n // . LOADING DATA .\n // ................\n\n /**\n Load a new data hash into the store for a given id and type combination.\n If data for that record had been loaded previously, the new information\n overwrites the old.\n\n If the record you are loading data for has outstanding changes that have not\n yet been saved, an exception will be thrown.\n\n @param {DS.Model} type\n @param {String|Number} id\n @param {Object} hash the data hash to load\n */\n load: function(type, id, hash) {\n if (hash === undefined) {\n hash = id;\n var primaryKey = type.proto().primaryKey;\n Ember.assert(\"A data hash was loaded for a record of type \" + type.toString() + \" but no primary key '\" + primaryKey + \"' was provided.\", primaryKey in hash);\n id = hash[primaryKey];\n }\n\n var typeMap = this.typeMapFor(type),\n dataCache = typeMap.cidToHash,\n clientId = typeMap.idToCid[id],\n recordCache = get(this, 'recordCache');\n\n if (clientId !== undefined) {\n dataCache[clientId] = hash;\n\n var record = recordCache[clientId];\n if (record) {\n record.send('didChangeData');\n }\n } else {\n clientId = this.pushHash(hash, id, type);\n }\n\n DATA_PROXY.savedData = hash;\n this.updateRecordArrays(type, clientId, DATA_PROXY);\n\n return { id: id, clientId: clientId };\n },\n\n loadMany: function(type, ids, hashes) {\n var clientIds = Ember.A([]);\n\n if (hashes === undefined) {\n hashes = ids;\n ids = [];\n var primaryKey = type.proto().primaryKey;\n\n ids = Ember.ArrayUtils.map(hashes, function(hash) {\n return hash[primaryKey];\n });\n }\n\n for (var i=0, l=get(ids, 'length'); i<l; i++) {\n var loaded = this.load(type, ids[i], hashes[i]);\n clientIds.pushObject(loaded.clientId);\n }\n\n return { clientIds: clientIds, ids: ids };\n },\n\n /** @private\n\n Stores a data hash for the specified type and id combination and returns\n the client id.\n\n @param {Object} hash\n @param {String|Number} id\n @param {DS.Model} type\n @returns {Number}\n */\n pushHash: function(hash, id, type) {\n var typeMap = this.typeMapFor(type);\n\n var idToClientIdMap = typeMap.idToCid,\n clientIdToIdMap = this.clientIdToId,\n clientIds = typeMap.clientIds,\n dataCache = typeMap.cidToHash;\n\n var clientId = ++this.clientIdCounter;\n\n dataCache[clientId] = hash;\n\n // if we're creating an item, this process will be done\n // later, once the object has been persisted.\n if (id) {\n idToClientIdMap[id] = clientId;\n clientIdToIdMap[clientId] = id;\n }\n\n clientIds.push(clientId);\n\n return clientId;\n },\n\n // ..........................\n // . RECORD MATERIALIZATION .\n // ..........................\n\n materializeRecord: function(type, clientId) {\n var record;\n\n get(this, 'recordCache')[clientId] = record = type._create({\n store: this,\n clientId: clientId\n });\n\n get(this, 'defaultTransaction').adoptRecord(record);\n\n record.send('loadingData');\n return record;\n },\n\n destroy: function() {\n if (get(DS, 'defaultStore') === this) {\n set(DS, 'defaultStore', null);\n }\n\n return this._super();\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/store");minispade.register('ember-data/system/transaction', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt;\n\n/**\n A transaction allows you to collect multiple records into a unit of work\n that can be committed or rolled back as a group.\n\n For example, if a record has local modifications that have not yet\n been saved, calling `commit()` on its transaction will cause those\n modifications to be sent to the adapter to be saved. Calling\n `rollback()` on its transaction would cause all of the modifications to\n be discarded and the record to return to the last known state before\n changes were made.\n\n If a newly created record's transaction is rolled back, it will\n immediately transition to the deleted state.\n\n If you do not explicitly create a transaction, a record is assigned to\n an implicit transaction called the default transaction. In these cases,\n you can treat your application's instance of `DS.Store` as a transaction\n and call the `commit()` and `rollback()` methods on the store itself. \n\n Once a record has been successfully committed or rolled back, it will\n be moved back to the implicit transaction. Because it will now be in\n a clean state, it can be moved to a new transaction if you wish.\n\n ### Creating a Transaction\n\n To create a new transaction, call the `transaction()` method of your\n application's `DS.Store` instance:\n\n var transaction = App.store.transaction();\n\n This will return a new instance of `DS.Transaction` with no records\n yet assigned to it.\n\n ### Adding Existing Records\n\n Add records to a transaction using the `add()` method:\n\n record = App.store.find(Person, 1);\n transaction.add(record);\n\n Note that only records whose `isDirty` flag is `false` may be added\n to a transaction. Once modifications to a record have been made\n (its `isDirty` flag is `true`), it is not longer able to be added to\n a transaction.\n\n ### Creating New Records\n\n Because newly created records are dirty from the time they are created,\n and because dirty records can not be added to a transaction, you must\n use the `createRecord()` method to assign new records to a transaction.\n\n For example, instead of this:\n\n var transaction = store.transaction();\n var person = Person.createRecord({ name: \"Steve\" });\n\n // won't work because person is dirty\n transaction.add(person);\n\n Call `createRecord()` on the transaction directly:\n\n var transaction = store.transaction();\n transaction.createRecord(Person, { name: \"Steve\" });\n\n ### Asynchronous Commits\n\n Typically, all of the records in a transaction will be committed\n together. However, new records that have a dependency on other new\n records need to wait for their parent record to be saved and assigned an\n ID. In that case, the child record will continue to live in the\n transaction until its parent is saved, at which time the transaction will\n attempt to commit again.\n\n For this reason, you should not re-use transactions once you have committed\n them. Always make a new transaction and move the desired records to it before\n calling commit.\n*/\n\nDS.Transaction = Ember.Object.extend({\n /**\n @private\n\n Creates the bucket data structure used to segregate records by\n type.\n */\n init: function() {\n set(this, 'buckets', {\n clean: Ember.Map.create(),\n created: Ember.Map.create(),\n updated: Ember.Map.create(),\n deleted: Ember.Map.create(),\n inflight: Ember.Map.create()\n });\n },\n\n /**\n Creates a new record of the given type and assigns it to the transaction\n on which the method was called.\n\n This is useful as only clean records can be added to a transaction and\n new records created using other methods immediately become dirty.\n\n @param {DS.Model} type the model type to create\n @param {Object} hash the data hash to assign the new record\n */\n createRecord: function(type, hash) {\n var store = get(this, 'store');\n\n return store.createRecord(type, hash, this);\n },\n\n /**\n Adds an existing record to this transaction. Only records without\n modficiations (i.e., records whose `isDirty` property is `false`)\n can be added to a transaction.\n\n @param {DS.Model} record the record to add to the transaction\n */\n add: function(record) {\n // we could probably make this work if someone has a valid use case. Do you?\n Ember.assert(\"Once a record has changed, you cannot move it into a different transaction\", !get(record, 'isDirty'));\n\n var recordTransaction = get(record, 'transaction'),\n defaultTransaction = getPath(this, 'store.defaultTransaction');\n\n Ember.assert(\"Models cannot belong to more than one transaction at a time.\", recordTransaction === defaultTransaction);\n\n this.adoptRecord(record);\n },\n\n /**\n Commits the transaction, which causes all of the modified records that\n belong to the transaction to be sent to the adapter to be saved.\n\n Once you call `commit()` on a transaction, you should not re-use it.\n\n When a record is saved, it will be removed from this transaction and\n moved back to the store's default transaction.\n */\n commit: function() {\n var self = this,\n iterate;\n\n iterate = function(bucketType, fn, binding) {\n var dirty = self.bucketForType(bucketType);\n\n dirty.forEach(function(type, records) {\n if (records.isEmpty()) { return; }\n\n var array = [];\n\n records.forEach(function(record) {\n record.send('willCommit');\n\n if (get(record, 'isPending') === false) {\n array.push(record);\n }\n });\n\n fn.call(binding, type, array);\n });\n };\n\n var commitDetails = {\n updated: {\n eachType: function(fn, binding) { iterate('updated', fn, binding); }\n },\n\n created: {\n eachType: function(fn, binding) { iterate('created', fn, binding); }\n },\n\n deleted: {\n eachType: function(fn, binding) { iterate('deleted', fn, binding); }\n }\n };\n\n var store = get(this, 'store');\n var adapter = get(store, '_adapter');\n\n this.removeCleanRecords();\n\n if (adapter && adapter.commit) { adapter.commit(store, commitDetails); }\n else { throw fmt(\"Adapter is either null or does not implement `commit` method\", this); }\n },\n\n /**\n Rolling back a transaction resets the records that belong to\n that transaction.\n\n Updated records have their properties reset to the last known\n value from the persistence layer. Deleted records are reverted\n to a clean, non-deleted state. Newly created records immediately\n become deleted, and are not sent to the adapter to be persisted.\n\n After the transaction is rolled back, any records that belong\n to it will return to the store's default transaction, and the\n current transaction should not be used again.\n */\n rollback: function() {\n var store = get(this, 'store'),\n dirty;\n\n // Loop through all of the records in each of the dirty states\n // and initiate a rollback on them. As a side effect of telling\n // the record to roll back, it should also move itself out of\n // the dirty bucket and into the clean bucket.\n ['created', 'updated', 'deleted', 'inflight'].forEach(function(bucketType) {\n dirty = this.bucketForType(bucketType);\n\n dirty.forEach(function(type, records) {\n records.forEach(function(record) {\n record.send('rollback');\n });\n });\n }, this);\n\n // Now that all records in the transaction are guaranteed to be\n // clean, migrate them all to the store's default transaction.\n this.removeCleanRecords();\n },\n\n /**\n @private\n\n Removes a record from this transaction and back to the store's\n default transaction.\n\n Note: This method is private for now, but should probably be exposed\n in the future once we have stricter error checking (for example, in the\n case of the record being dirty).\n\n @param {DS.Model} record\n */\n remove: function(record) {\n var defaultTransaction = getPath(this, 'store.defaultTransaction');\n defaultTransaction.adoptRecord(record);\n },\n\n /**\n @private\n\n Removes all of the records in the transaction's clean bucket.\n */\n removeCleanRecords: function() {\n var clean = this.bucketForType('clean'),\n self = this;\n\n clean.forEach(function(type, records) {\n records.forEach(function(record) {\n self.remove(record);\n });\n });\n },\n\n /**\n @private\n\n Returns the bucket for the given bucket type. For example, you might call\n `this.bucketForType('updated')` to get the `Ember.Map` that contains all\n of the records that have changes pending.\n\n @param {String} bucketType the type of bucket\n @returns Ember.Map\n */\n bucketForType: function(bucketType) {\n var buckets = get(this, 'buckets');\n\n return get(buckets, bucketType);\n },\n\n /**\n @private\n\n This method moves a record into a different transaction without the normal\n checks that ensure that the user is not doing something weird, like moving\n a dirty record into a new transaction.\n\n It is designed for internal use, such as when we are moving a clean record\n into a new transaction when the transaction is committed.\n\n This method must not be called unless the record is clean.\n\n @param {DS.Model} record\n */\n adoptRecord: function(record) {\n var oldTransaction = get(record, 'transaction');\n\n if (oldTransaction) {\n oldTransaction.removeFromBucket('clean', record);\n }\n\n this.addToBucket('clean', record);\n set(record, 'transaction', this);\n },\n\n /**\n @private\n\n Adds a record to the named bucket.\n\n @param {String} bucketType one of `clean`, `created`, `updated`, or `deleted`\n */\n addToBucket: function(bucketType, record) {\n var bucket = this.bucketForType(bucketType),\n type = record.constructor;\n\n var records = bucket.get(type);\n\n if (!records) {\n records = Ember.OrderedSet.create();\n bucket.set(type, records);\n }\n\n records.add(record);\n },\n\n /**\n @private\n\n Removes a record from the named bucket.\n\n @param {String} bucketType one of `clean`, `created`, `updated`, or `deleted`\n */\n removeFromBucket: function(bucketType, record) {\n var bucket = this.bucketForType(bucketType),\n type = record.constructor;\n\n var records = bucket.get(type);\n records.remove(record);\n },\n\n /**\n @private\n\n Called by a record's state manager to indicate that the record has entered\n a dirty state. The record will be moved from the `clean` bucket and into\n the appropriate dirty bucket.\n\n @param {String} bucketType one of `created`, `updated`, or `deleted`\n */\n recordBecameDirty: function(bucketType, record) {\n this.removeFromBucket('clean', record);\n this.addToBucket(bucketType, record);\n },\n\n /**\n @private\n\n Called by a record's state manager to indicate that the record has entered\n inflight state. The record will be moved from its current dirty bucket and into\n the `inflight` bucket.\n\n @param {String} bucketType one of `created`, `updated`, or `deleted`\n */\n recordBecameInFlight: function(kind, record) {\n this.removeFromBucket(kind, record);\n this.addToBucket('inflight', record);\n },\n\n /**\n @private\n\n Called by a record's state manager to indicate that the record has entered\n a clean state. The record will be moved from its current dirty or inflight bucket and into\n the `clean` bucket.\n\n @param {String} bucketType one of `created`, `updated`, or `deleted`\n */\n recordBecameClean: function(kind, record) {\n this.removeFromBucket(kind, record);\n\n this.remove(record);\n }\n});\n\n})();\n//@ sourceURL=ember-data/system/transaction");minispade.register('ember', "(function() {(function() {\n/*global __fail__*/\n\nif ('undefined' === typeof Ember) {\n Ember = {};\n\n if ('undefined' !== typeof window) {\n window.Em = window.Ember = Em = Ember;\n }\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.\n\n ## Examples\n\n #js:\n\n // pass a simple Boolean value\n Ember.assert('must pass a valid object', !!obj);\n\n // pass a function. If the function returns false the assertion fails\n // any other return value (including void) will pass.\n Ember.assert('a passed record must have a firstName', function() {\n if (obj instanceof Ember.Record) {\n return !Ember.empty(obj.firstName);\n }\n });\n\n @static\n @function\n @param {String} desc\n A description of the assertion. This will become the text of the Error\n thrown if the assertion fails.\n\n @param {Boolean} test\n Must return true for the assertion to pass. If you pass a function it\n will be executed. If the function returns false an exception will be\n thrown.\n*/\nEmber.assert = function(desc, test) {\n if ('function' === typeof test) test = test()!==false;\n if (!test) throw new Error(\"assertion failed: \"+desc);\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 @static\n @function\n @param {String} message\n A warning to display.\n\n @param {Boolean} test\n An optional boolean or function. If the test returns false, the warning\n will be displayed.\n*/\nEmber.warn = function(message, test) {\n if (arguments.length === 1) { test = false; }\n if ('function' === typeof test) test = test()!==false;\n if (!test) console.warn(\"WARNING: \"+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 @static\n @function\n @param {String} message\n A description of the deprecation.\n\n @param {Boolean} test\n An optional boolean or function. If the test returns false, the deprecation\n will be displayed.\n*/\nEmber.deprecate = function(message, test) {\n if (Ember && Ember.TESTING_DEPRECATION) { return; }\n\n if (arguments.length === 1) { test = false; }\n if ('function' === typeof test) { test = test()!==false; }\n if (test) { return; }\n\n if (Ember && Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); }\n\n var error, stackStr = '';\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 (error.stack) {\n var stack;\n\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.<anonymous>\\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 }\n\n console.warn(\"DEPRECATION: \"+message+stackStr);\n};\n\n\n\n/**\n Display a deprecation warning with the provided message and a stack trace\n (Chrome and Firefox only) when the wrapped 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 @static\n @function\n @param {String} message\n A description of the deprecation.\n\n @param {Function} func\n The function to be deprecated.\n*/\nEmber.deprecateFunc = function(message, func) {\n return function() {\n Ember.deprecate(message);\n return func.apply(this, arguments);\n };\n};\n\n\nwindow.ember_assert = Ember.deprecateFunc(\"ember_assert is deprecated. Please use Ember.assert instead.\", Ember.assert);\nwindow.ember_warn = Ember.deprecateFunc(\"ember_warn is deprecated. Please use Ember.warn instead.\", Ember.warn);\nwindow.ember_deprecate = Ember.deprecateFunc(\"ember_deprecate is deprecated. Please use Ember.deprecate instead.\", Ember.deprecate);\nwindow.ember_deprecateFunc = Ember.deprecateFunc(\"ember_deprecateFunc is deprecated. Please use Ember.deprecateFunc instead.\", Ember.deprecateFunc);\n\n})();\n\n(function() {\n// lib/handlebars/base.js\nvar Handlebars = {};\n\nwindow.Handlebars = Handlebars;\n\nHandlebars.VERSION = \"1.0.beta.6\";\n\nHandlebars.helpers = {};\nHandlebars.partials = {};\n\nHandlebars.registerHelper = function(name, fn, inverse) {\n if(inverse) { fn.not = inverse; }\n this.helpers[name] = fn;\n};\n\nHandlebars.registerPartial = function(name, str) {\n this.partials[name] = str;\n};\n\nHandlebars.registerHelper('helperMissing', function(arg) {\n if(arguments.length === 2) {\n return undefined;\n } else {\n throw new Error(\"Could not find property '\" + arg + \"'\");\n }\n});\n\nvar toString = Object.prototype.toString, functionType = \"[object Function]\";\n\nHandlebars.registerHelper('blockHelperMissing', function(context, options) {\n var inverse = options.inverse || function() {}, fn = options.fn;\n\n\n var ret = \"\";\n var type = toString.call(context);\n\n if(type === functionType) { context = context.call(this); }\n\n if(context === true) {\n return fn(this);\n } else if(context === false || context == null) {\n return inverse(this);\n } else if(type === \"[object Array]\") {\n if(context.length > 0) {\n for(var i=0, j=context.length; i<j; i++) {\n ret = ret + fn(context[i]);\n }\n } else {\n ret = inverse(this);\n }\n return ret;\n } else {\n return fn(context);\n }\n});\n\nHandlebars.registerHelper('each', function(context, options) {\n var fn = options.fn, inverse = options.inverse;\n var ret = \"\";\n\n if(context && context.length > 0) {\n for(var i=0, j=context.length; i<j; i++) {\n ret = ret + fn(context[i]);\n }\n } else {\n ret = inverse(this);\n }\n return ret;\n});\n\nHandlebars.registerHelper('if', function(context, options) {\n var type = toString.call(context);\n if(type === functionType) { context = context.call(this); }\n\n if(!context || Handlebars.Utils.isEmpty(context)) {\n return options.inverse(this);\n } else {\n return options.fn(this);\n }\n});\n\nHandlebars.registerHelper('unless', function(context, options) {\n var fn = options.fn, inverse = options.inverse;\n options.fn = inverse;\n options.inverse = fn;\n\n return Handlebars.helpers['if'].call(this, context, options);\n});\n\nHandlebars.registerHelper('with', function(context, options) {\n return options.fn(context);\n});\n\nHandlebars.registerHelper('log', function(context) {\n Handlebars.log(context);\n});\n;\n// lib/handlebars/compiler/parser.js\n/* Jison generated parser */\nvar handlebars = (function(){\n\nvar parser = {trace: function trace() { },\nyy: {},\nsymbols_: {\"error\":2,\"root\":3,\"program\":4,\"EOF\":5,\"statements\":6,\"simpleInverse\":7,\"statement\":8,\"openInverse\":9,\"closeBlock\":10,\"openBlock\":11,\"mustache\":12,\"partial\":13,\"CONTENT\":14,\"COMMENT\":15,\"OPEN_BLOCK\":16,\"inMustache\":17,\"CLOSE\":18,\"OPEN_INVERSE\":19,\"OPEN_ENDBLOCK\":20,\"path\":21,\"OPEN\":22,\"OPEN_UNESCAPED\":23,\"OPEN_PARTIAL\":24,\"params\":25,\"hash\":26,\"param\":27,\"STRING\":28,\"INTEGER\":29,\"BOOLEAN\":30,\"hashSegments\":31,\"hashSegment\":32,\"ID\":33,\"EQUALS\":34,\"pathSegments\":35,\"SEP\":36,\"$accept\":0,\"$end\":1},\nterminals_: {2:\"error\",5:\"EOF\",14:\"CONTENT\",15:\"COMMENT\",16:\"OPEN_BLOCK\",18:\"CLOSE\",19:\"OPEN_INVERSE\",20:\"OPEN_ENDBLOCK\",22:\"OPEN\",23:\"OPEN_UNESCAPED\",24:\"OPEN_PARTIAL\",28:\"STRING\",29:\"INTEGER\",30:\"BOOLEAN\",33:\"ID\",34:\"EQUALS\",36:\"SEP\"},\nproductions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],\nperformAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {\n\nvar $0 = $$.length - 1;\nswitch (yystate) {\ncase 1: return $$[$0-1]\nbreak;\ncase 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0])\nbreak;\ncase 3: this.$ = new yy.ProgramNode($$[$0])\nbreak;\ncase 4: this.$ = new yy.ProgramNode([])\nbreak;\ncase 5: this.$ = [$$[$0]]\nbreak;\ncase 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]\nbreak;\ncase 7: this.$ = new yy.InverseNode($$[$0-2], $$[$0-1], $$[$0])\nbreak;\ncase 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0])\nbreak;\ncase 9: this.$ = $$[$0]\nbreak;\ncase 10: this.$ = $$[$0]\nbreak;\ncase 11: this.$ = new yy.ContentNode($$[$0])\nbreak;\ncase 12: this.$ = new yy.CommentNode($$[$0])\nbreak;\ncase 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])\nbreak;\ncase 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])\nbreak;\ncase 15: this.$ = $$[$0-1]\nbreak;\ncase 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])\nbreak;\ncase 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true)\nbreak;\ncase 18: this.$ = new yy.PartialNode($$[$0-1])\nbreak;\ncase 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1])\nbreak;\ncase 20:\nbreak;\ncase 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]\nbreak;\ncase 22: this.$ = [[$$[$0-1]].concat($$[$0]), null]\nbreak;\ncase 23: this.$ = [[$$[$0-1]], $$[$0]]\nbreak;\ncase 24: this.$ = [[$$[$0]], null]\nbreak;\ncase 25: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];\nbreak;\ncase 26: this.$ = [$$[$0]]\nbreak;\ncase 27: this.$ = $$[$0]\nbreak;\ncase 28: this.$ = new yy.StringNode($$[$0])\nbreak;\ncase 29: this.$ = new yy.IntegerNode($$[$0])\nbreak;\ncase 30: this.$ = new yy.BooleanNode($$[$0])\nbreak;\ncase 31: this.$ = new yy.HashNode($$[$0])\nbreak;\ncase 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]\nbreak;\ncase 33: this.$ = [$$[$0]]\nbreak;\ncase 34: this.$ = [$$[$0-2], $$[$0]]\nbreak;\ncase 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]\nbreak;\ncase 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]\nbreak;\ncase 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]\nbreak;\ncase 38: this.$ = new yy.IdNode($$[$0])\nbreak;\ncase 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];\nbreak;\ncase 40: this.$ = [$$[$0]]\nbreak;\n}\n},\ntable: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],\ndefaultActions: {16:[2,1],37:[2,23],53:[2,21]},\nparseError: function parseError(str, hash) {\n throw new Error(str);\n},\nparse: function parse(input) {\n var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = \"\", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\n this.lexer.setInput(input);\n this.lexer.yy = this.yy;\n this.yy.lexer = this.lexer;\n if (typeof this.lexer.yylloc == \"undefined\")\n this.lexer.yylloc = {};\n var yyloc = this.lexer.yylloc;\n lstack.push(yyloc);\n if (typeof this.yy.parseError === \"function\")\n this.parseError = this.yy.parseError;\n function popStack(n) {\n stack.length = stack.length - 2 * n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n function lex() {\n var token;\n token = self.lexer.lex() || 1;\n if (typeof token !== \"number\") {\n token = self.symbols_[token] || token;\n }\n return token;\n }\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\n while (true) {\n state = stack[stack.length - 1];\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol == null)\n symbol = lex();\n action = table[state] && table[state][symbol];\n }\n if (typeof action === \"undefined\" || !action.length || !action[0]) {\n if (!recovering) {\n expected = [];\n for (p in table[state])\n if (this.terminals_[p] && p > 2) {\n expected.push(\"'\" + this.terminals_[p] + \"'\");\n }\n var errStr = \"\";\n if (this.lexer.showPosition) {\n errStr = \"Parse error on line \" + (yylineno + 1) + \":\\n\" + this.lexer.showPosition() + \"\\nExpecting \" + expected.join(\", \") + \", got '\" + this.terminals_[symbol] + \"'\";\n } else {\n errStr = \"Parse error on line \" + (yylineno + 1) + \": Unexpected \" + (symbol == 1?\"end of input\":\"'\" + (this.terminals_[symbol] || symbol) + \"'\");\n }\n this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});\n }\n }\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error(\"Parse Error: multiple actions possible at state: \" + state + \", token: \" + symbol);\n }\n switch (action[0]) {\n case 1:\n stack.push(symbol);\n vstack.push(this.lexer.yytext);\n lstack.push(this.lexer.yylloc);\n stack.push(action[1]);\n symbol = null;\n if (!preErrorSymbol) {\n yyleng = this.lexer.yyleng;\n yytext = this.lexer.yytext;\n yylineno = this.lexer.yylineno;\n yyloc = this.lexer.yylloc;\n if (recovering > 0)\n recovering--;\n } else {\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n case 2:\n len = this.productions_[action[1]][1];\n yyval.$ = vstack[vstack.length - len];\n yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);\n if (typeof r !== \"undefined\") {\n return r;\n }\n if (len) {\n stack = stack.slice(0, -1 * len * 2);\n vstack = vstack.slice(0, -1 * len);\n lstack = lstack.slice(0, -1 * len);\n }\n stack.push(this.productions_[action[1]][0]);\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\n stack.push(newState);\n break;\n case 3:\n return true;\n }\n }\n return true;\n}\n};/* Jison generated lexer */\nvar lexer = (function(){\n\nvar lexer = ({EOF:1,\nparseError:function parseError(str, hash) {\n if (this.yy.parseError) {\n this.yy.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n },\nsetInput:function (input) {\n this._input = input;\n this._more = this._less = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = '';\n this.conditionStack = ['INITIAL'];\n this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};\n return this;\n },\ninput:function () {\n var ch = this._input[0];\n this.yytext+=ch;\n this.yyleng++;\n this.match+=ch;\n this.matched+=ch;\n var lines = ch.match(/\\n/);\n if (lines) this.yylineno++;\n this._input = this._input.slice(1);\n return ch;\n },\nunput:function (ch) {\n this._input = ch + this._input;\n return this;\n },\nmore:function () {\n this._more = true;\n return this;\n },\npastInput:function () {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\n },\nupcomingInput:function () {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20-next.length);\n }\n return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\\n/g, \"\");\n },\nshowPosition:function () {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c+\"^\";\n },\nnext:function () {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) this.done = true;\n\n var token,\n match,\n col,\n lines;\n if (!this._more) {\n this.yytext = '';\n this.match = '';\n }\n var rules = this._currentRules();\n for (var i=0;i < rules.length; i++) {\n match = this._input.match(this.rules[rules[i]]);\n if (match) {\n lines = match[0].match(/\\n.*/g);\n if (lines) this.yylineno += lines.length;\n this.yylloc = {first_line: this.yylloc.last_line,\n last_line: this.yylineno+1,\n first_column: this.yylloc.last_column,\n last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n this._more = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);\n if (token) return token;\n else return;\n }\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\\n'+this.showPosition(),\n {text: \"\", token: null, line: this.yylineno});\n }\n },\nlex:function lex() {\n var r = this.next();\n if (typeof r !== 'undefined') {\n return r;\n } else {\n return this.lex();\n }\n },\nbegin:function begin(condition) {\n this.conditionStack.push(condition);\n },\npopState:function popState() {\n return this.conditionStack.pop();\n },\n_currentRules:function _currentRules() {\n return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;\n },\ntopState:function () {\n return this.conditionStack[this.conditionStack.length-2];\n },\npushState:function begin(condition) {\n this.begin(condition);\n }});\nlexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\n\nvar YYSTATE=YY_START\nswitch($avoiding_name_collisions) {\ncase 0:\n if(yy_.yytext.slice(-1) !== \"\\\\\") this.begin(\"mu\");\n if(yy_.yytext.slice(-1) === \"\\\\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin(\"emu\");\n if(yy_.yytext) return 14;\n\nbreak;\ncase 1: return 14;\nbreak;\ncase 2: this.popState(); return 14;\nbreak;\ncase 3: return 24;\nbreak;\ncase 4: return 16;\nbreak;\ncase 5: return 20;\nbreak;\ncase 6: return 19;\nbreak;\ncase 7: return 19;\nbreak;\ncase 8: return 23;\nbreak;\ncase 9: return 23;\nbreak;\ncase 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;\nbreak;\ncase 11: return 22;\nbreak;\ncase 12: return 34;\nbreak;\ncase 13: return 33;\nbreak;\ncase 14: return 33;\nbreak;\ncase 15: return 36;\nbreak;\ncase 16: /*ignore whitespace*/\nbreak;\ncase 17: this.popState(); return 18;\nbreak;\ncase 18: this.popState(); return 18;\nbreak;\ncase 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\\\\"/g,'\"'); return 28;\nbreak;\ncase 20: return 30;\nbreak;\ncase 21: return 30;\nbreak;\ncase 22: return 29;\nbreak;\ncase 23: return 33;\nbreak;\ncase 24: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33;\nbreak;\ncase 25: return 'INVALID';\nbreak;\ncase 26: return 5;\nbreak;\n}\n};\nlexer.rules = [/^[^\\x00]*?(?=(\\{\\{))/,/^[^\\x00]+/,/^[^\\x00]{2,}?(?=(\\{\\{))/,/^\\{\\{>/,/^\\{\\{#/,/^\\{\\{\\//,/^\\{\\{\\^/,/^\\{\\{\\s*else\\b/,/^\\{\\{\\{/,/^\\{\\{&/,/^\\{\\{![\\s\\S]*?\\}\\}/,/^\\{\\{/,/^=/,/^\\.(?=[} ])/,/^\\.\\./,/^[\\/.]/,/^\\s+/,/^\\}\\}\\}/,/^\\}\\}/,/^\"(\\\\[\"]|[^\"])*\"/,/^true(?=[}\\s])/,/^false(?=[}\\s])/,/^[0-9]+(?=[}\\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\\s\\/.])/,/^\\[[^\\]]*\\]/,/^./,/^$/];\nlexer.conditions = {\"mu\":{\"rules\":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],\"inclusive\":false},\"emu\":{\"rules\":[2],\"inclusive\":false},\"INITIAL\":{\"rules\":[0,1,26],\"inclusive\":true}};return lexer;})()\nparser.lexer = lexer;\nreturn parser;\n})();\nif (typeof require !== 'undefined' && typeof exports !== 'undefined') {\nexports.parser = handlebars;\nexports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }\nexports.main = function commonjsMain(args) {\n if (!args[1])\n throw new Error('Usage: '+args[0]+' FILE');\n if (typeof process !== 'undefined') {\n var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), \"utf8\");\n } else {\n var cwd = require(\"file\").path(require(\"file\").cwd());\n var source = cwd.join(args[1]).read({charset: \"utf-8\"});\n }\n return exports.parser.parse(source);\n}\nif (typeof module !== 'undefined' && require.main === module) {\n exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require(\"system\").args);\n}\n};\n;\n// lib/handlebars/compiler/base.js\nHandlebars.Parser = handlebars;\n\nHandlebars.parse = function(string) {\n Handlebars.Parser.yy = Handlebars.AST;\n return Handlebars.Parser.parse(string);\n};\n\nHandlebars.print = function(ast) {\n return new Handlebars.PrintVisitor().accept(ast);\n};\n\nHandlebars.logger = {\n DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,\n\n // override in the host environment\n log: function(level, str) {}\n};\n\nHandlebars.log = function(level, str) { Handlebars.logger.log(level, str); };\n;\n// lib/handlebars/compiler/ast.js\n(function() {\n\n Handlebars.AST = {};\n\n Handlebars.AST.ProgramNode = function(statements, inverse) {\n this.type = \"program\";\n this.statements = statements;\n if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }\n };\n\n Handlebars.AST.MustacheNode = function(params, hash, unescaped) {\n this.type = \"mustache\";\n this.id = params[0];\n this.params = params.slice(1);\n this.hash = hash;\n this.escaped = !unescaped;\n };\n\n Handlebars.AST.PartialNode = function(id, context) {\n this.type = \"partial\";\n\n // TODO: disallow complex IDs\n\n this.id = id;\n this.context = context;\n };\n\n var verifyMatch = function(open, close) {\n if(open.original !== close.original) {\n throw new Handlebars.Exception(open.original + \" doesn't match \" + close.original);\n }\n };\n\n Handlebars.AST.BlockNode = function(mustache, program, close) {\n verifyMatch(mustache.id, close);\n this.type = \"block\";\n this.mustache = mustache;\n this.program = program;\n };\n\n Handlebars.AST.InverseNode = function(mustache, program, close) {\n verifyMatch(mustache.id, close);\n this.type = \"inverse\";\n this.mustache = mustache;\n this.program = program;\n };\n\n Handlebars.AST.ContentNode = function(string) {\n this.type = \"content\";\n this.string = string;\n };\n\n Handlebars.AST.HashNode = function(pairs) {\n this.type = \"hash\";\n this.pairs = pairs;\n };\n\n Handlebars.AST.IdNode = function(parts) {\n this.type = \"ID\";\n this.original = parts.join(\".\");\n\n var dig = [], depth = 0;\n\n for(var i=0,l=parts.length; i<l; i++) {\n var part = parts[i];\n\n if(part === \"..\") { depth++; }\n else if(part === \".\" || part === \"this\") { this.isScoped = true; }\n else { dig.push(part); }\n }\n\n this.parts = dig;\n this.string = dig.join('.');\n this.depth = depth;\n this.isSimple = (dig.length === 1) && (depth === 0);\n };\n\n Handlebars.AST.StringNode = function(string) {\n this.type = \"STRING\";\n this.string = string;\n };\n\n Handlebars.AST.IntegerNode = function(integer) {\n this.type = \"INTEGER\";\n this.integer = integer;\n };\n\n Handlebars.AST.BooleanNode = function(bool) {\n this.type = \"BOOLEAN\";\n this.bool = bool;\n };\n\n Handlebars.AST.CommentNode = function(comment) {\n this.type = \"comment\";\n this.comment = comment;\n };\n\n})();;\n// lib/handlebars/utils.js\nHandlebars.Exception = function(message) {\n var tmp = Error.prototype.constructor.apply(this, arguments);\n\n for (var p in tmp) {\n if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }\n }\n\n this.message = tmp.message;\n};\nHandlebars.Exception.prototype = new Error;\n\n// Build out our basic SafeString type\nHandlebars.SafeString = function(string) {\n this.string = string;\n};\nHandlebars.SafeString.prototype.toString = function() {\n return this.string.toString();\n};\n\n(function() {\n var escape = {\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n '\"': \"&quot;\",\n \"'\": \"&#x27;\",\n \"`\": \"&#x60;\"\n };\n\n var badChars = /&(?!\\w+;)|[<>\"'`]/g;\n var possible = /[&<>\"'`]/;\n\n var escapeChar = function(chr) {\n return escape[chr] || \"&amp;\";\n };\n\n Handlebars.Utils = {\n escapeExpression: function(string) {\n // don't escape SafeStrings, since they're already safe\n if (string instanceof Handlebars.SafeString) {\n return string.toString();\n } else if (string == null || string === false) {\n return \"\";\n }\n\n if(!possible.test(string)) { return string; }\n return string.replace(badChars, escapeChar);\n },\n\n isEmpty: function(value) {\n if (typeof value === \"undefined\") {\n return true;\n } else if (value === null) {\n return true;\n } else if (value === false) {\n return true;\n } else if(Object.prototype.toString.call(value) === \"[object Array]\" && value.length === 0) {\n return true;\n } else {\n return false;\n }\n }\n };\n})();;\n// lib/handlebars/compiler/compiler.js\nHandlebars.Compiler = function() {};\nHandlebars.JavaScriptCompiler = function() {};\n\n(function(Compiler, JavaScriptCompiler) {\n Compiler.OPCODE_MAP = {\n appendContent: 1,\n getContext: 2,\n lookupWithHelpers: 3,\n lookup: 4,\n append: 5,\n invokeMustache: 6,\n appendEscaped: 7,\n pushString: 8,\n truthyOrFallback: 9,\n functionOrFallback: 10,\n invokeProgram: 11,\n invokePartial: 12,\n push: 13,\n assignToHash: 15,\n pushStringParam: 16\n };\n\n Compiler.MULTI_PARAM_OPCODES = {\n appendContent: 1,\n getContext: 1,\n lookupWithHelpers: 2,\n lookup: 1,\n invokeMustache: 3,\n pushString: 1,\n truthyOrFallback: 1,\n functionOrFallback: 1,\n invokeProgram: 3,\n invokePartial: 1,\n push: 1,\n assignToHash: 1,\n pushStringParam: 1\n };\n\n Compiler.DISASSEMBLE_MAP = {};\n\n for(var prop in Compiler.OPCODE_MAP) {\n var value = Compiler.OPCODE_MAP[prop];\n Compiler.DISASSEMBLE_MAP[value] = prop;\n }\n\n Compiler.multiParamSize = function(code) {\n return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]];\n };\n\n Compiler.prototype = {\n compiler: Compiler,\n\n disassemble: function() {\n var opcodes = this.opcodes, opcode, nextCode;\n var out = [], str, name, value;\n\n for(var i=0, l=opcodes.length; i<l; i++) {\n opcode = opcodes[i];\n\n if(opcode === 'DECLARE') {\n name = opcodes[++i];\n value = opcodes[++i];\n out.push(\"DECLARE \" + name + \" = \" + value);\n } else {\n str = Compiler.DISASSEMBLE_MAP[opcode];\n\n var extraParams = Compiler.multiParamSize(opcode);\n var codes = [];\n\n for(var j=0; j<extraParams; j++) {\n nextCode = opcodes[++i];\n\n if(typeof nextCode === \"string\") {\n nextCode = \"\\\"\" + nextCode.replace(\"\\n\", \"\\\\n\") + \"\\\"\";\n }\n\n codes.push(nextCode);\n }\n\n str = str + \" \" + codes.join(\" \");\n\n out.push(str);\n }\n }\n\n return out.join(\"\\n\");\n },\n\n guid: 0,\n\n compile: function(program, options) {\n this.children = [];\n this.depths = {list: []};\n this.options = options;\n\n // These changes will propagate to the other compiler components\n var knownHelpers = this.options.knownHelpers;\n this.options.knownHelpers = {\n 'helperMissing': true,\n 'blockHelperMissing': true,\n 'each': true,\n 'if': true,\n 'unless': true,\n 'with': true,\n 'log': true\n };\n if (knownHelpers) {\n for (var name in knownHelpers) {\n this.options.knownHelpers[name] = knownHelpers[name];\n }\n }\n\n return this.program(program);\n },\n\n accept: function(node) {\n return this[node.type](node);\n },\n\n program: function(program) {\n var statements = program.statements, statement;\n this.opcodes = [];\n\n for(var i=0, l=statements.length; i<l; i++) {\n statement = statements[i];\n this[statement.type](statement);\n }\n this.isSimple = l === 1;\n\n this.depths.list = this.depths.list.sort(function(a, b) {\n return a - b;\n });\n\n return this;\n },\n\n compileProgram: function(program) {\n var result = new this.compiler().compile(program, this.options);\n var guid = this.guid++;\n\n this.usePartial = this.usePartial || result.usePartial;\n\n this.children[guid] = result;\n\n for(var i=0, l=result.depths.list.length; i<l; i++) {\n depth = result.depths.list[i];\n\n if(depth < 2) { continue; }\n else { this.addDepth(depth - 1); }\n }\n\n return guid;\n },\n\n block: function(block) {\n var mustache = block.mustache;\n var depth, child, inverse, inverseGuid;\n\n var params = this.setupStackForMustache(mustache);\n\n var programGuid = this.compileProgram(block.program);\n\n if(block.program.inverse) {\n inverseGuid = this.compileProgram(block.program.inverse);\n this.declare('inverse', inverseGuid);\n }\n\n this.opcode('invokeProgram', programGuid, params.length, !!mustache.hash);\n this.declare('inverse', null);\n this.opcode('append');\n },\n\n inverse: function(block) {\n var params = this.setupStackForMustache(block.mustache);\n\n var programGuid = this.compileProgram(block.program);\n\n this.declare('inverse', programGuid);\n\n this.opcode('invokeProgram', null, params.length, !!block.mustache.hash);\n this.declare('inverse', null);\n this.opcode('append');\n },\n\n hash: function(hash) {\n var pairs = hash.pairs, pair, val;\n\n this.opcode('push', '{}');\n\n for(var i=0, l=pairs.length; i<l; i++) {\n pair = pairs[i];\n val = pair[1];\n\n this.accept(val);\n this.opcode('assignToHash', pair[0]);\n }\n },\n\n partial: function(partial) {\n var id = partial.id;\n this.usePartial = true;\n\n if(partial.context) {\n this.ID(partial.context);\n } else {\n this.opcode('push', 'depth0');\n }\n\n this.opcode('invokePartial', id.original);\n this.opcode('append');\n },\n\n content: function(content) {\n this.opcode('appendContent', content.string);\n },\n\n mustache: function(mustache) {\n var params = this.setupStackForMustache(mustache);\n\n this.opcode('invokeMustache', params.length, mustache.id.original, !!mustache.hash);\n\n if(mustache.escaped && !this.options.noEscape) {\n this.opcode('appendEscaped');\n } else {\n this.opcode('append');\n }\n },\n\n ID: function(id) {\n this.addDepth(id.depth);\n\n this.opcode('getContext', id.depth);\n\n this.opcode('lookupWithHelpers', id.parts[0] || null, id.isScoped || false);\n\n for(var i=1, l=id.parts.length; i<l; i++) {\n this.opcode('lookup', id.parts[i]);\n }\n },\n\n STRING: function(string) {\n this.opcode('pushString', string.string);\n },\n\n INTEGER: function(integer) {\n this.opcode('push', integer.integer);\n },\n\n BOOLEAN: function(bool) {\n this.opcode('push', bool.bool);\n },\n\n comment: function() {},\n\n // HELPERS\n pushParams: function(params) {\n var i = params.length, param;\n\n while(i--) {\n param = params[i];\n\n if(this.options.stringParams) {\n if(param.depth) {\n this.addDepth(param.depth);\n }\n\n this.opcode('getContext', param.depth || 0);\n this.opcode('pushStringParam', param.string);\n } else {\n this[param.type](param);\n }\n }\n },\n\n opcode: function(name, val1, val2, val3) {\n this.opcodes.push(Compiler.OPCODE_MAP[name]);\n if(val1 !== undefined) { this.opcodes.push(val1); }\n if(val2 !== undefined) { this.opcodes.push(val2); }\n if(val3 !== undefined) { this.opcodes.push(val3); }\n },\n\n declare: function(name, value) {\n this.opcodes.push('DECLARE');\n this.opcodes.push(name);\n this.opcodes.push(value);\n },\n\n addDepth: function(depth) {\n if(depth === 0) { return; }\n\n if(!this.depths[depth]) {\n this.depths[depth] = true;\n this.depths.list.push(depth);\n }\n },\n\n setupStackForMustache: function(mustache) {\n var params = mustache.params;\n\n this.pushParams(params);\n\n if(mustache.hash) {\n this.hash(mustache.hash);\n }\n\n this.ID(mustache.id);\n\n return params;\n }\n };\n\n JavaScriptCompiler.prototype = {\n // PUBLIC API: You can override these methods in a subclass to provide\n // alternative compiled forms for name lookup and buffering semantics\n nameLookup: function(parent, name, type) {\n\t\t\tif (/^[0-9]+$/.test(name)) {\n return parent + \"[\" + name + \"]\";\n } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {\n\t \treturn parent + \".\" + name;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn parent + \"['\" + name + \"']\";\n }\n },\n\n appendToBuffer: function(string) {\n if (this.environment.isSimple) {\n return \"return \" + string + \";\";\n } else {\n return \"buffer += \" + string + \";\";\n }\n },\n\n initializeBuffer: function() {\n return this.quotedString(\"\");\n },\n\n namespace: \"Handlebars\",\n // END PUBLIC API\n\n compile: function(environment, options, context, asObject) {\n this.environment = environment;\n this.options = options || {};\n\n this.name = this.environment.name;\n this.isChild = !!context;\n this.context = context || {\n programs: [],\n aliases: { self: 'this' },\n registers: {list: []}\n };\n\n this.preamble();\n\n this.stackSlot = 0;\n this.stackVars = [];\n\n this.compileChildren(environment, options);\n\n var opcodes = environment.opcodes, opcode;\n\n this.i = 0;\n\n for(l=opcodes.length; this.i<l; this.i++) {\n opcode = this.nextOpcode(0);\n\n if(opcode[0] === 'DECLARE') {\n this.i = this.i + 2;\n this[opcode[1]] = opcode[2];\n } else {\n this.i = this.i + opcode[1].length;\n this[opcode[0]].apply(this, opcode[1]);\n }\n }\n\n return this.createFunctionContext(asObject);\n },\n\n nextOpcode: function(n) {\n var opcodes = this.environment.opcodes, opcode = opcodes[this.i + n], name, val;\n var extraParams, codes;\n\n if(opcode === 'DECLARE') {\n name = opcodes[this.i + 1];\n val = opcodes[this.i + 2];\n return ['DECLARE', name, val];\n } else {\n name = Compiler.DISASSEMBLE_MAP[opcode];\n\n extraParams = Compiler.multiParamSize(opcode);\n codes = [];\n\n for(var j=0; j<extraParams; j++) {\n codes.push(opcodes[this.i + j + 1 + n]);\n }\n\n return [name, codes];\n }\n },\n\n eat: function(opcode) {\n this.i = this.i + opcode.length;\n },\n\n preamble: function() {\n var out = [];\n\n // this register will disambiguate helper lookup from finding a function in\n // a context. This is necessary for mustache compatibility, which requires\n // that context functions in blocks are evaluated by blockHelperMissing, and\n // then proceed as if the resulting value was provided to blockHelperMissing.\n this.useRegister('foundHelper');\n\n if (!this.isChild) {\n var namespace = this.namespace;\n var copies = \"helpers = helpers || \" + namespace + \".helpers;\";\n if(this.environment.usePartial) { copies = copies + \" partials = partials || \" + namespace + \".partials;\"; }\n out.push(copies);\n } else {\n out.push('');\n }\n\n if (!this.environment.isSimple) {\n out.push(\", buffer = \" + this.initializeBuffer());\n } else {\n out.push(\"\");\n }\n\n // track the last context pushed into place to allow skipping the\n // getContext opcode when it would be a noop\n this.lastContext = 0;\n this.source = out;\n },\n\n createFunctionContext: function(asObject) {\n var locals = this.stackVars;\n if (!this.isChild) {\n locals = locals.concat(this.context.registers.list);\n }\n\n if(locals.length > 0) {\n this.source[1] = this.source[1] + \", \" + locals.join(\", \");\n }\n\n // Generate minimizer alias mappings\n if (!this.isChild) {\n var aliases = []\n for (var alias in this.context.aliases) {\n this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];\n }\n }\n\n if (this.source[1]) {\n this.source[1] = \"var \" + this.source[1].substring(2) + \";\";\n }\n\n // Merge children\n if (!this.isChild) {\n this.source[1] += '\\n' + this.context.programs.join('\\n') + '\\n';\n }\n\n if (!this.environment.isSimple) {\n this.source.push(\"return buffer;\");\n }\n\n var params = this.isChild ? [\"depth0\", \"data\"] : [\"Handlebars\", \"depth0\", \"helpers\", \"partials\", \"data\"];\n\n for(var i=0, l=this.environment.depths.list.length; i<l; i++) {\n params.push(\"depth\" + this.environment.depths.list[i]);\n }\n\n if (asObject) {\n params.push(this.source.join(\"\\n \"));\n\n return Function.apply(this, params);\n } else {\n var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\\n ' + this.source.join(\"\\n \") + '}';\n Handlebars.log(Handlebars.logger.DEBUG, functionSource + \"\\n\\n\");\n return functionSource;\n }\n },\n\n appendContent: function(content) {\n this.source.push(this.appendToBuffer(this.quotedString(content)));\n },\n\n append: function() {\n var local = this.popStack();\n this.source.push(\"if(\" + local + \" || \" + local + \" === 0) { \" + this.appendToBuffer(local) + \" }\");\n if (this.environment.isSimple) {\n this.source.push(\"else { \" + this.appendToBuffer(\"''\") + \" }\");\n }\n },\n\n appendEscaped: function() {\n var opcode = this.nextOpcode(1), extra = \"\";\n this.context.aliases.escapeExpression = 'this.escapeExpression';\n\n if(opcode[0] === 'appendContent') {\n extra = \" + \" + this.quotedString(opcode[1][0]);\n this.eat(opcode);\n }\n\n this.source.push(this.appendToBuffer(\"escapeExpression(\" + this.popStack() + \")\" + extra));\n },\n\n getContext: function(depth) {\n if(this.lastContext !== depth) {\n this.lastContext = depth;\n }\n },\n\n lookupWithHelpers: function(name, isScoped) {\n if(name) {\n var topStack = this.nextStack();\n\n this.usingKnownHelper = false;\n\n var toPush;\n if (!isScoped && this.options.knownHelpers[name]) {\n toPush = topStack + \" = \" + this.nameLookup('helpers', name, 'helper');\n this.usingKnownHelper = true;\n } else if (isScoped || this.options.knownHelpersOnly) {\n toPush = topStack + \" = \" + this.nameLookup('depth' + this.lastContext, name, 'context');\n } else {\n this.register('foundHelper', this.nameLookup('helpers', name, 'helper'));\n toPush = topStack + \" = foundHelper || \" + this.nameLookup('depth' + this.lastContext, name, 'context');\n }\n\n toPush += ';';\n this.source.push(toPush);\n } else {\n this.pushStack('depth' + this.lastContext);\n }\n },\n\n lookup: function(name) {\n var topStack = this.topStack();\n this.source.push(topStack + \" = (\" + topStack + \" === null || \" + topStack + \" === undefined || \" + topStack + \" === false ? \" +\n \t\t\t\ttopStack + \" : \" + this.nameLookup(topStack, name, 'context') + \");\");\n },\n\n pushStringParam: function(string) {\n this.pushStack('depth' + this.lastContext);\n this.pushString(string);\n },\n\n pushString: function(string) {\n this.pushStack(this.quotedString(string));\n },\n\n push: function(name) {\n this.pushStack(name);\n },\n\n invokeMustache: function(paramSize, original, hasHash) {\n this.populateParams(paramSize, this.quotedString(original), \"{}\", null, hasHash, function(nextStack, helperMissingString, id) {\n if (!this.usingKnownHelper) {\n this.context.aliases.helperMissing = 'helpers.helperMissing';\n this.context.aliases.undef = 'void 0';\n this.source.push(\"else if(\" + id + \"=== undef) { \" + nextStack + \" = helperMissing.call(\" + helperMissingString + \"); }\");\n if (nextStack !== id) {\n this.source.push(\"else { \" + nextStack + \" = \" + id + \"; }\");\n }\n }\n });\n },\n\n invokeProgram: function(guid, paramSize, hasHash) {\n var inverse = this.programExpression(this.inverse);\n var mainProgram = this.programExpression(guid);\n\n this.populateParams(paramSize, null, mainProgram, inverse, hasHash, function(nextStack, helperMissingString, id) {\n if (!this.usingKnownHelper) {\n this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';\n this.source.push(\"else { \" + nextStack + \" = blockHelperMissing.call(\" + helperMissingString + \"); }\");\n }\n });\n },\n\n populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) {\n var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data;\n var id = this.popStack(), nextStack;\n var params = [], param, stringParam, stringOptions;\n\n if (needsRegister) {\n this.register('tmp1', program);\n stringOptions = 'tmp1';\n } else {\n stringOptions = '{ hash: {} }';\n }\n\n if (needsRegister) {\n var hash = (hasHash ? this.popStack() : '{}');\n this.source.push('tmp1.hash = ' + hash + ';');\n }\n\n if(this.options.stringParams) {\n this.source.push('tmp1.contexts = [];');\n }\n\n for(var i=0; i<paramSize; i++) {\n param = this.popStack();\n params.push(param);\n\n if(this.options.stringParams) {\n this.source.push('tmp1.contexts.push(' + this.popStack() + ');');\n }\n }\n\n if(inverse) {\n this.source.push('tmp1.fn = tmp1;');\n this.source.push('tmp1.inverse = ' + inverse + ';');\n }\n\n if(this.options.data) {\n this.source.push('tmp1.data = data;');\n }\n\n params.push(stringOptions);\n\n this.populateCall(params, id, helperId || id, fn, program !== '{}');\n },\n\n populateCall: function(params, id, helperId, fn, program) {\n var paramString = [\"depth0\"].concat(params).join(\", \");\n var helperMissingString = [\"depth0\"].concat(helperId).concat(params).join(\", \");\n\n var nextStack = this.nextStack();\n\n if (this.usingKnownHelper) {\n this.source.push(nextStack + \" = \" + id + \".call(\" + paramString + \");\");\n } else {\n this.context.aliases.functionType = '\"function\"';\n var condition = program ? \"foundHelper && \" : \"\"\n this.source.push(\"if(\" + condition + \"typeof \" + id + \" === functionType) { \" + nextStack + \" = \" + id + \".call(\" + paramString + \"); }\");\n }\n fn.call(this, nextStack, helperMissingString, id);\n this.usingKnownHelper = false;\n },\n\n invokePartial: function(context) {\n params = [this.nameLookup('partials', context, 'partial'), \"'\" + context + \"'\", this.popStack(), \"helpers\", \"partials\"];\n\n if (this.options.data) {\n params.push(\"data\");\n }\n\n this.pushStack(\"self.invokePartial(\" + params.join(\", \") + \");\");\n },\n\n assignToHash: function(key) {\n var value = this.popStack();\n var hash = this.topStack();\n\n this.source.push(hash + \"['\" + key + \"'] = \" + value + \";\");\n },\n\n // HELPERS\n\n compiler: JavaScriptCompiler,\n\n compileChildren: function(environment, options) {\n var children = environment.children, child, compiler;\n\n for(var i=0, l=children.length; i<l; i++) {\n child = children[i];\n compiler = new this.compiler();\n\n this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children\n var index = this.context.programs.length;\n child.index = index;\n child.name = 'program' + index;\n this.context.programs[index] = compiler.compile(child, options, this.context);\n }\n },\n\n programExpression: function(guid) {\n if(guid == null) { return \"self.noop\"; }\n\n var child = this.environment.children[guid],\n depths = child.depths.list;\n var programParams = [child.index, child.name, \"data\"];\n\n for(var i=0, l = depths.length; i<l; i++) {\n depth = depths[i];\n\n if(depth === 1) { programParams.push(\"depth0\"); }\n else { programParams.push(\"depth\" + (depth - 1)); }\n }\n\n if(depths.length === 0) {\n return \"self.program(\" + programParams.join(\", \") + \")\";\n } else {\n programParams.shift();\n return \"self.programWithDepth(\" + programParams.join(\", \") + \")\";\n }\n },\n\n register: function(name, val) {\n this.useRegister(name);\n this.source.push(name + \" = \" + val + \";\");\n },\n\n useRegister: function(name) {\n if(!this.context.registers[name]) {\n this.context.registers[name] = true;\n this.context.registers.list.push(name);\n }\n },\n\n pushStack: function(item) {\n this.source.push(this.nextStack() + \" = \" + item + \";\");\n return \"stack\" + this.stackSlot;\n },\n\n nextStack: function() {\n this.stackSlot++;\n if(this.stackSlot > this.stackVars.length) { this.stackVars.push(\"stack\" + this.stackSlot); }\n return \"stack\" + this.stackSlot;\n },\n\n popStack: function() {\n return \"stack\" + this.stackSlot--;\n },\n\n topStack: function() {\n return \"stack\" + this.stackSlot;\n },\n\n quotedString: function(str) {\n return '\"' + str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r') + '\"';\n }\n };\n\n var reservedWords = (\n \"break else new var\" +\n \" case finally return void\" +\n \" catch for switch while\" +\n \" continue function this with\" +\n \" default if throw\" +\n \" delete in try\" +\n \" do instanceof typeof\" +\n \" abstract enum int short\" +\n \" boolean export interface static\" +\n \" byte extends long super\" +\n \" char final native synchronized\" +\n \" class float package throws\" +\n \" const goto private transient\" +\n \" debugger implements protected volatile\" +\n \" double import public let yield\"\n ).split(\" \");\n\n var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};\n\n for(var i=0, l=reservedWords.length; i<l; i++) {\n compilerWords[reservedWords[i]] = true;\n }\n\n\tJavaScriptCompiler.isValidJavaScriptVariableName = function(name) {\n\t\tif(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);\n\nHandlebars.precompile = function(string, options) {\n options = options || {};\n\n var ast = Handlebars.parse(string);\n var environment = new Handlebars.Compiler().compile(ast, options);\n return new Handlebars.JavaScriptCompiler().compile(environment, options);\n};\n\nHandlebars.compile = function(string, options) {\n options = options || {};\n\n var compiled;\n function compile() {\n var ast = Handlebars.parse(string);\n var environment = new Handlebars.Compiler().compile(ast, options);\n var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n return Handlebars.template(templateSpec);\n }\n\n // Template is only compiled on first use and cached after that point.\n return function(context, options) {\n if (!compiled) {\n compiled = compile();\n }\n return compiled.call(this, context, options);\n };\n};\n;\n// lib/handlebars/runtime.js\nHandlebars.VM = {\n template: function(templateSpec) {\n // Just add water\n var container = {\n escapeExpression: Handlebars.Utils.escapeExpression,\n invokePartial: Handlebars.VM.invokePartial,\n programs: [],\n program: function(i, fn, data) {\n var programWrapper = this.programs[i];\n if(data) {\n return Handlebars.VM.program(fn, data);\n } else if(programWrapper) {\n return programWrapper;\n } else {\n programWrapper = this.programs[i] = Handlebars.VM.program(fn);\n return programWrapper;\n }\n },\n programWithDepth: Handlebars.VM.programWithDepth,\n noop: Handlebars.VM.noop\n };\n\n return function(context, options) {\n options = options || {};\n return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);\n };\n },\n\n programWithDepth: function(fn, data, $depth) {\n var args = Array.prototype.slice.call(arguments, 2);\n\n return function(context, options) {\n options = options || {};\n\n return fn.apply(this, [context, options.data || data].concat(args));\n };\n },\n program: function(fn, data) {\n return function(context, options) {\n options = options || {};\n\n return fn(context, options.data || data);\n };\n },\n noop: function() { return \"\"; },\n invokePartial: function(partial, name, context, helpers, partials, data) {\n options = { helpers: helpers, partials: partials, data: data };\n\n if(partial === undefined) {\n throw new Handlebars.Exception(\"The partial \" + name + \" could not be found\");\n } else if(partial instanceof Function) {\n return partial(context, options);\n } else if (!Handlebars.compile) {\n throw new Handlebars.Exception(\"The partial \" + name + \" could not be compiled when running in runtime-only mode\");\n } else {\n partials[name] = Handlebars.compile(partial);\n return partials[name](context, options);\n }\n }\n};\n\nHandlebars.template = Handlebars.VM.template;\n;\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Em:true ENV */\n\nif ('undefined' === typeof Ember) {\n/**\n @namespace\n @name Ember\n @version 0.9.7.1\n\n All Ember methods and functions are defined inside of this namespace.\n You generally should not add new properties to this namespace as it may be\n overwritten by future versions of Ember.\n\n You can also use the shorthand \"Em\" instead of \"Ember\".\n\n Ember-Runtime is a framework that provides core functions for\n Ember including cross-platform functions, support for property\n observing and objects. Its focus is on small size and performance. You can\n use this in place of or along-side other cross-platform libraries such as\n jQuery.\n\n The core Runtime framework is based on the jQuery API with a number of\n performance optimizations.\n*/\n\n// Create core object. Make it act like an instance of Ember.Namespace so that\n// objects assigned to it are given a sane string representation.\nEmber = {};\n\n// aliases needed to keep minifiers from removing the global context\nif ('undefined' !== typeof window) {\n window.Em = window.Ember = Em = Ember;\n}\n\n}\n\n// Make sure these are set whether Ember was already defined or not\n\nEmber.isNamespace = true;\n\nEmber.toString = function() { return \"Ember\"; };\n\n\n/**\n @static\n @type String\n @default '0.9.7.1'\n @constant\n*/\nEmber.VERSION = '0.9.7.1';\n\n/**\n @static\n @type Hash\n @constant\n\n Standard environmental variables. You can define these in a global `ENV`\n variable before loading Ember to control various configuration\n settings.\n*/\nEmber.ENV = 'undefined' === typeof ENV ? {} : ENV;\n\n\n// ..........................................................\n// BOOTSTRAP\n//\n\n/**\n @static\n @type Boolean\n @default true\n @constant\n\n Determines whether Ember should enhances some built-in object\n prototypes to provide a more friendly API. If enabled, a few methods\n will be added to Function, String, and Array. Object.prototype will not be\n enhanced, which is the one that causes most troubles for people.\n\n In general we recommend leaving this option set to true since it rarely\n conflicts with other code. If you need to turn it off however, you can\n define an ENV.EXTEND_PROTOTYPES config to disable it.\n*/\nEmber.EXTEND_PROTOTYPES = (Ember.ENV.EXTEND_PROTOTYPES !== false);\n\n\n/**\n @static\n @type Boolean\n @default Ember.EXTEND_PROTOTYPES\n @constant\n\n Determines whether Ember should add ECMAScript 5 shims to older browsers.\n*/\nEmber.SHIM_ES5 = (Ember.ENV.SHIM_ES5 === false) ? false : Ember.EXTEND_PROTOTYPES;\n\n\n/**\n @static\n @type Boolean\n @default false\n @constant\n\n Determines whether computed properties are cacheable by default.\n In future releases this will default to `true`. For the 1.0 release,\n the option to turn off caching by default will be removed entirely.\n\n When caching is enabled by default, you can use `volatile()` to disable\n caching on individual computed properties.\n*/\nEmber.CP_DEFAULT_CACHEABLE = !!Ember.ENV.CP_DEFAULT_CACHEABLE;\n\n/**\n @static\n @type Boolean\n @default false\n @constant\n\n Determines whether views render their templates using themselves\n as the context, or whether it is inherited from the parent. In\n future releases, this will default to `true`. For the 1.0 release,\n the option to have views change context by default will be removed entirely.\n\n If you need to update your application to use the new context rules, simply\n prefix property access with `view.`:\n\n // Before:\n {{#each App.photosController}}\n Photo Title: {{title}}\n {{#view App.InfoView contentBinding=\"this\"}}\n {{content.date}}\n {{content.cameraType}}\n {{otherViewProperty}}\n {{/view}}\n {{/each}}\n\n // After:\n {{#each App.photosController}}\n Photo Title: {{title}}\n {{#view App.InfoView}}\n {{date}}\n {{cameraType}}\n {{view.otherViewProperty}}\n {{/view}}\n {{/each}}\n*/\nEmber.VIEW_PRESERVES_CONTEXT = !!Ember.ENV.VIEW_PRESERVES_CONTEXT;\n\n/**\n Empty function. Useful for some operations.\n\n @returns {Object}\n @private\n*/\nEmber.K = function() { return this; };\n\n/**\n @namespace\n @name window\n @description The global window object\n*/\n\n\n// Stub out the methods defined by the ember-debug package in case it's not loaded\n\nif ('undefined' === typeof Ember.assert) { Ember.assert = Ember.K; }\nif ('undefined' === typeof Ember.warn) { Ember.warn = Ember.K; }\nif ('undefined' === typeof Ember.deprecate) { Ember.deprecate = Ember.K; }\nif ('undefined' === typeof Ember.deprecateFunc) {\n Ember.deprecateFunc = function(_, func) { return func; };\n}\n\n// These are deprecated but still supported\n\nif ('undefined' === typeof ember_assert) { window.ember_assert = Ember.K; }\nif ('undefined' === typeof ember_warn) { window.ember_warn = Ember.K; }\nif ('undefined' === typeof ember_deprecate) { window.ember_deprecate = Ember.K; }\nif ('undefined' === typeof ember_deprecateFunc) {\n window.ember_deprecateFunc = function(_, func) { return func; };\n}\n\n\n// ..........................................................\n// LOGGER\n//\n\n/**\n @class\n\n Inside Ember-Metal, simply uses the window.console object.\n Override this to provide more robust logging functionality.\n*/\nEmber.Logger = window.console || { log: Ember.K, warn: Ember.K, error: Ember.K };\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Node */\n/**\n @class\n\n Platform specific methods and feature detectors needed by the framework.\n\n @name Ember.platform\n*/\nvar platform = Ember.platform = {} ;\n\n/**\n Identical to Object.create(). Implements if not available natively.\n @memberOf Ember.platform\n @name create\n*/\nplatform.create = Object.create;\n\nif (!platform.create) {\n /** @private */\n var O_ctor = function() {},\n O_proto = O_ctor.prototype;\n\n platform.create = function(obj, descs) {\n O_ctor.prototype = obj;\n obj = new O_ctor();\n O_ctor.prototype = O_proto;\n\n if (descs !== undefined) {\n for(var key in descs) {\n if (!descs.hasOwnProperty(key)) continue;\n platform.defineProperty(obj, key, descs[key]);\n }\n }\n\n return obj;\n };\n\n platform.create.isSimulated = true;\n}\n\n/** @private */\nvar defineProperty = Object.defineProperty;\nvar canRedefineProperties, canDefinePropertyOnDOM;\n\n// Catch IE8 where Object.defineProperty exists but only works on DOM elements\nif (defineProperty) {\n try {\n defineProperty({}, 'a',{get:function(){}});\n } catch (e) {\n /** @private */\n defineProperty = null;\n }\n}\n\nif (defineProperty) {\n // Detects a bug in Android <3.2 where you cannot redefine a property using\n // Object.defineProperty once accessors have already been set.\n /** @private */\n canRedefineProperties = (function() {\n var obj = {};\n\n defineProperty(obj, 'a', {\n configurable: true,\n enumerable: true,\n get: function() { },\n set: function() { }\n });\n\n defineProperty(obj, 'a', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: true\n });\n\n return obj.a === true;\n })();\n\n // This is for Safari 5.0, which supports Object.defineProperty, but not\n // on DOM nodes.\n /** @private */\n canDefinePropertyOnDOM = (function(){\n try {\n defineProperty(document.createElement('div'), 'definePropertyOnDOM', {});\n return true;\n } catch(e) { }\n\n return false;\n })();\n\n if (!canRedefineProperties) {\n /** @private */\n defineProperty = null;\n } else if (!canDefinePropertyOnDOM) {\n /** @private */\n defineProperty = function(obj, keyName, desc){\n var isNode;\n\n if (typeof Node === \"object\") {\n isNode = obj instanceof Node;\n } else {\n isNode = typeof obj === \"object\" && typeof obj.nodeType === \"number\" && typeof obj.nodeName === \"string\";\n }\n\n if (isNode) {\n // TODO: Should we have a warning here?\n return (obj[keyName] = desc.value);\n } else {\n return Object.defineProperty(obj, keyName, desc);\n }\n };\n }\n}\n\n/**\n Identical to Object.defineProperty(). Implements as much functionality\n as possible if not available natively.\n\n @memberOf Ember.platform\n @name defineProperty\n @param {Object} obj The object to modify\n @param {String} keyName property name to modify\n @param {Object} desc descriptor hash\n @returns {void}\n*/\nplatform.defineProperty = defineProperty;\n\n/**\n Set to true if the platform supports native getters and setters.\n\n @memberOf Ember.platform\n @name hasPropertyAccessors\n*/\nplatform.hasPropertyAccessors = true;\n\nif (!platform.defineProperty) {\n platform.hasPropertyAccessors = false;\n\n platform.defineProperty = function(obj, keyName, desc) {\n Ember.assert(\"property descriptor cannot have `get` or `set` on this platform\", !desc.get && !desc.set);\n obj[keyName] = desc.value;\n };\n\n platform.defineProperty.isSimulated = true;\n}\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// ..........................................................\n// GUIDS\n//\n\n// Used for guid generation...\nvar GUID_KEY = '__ember'+ (+ new Date());\nvar uuid, numberCache, stringCache;\n\nuuid = 0;\nnumberCache = [];\nstringCache = {};\n\nvar GUID_DESC = Ember.GUID_DESC = {\n configurable: true,\n writable: true,\n enumerable: false\n};\n\nvar o_defineProperty = Ember.platform.defineProperty;\nvar o_create = Ember.platform.create;\n\n/**\n @private\n @static\n @type String\n @constant\n\n A unique key used to assign guids and other private metadata to objects.\n If you inspect an object in your browser debugger you will often see these.\n They can be safely ignored.\n\n On browsers that support it, these properties are added with enumeration\n disabled so they won't show up when you iterate over your properties.\n*/\nEmber.GUID_KEY = GUID_KEY;\n\n/**\n @private\n\n Generates a new guid, optionally saving the guid to the object that you\n pass in. You will rarely need to use this method. Instead you should\n call Ember.guidFor(obj), which return an existing guid if available.\n\n @param {Object} obj\n Optional object the guid will be used for. If passed in, the guid will\n be saved on the object and reused whenever you pass the same object\n again.\n\n If no object is passed, just generate a new guid.\n\n @param {String} prefix\n Optional prefix to place in front of the guid. Useful when you want to\n separate the guid into separate namespaces.\n\n @returns {String} the guid\n*/\nEmber.generateGuid = function(obj, prefix) {\n if (!prefix) prefix = 'ember';\n var ret = (prefix + (uuid++));\n if (obj) {\n GUID_DESC.value = ret;\n o_defineProperty(obj, GUID_KEY, GUID_DESC);\n GUID_DESC.value = null;\n }\n\n return ret ;\n};\n\n/**\n @private\n\n Returns a unique id for the object. If the object does not yet have\n a guid, one will be assigned to it. You can call this on any object,\n Ember.Object-based or not, but be aware that it will add a _guid property.\n\n You can also use this method on DOM Element objects.\n\n @method\n @param obj {Object} any object, string, number, Element, or primitive\n @returns {String} the unique guid for this instance.\n*/\nEmber.guidFor = function(obj) {\n\n // special cases where we don't want to add a key to object\n if (obj === undefined) return \"(undefined)\";\n if (obj === null) return \"(null)\";\n\n var cache, ret;\n var type = typeof obj;\n\n // Don't allow prototype changes to String etc. to change the guidFor\n switch(type) {\n case 'number':\n ret = numberCache[obj];\n if (!ret) ret = numberCache[obj] = 'nu'+obj;\n return ret;\n\n case 'string':\n ret = stringCache[obj];\n if (!ret) ret = stringCache[obj] = 'st'+(uuid++);\n return ret;\n\n case 'boolean':\n return obj ? '(true)' : '(false)';\n\n default:\n if (obj[GUID_KEY]) return obj[GUID_KEY];\n if (obj === Object) return '(Object)';\n if (obj === Array) return '(Array)';\n return Ember.generateGuid(obj, 'ember');\n }\n};\n\n\n// ..........................................................\n// META\n//\n\nvar META_DESC = {\n writable: true,\n configurable: false,\n enumerable: false,\n value: null\n};\n\nvar META_KEY = Ember.GUID_KEY+'_meta';\n\n/**\n The key used to store meta information on object for property observing.\n\n @static\n @property\n*/\nEmber.META_KEY = META_KEY;\n\n// Placeholder for non-writable metas.\nvar EMPTY_META = {\n descs: {},\n watching: {}\n};\n\nif (Object.freeze) Object.freeze(EMPTY_META);\n\nvar createMeta = Ember.platform.defineProperty.isSimulated ? o_create : (function(meta) { return meta; });\n\n/**\n @private\n @function\n\n Retrieves the meta hash for an object. If 'writable' is true ensures the\n hash is writable for this object as well.\n\n The meta object contains information about computed property descriptors as\n well as any watched properties and other information. You generally will\n not access this information directly but instead work with higher level\n methods that manipulate this hash indirectly.\n\n @param {Object} obj\n The object to retrieve meta for\n\n @param {Boolean} writable\n Pass false if you do not intend to modify the meta hash, allowing the\n method to avoid making an unnecessary copy.\n\n @returns {Hash}\n*/\nEmber.meta = function meta(obj, writable) {\n\n var ret = obj[META_KEY];\n if (writable===false) return ret || EMPTY_META;\n\n if (!ret) {\n o_defineProperty(obj, META_KEY, META_DESC);\n ret = obj[META_KEY] = createMeta({\n descs: {},\n watching: {},\n values: {},\n lastSetValues: {},\n cache: {},\n source: obj\n });\n\n // make sure we don't accidentally try to create constructor like desc\n ret.descs.constructor = null;\n\n } else if (ret.source !== obj) {\n ret = o_create(ret);\n ret.descs = o_create(ret.descs);\n ret.values = o_create(ret.values);\n ret.watching = o_create(ret.watching);\n ret.lastSetValues = {};\n ret.cache = {};\n ret.source = obj;\n\n o_defineProperty(obj, META_KEY, META_DESC);\n ret = obj[META_KEY] = createMeta(ret);\n }\n return ret;\n};\n\nEmber.getMeta = function getMeta(obj, property) {\n var meta = Ember.meta(obj, false);\n return meta[property];\n};\n\nEmber.setMeta = function setMeta(obj, property, value) {\n var meta = Ember.meta(obj, true);\n meta[property] = value;\n return value;\n};\n\n/**\n @private\n\n In order to store defaults for a class, a prototype may need to create\n a default meta object, which will be inherited by any objects instantiated\n from the class's constructor.\n\n However, the properties of that meta object are only shallow-cloned,\n so if a property is a hash (like the event system's `listeners` hash),\n it will by default be shared across all instances of that class.\n\n This method allows extensions to deeply clone a series of nested hashes or\n other complex objects. For instance, the event system might pass\n ['listeners', 'foo:change', 'ember157'] to `prepareMetaPath`, which will\n walk down the keys provided.\n\n For each key, if the key does not exist, it is created. If it already\n exists and it was inherited from its constructor, the constructor's\n key is cloned.\n\n You can also pass false for `writable`, which will simply return\n undefined if `prepareMetaPath` discovers any part of the path that\n shared or undefined.\n\n @param {Object} obj The object whose meta we are examining\n @param {Array} path An array of keys to walk down\n @param {Boolean} writable whether or not to create a new meta\n (or meta property) if one does not already exist or if it's\n shared with its constructor\n*/\nEmber.metaPath = function(obj, path, writable) {\n var meta = Ember.meta(obj, writable), keyName, value;\n\n for (var i=0, l=path.length; i<l; i++) {\n keyName = path[i];\n value = meta[keyName];\n\n if (!value) {\n if (!writable) { return undefined; }\n value = meta[keyName] = { __ember_source__: obj };\n } else if (value.__ember_source__ !== obj) {\n if (!writable) { return undefined; }\n value = meta[keyName] = o_create(value);\n value.__ember_source__ = obj;\n }\n\n meta = value;\n }\n\n return value;\n};\n\n/**\n @private\n\n Wraps the passed function so that `this._super` will point to the superFunc\n when the function is invoked. This is the primitive we use to implement\n calls to super.\n\n @param {Function} func\n The function to call\n\n @param {Function} superFunc\n The super function.\n\n @returns {Function} wrapped function.\n*/\nEmber.wrap = function(func, superFunc) {\n\n function K() {}\n\n var newFunc = function() {\n var ret, sup = this._super;\n this._super = superFunc || K;\n ret = func.apply(this, arguments);\n this._super = sup;\n return ret;\n };\n\n newFunc.base = func;\n return newFunc;\n};\n\n/**\n Returns true if the passed object is an array or Array-like.\n\n Ember Array Protocol:\n\n - the object has an objectAt property\n - the object is a native Array\n - the object is an Object, and has a length property\n\n Unlike Ember.typeOf this method returns true even if the passed object is\n not formally array but appears to be array-like (i.e. implements Ember.Array)\n\n Ember.isArray(); // false\n Ember.isArray([]); // true\n Ember.isArray( Ember.ArrayProxy.create({ content: [] }) ); // true\n\n @param {Object} obj The object to test\n @returns {Boolean}\n*/\nEmber.isArray = function(obj) {\n if (!obj || obj.setInterval) { return false; }\n if (Array.isArray && Array.isArray(obj)) { return true; }\n if (Ember.Array && Ember.Array.detect(obj)) { return true; }\n if ((obj.length !== undefined) && 'object'===typeof obj) { return true; }\n return false;\n};\n\n/**\n Forces the passed object to be part of an array. If the object is already\n an array or array-like, returns the object. Otherwise adds the object to\n an array. If obj is null or undefined, returns an empty array.\n\n Ember.makeArray(); => []\n Ember.makeArray(null); => []\n Ember.makeArray(undefined); => []\n Ember.makeArray('lindsay'); => ['lindsay'] \n Ember.makeArray([1,2,42]); => [1,2,42]\n\n var controller = Ember.ArrayProxy.create({ content: [] });\n Ember.makeArray(controller) === controller; => true\n\n @param {Object} obj the object\n @returns {Array}\n*/\nEmber.makeArray = function(obj) {\n if (obj === null || obj === undefined) return [];\n return Ember.isArray(obj) ? obj : [obj];\n};\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar USE_ACCESSORS = Ember.platform.hasPropertyAccessors && Ember.ENV.USE_ACCESSORS;\nEmber.USE_ACCESSORS = !!USE_ACCESSORS;\n\nvar meta = Ember.meta;\n\n// ..........................................................\n// GET AND SET\n//\n// If we are on a platform that supports accessors we can get use those.\n// Otherwise simulate accessors by looking up the property directly on the\n// object.\n\nvar get, set;\n\n/** @private */\nget = function get(obj, keyName) {\n if (keyName === undefined && 'string' === typeof obj) {\n keyName = obj;\n obj = Ember;\n }\n\n if (!obj) return undefined;\n var ret = obj[keyName];\n if (ret===undefined && 'function'===typeof obj.unknownProperty) {\n ret = obj.unknownProperty(keyName);\n }\n return ret;\n};\n\n/** @private */\nset = function set(obj, keyName, value) {\n if (('object'===typeof obj) && !(keyName in obj)) {\n if ('function' === typeof obj.setUnknownProperty) {\n obj.setUnknownProperty(keyName, value);\n } else if ('function' === typeof obj.unknownProperty) {\n obj.unknownProperty(keyName, value);\n } else obj[keyName] = value;\n } else {\n obj[keyName] = value;\n }\n return value;\n};\n\nif (!USE_ACCESSORS) {\n\n var o_get = get, o_set = set;\n\n /** @private */\n get = function(obj, keyName) {\n if (keyName === undefined && 'string' === typeof obj) {\n keyName = obj;\n obj = Ember;\n }\n\n Ember.assert(\"You need to provide an object and key to `get`.\", !!obj && keyName);\n\n if (!obj) return undefined;\n var desc = meta(obj, false).descs[keyName];\n if (desc) return desc.get(obj, keyName);\n else return o_get(obj, keyName);\n };\n\n /** @private */\n set = function(obj, keyName, value) {\n Ember.assert(\"You need to provide an object and key to `set`.\", !!obj && keyName !== undefined);\n var desc = meta(obj, false).descs[keyName];\n if (desc) desc.set(obj, keyName, value);\n else o_set(obj, keyName, value);\n return value;\n };\n\n}\n\n/**\n @function\n\n Gets the value of a property on an object. If the property is computed,\n the function will be invoked. If the property is not defined but the\n object implements the unknownProperty() method then that will be invoked.\n\n If you plan to run on IE8 and older browsers then you should use this\n method anytime you want to retrieve a property on an object that you don't\n know for sure is private. (My convention only properties beginning with\n an underscore '_' are considered private.)\n\n On all newer browsers, you only need to use this method to retrieve\n properties if the property might not be defined on the object and you want\n to respect the unknownProperty() handler. Otherwise you can ignore this\n method.\n\n Note that if the obj itself is null, this method will simply return\n undefined.\n\n @param {Object} obj\n The object to retrieve from.\n\n @param {String} keyName\n The property key to retrieve\n\n @returns {Object} the property value or null.\n*/\nEmber.get = get;\n\n/**\n @function\n\n Sets the value of a property on an object, respecting computed properties\n and notifying observers and other listeners of the change. If the\n property is not defined but the object implements the unknownProperty()\n method then that will be invoked as well.\n\n If you plan to run on IE8 and older browsers then you should use this\n method anytime you want to set a property on an object that you don't\n know for sure is private. (My convention only properties beginning with\n an underscore '_' are considered private.)\n\n On all newer browsers, you only need to use this method to set\n properties if the property might not be defined on the object and you want\n to respect the unknownProperty() handler. Otherwise you can ignore this\n method.\n\n @param {Object} obj\n The object to modify.\n\n @param {String} keyName\n The property key to set\n\n @param {Object} value\n The value to set\n\n @returns {Object} the passed value.\n*/\nEmber.set = set;\n\n// ..........................................................\n// PATHS\n//\n\n/** @private */\nfunction normalizePath(path) {\n Ember.assert('must pass non-empty string to normalizePath()', path && path!=='');\n\n if (path==='*') return path; //special case...\n var first = path.charAt(0);\n if(first==='.') return 'this'+path;\n if (first==='*' && path.charAt(1)!=='.') return 'this.'+path.slice(1);\n return path;\n}\n\n// assumes normalized input; no *, normalized path, always a target...\n/** @private */\nfunction getPath(target, path) {\n var len = path.length, idx, next, key;\n\n idx = path.indexOf('*');\n if (idx>0 && path.charAt(idx-1)!=='.') {\n return getPath(getPath(target, path.slice(0, idx)), path.slice(idx+1));\n }\n\n idx = 0;\n while(target && idx<len) {\n next = path.indexOf('.', idx);\n if (next<0) next = len;\n key = path.slice(idx, next);\n target = key==='*' ? target : get(target, key);\n\n if (target && target.isDestroyed) { return undefined; }\n\n idx = next+1;\n }\n return target ;\n}\n\nvar TUPLE_RET = [];\nvar IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;\nvar IS_GLOBAL_PATH = /^([A-Z$]|([0-9][A-Z$])).*[\\.\\*]/;\nvar HAS_THIS = /^this[\\.\\*]/;\nvar FIRST_KEY = /^([^\\.\\*]+)/;\n\n/** @private */\nfunction firstKey(path) {\n return path.match(FIRST_KEY)[0];\n}\n\n// assumes path is already normalized\n/** @private */\nfunction normalizeTuple(target, path) {\n var hasThis = HAS_THIS.test(path),\n isGlobal = !hasThis && IS_GLOBAL_PATH.test(path),\n key;\n\n if (!target || isGlobal) target = window;\n if (hasThis) path = path.slice(5);\n\n var idx = path.indexOf('*');\n if (idx>0 && path.charAt(idx-1)!=='.') {\n\n // should not do lookup on a prototype object because the object isn't\n // really live yet.\n if (target && meta(target,false).proto!==target) {\n target = getPath(target, path.slice(0, idx));\n } else {\n target = null;\n }\n path = path.slice(idx+1);\n\n } else if (target === window) {\n key = firstKey(path);\n target = get(target, key);\n path = path.slice(key.length+1);\n }\n\n // must return some kind of path to be valid else other things will break.\n if (!path || path.length===0) throw new Error('Invalid Path');\n\n TUPLE_RET[0] = target;\n TUPLE_RET[1] = path;\n return TUPLE_RET;\n}\n\n/**\n @private\n\n Normalizes a path to support older-style property paths beginning with . or\n\n @function\n @param {String} path path to normalize\n @returns {String} normalized path\n*/\nEmber.normalizePath = normalizePath;\n\n/**\n @private\n\n Normalizes a target/path pair to reflect that actual target/path that should\n be observed, etc. This takes into account passing in global property\n paths (i.e. a path beginning with a captial letter not defined on the\n target) and * separators.\n\n @param {Object} target\n The current target. May be null.\n\n @param {String} path\n A path on the target or a global property path.\n\n @returns {Array} a temporary array with the normalized target/path pair.\n*/\nEmber.normalizeTuple = function(target, path) {\n return normalizeTuple(target, normalizePath(path));\n};\n\nEmber.normalizeTuple.primitive = normalizeTuple;\n\nEmber.getWithDefault = function(root, key, defaultValue) {\n var value = Ember.get(root, key);\n\n if (value === undefined) { return defaultValue; }\n return value;\n};\n\nEmber.getPath = function(root, path, _checkGlobal) {\n var pathOnly, hasThis, hasStar, isGlobal, ret;\n\n // Helpers that operate with 'this' within an #each\n if (path === '') {\n return root;\n }\n\n if (!path && 'string'===typeof root) {\n path = root;\n root = null;\n pathOnly = true;\n }\n\n hasStar = path.indexOf('*') > -1;\n\n // If there is no root and path is a key name, return that\n // property from the global object.\n // E.g. getPath('Ember') -> Ember\n if (root === null && !hasStar && path.indexOf('.') < 0) { return get(window, path); }\n\n // detect complicated paths and normalize them\n path = normalizePath(path);\n hasThis = HAS_THIS.test(path);\n\n if (!root || hasThis || hasStar) {\n Ember.deprecate(\"Fetching globals with Ember.getPath is deprecated (root: \"+root+\", path: \"+path+\")\", !root || root === window || !IS_GLOBAL.test(path));\n\n var tuple = normalizeTuple(root, path);\n root = tuple[0];\n path = tuple[1];\n tuple.length = 0;\n }\n\n ret = getPath(root, path);\n\n if (ret === undefined && !pathOnly && !hasThis && root !== window && IS_GLOBAL.test(path) && _checkGlobal !== false) {\n Ember.deprecate(\"Fetching globals with Ember.getPath is deprecated (root: \"+root+\", path: \"+path+\")\");\n return Ember.getPath(window, path);\n } else {\n return ret;\n }\n};\n\nEmber.setPath = function(root, path, value, tolerant) {\n var keyName;\n\n if (arguments.length===2 && 'string' === typeof root) {\n value = path;\n path = root;\n root = null;\n }\n\n path = normalizePath(path);\n if (path.indexOf('*')>0) {\n Ember.deprecate(\"Setting globals with Ember.setPath is deprecated (path: \"+path+\")\", !root || root === window || !IS_GLOBAL.test(path));\n\n var tuple = normalizeTuple(root, path);\n root = tuple[0];\n path = tuple[1];\n tuple.length = 0;\n }\n\n if (path.indexOf('.') > 0) {\n keyName = path.slice(path.lastIndexOf('.')+1);\n path = path.slice(0, path.length-(keyName.length+1));\n if (path !== 'this') {\n // Remove the `false` when we're done with this deprecation\n root = Ember.getPath(root, path, false);\n if (!root && IS_GLOBAL.test(path)) {\n Ember.deprecate(\"Setting globals with Ember.setPath is deprecated (path: \"+path+\")\");\n root = Ember.getPath(window, path);\n }\n }\n\n } else {\n if (IS_GLOBAL.test(path)) throw new Error('Invalid Path');\n keyName = path;\n }\n\n if (!keyName || keyName.length===0 || keyName==='*') {\n throw new Error('Invalid Path');\n }\n\n if (!root) {\n if (tolerant) { return; }\n else { throw new Error('Object in path '+path+' could not be found or was destroyed.'); }\n }\n\n return Ember.set(root, keyName, value);\n};\n\n/**\n Error-tolerant form of Ember.setPath. Will not blow up if any part of the\n chain is undefined, null, or destroyed.\n\n This is primarily used when syncing bindings, which may try to update after\n an object has been destroyed.\n*/\nEmber.trySetPath = function(root, path, value) {\n if (arguments.length===2 && 'string' === typeof root) {\n value = path;\n path = root;\n root = null;\n }\n\n return Ember.setPath(root, path, value, true);\n};\n\n/**\n Returns true if the provided path is global (e.g., \"MyApp.fooController.bar\")\n instead of local (\"foo.bar.baz\").\n\n @param {String} path\n @returns Boolean\n*/\nEmber.isGlobalPath = function(path) {\n return !HAS_THIS.test(path) && IS_GLOBAL.test(path);\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar USE_ACCESSORS = Ember.USE_ACCESSORS;\nvar GUID_KEY = Ember.GUID_KEY;\nvar META_KEY = Ember.META_KEY;\nvar meta = Ember.meta;\nvar o_create = Ember.platform.create;\nvar o_defineProperty = Ember.platform.defineProperty;\nvar SIMPLE_PROPERTY, WATCHED_PROPERTY;\n\n// ..........................................................\n// DESCRIPTOR\n//\n\nvar SIMPLE_DESC = {\n writable: true,\n configurable: true,\n enumerable: true,\n value: null\n};\n\n/**\n @private\n @constructor\n\n Objects of this type can implement an interface to responds requests to\n get and set. The default implementation handles simple properties.\n\n You generally won't need to create or subclass this directly.\n*/\nvar Dc = Ember.Descriptor = function() {};\n\nvar setup = Dc.setup = function(obj, keyName, value) {\n SIMPLE_DESC.value = value;\n o_defineProperty(obj, keyName, SIMPLE_DESC);\n SIMPLE_DESC.value = null;\n};\n\nvar Dp = Ember.Descriptor.prototype;\n\n/**\n Called whenever we want to set the property value. Should set the value\n and return the actual set value (which is usually the same but may be\n different in the case of computed properties.)\n\n @param {Object} obj\n The object to set the value on.\n\n @param {String} keyName\n The key to set.\n\n @param {Object} value\n The new value\n\n @returns {Object} value actual set value\n*/\nDp.set = function(obj, keyName, value) {\n obj[keyName] = value;\n return value;\n};\n\n/**\n Called whenever we want to get the property value. Should retrieve the\n current value.\n\n @param {Object} obj\n The object to get the value on.\n\n @param {String} keyName\n The key to retrieve\n\n @returns {Object} the current value\n*/\nDp.get = function(obj, keyName) {\n return w_get(obj, keyName, obj);\n};\n\n/**\n This is called on the descriptor to set it up on the object. The\n descriptor is responsible for actually defining the property on the object\n here.\n\n The passed `value` is the transferValue returned from any previous\n descriptor.\n\n @param {Object} obj\n The object to set the value on.\n\n @param {String} keyName\n The key to set.\n\n @param {Object} value\n The transfer value from any previous descriptor.\n\n @returns {void}\n*/\nDp.setup = setup;\n\n/**\n This is called on the descriptor just before another descriptor takes its\n place. This method should at least return the 'transfer value' of the\n property - which is the value you want to passed as the input to the new\n descriptor's setup() method.\n\n It is not generally necessary to actually 'undefine' the property as a new\n property descriptor will redefine it immediately after this method returns.\n\n @param {Object} obj\n The object to set the value on.\n\n @param {String} keyName\n The key to set.\n\n @returns {Object} transfer value\n*/\nDp.teardown = function(obj, keyName) {\n return obj[keyName];\n};\n\nDp.val = function(obj, keyName) {\n return obj[keyName];\n};\n\n// ..........................................................\n// SIMPLE AND WATCHED PROPERTIES\n//\n\n// if accessors are disabled for the app then this will act as a guard when\n// testing on browsers that do support accessors. It will throw an exception\n// if you do foo.bar instead of Ember.get(foo, 'bar')\n\n// The exception to this is that any objects managed by Ember but not a descendant\n// of Ember.Object will not throw an exception, instead failing silently. This\n// prevent errors with other libraries that may attempt to access special\n// properties on standard objects like Array. Usually this happens when copying\n// an object by looping over all properties.\n\nif (!USE_ACCESSORS) {\n Ember.Descriptor.MUST_USE_GETTER = function() {\n if (this instanceof Ember.Object) {\n Ember.assert('Must use Ember.get() to access this property', false);\n }\n };\n\n Ember.Descriptor.MUST_USE_SETTER = function() {\n if (this instanceof Ember.Object) {\n if (this.isDestroyed) {\n Ember.assert('You cannot set observed properties on destroyed objects', false);\n } else {\n Ember.assert('Must use Ember.set() to access this property', false);\n }\n }\n };\n}\n\nvar WATCHED_DESC = {\n configurable: true,\n enumerable: true,\n set: Ember.Descriptor.MUST_USE_SETTER\n};\n\n/** @private */\nfunction w_get(obj, keyName, values) {\n values = values || meta(obj, false).values;\n\n if (values) {\n var ret = values[keyName];\n if (ret !== undefined) { return ret; }\n if (obj.unknownProperty) { return obj.unknownProperty(keyName); }\n }\n\n}\n\n/** @private */\nfunction w_set(obj, keyName, value) {\n var m = meta(obj), watching;\n\n watching = m.watching[keyName]>0 && value!==m.values[keyName];\n if (watching) Ember.propertyWillChange(obj, keyName);\n m.values[keyName] = value;\n if (watching) Ember.propertyDidChange(obj, keyName);\n return value;\n}\n\nvar WATCHED_GETTERS = {};\n/** @private */\nfunction mkWatchedGetter(keyName) {\n var ret = WATCHED_GETTERS[keyName];\n if (!ret) {\n ret = WATCHED_GETTERS[keyName] = function() {\n return w_get(this, keyName);\n };\n }\n return ret;\n}\n\nvar WATCHED_SETTERS = {};\n/** @private */\nfunction mkWatchedSetter(keyName) {\n var ret = WATCHED_SETTERS[keyName];\n if (!ret) {\n ret = WATCHED_SETTERS[keyName] = function(value) {\n return w_set(this, keyName, value);\n };\n }\n return ret;\n}\n\n/**\n @private\n\n Private version of simple property that invokes property change callbacks.\n*/\nWATCHED_PROPERTY = new Ember.Descriptor();\n\nif (Ember.platform.hasPropertyAccessors) {\n WATCHED_PROPERTY.get = w_get ;\n WATCHED_PROPERTY.set = w_set ;\n\n if (USE_ACCESSORS) {\n WATCHED_PROPERTY.setup = function(obj, keyName, value) {\n WATCHED_DESC.get = mkWatchedGetter(keyName);\n WATCHED_DESC.set = mkWatchedSetter(keyName);\n o_defineProperty(obj, keyName, WATCHED_DESC);\n WATCHED_DESC.get = WATCHED_DESC.set = null;\n if (value !== undefined) meta(obj).values[keyName] = value;\n };\n\n } else {\n WATCHED_PROPERTY.setup = function(obj, keyName, value) {\n WATCHED_DESC.get = mkWatchedGetter(keyName);\n o_defineProperty(obj, keyName, WATCHED_DESC);\n WATCHED_DESC.get = null;\n if (value !== undefined) meta(obj).values[keyName] = value;\n };\n }\n\n WATCHED_PROPERTY.teardown = function(obj, keyName) {\n var ret = meta(obj).values[keyName];\n delete meta(obj).values[keyName];\n return ret;\n };\n\n// NOTE: if platform does not have property accessors then we just have to\n// set values and hope for the best. You just won't get any warnings...\n} else {\n\n WATCHED_PROPERTY.set = function(obj, keyName, value) {\n var m = meta(obj), watching;\n\n watching = m.watching[keyName]>0 && value!==obj[keyName];\n if (watching) Ember.propertyWillChange(obj, keyName);\n obj[keyName] = value;\n if (watching) Ember.propertyDidChange(obj, keyName);\n return value;\n };\n\n}\n\n/**\n The default descriptor for simple properties. Pass as the third argument\n to Ember.defineProperty() along with a value to set a simple value.\n\n @static\n @default Ember.Descriptor\n*/\nEmber.SIMPLE_PROPERTY = new Ember.Descriptor();\nSIMPLE_PROPERTY = Ember.SIMPLE_PROPERTY;\n\nSIMPLE_PROPERTY.unwatched = WATCHED_PROPERTY.unwatched = SIMPLE_PROPERTY;\nSIMPLE_PROPERTY.watched = WATCHED_PROPERTY.watched = WATCHED_PROPERTY;\n\n\n// ..........................................................\n// DEFINING PROPERTIES API\n//\n\n/** @private */\nfunction hasDesc(descs, keyName) {\n if (keyName === 'toString') return 'function' !== typeof descs.toString;\n else return !!descs[keyName];\n}\n\n/**\n @private\n\n NOTE: This is a low-level method used by other parts of the API. You almost\n never want to call this method directly. Instead you should use Ember.mixin()\n to define new properties.\n\n Defines a property on an object. This method works much like the ES5\n Object.defineProperty() method except that it can also accept computed\n properties and other special descriptors.\n\n Normally this method takes only three parameters. However if you pass an\n instance of Ember.Descriptor as the third param then you can pass an optional\n value as the fourth parameter. This is often more efficient than creating\n new descriptor hashes for each property.\n\n ## Examples\n\n // ES5 compatible mode\n Ember.defineProperty(contact, 'firstName', {\n writable: true,\n configurable: false,\n enumerable: true,\n value: 'Charles'\n });\n\n // define a simple property\n Ember.defineProperty(contact, 'lastName', Ember.SIMPLE_PROPERTY, 'Jolley');\n\n // define a computed property\n Ember.defineProperty(contact, 'fullName', Ember.computed(function() {\n return this.firstName+' '+this.lastName;\n }).property('firstName', 'lastName').cacheable());\n*/\nEmber.defineProperty = function(obj, keyName, desc, val) {\n var m = meta(obj, false), descs = m.descs, watching = m.watching[keyName]>0, override = true;\n\n if (val === undefined) {\n override = false;\n val = hasDesc(descs, keyName) ? descs[keyName].teardown(obj, keyName) : obj[keyName];\n } else if (hasDesc(descs, keyName)) {\n descs[keyName].teardown(obj, keyName);\n }\n\n if (!desc) desc = SIMPLE_PROPERTY;\n\n if (desc instanceof Ember.Descriptor) {\n m = meta(obj, true);\n descs = m.descs;\n\n desc = (watching ? desc.watched : desc.unwatched) || desc;\n descs[keyName] = desc;\n desc.setup(obj, keyName, val, watching);\n\n // compatibility with ES5\n } else {\n if (descs[keyName]) meta(obj).descs[keyName] = null;\n o_defineProperty(obj, keyName, desc);\n }\n\n // if key is being watched, override chains that\n // were initialized with the prototype\n if (override && watching) Ember.overrideChains(obj, keyName, m);\n\n return this;\n};\n\n/**\n Creates a new object using the passed object as its prototype. On browsers\n that support it, this uses the built in Object.create method. Else one is\n simulated for you.\n\n This method is a better choice than Object.create() because it will make\n sure that any observers, event listeners, and computed properties are\n inherited from the parent as well.\n\n @param {Object} obj\n The object you want to have as the prototype.\n\n @returns {Object} the newly created object\n*/\nEmber.create = function(obj, props) {\n var ret = o_create(obj, props);\n if (GUID_KEY in ret) Ember.generateGuid(ret, 'ember');\n if (META_KEY in ret) Ember.rewatch(ret); // setup watch chains if needed.\n return ret;\n};\n\n/**\n @private\n\n Creates a new object using the passed object as its prototype. This method\n acts like `Ember.create()` in every way except that bindings, observers, and\n computed properties will be activated on the object.\n\n The purpose of this method is to build an object for use in a prototype\n chain. (i.e. to be set as the `prototype` property on a constructor\n function). Prototype objects need to inherit bindings, observers and\n other configuration so they pass it on to their children. However since\n they are never 'live' objects themselves, they should not fire or make\n other changes when various properties around them change.\n\n You should use this method anytime you want to create a new object for use\n in a prototype chain.\n\n @param {Object} obj\n The base object.\n\n @param {Object} hash\n Optional hash of properties to define on the object.\n\n @returns {Object} new object\n*/\nEmber.createPrototype = function(obj, props) {\n var ret = o_create(obj, props);\n meta(ret, true).proto = ret;\n if (GUID_KEY in ret) Ember.generateGuid(ret, 'ember');\n if (META_KEY in ret) Ember.rewatch(ret); // setup watch chains if needed.\n return ret;\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nEmber.warn(\"Computed properties will soon be cacheable by default. To enable this in your app, set `ENV.CP_DEFAULT_CACHEABLE = true`.\", Ember.CP_DEFAULT_CACHEABLE);\n\n\nvar meta = Ember.meta;\nvar guidFor = Ember.guidFor;\nvar USE_ACCESSORS = Ember.USE_ACCESSORS;\nvar a_slice = Array.prototype.slice;\nvar o_create = Ember.platform.create;\nvar o_defineProperty = Ember.platform.defineProperty;\n\n// ..........................................................\n// DEPENDENT KEYS\n//\n\n// data structure:\n// meta.deps = {\n// 'depKey': {\n// 'keyName': count,\n// __emberproto__: SRC_OBJ [to detect clones]\n// },\n// __emberproto__: SRC_OBJ\n// }\n\n/** @private */\nfunction uniqDeps(obj, depKey) {\n var m = meta(obj), deps, ret;\n deps = m.deps;\n if (!deps) {\n deps = m.deps = { __emberproto__: obj };\n } else if (deps.__emberproto__ !== obj) {\n deps = m.deps = o_create(deps);\n deps.__emberproto__ = obj;\n }\n\n ret = deps[depKey];\n if (!ret) {\n ret = deps[depKey] = { __emberproto__: obj };\n } else if (ret.__emberproto__ !== obj) {\n ret = deps[depKey] = o_create(ret);\n ret.__emberproto__ = obj;\n }\n\n return ret;\n}\n\n/** @private */\nfunction addDependentKey(obj, keyName, depKey) {\n var deps = uniqDeps(obj, depKey);\n deps[keyName] = (deps[keyName] || 0) + 1;\n Ember.watch(obj, depKey);\n}\n\n/** @private */\nfunction removeDependentKey(obj, keyName, depKey) {\n var deps = uniqDeps(obj, depKey);\n deps[keyName] = (deps[keyName] || 0) - 1;\n Ember.unwatch(obj, depKey);\n}\n\n/** @private */\nfunction addDependentKeys(desc, obj, keyName) {\n var keys = desc._dependentKeys,\n len = keys ? keys.length : 0;\n for(var idx=0;idx<len;idx++) addDependentKey(obj, keyName, keys[idx]);\n}\n\n// ..........................................................\n// COMPUTED PROPERTY\n//\n\n/** @private */\nfunction ComputedProperty(func, opts) {\n this.func = func;\n this._cacheable = (opts && opts.cacheable !== undefined) ? opts.cacheable : Ember.CP_DEFAULT_CACHEABLE;\n this._dependentKeys = opts && opts.dependentKeys;\n}\n\n/**\n @constructor\n*/\nEmber.ComputedProperty = ComputedProperty;\nComputedProperty.prototype = new Ember.Descriptor();\n\nvar CP_DESC = {\n configurable: true,\n enumerable: true,\n get: function() { return undefined; }, // for when use_accessors is false.\n set: Ember.Descriptor.MUST_USE_SETTER // for when use_accessors is false\n};\n\n/** @private */\nfunction mkCpGetter(keyName, desc) {\n var cacheable = desc._cacheable,\n func = desc.func;\n\n if (cacheable) {\n return function() {\n var ret, cache = meta(this).cache;\n if (keyName in cache) return cache[keyName];\n ret = cache[keyName] = func.call(this, keyName);\n return ret ;\n };\n } else {\n return function() {\n return func.call(this, keyName);\n };\n }\n}\n\n/** @private */\nfunction mkCpSetter(keyName, desc) {\n var cacheable = desc._cacheable,\n func = desc.func;\n\n return function(value) {\n var m = meta(this, cacheable),\n watched = (m.source===this) && m.watching[keyName]>0,\n ret, oldSuspended, lastSetValues;\n\n oldSuspended = desc._suspended;\n desc._suspended = this;\n\n watched = watched && m.lastSetValues[keyName]!==guidFor(value);\n if (watched) {\n m.lastSetValues[keyName] = guidFor(value);\n Ember.propertyWillChange(this, keyName);\n }\n\n if (cacheable) delete m.cache[keyName];\n ret = func.call(this, keyName, value);\n if (cacheable) m.cache[keyName] = ret;\n if (watched) Ember.propertyDidChange(this, keyName);\n desc._suspended = oldSuspended;\n return ret;\n };\n}\n\n/**\n @extends Ember.ComputedProperty\n @private\n*/\nvar Cp = ComputedProperty.prototype;\n\n/**\n Call on a computed property to set it into cacheable mode. When in this\n mode the computed property will automatically cache the return value of\n your function until one of the dependent keys changes.\n\n MyApp.president = Ember.Object.create({\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // After calculating the value of this function, Ember.js will\n // return that value without re-executing this function until\n // one of the dependent properties change.\n }.property('firstName', 'lastName').cacheable()\n });\n\n Properties are cacheable by default.\n\n @name Ember.ComputedProperty.cacheable\n @param {Boolean} aFlag optional set to false to disable caching\n @returns {Ember.ComputedProperty} receiver\n*/\nCp.cacheable = function(aFlag) {\n this._cacheable = aFlag!==false;\n return this;\n};\n\n/**\n Call on a computed property to set it into non-cached mode. When in this\n mode the computed property will not automatically cache the return value.\n\n MyApp.outsideService = Ember.Object.create({\n value: function() {\n return OutsideService.getValue();\n }.property().volatile()\n });\n\n @name Ember.ComputedProperty.volatile\n @returns {Ember.ComputedProperty} receiver\n*/\nCp.volatile = function() {\n return this.cacheable(false);\n};\n\n/**\n Sets the dependent keys on this computed property. Pass any number of\n arguments containing key paths that this computed property depends on.\n\n MyApp.president = Ember.Object.create({\n fullName: Ember.computed(function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Tell Ember.js that this computed property depends on firstName\n // and lastName\n }).property('firstName', 'lastName')\n });\n\n @name Ember.ComputedProperty.property\n @param {String} path... zero or more property paths\n @returns {Ember.ComputedProperty} receiver\n*/\nCp.property = function() {\n this._dependentKeys = a_slice.call(arguments);\n return this;\n};\n\n/**\n In some cases, you may want to annotate computed properties with additional\n metadata about how they function or what values they operate on. For example,\n computed property functions may close over variables that are then no longer\n available for introspection.\n\n You can pass a hash of these values to a computed property like this:\n\n person: function() {\n var personId = this.get('personId');\n return App.Person.create({ id: personId });\n }.property().meta({ type: App.Person })\n\n The hash that you pass to the `meta()` function will be saved on the\n computed property descriptor under the `_meta` key. Ember runtime\n exposes a public API for retrieving these values from classes,\n via the `metaForProperty()` function.\n\n @name Ember.ComputedProperty.meta\n @param {Hash} metadata\n @returns {Ember.ComputedProperty} property descriptor instance\n*/\n\nCp.meta = function(meta) {\n this._meta = meta;\n return this;\n};\n\n/** @private - impl descriptor API */\nCp.setup = function(obj, keyName, value) {\n CP_DESC.get = mkCpGetter(keyName, this);\n CP_DESC.set = mkCpSetter(keyName, this);\n o_defineProperty(obj, keyName, CP_DESC);\n CP_DESC.get = CP_DESC.set = null;\n addDependentKeys(this, obj, keyName);\n};\n\n/** @private - impl descriptor API */\nCp.teardown = function(obj, keyName) {\n var keys = this._dependentKeys,\n len = keys ? keys.length : 0;\n for(var idx=0;idx<len;idx++) removeDependentKey(obj, keyName, keys[idx]);\n\n if (this._cacheable) delete meta(obj).cache[keyName];\n\n return null; // no value to restore\n};\n\n/** @private - impl descriptor API */\nCp.didChange = function(obj, keyName) {\n if (this._cacheable && (this._suspended !== obj)) {\n delete meta(obj).cache[keyName];\n }\n};\n\n/** @private - impl descriptor API */\nCp.get = function(obj, keyName) {\n var ret, cache;\n\n if (this._cacheable) {\n cache = meta(obj).cache;\n if (keyName in cache) return cache[keyName];\n ret = cache[keyName] = this.func.call(obj, keyName);\n } else {\n ret = this.func.call(obj, keyName);\n }\n return ret ;\n};\n\n/** @private - impl descriptor API */\nCp.set = function(obj, keyName, value) {\n var cacheable = this._cacheable;\n\n var m = meta(obj, cacheable),\n watched = (m.source===obj) && m.watching[keyName]>0,\n ret, oldSuspended, lastSetValues;\n\n oldSuspended = this._suspended;\n this._suspended = obj;\n\n watched = watched && m.lastSetValues[keyName]!==guidFor(value);\n if (watched) {\n m.lastSetValues[keyName] = guidFor(value);\n Ember.propertyWillChange(obj, keyName);\n }\n\n if (cacheable) delete m.cache[keyName];\n ret = this.func.call(obj, keyName, value);\n if (cacheable) m.cache[keyName] = ret;\n if (watched) Ember.propertyDidChange(obj, keyName);\n this._suspended = oldSuspended;\n return ret;\n};\n\nCp.val = function(obj, keyName) {\n return meta(obj, false).values[keyName];\n};\n\nif (!Ember.platform.hasPropertyAccessors) {\n Cp.setup = function(obj, keyName, value) {\n obj[keyName] = undefined; // so it shows up in key iteration\n addDependentKeys(this, obj, keyName);\n };\n\n} else if (!USE_ACCESSORS) {\n Cp.setup = function(obj, keyName) {\n // throw exception if not using Ember.get() and Ember.set() when supported\n o_defineProperty(obj, keyName, CP_DESC);\n addDependentKeys(this, obj, keyName);\n };\n}\n\n/**\n This helper returns a new property descriptor that wraps the passed\n computed property function. You can use this helper to define properties\n with mixins or via Ember.defineProperty().\n\n The function you pass will be used to both get and set property values.\n The function should accept two parameters, key and value. If value is not\n undefined you should set the value first. In either case return the\n current value of the property.\n\n @param {Function} func\n The computed property function.\n\n @returns {Ember.ComputedProperty} property descriptor instance\n*/\nEmber.computed = function(func) {\n var args;\n\n if (arguments.length > 1) {\n args = a_slice.call(arguments, 0, -1);\n func = a_slice.call(arguments, -1)[0];\n }\n\n var cp = new ComputedProperty(func);\n\n if (args) {\n cp.property.apply(cp, args);\n }\n\n return cp;\n};\n\n/**\n Returns the cached value for a property, if one exists.\n This can be useful for peeking at the value of a computed\n property that is generated lazily, without accidentally causing\n it to be created.\n\n @param {Object} obj the object whose property you want to check\n @param {String} key the name of the property whose cached value you want\n to return\n\n*/\nEmber.cacheFor = function(obj, key) {\n var cache = meta(obj, false).cache;\n\n if (cache && key in cache) {\n return cache[key];\n }\n};\n\n})();\n\n\n\n(function() {\n/*jshint newcap:false*/\n\n// NOTE: There is a bug in jshint that doesn't recognize `Object()` without `new`\n// as being ok unless both `newcap:false` and not `use strict`.\n// https://github.com/jshint/jshint/issues/392\n\n// Testing this is not ideal, but we want ArrayUtils to use native functions\n// if available, but not to use versions created by libraries like Prototype\n/** @private */\nvar isNativeFunc = function(func) {\n // This should probably work in all browsers likely to have ES5 array methods\n return func && Function.prototype.toString.call(func).indexOf('[native code]') > -1;\n};\n\n// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/map\n/** @private */\nvar arrayMap = isNativeFunc(Array.prototype.map) ? Array.prototype.map : function(fun /*, thisp */) {\n //\"use strict\";\n\n if (this === void 0 || this === null) {\n throw new TypeError();\n }\n\n var t = Object(this);\n var len = t.length >>> 0;\n if (typeof fun !== \"function\") {\n throw new TypeError();\n }\n\n var res = new Array(len);\n var thisp = arguments[1];\n for (var i = 0; i < len; i++) {\n if (i in t) {\n res[i] = fun.call(thisp, t[i], i, t);\n }\n }\n\n return res;\n};\n\n// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach\n/** @private */\nvar arrayForEach = isNativeFunc(Array.prototype.forEach) ? Array.prototype.forEach : function(fun /*, thisp */) {\n //\"use strict\";\n\n if (this === void 0 || this === null) {\n throw new TypeError();\n }\n\n var t = Object(this);\n var len = t.length >>> 0;\n if (typeof fun !== \"function\") {\n throw new TypeError();\n }\n\n var thisp = arguments[1];\n for (var i = 0; i < len; i++) {\n if (i in t) {\n fun.call(thisp, t[i], i, t);\n }\n }\n};\n\n/** @private */\nvar arrayIndexOf = isNativeFunc(Array.prototype.indexOf) ? Array.prototype.indexOf : function (obj, fromIndex) {\n if (fromIndex === null || fromIndex === undefined) { fromIndex = 0; }\n else if (fromIndex < 0) { fromIndex = Math.max(0, this.length + fromIndex); }\n for (var i = fromIndex, j = this.length; i < j; i++) {\n if (this[i] === obj) { return i; }\n }\n return -1;\n};\n\n\nEmber.ArrayUtils = {\n map: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return obj.map ? obj.map.apply(obj, args) : arrayMap.apply(obj, args);\n },\n\n forEach: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return obj.forEach ? obj.forEach.apply(obj, args) : arrayForEach.apply(obj, args);\n },\n\n indexOf: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return obj.indexOf ? obj.indexOf.apply(obj, args) : arrayIndexOf.apply(obj, args);\n },\n\n indexesOf: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return args[0] === undefined ? [] : Ember.ArrayUtils.map(args[0], function(item) {\n return Ember.ArrayUtils.indexOf(obj, item);\n });\n },\n\n removeObject: function(array, item) {\n var index = this.indexOf(array, item);\n if (index !== -1) { array.splice(index, 1); }\n }\n};\n\n\nif (Ember.SHIM_ES5) {\n if (!Array.prototype.map) {\n /** @private */\n Array.prototype.map = arrayMap;\n }\n\n if (!Array.prototype.forEach) {\n /** @private */\n Array.prototype.forEach = arrayForEach;\n }\n\n if (!Array.prototype.indexOf) {\n /** @private */\n Array.prototype.indexOf = arrayIndexOf;\n }\n}\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar AFTER_OBSERVERS = ':change';\nvar BEFORE_OBSERVERS = ':before';\nvar guidFor = Ember.guidFor;\nvar normalizePath = Ember.normalizePath;\n\nvar deferred = 0;\nvar array_Slice = Array.prototype.slice;\nvar array_ForEach = Ember.ArrayUtils.forEach;\n\n/** @private */\nvar ObserverSet = function () {\n this.targetSet = {};\n};\nObserverSet.prototype.add = function (target, path) {\n var targetSet = this.targetSet,\n targetGuid = Ember.guidFor(target),\n pathSet = targetSet[targetGuid];\n if (!pathSet) {\n targetSet[targetGuid] = pathSet = {};\n }\n if (pathSet[path]) {\n return false;\n } else {\n return pathSet[path] = true;\n }\n};\nObserverSet.prototype.clear = function () {\n this.targetSet = {};\n};\n\n/** @private */\nvar DeferredEventQueue = function() {\n this.targetSet = {};\n this.queue = [];\n};\n\nDeferredEventQueue.prototype.push = function(target, eventName) {\n var targetSet = this.targetSet,\n queue = this.queue,\n targetGuid = Ember.guidFor(target),\n eventNameSet = targetSet[targetGuid],\n index;\n\n if (!eventNameSet) {\n targetSet[targetGuid] = eventNameSet = {};\n }\n index = eventNameSet[eventName];\n if (index === undefined) {\n eventNameSet[eventName] = queue.push(Ember.deferEvent(target, eventName)) - 1;\n } else {\n queue[index] = Ember.deferEvent(target, eventName);\n }\n};\n\nDeferredEventQueue.prototype.flush = function() {\n var queue = this.queue;\n this.queue = [];\n this.targetSet = {};\n for (var i=0, len=queue.length; i < len; ++i) {\n queue[i]();\n }\n};\n\nvar queue = new DeferredEventQueue(), beforeObserverSet = new ObserverSet();\n\n/** @private */\nfunction notifyObservers(obj, eventName, forceNotification) {\n if (deferred && !forceNotification) {\n queue.push(obj, eventName);\n } else {\n Ember.sendEvent(obj, eventName);\n }\n}\n\n/** @private */\nfunction flushObserverQueue() {\n beforeObserverSet.clear();\n\n queue.flush();\n}\n\nEmber.beginPropertyChanges = function() {\n deferred++;\n return this;\n};\n\nEmber.endPropertyChanges = function() {\n deferred--;\n if (deferred<=0) flushObserverQueue();\n};\n\n/**\n Make a series of property changes together in an\n exception-safe way.\n\n Ember.changeProperties(function() {\n obj1.set('foo', mayBlowUpWhenSet);\n obj2.set('bar', baz);\n });\n*/\nEmber.changeProperties = function(cb, binding){\n Ember.beginPropertyChanges();\n try {\n cb.call(binding);\n } finally {\n Ember.endPropertyChanges();\n }\n};\n\n/**\n Set a list of properties on an object. These properties are set inside\n a single `beginPropertyChanges` and `endPropertyChanges` batch, so\n observers will be buffered.\n*/\nEmber.setProperties = function(self, hash) {\n Ember.changeProperties(function(){\n for(var prop in hash) {\n if (hash.hasOwnProperty(prop)) Ember.set(self, prop, hash[prop]);\n }\n });\n return self;\n};\n\n\n/** @private */\nfunction changeEvent(keyName) {\n return keyName+AFTER_OBSERVERS;\n}\n\n/** @private */\nfunction beforeEvent(keyName) {\n return keyName+BEFORE_OBSERVERS;\n}\n\n/** @private */\nfunction changeKey(eventName) {\n return eventName.slice(0, -7);\n}\n\n/** @private */\nfunction beforeKey(eventName) {\n return eventName.slice(0, -7);\n}\n\n/** @private */\nfunction xformForArgs(args) {\n return function (target, method, params) {\n var obj = params[0], keyName = changeKey(params[1]), val;\n var copy_args = args.slice();\n if (method.length>2) {\n val = Ember.getPath(Ember.isGlobalPath(keyName) ? window : obj, keyName);\n }\n copy_args.unshift(obj, keyName, val);\n method.apply(target, copy_args);\n };\n}\n\nvar xformChange = xformForArgs([]);\n\n/** @private */\nfunction xformBefore(target, method, params) {\n var obj = params[0], keyName = beforeKey(params[1]), val;\n if (method.length>2) val = Ember.getPath(obj, keyName);\n method.call(target, obj, keyName, val);\n}\n\nEmber.addObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n\n var xform;\n if (arguments.length > 4) {\n var args = array_Slice.call(arguments, 4);\n xform = xformForArgs(args);\n } else {\n xform = xformChange;\n }\n Ember.addListener(obj, changeEvent(path), target, method, xform);\n Ember.watch(obj, path);\n return this;\n};\n\n/** @private */\nEmber.observersFor = function(obj, path) {\n return Ember.listenersFor(obj, changeEvent(path));\n};\n\nEmber.removeObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n Ember.unwatch(obj, path);\n Ember.removeListener(obj, changeEvent(path), target, method);\n return this;\n};\n\nEmber.addBeforeObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n Ember.addListener(obj, beforeEvent(path), target, method, xformBefore);\n Ember.watch(obj, path);\n return this;\n};\n\n// Suspend observer during callback.\n//\n// This should only be used by the target of the observer\n// while it is setting the observed path.\n/** @private */\nEmber._suspendObserver = function(obj, path, target, method, callback) {\n return Ember._suspendListener(obj, changeEvent(path), target, method, callback);\n};\n\n/** @private */\nEmber.beforeObserversFor = function(obj, path) {\n return Ember.listenersFor(obj, beforeEvent(path));\n};\n\nEmber.removeBeforeObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n Ember.unwatch(obj, path);\n Ember.removeListener(obj, beforeEvent(path), target, method);\n return this;\n};\n\n/** @private */\nEmber.notifyObservers = function(obj, keyName) {\n if (obj.isDestroying) { return; }\n\n notifyObservers(obj, changeEvent(keyName));\n};\n\n/** @private */\nEmber.notifyBeforeObservers = function(obj, keyName) {\n if (obj.isDestroying) { return; }\n\n var guid, set, forceNotification = false;\n\n if (deferred) {\n if (beforeObserverSet.add(obj, keyName)) {\n forceNotification = true;\n } else {\n return;\n }\n }\n\n notifyObservers(obj, beforeEvent(keyName), forceNotification);\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar guidFor = Ember.guidFor;\nvar meta = Ember.meta;\nvar get = Ember.get, set = Ember.set;\nvar normalizeTuple = Ember.normalizeTuple.primitive;\nvar normalizePath = Ember.normalizePath;\nvar SIMPLE_PROPERTY = Ember.SIMPLE_PROPERTY;\nvar GUID_KEY = Ember.GUID_KEY;\nvar META_KEY = Ember.META_KEY;\nvar notifyObservers = Ember.notifyObservers;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar FIRST_KEY = /^([^\\.\\*]+)/;\nvar IS_PATH = /[\\.\\*]/;\n\n/** @private */\nfunction firstKey(path) {\n return path.match(FIRST_KEY)[0];\n}\n\n// returns true if the passed path is just a keyName\n/** @private */\nfunction isKeyName(path) {\n return path==='*' || !IS_PATH.test(path);\n}\n\n// ..........................................................\n// DEPENDENT KEYS\n//\n\nvar DEP_SKIP = { __emberproto__: true }; // skip some keys and toString\n\n/** @private */\nfunction iterDeps(method, obj, depKey, seen, meta) {\n\n var guid = guidFor(obj);\n if (!seen[guid]) seen[guid] = {};\n if (seen[guid][depKey]) return ;\n seen[guid][depKey] = true;\n\n var deps = meta.deps;\n deps = deps && deps[depKey];\n if (deps) {\n for(var key in deps) {\n if (DEP_SKIP[key]) continue;\n method(obj, key);\n }\n }\n}\n\n\nvar WILL_SEEN, DID_SEEN;\n\n// called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...)\n/** @private */\nfunction dependentKeysWillChange(obj, depKey, meta) {\n if (obj.isDestroying) { return; }\n\n var seen = WILL_SEEN, top = !seen;\n if (top) seen = WILL_SEEN = {};\n iterDeps(propertyWillChange, obj, depKey, seen, meta);\n if (top) WILL_SEEN = null;\n}\n\n// called whenever a property has just changed to update dependent keys\n/** @private */\nfunction dependentKeysDidChange(obj, depKey, meta) {\n if (obj.isDestroying) { return; }\n\n var seen = DID_SEEN, top = !seen;\n if (top) seen = DID_SEEN = {};\n iterDeps(propertyDidChange, obj, depKey, seen, meta);\n if (top) DID_SEEN = null;\n}\n\n// ..........................................................\n// CHAIN\n//\n\n/** @private */\nfunction addChainWatcher(obj, keyName, node) {\n if (!obj || ('object' !== typeof obj)) return; // nothing to do\n var m = meta(obj);\n var nodes = m.chainWatchers;\n if (!nodes || nodes.__emberproto__ !== obj) {\n nodes = m.chainWatchers = { __emberproto__: obj };\n }\n\n if (!nodes[keyName]) nodes[keyName] = {};\n nodes[keyName][guidFor(node)] = node;\n Ember.watch(obj, keyName);\n}\n\n/** @private */\nfunction removeChainWatcher(obj, keyName, node) {\n if (!obj || ('object' !== typeof obj)) return; // nothing to do\n var m = meta(obj, false);\n var nodes = m.chainWatchers;\n if (!nodes || nodes.__emberproto__ !== obj) return; //nothing to do\n if (nodes[keyName]) delete nodes[keyName][guidFor(node)];\n Ember.unwatch(obj, keyName);\n}\n\nvar pendingQueue = [];\n\n// attempts to add the pendingQueue chains again. If some of them end up\n// back in the queue and reschedule is true, schedules a timeout to try\n// again.\n/** @private */\nfunction flushPendingChains(reschedule) {\n if (pendingQueue.length===0) return ; // nothing to do\n\n var queue = pendingQueue;\n pendingQueue = [];\n\n forEach(queue, function(q) { q[0].add(q[1]); });\n if (reschedule!==false && pendingQueue.length>0) {\n setTimeout(flushPendingChains, 1);\n }\n}\n\n/** @private */\nfunction isProto(pvalue) {\n return meta(pvalue, false).proto === pvalue;\n}\n\n// A ChainNode watches a single key on an object. If you provide a starting\n// value for the key then the node won't actually watch it. For a root node\n// pass null for parent and key and object for value.\n/** @private */\nvar ChainNode = function(parent, key, value, separator) {\n var obj;\n this._parent = parent;\n this._key = key;\n\n // _watching is true when calling get(this._parent, this._key) will\n // return the value of this node.\n //\n // It is false for the root of a chain (because we have no parent)\n // and for global paths (because the parent node is the object with\n // the observer on it)\n this._watching = value===undefined;\n\n this._value = value;\n this._separator = separator || '.';\n this._paths = {};\n if (this._watching) {\n this._object = parent.value();\n if (this._object) addChainWatcher(this._object, this._key, this);\n }\n\n // Special-case: the EachProxy relies on immediate evaluation to\n // establish its observers.\n //\n // TODO: Replace this with an efficient callback that the EachProxy\n // can implement.\n if (this._parent && this._parent._key === '@each') {\n this.value();\n }\n};\n\n\nvar Wp = ChainNode.prototype;\n\nWp.value = function() {\n if (this._value === undefined && this._watching){\n var obj = this._parent.value();\n this._value = (obj && !isProto(obj)) ? get(obj, this._key) : undefined;\n }\n return this._value;\n};\n\nWp.destroy = function() {\n if (this._watching) {\n var obj = this._object;\n if (obj) removeChainWatcher(obj, this._key, this);\n this._watching = false; // so future calls do nothing\n }\n};\n\n// copies a top level object only\nWp.copy = function(obj) {\n var ret = new ChainNode(null, null, obj, this._separator);\n var paths = this._paths, path;\n for(path in paths) {\n if (paths[path] <= 0) continue; // this check will also catch non-number vals.\n ret.add(path);\n }\n return ret;\n};\n\n// called on the root node of a chain to setup watchers on the specified\n// path.\nWp.add = function(path) {\n var obj, tuple, key, src, separator, paths;\n\n paths = this._paths;\n paths[path] = (paths[path] || 0) + 1 ;\n\n obj = this.value();\n tuple = normalizeTuple(obj, path);\n\n // the path was a local path\n if (tuple[0] && (tuple[0] === obj)) {\n path = tuple[1];\n key = firstKey(path);\n path = path.slice(key.length+1);\n\n // global path, but object does not exist yet.\n // put into a queue and try to connect later.\n } else if (!tuple[0]) {\n pendingQueue.push([this, path]);\n tuple.length = 0;\n return;\n\n // global path, and object already exists\n } else {\n src = tuple[0];\n key = path.slice(0, 0-(tuple[1].length+1));\n separator = path.slice(key.length, key.length+1);\n path = tuple[1];\n }\n\n tuple.length = 0;\n this.chain(key, path, src, separator);\n};\n\n// called on the root node of a chain to teardown watcher on the specified\n// path\nWp.remove = function(path) {\n var obj, tuple, key, src, paths;\n\n paths = this._paths;\n if (paths[path] > 0) paths[path]--;\n\n obj = this.value();\n tuple = normalizeTuple(obj, path);\n if (tuple[0] === obj) {\n path = tuple[1];\n key = firstKey(path);\n path = path.slice(key.length+1);\n\n } else {\n src = tuple[0];\n key = path.slice(0, 0-(tuple[1].length+1));\n path = tuple[1];\n }\n\n tuple.length = 0;\n this.unchain(key, path);\n};\n\nWp.count = 0;\n\nWp.chain = function(key, path, src, separator) {\n var chains = this._chains, node;\n if (!chains) chains = this._chains = {};\n\n node = chains[key];\n if (!node) node = chains[key] = new ChainNode(this, key, src, separator);\n node.count++; // count chains...\n\n // chain rest of path if there is one\n if (path && path.length>0) {\n key = firstKey(path);\n path = path.slice(key.length+1);\n node.chain(key, path); // NOTE: no src means it will observe changes...\n }\n};\n\nWp.unchain = function(key, path) {\n var chains = this._chains, node = chains[key];\n\n // unchain rest of path first...\n if (path && path.length>1) {\n key = firstKey(path);\n path = path.slice(key.length+1);\n node.unchain(key, path);\n }\n\n // delete node if needed.\n node.count--;\n if (node.count<=0) {\n delete chains[node._key];\n node.destroy();\n }\n\n};\n\nWp.willChange = function() {\n var chains = this._chains;\n if (chains) {\n for(var key in chains) {\n if (!chains.hasOwnProperty(key)) continue;\n chains[key].willChange();\n }\n }\n\n if (this._parent) this._parent.chainWillChange(this, this._key, 1);\n};\n\nWp.chainWillChange = function(chain, path, depth) {\n if (this._key) path = this._key+this._separator+path;\n\n if (this._parent) {\n this._parent.chainWillChange(this, path, depth+1);\n } else {\n if (depth>1) Ember.propertyWillChange(this.value(), path);\n path = 'this.'+path;\n if (this._paths[path]>0) Ember.propertyWillChange(this.value(), path);\n }\n};\n\nWp.chainDidChange = function(chain, path, depth) {\n if (this._key) path = this._key+this._separator+path;\n if (this._parent) {\n this._parent.chainDidChange(this, path, depth+1);\n } else {\n if (depth>1) Ember.propertyDidChange(this.value(), path);\n path = 'this.'+path;\n if (this._paths[path]>0) Ember.propertyDidChange(this.value(), path);\n }\n};\n\nWp.didChange = function(suppressEvent) {\n // invalidate my own value first.\n if (this._watching) {\n var obj = this._parent.value();\n if (obj !== this._object) {\n removeChainWatcher(this._object, this._key, this);\n this._object = obj;\n addChainWatcher(obj, this._key, this);\n }\n this._value = undefined;\n\n // Special-case: the EachProxy relies on immediate evaluation to\n // establish its observers.\n if (this._parent && this._parent._key === '@each')\n this.value();\n }\n\n // then notify chains...\n var chains = this._chains;\n if (chains) {\n for(var key in chains) {\n if (!chains.hasOwnProperty(key)) continue;\n chains[key].didChange(suppressEvent);\n }\n }\n\n if (suppressEvent) return;\n\n // and finally tell parent about my path changing...\n if (this._parent) this._parent.chainDidChange(this, this._key, 1);\n};\n\n// get the chains for the current object. If the current object has\n// chains inherited from the proto they will be cloned and reconfigured for\n// the current object.\n/** @private */\nfunction chainsFor(obj) {\n var m = meta(obj), ret = m.chains;\n if (!ret) {\n ret = m.chains = new ChainNode(null, null, obj);\n } else if (ret.value() !== obj) {\n ret = m.chains = ret.copy(obj);\n }\n return ret ;\n}\n\n\n/** @private */\nfunction notifyChains(obj, m, keyName, methodName, arg) {\n var nodes = m.chainWatchers;\n\n if (!nodes || nodes.__emberproto__ !== obj) return; // nothing to do\n\n nodes = nodes[keyName];\n if (!nodes) return;\n\n for(var key in nodes) {\n if (!nodes.hasOwnProperty(key)) continue;\n nodes[key][methodName](arg);\n }\n}\n\nEmber.overrideChains = function(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'didChange', true);\n};\n\n/** @private */\nfunction chainsWillChange(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'willChange');\n}\n\n/** @private */\nfunction chainsDidChange(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'didChange');\n}\n\n// ..........................................................\n// WATCH\n//\n\nvar WATCHED_PROPERTY = Ember.SIMPLE_PROPERTY.watched;\n\n/**\n @private\n\n Starts watching a property on an object. Whenever the property changes,\n invokes Ember.propertyWillChange and Ember.propertyDidChange. This is the\n primitive used by observers and dependent keys; usually you will never call\n this method directly but instead use higher level methods like\n Ember.addObserver().\n*/\nEmber.watch = function(obj, keyName) {\n\n // can't watch length on Array - it is special...\n if (keyName === 'length' && Ember.typeOf(obj)==='array') return this;\n\n var m = meta(obj), watching = m.watching, desc;\n keyName = normalizePath(keyName);\n\n // activate watching first time\n if (!watching[keyName]) {\n watching[keyName] = 1;\n if (isKeyName(keyName)) {\n desc = m.descs[keyName];\n desc = desc ? desc.watched : WATCHED_PROPERTY;\n if (desc) Ember.defineProperty(obj, keyName, desc);\n } else {\n chainsFor(obj).add(keyName);\n }\n\n } else {\n watching[keyName] = (watching[keyName]||0)+1;\n }\n return this;\n};\n\nEmber.isWatching = function(obj, keyName) {\n return !!meta(obj).watching[keyName];\n};\n\nEmber.watch.flushPending = flushPendingChains;\n\n/** @private */\nEmber.unwatch = function(obj, keyName) {\n // can't watch length on Array - it is special...\n if (keyName === 'length' && Ember.typeOf(obj)==='array') return this;\n\n var watching = meta(obj).watching, desc, descs;\n keyName = normalizePath(keyName);\n if (watching[keyName] === 1) {\n watching[keyName] = 0;\n if (isKeyName(keyName)) {\n desc = meta(obj).descs[keyName];\n desc = desc ? desc.unwatched : SIMPLE_PROPERTY;\n if (desc) Ember.defineProperty(obj, keyName, desc);\n } else {\n chainsFor(obj).remove(keyName);\n }\n\n } else if (watching[keyName]>1) {\n watching[keyName]--;\n }\n\n return this;\n};\n\n/**\n @private\n\n Call on an object when you first beget it from another object. This will\n setup any chained watchers on the object instance as needed. This method is\n safe to call multiple times.\n*/\nEmber.rewatch = function(obj) {\n var m = meta(obj, false), chains = m.chains, bindings = m.bindings, key, b;\n\n // make sure the object has its own guid.\n if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) {\n Ember.generateGuid(obj, 'ember');\n }\n\n // make sure any chained watchers update.\n if (chains && chains.value() !== obj) chainsFor(obj);\n\n return this;\n};\n\n// ..........................................................\n// PROPERTY CHANGES\n//\n\n/**\n This function is called just before an object property is about to change.\n It will notify any before observers and prepare caches among other things.\n\n Normally you will not need to call this method directly but if for some\n reason you can't directly watch a property you can invoke this method\n manually along with `Ember.propertyDidChange()` which you should call just\n after the property value changes.\n\n @memberOf Ember\n\n @param {Object} obj\n The object with the property that will change\n\n @param {String} keyName\n The property key (or path) that will change.\n\n @returns {void}\n*/\nfunction propertyWillChange(obj, keyName) {\n var m = meta(obj, false), proto = m.proto, desc = m.descs[keyName];\n if (proto === obj) return ;\n if (desc && desc.willChange) desc.willChange(obj, keyName);\n dependentKeysWillChange(obj, keyName, m);\n chainsWillChange(obj, keyName, m);\n Ember.notifyBeforeObservers(obj, keyName);\n}\n\nEmber.propertyWillChange = propertyWillChange;\n\n/**\n This function is called just after an object property has changed.\n It will notify any observers and clear caches among other things.\n\n Normally you will not need to call this method directly but if for some\n reason you can't directly watch a property you can invoke this method\n manually along with `Ember.propertyWilLChange()` which you should call just\n before the property value changes.\n\n @memberOf Ember\n\n @param {Object} obj\n The object with the property that will change\n\n @param {String} keyName\n The property key (or path) that will change.\n\n @returns {void}\n*/\nfunction propertyDidChange(obj, keyName) {\n var m = meta(obj, false), proto = m.proto, desc = m.descs[keyName];\n if (proto === obj) return ;\n if (desc && desc.didChange) desc.didChange(obj, keyName);\n dependentKeysDidChange(obj, keyName, m);\n chainsDidChange(obj, keyName, m);\n Ember.notifyObservers(obj, keyName);\n}\n\nEmber.propertyDidChange = propertyDidChange;\n\nvar NODE_STACK = [];\n\n/**\n Tears down the meta on an object so that it can be garbage collected.\n Multiple calls will have no effect.\n\n @param {Object} obj the object to destroy\n @returns {void}\n*/\nEmber.destroy = function (obj) {\n var meta = obj[META_KEY], node, nodes, key, nodeObject;\n if (meta) {\n obj[META_KEY] = null;\n // remove chainWatchers to remove circular references that would prevent GC\n node = meta.chains;\n if (node) {\n NODE_STACK.push(node);\n // process tree\n while (NODE_STACK.length > 0) {\n node = NODE_STACK.pop();\n // push children\n nodes = node._chains;\n if (nodes) {\n for (key in nodes) {\n if (nodes.hasOwnProperty(key)) {\n NODE_STACK.push(nodes[key]);\n }\n }\n }\n // remove chainWatcher in node object\n if (node._watching) {\n nodeObject = node._object;\n if (nodeObject) {\n removeChainWatcher(nodeObject, node._key, node);\n }\n }\n }\n }\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar o_create = Ember.platform.create;\nvar meta = Ember.meta;\nvar guidFor = Ember.guidFor;\nvar a_slice = Array.prototype.slice;\n\n/**\n The event system uses a series of nested hashes to store listeners on an\n object. When a listener is registered, or when an event arrives, these\n hashes are consulted to determine which target and action pair to invoke.\n\n The hashes are stored in the object's meta hash, and look like this:\n\n // Object's meta hash\n {\n listeners: { // variable name: `listenerSet`\n \"foo:changed\": { // variable name: `targetSet`\n [targetGuid]: { // variable name: `actionSet`\n [methodGuid]: { // variable name: `action`\n target: [Object object],\n method: [Function function],\n xform: [Function function]\n }\n }\n }\n }\n }\n\n*/\n\n/** @private */\nvar metaPath = Ember.metaPath;\n\n// Gets the set of all actions, keyed on the guid of each action's\n// method property.\n/** @private */\nfunction actionSetFor(obj, eventName, target, writable) {\n var targetGuid = guidFor(target);\n return metaPath(obj, ['listeners', eventName, targetGuid], writable);\n}\n\n// Gets the set of all targets, keyed on the guid of each action's\n// target property.\n/** @private */\nfunction targetSetFor(obj, eventName) {\n var listenerSet = meta(obj, false).listeners;\n if (!listenerSet) { return false; }\n\n return listenerSet[eventName] || false;\n}\n\n// TODO: This knowledge should really be a part of the\n// meta system.\nvar SKIP_PROPERTIES = { __ember_source__: true };\n\n/** @private */\nfunction iterateSet(targetSet, callback, params) {\n if (!targetSet) { return false; }\n // Iterate through all elements of the target set\n for(var targetGuid in targetSet) {\n if (SKIP_PROPERTIES[targetGuid]) { continue; }\n\n var actionSet = targetSet[targetGuid];\n if (actionSet) {\n // Iterate through the elements of the action set\n for(var methodGuid in actionSet) {\n if (SKIP_PROPERTIES[methodGuid]) { continue; }\n\n var action = actionSet[methodGuid];\n if (action) {\n if (callback(action, params) === true) {\n return true;\n }\n }\n }\n }\n }\n return false;\n}\n\n/** @private */\nfunction invokeAction(action, params) {\n var method = action.method, target = action.target, xform = action.xform;\n // If there is no target, the target is the object\n // on which the event was fired.\n if (!target) { target = params[0]; }\n if ('string' === typeof method) { method = target[method]; }\n\n // Listeners can provide an `xform` function, which can perform\n // arbitrary transformations, such as changing the order of\n // parameters.\n //\n // This is primarily used by ember-runtime's observer system, which\n // provides a higher level abstraction on top of events, including\n // dynamically looking up current values and passing them into the\n // registered listener.\n if (xform) {\n xform(target, method, params);\n } else {\n method.apply(target, params);\n }\n}\n\n/**\n The parameters passed to an event listener are not exactly the\n parameters passed to an observer. if you pass an xform function, it will\n be invoked and is able to translate event listener parameters into the form\n that observers are expecting.\n\n @memberOf Ember\n*/\nfunction addListener(obj, eventName, target, method, xform) {\n Ember.assert(\"You must pass at least an object and event name to Ember.addListener\", !!obj && !!eventName);\n\n if (!method && 'function' === typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method);\n\n if (!actionSet[methodGuid]) {\n actionSet[methodGuid] = { target: target, method: method, xform: xform };\n } else {\n actionSet[methodGuid].xform = xform; // used by observers etc to map params\n }\n\n if ('function' === typeof obj.didAddListener) {\n obj.didAddListener(eventName, target, method);\n }\n}\n\n/** @memberOf Ember */\nfunction removeListener(obj, eventName, target, method) {\n if (!method && 'function'===typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method);\n\n // we can't simply delete this parameter, because if we do, we might\n // re-expose the property from the prototype chain.\n if (actionSet && actionSet[methodGuid]) { actionSet[methodGuid] = null; }\n\n if (obj && 'function'===typeof obj.didRemoveListener) {\n obj.didRemoveListener(eventName, target, method);\n }\n}\n\n// Suspend listener during callback.\n//\n// This should only be used by the target of the event listener\n// when it is taking an action that would cause the event, e.g.\n// an object might suspend its property change listener while it is\n// setting that property.\n/** @private */\nfunction suspendListener(obj, eventName, target, method, callback) {\n if (!method && 'function' === typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method),\n action = actionSet && actionSet[methodGuid];\n\n actionSet[methodGuid] = null;\n try {\n return callback.call(target);\n } finally {\n actionSet[methodGuid] = action;\n }\n}\n\n// returns a list of currently watched events\n/** @memberOf Ember */\nfunction watchedEvents(obj) {\n var listeners = meta(obj, false).listeners, ret = [];\n\n if (listeners) {\n for(var eventName in listeners) {\n if (!SKIP_PROPERTIES[eventName] && listeners[eventName]) {\n ret.push(eventName);\n }\n }\n }\n return ret;\n}\n\n/** @memberOf Ember */\nfunction sendEvent(obj, eventName) {\n\n // first give object a chance to handle it\n if (obj !== Ember && 'function' === typeof obj.sendEvent) {\n obj.sendEvent.apply(obj, a_slice.call(arguments, 1));\n }\n\n var targetSet = targetSetFor(obj, eventName);\n iterateSet(targetSet, invokeAction, arguments);\n\n return true;\n}\n\n/** @memberOf Ember */\nfunction deferEvent(obj, eventName) {\n var targetSet = targetSetFor(obj, eventName), actions = [], params = arguments;\n iterateSet(targetSet, function (action) {\n actions.push(action);\n });\n\n return function() {\n if (obj !== Ember && 'function' === typeof obj.sendEvent) {\n obj.sendEvent.apply(obj, a_slice.call(params, 1));\n }\n\n for (var i=0, len=actions.length; i < len; ++i) {\n invokeAction(actions[i], params);\n }\n };\n}\n\n/** @memberOf Ember */\nfunction hasListeners(obj, eventName) {\n var targetSet = targetSetFor(obj, eventName);\n if (iterateSet(targetSet, function () {return true;})) {\n return true;\n }\n\n // no listeners! might as well clean this up so it is faster later.\n var set = metaPath(obj, ['listeners'], true);\n set[eventName] = null;\n\n return false;\n}\n\n/** @memberOf Ember */\nfunction listenersFor(obj, eventName) {\n var targetSet = targetSetFor(obj, eventName), ret = [];\n iterateSet(targetSet, function (action) {\n ret.push([action.target, action.method]);\n });\n return ret;\n}\n\nEmber.addListener = addListener;\nEmber.removeListener = removeListener;\nEmber._suspendListener = suspendListener;\nEmber.sendEvent = sendEvent;\nEmber.hasListeners = hasListeners;\nEmber.watchedEvents = watchedEvents;\nEmber.listenersFor = listenersFor;\nEmber.deferEvent = deferEvent;\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// Ember.Logger\n// Ember.watch.flushPending\n// Ember.beginPropertyChanges, Ember.endPropertyChanges\n// Ember.guidFor\n// Ember.ArrayUtils\n\n// ..........................................................\n// HELPERS\n//\n\nvar slice = Array.prototype.slice;\nvar forEach = Ember.ArrayUtils.forEach;\n\n// invokes passed params - normalizing so you can pass target/func,\n// target/string or just func\n/** @private */\nfunction invoke(target, method, args, ignore) {\n\n if (method===undefined) {\n method = target;\n target = undefined;\n }\n\n if ('string'===typeof method) method = target[method];\n if (args && ignore>0) {\n args = args.length>ignore ? slice.call(args, ignore) : null;\n }\n\n // Unfortunately in some browsers we lose the backtrace if we rethrow the existing error,\n // so in the event that we don't have an `onerror` handler we don't wrap in a try/catch\n if ('function' === typeof Ember.onerror) {\n try {\n // IE8's Function.prototype.apply doesn't accept undefined/null arguments.\n return method.apply(target || this, args || []);\n } catch (error) {\n Ember.onerror(error);\n }\n } else {\n // IE8's Function.prototype.apply doesn't accept undefined/null arguments.\n return method.apply(target || this, args || []);\n }\n}\n\n\n// ..........................................................\n// RUNLOOP\n//\n\nvar timerMark; // used by timers...\n\n/** @private */\nvar K = function() {};\n\n/** @private */\nvar RunLoop = function(prev) {\n var self;\n\n if (this instanceof RunLoop) {\n self = this;\n } else {\n self = new K();\n }\n\n self._prev = prev || null;\n self.onceTimers = {};\n\n return self;\n};\n\nK.prototype = RunLoop.prototype;\n\nRunLoop.prototype = {\n end: function() {\n this.flush();\n },\n\n prev: function() {\n return this._prev;\n },\n\n // ..........................................................\n // Delayed Actions\n //\n\n schedule: function(queueName, target, method) {\n var queues = this._queues, queue;\n if (!queues) queues = this._queues = {};\n queue = queues[queueName];\n if (!queue) queue = queues[queueName] = [];\n\n var args = arguments.length>3 ? slice.call(arguments, 3) : null;\n queue.push({ target: target, method: method, args: args });\n return this;\n },\n\n flush: function(queueName) {\n var queues = this._queues, queueNames, idx, len, queue, log;\n\n if (!queues) return this; // nothing to do\n\n function iter(item) {\n invoke(item.target, item.method, item.args);\n }\n\n Ember.watch.flushPending(); // make sure all chained watchers are setup\n\n if (queueName) {\n while (this._queues && (queue = this._queues[queueName])) {\n this._queues[queueName] = null;\n\n // the sync phase is to allow property changes to propagate. don't\n // invoke observers until that is finished.\n if (queueName === 'sync') {\n log = Ember.LOG_BINDINGS;\n if (log) Ember.Logger.log('Begin: Flush Sync Queue');\n\n Ember.beginPropertyChanges();\n try {\n forEach(queue, iter);\n } finally {\n Ember.endPropertyChanges();\n }\n\n if (log) Ember.Logger.log('End: Flush Sync Queue');\n\n } else {\n forEach(queue, iter);\n }\n }\n\n } else {\n queueNames = Ember.run.queues;\n len = queueNames.length;\n do {\n this._queues = null;\n for(idx=0;idx<len;idx++) {\n queueName = queueNames[idx];\n queue = queues[queueName];\n\n if (queue) {\n // the sync phase is to allow property changes to propagate. don't\n // invoke observers until that is finished.\n if (queueName === 'sync') {\n log = Ember.LOG_BINDINGS;\n if (log) Ember.Logger.log('Begin: Flush Sync Queue');\n\n Ember.beginPropertyChanges();\n try {\n forEach(queue, iter);\n } finally {\n Ember.endPropertyChanges();\n }\n\n if (log) Ember.Logger.log('End: Flush Sync Queue');\n } else {\n forEach(queue, iter);\n }\n }\n }\n } while (queues = this._queues); // go until queues stay clean\n }\n\n timerMark = null;\n\n return this;\n }\n\n};\n\nEmber.RunLoop = RunLoop;\n\n// ..........................................................\n// Ember.run - this is ideally the only public API the dev sees\n//\n/** \n* @namespace Ember.run is both a function and a namespace for\n* RunLoop-related functions.\n* @name Ember.run\n*/ \n\n/**\n Runs the passed target and method inside of a RunLoop, ensuring any\n deferred actions including bindings and views updates are flushed at the\n end.\n\n Normally you should not need to invoke this method yourself. However if\n you are implementing raw event handlers when interfacing with other\n libraries or plugins, you should probably wrap all of your code inside this\n call.\n\n Ember.run(function(){\n // code to be execute within a RunLoop \n });\n\n @name run^2\n @methodOf Ember.run\n @param {Object} target\n (Optional) target of method to call\n\n @param {Function|String} method\n Method to invoke. May be a function or a string. If you pass a string\n then it will be looked up on the passed target.\n\n @param {Object...} args\n Any additional arguments you wish to pass to the method.\n\n @returns {Object} return value from invoking the passed function.\n*/\nEmber.run = function(target, method) {\n\n var ret, loop;\n run.begin();\n try {\n if (target || method) ret = invoke(target, method, arguments, 2);\n } finally {\n run.end();\n }\n return ret;\n};\n\n/** @private */\nvar run = Ember.run;\n\n\n/**\n Begins a new RunLoop. Any deferred actions invoked after the begin will\n be buffered until you invoke a matching call to Ember.run.end(). This is\n an lower-level way to use a RunLoop instead of using Ember.run().\n\n Ember.run.begin();\n // code to be execute within a RunLoop \n Ember.run.end();\n\n\n @returns {void}\n*/\nEmber.run.begin = function() {\n run.currentRunLoop = new RunLoop(run.currentRunLoop);\n};\n\n/**\n Ends a RunLoop. This must be called sometime after you call Ember.run.begin()\n to flush any deferred actions. This is a lower-level way to use a RunLoop\n instead of using Ember.run().\n\n Ember.run.begin();\n // code to be execute within a RunLoop \n Ember.run.end();\n\n @returns {void}\n*/\nEmber.run.end = function() {\n Ember.assert('must have a current run loop', run.currentRunLoop);\n try {\n run.currentRunLoop.end();\n }\n finally {\n run.currentRunLoop = run.currentRunLoop.prev();\n }\n};\n\n/**\n Array of named queues. This array determines the order in which queues\n are flushed at the end of the RunLoop. You can define your own queues by\n simply adding the queue name to this array. Normally you should not need\n to inspect or modify this property.\n\n @property {String}\n @default ['sync', 'actions', 'destroy', 'timers']\n*/\nEmber.run.queues = ['sync', 'actions', 'destroy', 'timers'];\n\n/**\n Adds the passed target/method and any optional arguments to the named\n queue to be executed at the end of the RunLoop. If you have not already\n started a RunLoop when calling this method one will be started for you\n automatically.\n\n At the end of a RunLoop, any methods scheduled in this way will be invoked.\n Methods will be invoked in an order matching the named queues defined in\n the run.queues property.\n\n Ember.run.schedule('timers', this, function(){\n // this will be executed at the end of the RunLoop, when timers are run\n console.log(\"scheduled on timers queue\");\n });\n Ember.run.schedule('sync', this, function(){\n // this will be executed at the end of the RunLoop, when bindings are synced\n console.log(\"scheduled on sync queue\");\n });\n // Note the functions will be run in order based on the run queues order. Output would be:\n // scheduled on sync queue\n // scheduled on timers queue\n\n @param {String} queue\n The name of the queue to schedule against. Default queues are 'sync' and\n 'actions'\n\n @param {Object} target\n (Optional) target object to use as the context when invoking a method.\n\n @param {String|Function} method\n The method to invoke. If you pass a string it will be resolved on the\n target object at the time the scheduled item is invoked allowing you to\n change the target function.\n\n @param {Object} arguments...\n Optional arguments to be passed to the queued method.\n\n @returns {void}\n*/\nEmber.run.schedule = function(queue, target, method) {\n var loop = run.autorun();\n loop.schedule.apply(loop, arguments);\n};\n\nvar autorunTimer;\n\n/** @private */\nfunction autorun() {\n autorunTimer = null;\n if (run.currentRunLoop) run.end();\n}\n\n/**\n Begins a new RunLoop if necessary and schedules a timer to flush the\n RunLoop at a later time. This method is used by parts of Ember to\n ensure the RunLoop always finishes. You normally do not need to call this\n method directly. Instead use Ember.run().\n\n Ember.run.autorun();\n\n @returns {Ember.RunLoop} the new current RunLoop\n*/\nEmber.run.autorun = function() {\n\n if (!run.currentRunLoop) {\n run.begin();\n\n // TODO: throw during tests\n if (Ember.testing) {\n run.end();\n } else if (!autorunTimer) {\n autorunTimer = setTimeout(autorun, 1);\n }\n }\n\n return run.currentRunLoop;\n};\n\n/**\n Immediately flushes any events scheduled in the 'sync' queue. Bindings\n use this queue so this method is a useful way to immediately force all\n bindings in the application to sync.\n\n You should call this method anytime you need any changed state to propagate\n throughout the app immediately without repainting the UI.\n\n Ember.run.sync();\n\n @returns {void}\n*/\nEmber.run.sync = function() {\n run.autorun();\n run.currentRunLoop.flush('sync');\n};\n\n// ..........................................................\n// TIMERS\n//\n\nvar timers = {}; // active timers...\n\nvar laterScheduled = false;\n/** @private */\nfunction invokeLaterTimers() {\n var now = (+ new Date()), earliest = -1;\n for(var key in timers) {\n if (!timers.hasOwnProperty(key)) continue;\n var timer = timers[key];\n if (timer && timer.expires) {\n if (now >= timer.expires) {\n delete timers[key];\n invoke(timer.target, timer.method, timer.args, 2);\n } else {\n if (earliest<0 || (timer.expires < earliest)) earliest=timer.expires;\n }\n }\n }\n\n // schedule next timeout to fire...\n if (earliest>0) setTimeout(invokeLaterTimers, earliest-(+ new Date()));\n}\n\n/**\n Invokes the passed target/method and optional arguments after a specified\n period if time. The last parameter of this method must always be a number\n of milliseconds.\n\n You should use this method whenever you need to run some action after a\n period of time instead of using setTimeout(). This method will ensure that\n items that expire during the same script execution cycle all execute\n together, which is often more efficient than using a real setTimeout.\n\n Ember.run.later(myContext, function(){\n // code here will execute within a RunLoop in about 500ms with this == myContext\n }, 500);\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n @param {Number} wait\n Number of milliseconds to wait.\n\n @returns {Timer} an object you can use to cancel a timer at a later time.\n*/\nEmber.run.later = function(target, method) {\n var args, expires, timer, guid, wait;\n\n // setTimeout compatibility...\n if (arguments.length===2 && 'function' === typeof target) {\n wait = method;\n method = target;\n target = undefined;\n args = [target, method];\n\n } else {\n args = slice.call(arguments);\n wait = args.pop();\n }\n\n expires = (+ new Date())+wait;\n timer = { target: target, method: method, expires: expires, args: args };\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n run.once(timers, invokeLaterTimers);\n return guid;\n};\n\n/** @private */\nfunction invokeOnceTimer(guid, onceTimers) {\n if (onceTimers[this.tguid]) delete onceTimers[this.tguid][this.mguid];\n if (timers[guid]) invoke(this.target, this.method, this.args, 2);\n delete timers[guid];\n}\n\n/**\n Schedules an item to run one time during the current RunLoop. Calling\n this method with the same target/method combination will have no effect.\n\n Note that although you can pass optional arguments these will not be\n considered when looking for duplicates. New arguments will replace previous\n calls.\n\n Ember.run(function(){\n var doFoo = function() { foo(); }\n Ember.run.once(myContext, doFoo);\n Ember.run.once(myContext, doFoo);\n // doFoo will only be executed once at the end of the RunLoop\n });\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n\n @returns {Object} timer\n*/\nEmber.run.once = function(target, method) {\n var tguid = Ember.guidFor(target), mguid = Ember.guidFor(method), guid, timer;\n\n var onceTimers = run.autorun().onceTimers;\n guid = onceTimers[tguid] && onceTimers[tguid][mguid];\n if (guid && timers[guid]) {\n timers[guid].args = slice.call(arguments); // replace args\n\n } else {\n timer = {\n target: target,\n method: method,\n args: slice.call(arguments),\n tguid: tguid,\n mguid: mguid\n };\n\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n if (!onceTimers[tguid]) onceTimers[tguid] = {};\n onceTimers[tguid][mguid] = guid; // so it isn't scheduled more than once\n\n run.schedule('actions', timer, invokeOnceTimer, guid, onceTimers);\n }\n\n return guid;\n};\n\nvar scheduledNext = false;\n/** @private */\nfunction invokeNextTimers() {\n scheduledNext = null;\n for(var key in timers) {\n if (!timers.hasOwnProperty(key)) continue;\n var timer = timers[key];\n if (timer.next) {\n delete timers[key];\n invoke(timer.target, timer.method, timer.args, 2);\n }\n }\n}\n\n/**\n Schedules an item to run after control has been returned to the system.\n This is often equivalent to calling setTimeout(function...,1).\n\n Ember.run.next(myContext, function(){\n // code to be executed in the next RunLoop, which will be scheduled after the current one\n });\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n @returns {Object} timer\n*/\nEmber.run.next = function(target, method) {\n var timer, guid;\n\n timer = {\n target: target,\n method: method,\n args: slice.call(arguments),\n next: true\n };\n\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n\n if (!scheduledNext) scheduledNext = setTimeout(invokeNextTimers, 1);\n return guid;\n};\n\n/**\n Cancels a scheduled item. Must be a value returned by `Ember.run.later()`,\n `Ember.run.once()`, or `Ember.run.next()`.\n\n var runNext = Ember.run.next(myContext, function(){\n // will not be executed\n });\n Ember.run.cancel(runNext);\n\n var runLater = Ember.run.next(myContext, function(){\n // will not be executed\n }, 500);\n Ember.run.cancel(runLater);\n\n var runOnce = Ember.run.once(myContext, function(){\n // will not be executed\n });\n Ember.run.cancel(runOnce);\n\n @param {Object} timer\n Timer object to cancel\n\n @returns {void}\n*/\nEmber.run.cancel = function(timer) {\n delete timers[timer];\n};\n\n// ..........................................................\n// DEPRECATED API\n//\n\n/**\n @namespace Compatibility for Ember.run\n @name Ember.RunLoop\n @deprecated\n*/\n\n/**\n @deprecated\n @method\n\n Use `#js:Ember.run.begin()` instead\n*/\nEmber.RunLoop.begin = Ember.deprecateFunc(\"Use Ember.run.begin instead of Ember.RunLoop.begin.\", Ember.run.begin);\n\n/**\n @deprecated\n @method\n\n Use `#js:Ember.run.end()` instead\n*/\nEmber.RunLoop.end = Ember.deprecateFunc(\"Use Ember.run.end instead of Ember.RunLoop.end.\", Ember.run.end);\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// Ember.Logger\n// get, getPath, setPath, trySetPath\n// guidFor, isArray, meta\n// addObserver, removeObserver\n// Ember.run.schedule\n\n// ..........................................................\n// CONSTANTS\n//\n\n\n/**\n @static\n\n Debug parameter you can turn on. This will log all bindings that fire to\n the console. This should be disabled in production code. Note that you\n can also enable this from the console or temporarily.\n\n @type Boolean\n @default false\n*/\nEmber.LOG_BINDINGS = false || !!Ember.ENV.LOG_BINDINGS;\n\n/**\n @static\n\n Performance paramter. This will benchmark the time spent firing each\n binding.\n\n @type Boolean\n*/\nEmber.BENCHMARK_BINDING_NOTIFICATIONS = !!Ember.ENV.BENCHMARK_BINDING_NOTIFICATIONS;\n\n/**\n @static\n\n Performance parameter. This will benchmark the time spend configuring each\n binding.\n\n @type Boolean\n*/\nEmber.BENCHMARK_BINDING_SETUP = !!Ember.ENV.BENCHMARK_BINDING_SETUP;\n\n\n/**\n @static\n\n Default placeholder for multiple values in bindings.\n\n @type String\n @default '@@MULT@@'\n*/\nEmber.MULTIPLE_PLACEHOLDER = '@@MULT@@';\n\n/**\n @static\n\n Default placeholder for empty values in bindings. Used by notEmpty()\n helper unless you specify an alternative.\n\n @type String\n @default '@@EMPTY@@'\n*/\nEmber.EMPTY_PLACEHOLDER = '@@EMPTY@@';\n\n// ..........................................................\n// TYPE COERCION HELPERS\n//\n\n// Coerces a non-array value into an array.\n/** @private */\nfunction MULTIPLE(val) {\n if (val instanceof Array) return val;\n if (val === undefined || val === null) return [];\n return [val];\n}\n\n// Treats a single-element array as the element. Otherwise\n// returns a placeholder.\n/** @private */\nfunction SINGLE(val, placeholder) {\n if (val instanceof Array) {\n if (val.length>1) return placeholder;\n else return val[0];\n }\n return val;\n}\n\n// Coerces the binding value into a Boolean.\n\nvar BOOL = {\n to: function (val) {\n return !!val;\n }\n};\n\n// Returns the Boolean inverse of the value.\nvar NOT = {\n to: function NOT(val) {\n return !val;\n }\n};\n\nvar get = Ember.get,\n getPath = Ember.getPath,\n setPath = Ember.setPath,\n guidFor = Ember.guidFor,\n isGlobalPath = Ember.isGlobalPath;\n\n// Applies a binding's transformations against a value.\n/** @private */\nfunction getTransformedValue(binding, val, obj, dir) {\n\n // First run a type transform, if it exists, that changes the fundamental\n // type of the value. For example, some transforms convert an array to a\n // single object.\n\n var typeTransform = binding._typeTransform;\n if (typeTransform) { val = typeTransform(val, binding._placeholder); }\n\n // handle transforms\n var transforms = binding._transforms,\n len = transforms ? transforms.length : 0,\n idx;\n\n for(idx=0;idx<len;idx++) {\n var transform = transforms[idx][dir];\n if (transform) { val = transform.call(this, val, obj); }\n }\n return val;\n}\n\n/** @private */\nfunction empty(val) {\n return val===undefined || val===null || val==='' || (Ember.isArray(val) && get(val, 'length')===0) ;\n}\n\n/** @private */\nfunction getPathWithGlobals(obj, path) {\n return getPath(isGlobalPath(path) ? window : obj, path);\n}\n\n/** @private */\nfunction getTransformedFromValue(obj, binding) {\n var operation = binding._operation,\n fromValue;\n if (operation) {\n fromValue = operation(obj, binding._from, binding._operand);\n } else {\n fromValue = getPathWithGlobals(obj, binding._from);\n }\n return getTransformedValue(binding, fromValue, obj, 'to');\n}\n\n/** @private */\nfunction getTransformedToValue(obj, binding) {\n var toValue = getPath(obj, binding._to);\n return getTransformedValue(binding, toValue, obj, 'from');\n}\n\n/** @private */\nvar AND_OPERATION = function(obj, left, right) {\n return getPathWithGlobals(obj, left) && getPathWithGlobals(obj, right);\n};\n\n/** @private */\nvar OR_OPERATION = function(obj, left, right) {\n return getPathWithGlobals(obj, left) || getPathWithGlobals(obj, right);\n};\n\n// ..........................................................\n// BINDING\n//\n/** @private */\nvar K = function() {};\n\n/** @private */\nvar Binding = function(toPath, fromPath) {\n var self;\n\n if (this instanceof Binding) {\n self = this;\n } else {\n self = new K();\n }\n\n /** @private */\n self._direction = 'fwd';\n\n /** @private */\n self._from = fromPath;\n self._to = toPath;\n\n return self;\n};\n\nK.prototype = Binding.prototype;\n\nBinding.prototype = /** @scope Ember.Binding.prototype */ {\n /**\n This copies the Binding so it can be connected to another object.\n @returns {Ember.Binding}\n */\n copy: function () {\n var copy = new Binding(this._to, this._from);\n if (this._oneWay) {\n copy._oneWay = true;\n }\n if (this._transforms) {\n copy._transforms = this._transforms.slice(0);\n }\n if (this._typeTransform) {\n copy._typeTransform = this._typeTransform;\n copy._placeholder = this._placeholder;\n }\n if (this._operand) {\n copy._operand = this._operand;\n copy._operation = this._operation;\n }\n return copy;\n },\n\n // ..........................................................\n // CONFIG\n //\n\n /**\n This will set \"from\" property path to the specified value. It will not\n attempt to resolve this property path to an actual object until you\n connect the binding.\n\n The binding will search for the property path starting at the root object\n you pass when you connect() the binding. It follows the same rules as\n `getPath()` - see that method for more information.\n\n @param {String} propertyPath the property path to connect to\n @returns {Ember.Binding} receiver\n */\n from: function(path) {\n this._from = path;\n return this;\n },\n\n /**\n This will set the \"to\" property path to the specified value. It will not\n attempt to resolve this property path to an actual object until you\n connect the binding.\n\n The binding will search for the property path starting at the root object\n you pass when you connect() the binding. It follows the same rules as\n `getPath()` - see that method for more information.\n\n @param {String|Tuple} propertyPath A property path or tuple\n @param {Object} [root] Root object to use when resolving the path.\n @returns {Ember.Binding} this\n */\n to: function(path) {\n this._to = path;\n return this;\n },\n\n /**\n Configures the binding as one way. A one-way binding will relay changes\n on the \"from\" side to the \"to\" side, but not the other way around. This\n means that if you change the \"to\" side directly, the \"from\" side may have\n a different value.\n\n @param {Boolean} flag\n (Optional) passing nothing here will make the binding oneWay. You can\n instead pass false to disable oneWay, making the binding two way again.\n\n @returns {Ember.Binding} receiver\n */\n oneWay: function(flag) {\n this._oneWay = flag===undefined ? true : !!flag;\n return this;\n },\n\n /**\n Adds the specified transform to the array of transform functions.\n\n A transform is a hash with `to` and `from` properties. Each property\n should be a function that performs a transformation in either the\n forward or back direction.\n\n The functions you pass must have the following signature:\n\n function(value) {};\n\n They must also return the transformed value.\n\n Transforms are invoked in the order they were added. If you are\n extending a binding and want to reset the transforms, you can call\n `resetTransform()` first.\n\n @param {Function} transformFunc the transform function.\n @returns {Ember.Binding} this\n */\n transform: function(transform) {\n if ('function' === typeof transform) {\n transform = { to: transform };\n }\n\n if (!this._transforms) this._transforms = [];\n this._transforms.push(transform);\n return this;\n },\n\n /**\n Resets the transforms for the binding. After calling this method the\n binding will no longer transform values. You can then add new transforms\n as needed.\n\n @returns {Ember.Binding} this\n */\n resetTransforms: function() {\n this._transforms = null;\n return this;\n },\n\n /**\n Adds a transform to the chain that will allow only single values to pass.\n This will allow single values and nulls to pass through. If you pass an\n array, it will be mapped as so:\n\n - [] => null\n - [a] => a\n - [a,b,c] => Multiple Placeholder\n\n You can pass in an optional multiple placeholder or it will use the\n default.\n\n Note that this transform will only happen on forwarded valued. Reverse\n values are send unchanged.\n\n @param {String} fromPath from path or null\n @param {Object} [placeholder] Placeholder value.\n @returns {Ember.Binding} this\n */\n single: function(placeholder) {\n if (placeholder===undefined) placeholder = Ember.MULTIPLE_PLACEHOLDER;\n this._typeTransform = SINGLE;\n this._placeholder = placeholder;\n return this;\n },\n\n /**\n Adds a transform that will convert the passed value to an array. If\n the value is null or undefined, it will be converted to an empty array.\n\n @param {String} [fromPath]\n @returns {Ember.Binding} this\n */\n multiple: function() {\n this._typeTransform = MULTIPLE;\n this._placeholder = null;\n return this;\n },\n\n /**\n Adds a transform to convert the value to a bool value. If the value is\n an array it will return true if array is not empty. If the value is a\n string it will return true if the string is not empty.\n\n @returns {Ember.Binding} this\n */\n bool: function() {\n this.transform(BOOL);\n return this;\n },\n\n /**\n Adds a transform that will return the placeholder value if the value is\n null, undefined, an empty array or an empty string. See also notNull().\n\n @param {Object} [placeholder] Placeholder value.\n @returns {Ember.Binding} this\n */\n notEmpty: function(placeholder) {\n if (placeholder === null || placeholder === undefined) {\n placeholder = Ember.EMPTY_PLACEHOLDER;\n }\n\n this.transform({\n to: function(val) { return empty(val) ? placeholder : val; }\n });\n\n return this;\n },\n\n /**\n Adds a transform that will return the placeholder value if the value is\n null or undefined. Otherwise it will passthrough untouched. See also notEmpty().\n\n @param {String} fromPath from path or null\n @param {Object} [placeholder] Placeholder value.\n @returns {Ember.Binding} this\n */\n notNull: function(placeholder) {\n if (placeholder === null || placeholder === undefined) {\n placeholder = Ember.EMPTY_PLACEHOLDER;\n }\n\n this.transform({\n to: function(val) { return (val === null || val === undefined) ? placeholder : val; }\n });\n\n return this;\n },\n\n /**\n Adds a transform to convert the value to the inverse of a bool value. This\n uses the same transform as bool() but inverts it.\n\n @returns {Ember.Binding} this\n */\n not: function() {\n this.transform(NOT);\n return this;\n },\n\n /**\n Adds a transform that will return true if the value is null or undefined, false otherwise.\n\n @returns {Ember.Binding} this\n */\n isNull: function() {\n this.transform(function(val) { return val === null || val === undefined; });\n return this;\n },\n\n /** @private */\n toString: function() {\n var oneWay = this._oneWay ? '[oneWay]' : '';\n return \"Ember.Binding<\" + guidFor(this) + \">(\" + this._from + \" -> \" + this._to + \")\" + oneWay;\n },\n\n // ..........................................................\n // CONNECT AND SYNC\n //\n\n /**\n Attempts to connect this binding instance so that it can receive and relay\n changes. This method will raise an exception if you have not set the\n from/to properties yet.\n\n @param {Object} obj\n The root object for this binding.\n\n @param {Boolean} preferFromParam\n private: Normally, `connect` cannot take an object if `from` already set\n an object. Internally, we would like to be able to provide a default object\n to be used if no object was provided via `from`, so this parameter turns\n off the assertion.\n\n @returns {Ember.Binding} this\n */\n connect: function(obj) {\n Ember.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);\n\n var oneWay = this._oneWay, operand = this._operand;\n\n // add an observer on the object to be notified when the binding should be updated\n Ember.addObserver(obj, this._from, this, this.fromDidChange);\n\n // if there is an operand, add an observer onto it as well\n if (operand) { Ember.addObserver(obj, operand, this, this.fromDidChange); }\n\n // if the binding is a two-way binding, also set up an observer on the target\n // object.\n if (!oneWay) { Ember.addObserver(obj, this._to, this, this.toDidChange); }\n\n if (Ember.meta(obj,false).proto !== obj) { this._scheduleSync(obj, 'fwd'); }\n\n this._readyToSync = true;\n return this;\n },\n\n /**\n Disconnects the binding instance. Changes will no longer be relayed. You\n will not usually need to call this method.\n\n @param {Object} obj\n The root object you passed when connecting the binding.\n\n @returns {Ember.Binding} this\n */\n disconnect: function(obj) {\n Ember.assert('Must pass a valid object to Ember.Binding.disconnect()', !!obj);\n\n var oneWay = this._oneWay, operand = this._operand;\n\n // remove an observer on the object so we're no longer notified of\n // changes that should update bindings.\n Ember.removeObserver(obj, this._from, this, this.fromDidChange);\n\n // if there is an operand, remove the observer from it as well\n if (operand) Ember.removeObserver(obj, operand, this, this.fromDidChange);\n\n // if the binding is two-way, remove the observer from the target as well\n if (!oneWay) Ember.removeObserver(obj, this._to, this, this.toDidChange);\n\n this._readyToSync = false; // disable scheduled syncs...\n return this;\n },\n\n // ..........................................................\n // PRIVATE\n //\n\n /** @private - called when the from side changes */\n fromDidChange: function(target) {\n this._scheduleSync(target, 'fwd');\n },\n\n /** @private - called when the to side changes */\n toDidChange: function(target) {\n this._scheduleSync(target, 'back');\n },\n\n /** @private */\n _scheduleSync: function(obj, dir) {\n var guid = guidFor(obj), existingDir = this[guid];\n\n // if we haven't scheduled the binding yet, schedule it\n if (!existingDir) {\n Ember.run.schedule('sync', this, this._sync, obj);\n this[guid] = dir;\n }\n\n // If both a 'back' and 'fwd' sync have been scheduled on the same object,\n // default to a 'fwd' sync so that it remains deterministic.\n if (existingDir === 'back' && dir === 'fwd') {\n this[guid] = 'fwd';\n }\n },\n\n /** @private */\n _sync: function(obj) {\n var log = Ember.LOG_BINDINGS;\n\n // don't synchronize destroyed objects or disconnected bindings\n if (obj.isDestroyed || !this._readyToSync) { return; }\n\n // get the direction of the binding for the object we are\n // synchronizing from\n var guid = guidFor(obj), direction = this[guid];\n\n var fromPath = this._from, toPath = this._to;\n\n delete this[guid];\n\n // if we're synchronizing from the remote object...\n if (direction === 'fwd') {\n var fromValue = getTransformedFromValue(obj, this);\n if (log) {\n Ember.Logger.log(' ', this.toString(), '->', fromValue, obj);\n }\n if (this._oneWay) {\n Ember.trySetPath(Ember.isGlobalPath(toPath) ? window : obj, toPath, fromValue);\n } else {\n Ember._suspendObserver(obj, toPath, this, this.toDidChange, function () {\n Ember.trySetPath(Ember.isGlobalPath(toPath) ? window : obj, toPath, fromValue);\n });\n }\n // if we're synchronizing *to* the remote object\n } else if (direction === 'back') {// && !this._oneWay) {\n var toValue = getTransformedToValue(obj, this);\n if (log) {\n Ember.Logger.log(' ', this.toString(), '<-', toValue, obj);\n }\n Ember._suspendObserver(obj, fromPath, this, this.fromDidChange, function () {\n Ember.trySetPath(Ember.isGlobalPath(fromPath) ? window : obj, fromPath, toValue);\n });\n }\n }\n\n};\n\n/** @private */\nfunction mixinProperties(to, from) {\n for (var key in from) {\n if (from.hasOwnProperty(key)) {\n to[key] = from[key];\n }\n }\n}\n\nmixinProperties(Binding,\n/** @scope Ember.Binding */ {\n\n /**\n @see Ember.Binding.prototype.from\n */\n from: function() {\n var C = this, binding = new C();\n return binding.from.apply(binding, arguments);\n },\n\n /**\n @see Ember.Binding.prototype.to\n */\n to: function() {\n var C = this, binding = new C();\n return binding.to.apply(binding, arguments);\n },\n\n /**\n @see Ember.Binding.prototype.oneWay\n */\n oneWay: function(from, flag) {\n var C = this, binding = new C(null, from);\n return binding.oneWay(flag);\n },\n\n /**\n @see Ember.Binding.prototype.single\n */\n single: function(from, placeholder) {\n var C = this, binding = new C(null, from);\n return binding.single(placeholder);\n },\n\n /**\n @see Ember.Binding.prototype.multiple\n */\n multiple: function(from) {\n var C = this, binding = new C(null, from);\n return binding.multiple();\n },\n\n /**\n @see Ember.Binding.prototype.transform\n */\n transform: function(from, func) {\n if (!func) {\n func = from;\n from = null;\n }\n var C = this, binding = new C(null, from);\n return binding.transform(func);\n },\n\n /**\n @see Ember.Binding.prototype.notEmpty\n */\n notEmpty: function(from, placeholder) {\n var C = this, binding = new C(null, from);\n return binding.notEmpty(placeholder);\n },\n\n /**\n @see Ember.Binding.prototype.notNull\n */\n notNull: function(from, placeholder) {\n var C = this, binding = new C(null, from);\n return binding.notNull(placeholder);\n },\n\n\n /**\n @see Ember.Binding.prototype.bool\n */\n bool: function(from) {\n var C = this, binding = new C(null, from);\n return binding.bool();\n },\n\n /**\n @see Ember.Binding.prototype.not\n */\n not: function(from) {\n var C = this, binding = new C(null, from);\n return binding.not();\n },\n\n /**\n @see Ember.Binding.prototype.isNull\n */\n isNull: function(from) {\n var C = this, binding = new C(null, from);\n return binding.isNull();\n },\n\n /**\n Adds a transform that forwards the logical 'AND' of values at 'pathA' and\n 'pathB' whenever either source changes. Note that the transform acts\n strictly as a one-way binding, working only in the direction\n\n 'pathA' AND 'pathB' --> value (value returned is the result of ('pathA' && 'pathB'))\n\n Usage example where a delete button's `isEnabled` value is determined by\n whether something is selected in a list and whether the current user is\n allowed to delete:\n\n deleteButton: Ember.ButtonView.design({\n isEnabledBinding: Ember.Binding.and('MyApp.itemsController.hasSelection', 'MyApp.userController.canDelete')\n })\n\n @param {String} pathA The first part of the conditional\n @param {String} pathB The second part of the conditional\n */\n and: function(pathA, pathB) {\n var C = this, binding = new C(null, pathA).oneWay();\n binding._operand = pathB;\n binding._operation = AND_OPERATION;\n return binding;\n },\n\n /**\n Adds a transform that forwards the 'OR' of values at 'pathA' and\n 'pathB' whenever either source changes. Note that the transform acts\n strictly as a one-way binding, working only in the direction\n\n 'pathA' AND 'pathB' --> value (value returned is the result of ('pathA' || 'pathB'))\n\n @param {String} pathA The first part of the conditional\n @param {String} pathB The second part of the conditional\n */\n or: function(pathA, pathB) {\n var C = this, binding = new C(null, pathA).oneWay();\n binding._operand = pathB;\n binding._operation = OR_OPERATION;\n return binding;\n }\n\n});\n\n/**\n @class\n\n A binding simply connects the properties of two objects so that whenever the\n value of one property changes, the other property will be changed also. You\n do not usually work with Binding objects directly but instead describe\n bindings in your class definition using something like:\n\n valueBinding: \"MyApp.someController.title\"\n\n This will create a binding from `MyApp.someController.title` to the `value`\n property of your object instance automatically. Now the two values will be\n kept in sync.\n\n ## Customizing Your Bindings\n\n In addition to synchronizing values, bindings can also perform some basic\n transforms on values. These transforms can help to make sure the data fed\n into one object always meets the expectations of that object regardless of\n what the other object outputs.\n\n To customize a binding, you can use one of the many helper methods defined\n on Ember.Binding like so:\n\n valueBinding: Ember.Binding.single(\"MyApp.someController.title\")\n\n This will create a binding just like the example above, except that now the\n binding will convert the value of `MyApp.someController.title` to a single\n object (removing any arrays) before applying it to the `value` property of\n your object.\n\n You can also chain helper methods to build custom bindings like so:\n\n valueBinding: Ember.Binding.single(\"MyApp.someController.title\").notEmpty(\"(EMPTY)\")\n\n This will force the value of MyApp.someController.title to be a single value\n and then check to see if the value is \"empty\" (null, undefined, empty array,\n or an empty string). If it is empty, the value will be set to the string\n \"(EMPTY)\".\n\n ## One Way Bindings\n\n One especially useful binding customization you can use is the `oneWay()`\n helper. This helper tells Ember that you are only interested in\n receiving changes on the object you are binding from. For example, if you\n are binding to a preference and you want to be notified if the preference\n has changed, but your object will not be changing the preference itself, you\n could do:\n\n bigTitlesBinding: Ember.Binding.oneWay(\"MyApp.preferencesController.bigTitles\")\n\n This way if the value of MyApp.preferencesController.bigTitles changes the\n \"bigTitles\" property of your object will change also. However, if you\n change the value of your \"bigTitles\" property, it will not update the\n preferencesController.\n\n One way bindings are almost twice as fast to setup and twice as fast to\n execute because the binding only has to worry about changes to one side.\n\n You should consider using one way bindings anytime you have an object that\n may be created frequently and you do not intend to change a property; only\n to monitor it for changes. (such as in the example above).\n\n ## Adding Custom Transforms\n\n In addition to using the standard helpers provided by Ember, you can\n also defined your own custom transform functions which will be used to\n convert the value. To do this, just define your transform function and add\n it to the binding with the transform() helper. The following example will\n not allow Integers less than ten. Note that it checks the value of the\n bindings and allows all other values to pass:\n\n valueBinding: Ember.Binding.transform(function(value, binding) {\n return ((Ember.typeOf(value) === 'number') && (value < 10)) ? 10 : value;\n }).from(\"MyApp.someController.value\")\n\n If you would like to instead use this transform on a number of bindings,\n you can also optionally add your own helper method to Ember.Binding. This\n method should simply return the value of `this.transform()`. The example\n below adds a new helper called `notLessThan()` which will limit the value to\n be not less than the passed minimum:\n\n Ember.Binding.reopen({\n notLessThan: function(minValue) {\n return this.transform(function(value, binding) {\n return ((Ember.typeOf(value) === 'number') && (value < minValue)) ? minValue : value;\n });\n }\n });\n\n You could specify this in your core.js file, for example. Then anywhere in\n your application you can use it to define bindings like so:\n\n valueBinding: Ember.Binding.from(\"MyApp.someController.value\").notLessThan(10)\n\n Also, remember that helpers are chained so you can use your helper along\n with any other helpers. The example below will create a one way binding that\n does not allow empty values or values less than 10:\n\n valueBinding: Ember.Binding.oneWay(\"MyApp.someController.value\").notEmpty().notLessThan(10)\n\n Finally, it's also possible to specify bi-directional transforms. To do this,\n you can pass a hash to `transform` with `to` and `from`. In the following\n example, we are expecting a lowercase string that we want to transform to\n uppercase.\n\n valueBinding: Ember.Binding.transform({\n to: function(value, binding) { return value.toUpperCase(); },\n from: function(value, binding) { return value.toLowerCase(); }\n\n ## How to Manually Adding Binding\n\n All of the examples above show you how to configure a custom binding, but\n the result of these customizations will be a binding template, not a fully\n active binding. The binding will actually become active only when you\n instantiate the object the binding belongs to. It is useful however, to\n understand what actually happens when the binding is activated.\n\n For a binding to function it must have at least a \"from\" property and a \"to\"\n property. The from property path points to the object/key that you want to\n bind from while the to path points to the object/key you want to bind to.\n\n When you define a custom binding, you are usually describing the property\n you want to bind from (such as \"MyApp.someController.value\" in the examples\n above). When your object is created, it will automatically assign the value\n you want to bind \"to\" based on the name of your binding key. In the\n examples above, during init, Ember objects will effectively call\n something like this on your binding:\n\n binding = Ember.Binding.from(this.valueBinding).to(\"value\");\n\n This creates a new binding instance based on the template you provide, and\n sets the to path to the \"value\" property of the new object. Now that the\n binding is fully configured with a \"from\" and a \"to\", it simply needs to be\n connected to become active. This is done through the connect() method:\n\n binding.connect(this);\n\n Note that when you connect a binding you pass the object you want it to be\n connected to. This object will be used as the root for both the from and\n to side of the binding when inspecting relative paths. This allows the\n binding to be automatically inherited by subclassed objects as well.\n\n Now that the binding is connected, it will observe both the from and to side\n and relay changes.\n\n If you ever needed to do so (you almost never will, but it is useful to\n understand this anyway), you could manually create an active binding by\n using the Ember.bind() helper method. (This is the same method used by\n to setup your bindings on objects):\n\n Ember.bind(MyApp.anotherObject, \"value\", \"MyApp.someController.value\");\n\n Both of these code fragments have the same effect as doing the most friendly\n form of binding creation like so:\n\n MyApp.anotherObject = Ember.Object.create({\n valueBinding: \"MyApp.someController.value\",\n\n // OTHER CODE FOR THIS OBJECT...\n\n });\n\n Ember's built in binding creation method makes it easy to automatically\n create bindings for you. You should always use the highest-level APIs\n available, even if you understand how to it works underneath.\n\n @since Ember 0.9\n*/\nEmber.Binding = Binding;\n\n/**\n Global helper method to create a new binding. Just pass the root object\n along with a to and from path to create and connect the binding. The new\n binding object will be returned which you can further configure with\n transforms and other conditions.\n\n @param {Object} obj\n The root object of the transform.\n\n @param {String} to\n The path to the 'to' side of the binding. Must be relative to obj.\n\n @param {String} from\n The path to the 'from' side of the binding. Must be relative to obj or\n a global path.\n\n @returns {Ember.Binding} binding instance\n*/\nEmber.bind = function(obj, to, from) {\n return new Ember.Binding(to, from).connect(obj);\n};\n\nEmber.oneWay = function(obj, to, from) {\n return new Ember.Binding(to, from).oneWay().connect(obj);\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar Mixin, MixinDelegate, REQUIRED, Alias;\nvar classToString, superClassString;\n\nvar a_map = Ember.ArrayUtils.map;\nvar a_indexOf = Ember.ArrayUtils.indexOf;\nvar a_forEach = Ember.ArrayUtils.forEach;\nvar a_slice = Array.prototype.slice;\nvar EMPTY_META = {}; // dummy for non-writable meta\nvar META_SKIP = { __emberproto__: true, __ember_count__: true };\n\nvar o_create = Ember.platform.create;\n\n/** @private */\nfunction meta(obj, writable) {\n var m = Ember.meta(obj, writable!==false), ret = m.mixins;\n if (writable===false) return ret || EMPTY_META;\n\n if (!ret) {\n ret = m.mixins = { __emberproto__: obj };\n } else if (ret.__emberproto__ !== obj) {\n ret = m.mixins = o_create(ret);\n ret.__emberproto__ = obj;\n }\n return ret;\n}\n\n/** @private */\nfunction initMixin(mixin, args) {\n if (args && args.length > 0) {\n mixin.mixins = a_map(args, function(x) {\n if (x instanceof Mixin) return x;\n\n // Note: Manually setup a primitive mixin here. This is the only\n // way to actually get a primitive mixin. This way normal creation\n // of mixins will give you combined mixins...\n var mixin = new Mixin();\n mixin.properties = x;\n return mixin;\n });\n }\n return mixin;\n}\n\nvar NATIVES = [Boolean, Object, Number, Array, Date, String];\n/** @private */\nfunction isMethod(obj) {\n if ('function' !== typeof obj || obj.isMethod===false) return false;\n return a_indexOf(NATIVES, obj)<0;\n}\n\n/** @private */\nfunction mergeMixins(mixins, m, descs, values, base) {\n var len = mixins.length, idx, mixin, guid, props, value, key, ovalue, concats;\n\n /** @private */\n function removeKeys(keyName) {\n delete descs[keyName];\n delete values[keyName];\n }\n\n for(idx=0;idx<len;idx++) {\n\n mixin = mixins[idx];\n if (!mixin) throw new Error('Null value found in Ember.mixin()');\n\n if (mixin instanceof Mixin) {\n guid = Ember.guidFor(mixin);\n if (m[guid]) continue;\n m[guid] = mixin;\n props = mixin.properties;\n } else {\n props = mixin; // apply anonymous mixin properties\n }\n\n if (props) {\n\n // reset before adding each new mixin to pickup concats from previous\n concats = values.concatenatedProperties || base.concatenatedProperties;\n if (props.concatenatedProperties) {\n concats = concats ? concats.concat(props.concatenatedProperties) : props.concatenatedProperties;\n }\n\n for (key in props) {\n if (!props.hasOwnProperty(key)) continue;\n value = props[key];\n if (value instanceof Ember.Descriptor) {\n if (value === REQUIRED && descs[key]) { continue; }\n\n descs[key] = value;\n values[key] = undefined;\n } else {\n\n // impl super if needed...\n if (isMethod(value)) {\n ovalue = (descs[key] === Ember.SIMPLE_PROPERTY) && values[key];\n if (!ovalue) ovalue = base[key];\n if ('function' !== typeof ovalue) ovalue = null;\n if (ovalue) {\n var o = value.__ember_observes__, ob = value.__ember_observesBefore__;\n value = Ember.wrap(value, ovalue);\n value.__ember_observes__ = o;\n value.__ember_observesBefore__ = ob;\n }\n } else if ((concats && a_indexOf(concats, key)>=0) || key === 'concatenatedProperties') {\n var baseValue = values[key] || base[key];\n value = baseValue ? baseValue.concat(value) : Ember.makeArray(value);\n }\n\n descs[key] = Ember.SIMPLE_PROPERTY;\n values[key] = value;\n }\n }\n\n // manually copy toString() because some JS engines do not enumerate it\n if (props.hasOwnProperty('toString')) {\n base.toString = props.toString;\n }\n\n } else if (mixin.mixins) {\n mergeMixins(mixin.mixins, m, descs, values, base);\n if (mixin._without) a_forEach(mixin._without, removeKeys);\n }\n }\n}\n\n/** @private */\nvar defineProperty = Ember.defineProperty;\n\n/** @private */\nfunction writableReq(obj) {\n var m = Ember.meta(obj), req = m.required;\n if (!req || (req.__emberproto__ !== obj)) {\n req = m.required = req ? o_create(req) : { __ember_count__: 0 };\n req.__emberproto__ = obj;\n }\n return req;\n}\n\n/** @private */\nfunction getObserverPaths(value) {\n return ('function' === typeof value) && value.__ember_observes__;\n}\n\n/** @private */\nfunction getBeforeObserverPaths(value) {\n return ('function' === typeof value) && value.__ember_observesBefore__;\n}\n\nvar IS_BINDING = Ember.IS_BINDING = /^.+Binding$/;\n\nfunction detectBinding(obj, key, m) {\n if (IS_BINDING.test(key)) {\n var bindings = m.bindings;\n if (!bindings) {\n bindings = m.bindings = { __emberproto__: obj };\n } else if (bindings.__emberproto__ !== obj) {\n bindings = m.bindings = o_create(m.bindings);\n bindings.__emberproto__ = obj;\n }\n bindings[key] = true;\n }\n}\n\nfunction connectBindings(obj, m) {\n if (m === undefined) {\n m = Ember.meta(obj);\n }\n var bindings = m.bindings, key, binding;\n if (bindings) {\n for (key in bindings) {\n binding = key !== '__emberproto__' && obj[key];\n if (binding) {\n if (binding instanceof Ember.Binding) {\n binding = binding.copy(); // copy prototypes' instance\n binding.to(key.slice(0, -7));\n } else {\n binding = new Ember.Binding(key.slice(0,-7), binding);\n }\n binding.connect(obj);\n obj[key] = binding;\n }\n }\n }\n}\n\n/** @private */\nfunction applyMixin(obj, mixins, partial) {\n var descs = {}, values = {}, m = Ember.meta(obj), req = m.required;\n var key, willApply, didApply, value, desc;\n\n // Go through all mixins and hashes passed in, and:\n //\n // * Handle concatenated properties\n // * Set up _super wrapping if necessary\n // * Set up descriptors (simple, watched or computed properties)\n // * Copying `toString` in broken browsers\n mergeMixins(mixins, meta(obj), descs, values, obj);\n\n if (MixinDelegate.detect(obj)) {\n willApply = values.willApplyProperty || obj.willApplyProperty;\n didApply = values.didApplyProperty || obj.didApplyProperty;\n }\n\n for(key in descs) {\n if (!descs.hasOwnProperty(key)) continue;\n\n desc = descs[key];\n value = values[key];\n\n if (desc === REQUIRED) {\n if (!(key in obj)) {\n if (!partial) throw new Error('Required property not defined: '+key);\n\n // for partial applies add to hash of required keys\n req = writableReq(obj);\n req.__ember_count__++;\n req[key] = true;\n }\n\n } else {\n\n while (desc instanceof Alias) {\n\n var altKey = desc.methodName;\n if (descs[altKey]) {\n value = values[altKey];\n desc = descs[altKey];\n } else if (m.descs[altKey]) {\n desc = m.descs[altKey];\n value = desc.val(obj, altKey);\n } else {\n value = obj[altKey];\n desc = Ember.SIMPLE_PROPERTY;\n }\n }\n\n if (willApply) willApply.call(obj, key);\n\n var observerPaths = getObserverPaths(value),\n curObserverPaths = observerPaths && getObserverPaths(obj[key]),\n beforeObserverPaths = getBeforeObserverPaths(value),\n curBeforeObserverPaths = beforeObserverPaths && getBeforeObserverPaths(obj[key]),\n len, idx;\n\n if (curObserverPaths) {\n len = curObserverPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.removeObserver(obj, curObserverPaths[idx], null, key);\n }\n }\n\n if (curBeforeObserverPaths) {\n len = curBeforeObserverPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.removeBeforeObserver(obj, curBeforeObserverPaths[idx], null,key);\n }\n }\n\n detectBinding(obj, key, m);\n\n defineProperty(obj, key, desc, value);\n\n if (observerPaths) {\n len = observerPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.addObserver(obj, observerPaths[idx], null, key);\n }\n }\n\n if (beforeObserverPaths) {\n len = beforeObserverPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.addBeforeObserver(obj, beforeObserverPaths[idx], null, key);\n }\n }\n\n if (req && req[key]) {\n req = writableReq(obj);\n req.__ember_count__--;\n req[key] = false;\n }\n\n if (didApply) didApply.call(obj, key);\n\n }\n }\n\n if (!partial) { // don't apply to prototype\n value = connectBindings(obj, m);\n }\n\n // Make sure no required attrs remain\n if (!partial && req && req.__ember_count__>0) {\n var keys = [];\n for(key in req) {\n if (META_SKIP[key]) continue;\n keys.push(key);\n }\n throw new Error('Required properties not defined: '+keys.join(','));\n }\n return obj;\n}\n\nEmber.mixin = function(obj) {\n var args = a_slice.call(arguments, 1);\n return applyMixin(obj, args, false);\n};\n\n\n/**\n @constructor\n*/\nEmber.Mixin = function() { return initMixin(this, arguments); };\n\n/** @private */\nMixin = Ember.Mixin;\n\n/** @private */\nMixin._apply = applyMixin;\n\nMixin.applyPartial = function(obj) {\n var args = a_slice.call(arguments, 1);\n return applyMixin(obj, args, true);\n};\n\nMixin.finishPartial = function(obj) {\n connectBindings(obj);\n return obj;\n};\n\nMixin.create = function() {\n classToString.processed = false;\n var M = this;\n return initMixin(new M(), arguments);\n};\n\nMixin.prototype.reopen = function() {\n\n var mixin, tmp;\n\n if (this.properties) {\n mixin = Mixin.create();\n mixin.properties = this.properties;\n delete this.properties;\n this.mixins = [mixin];\n }\n\n var len = arguments.length, mixins = this.mixins, idx;\n\n for(idx=0;idx<len;idx++) {\n mixin = arguments[idx];\n if (mixin instanceof Mixin) {\n mixins.push(mixin);\n } else {\n tmp = Mixin.create();\n tmp.properties = mixin;\n mixins.push(tmp);\n }\n }\n\n return this;\n};\n\nvar TMP_ARRAY = [];\nMixin.prototype.apply = function(obj) {\n TMP_ARRAY[0] = this;\n var ret = applyMixin(obj, TMP_ARRAY, false);\n TMP_ARRAY.length=0;\n return ret;\n};\n\nMixin.prototype.applyPartial = function(obj) {\n TMP_ARRAY[0] = this;\n var ret = applyMixin(obj, TMP_ARRAY, true);\n TMP_ARRAY.length=0;\n return ret;\n};\n\n/** @private */\nfunction _detect(curMixin, targetMixin, seen) {\n var guid = Ember.guidFor(curMixin);\n\n if (seen[guid]) return false;\n seen[guid] = true;\n\n if (curMixin === targetMixin) return true;\n var mixins = curMixin.mixins, loc = mixins ? mixins.length : 0;\n while(--loc >= 0) {\n if (_detect(mixins[loc], targetMixin, seen)) return true;\n }\n return false;\n}\n\nMixin.prototype.detect = function(obj) {\n if (!obj) return false;\n if (obj instanceof Mixin) return _detect(obj, this, {});\n return !!meta(obj, false)[Ember.guidFor(this)];\n};\n\nMixin.prototype.without = function() {\n var ret = new Mixin(this);\n ret._without = a_slice.call(arguments);\n return ret;\n};\n\n/** @private */\nfunction _keys(ret, mixin, seen) {\n if (seen[Ember.guidFor(mixin)]) return;\n seen[Ember.guidFor(mixin)] = true;\n\n if (mixin.properties) {\n var props = mixin.properties;\n for(var key in props) {\n if (props.hasOwnProperty(key)) ret[key] = true;\n }\n } else if (mixin.mixins) {\n a_forEach(mixin.mixins, function(x) { _keys(ret, x, seen); });\n }\n}\n\nMixin.prototype.keys = function() {\n var keys = {}, seen = {}, ret = [];\n _keys(keys, this, seen);\n for(var key in keys) {\n if (keys.hasOwnProperty(key)) ret.push(key);\n }\n return ret;\n};\n\n/** @private - make Mixin's have nice displayNames */\n\nvar NAME_KEY = Ember.GUID_KEY+'_name';\nvar get = Ember.get;\n\n/** @private */\nfunction processNames(paths, root, seen) {\n var idx = paths.length;\n for(var key in root) {\n if (!root.hasOwnProperty || !root.hasOwnProperty(key)) continue;\n var obj = root[key];\n paths[idx] = key;\n\n if (obj && obj.toString === classToString) {\n obj[NAME_KEY] = paths.join('.');\n } else if (obj && get(obj, 'isNamespace')) {\n if (seen[Ember.guidFor(obj)]) continue;\n seen[Ember.guidFor(obj)] = true;\n processNames(paths, obj, seen);\n }\n\n }\n paths.length = idx; // cut out last item\n}\n\n/** @private */\nfunction findNamespaces() {\n var Namespace = Ember.Namespace, obj, isNamespace;\n\n if (Namespace.PROCESSED) { return; }\n\n for (var prop in window) {\n // get(window.globalStorage, 'isNamespace') would try to read the storage for domain isNamespace and cause exception in Firefox.\n // globalStorage is a storage obsoleted by the WhatWG storage specification. See https://developer.mozilla.org/en/DOM/Storage#globalStorage\n if (prop === \"globalStorage\" && window.StorageList && window.globalStorage instanceof window.StorageList) { continue; }\n // Unfortunately, some versions of IE don't support window.hasOwnProperty\n if (window.hasOwnProperty && !window.hasOwnProperty(prop)) { continue; }\n\n // At times we are not allowed to access certain properties for security reasons.\n // There are also times where even if we can access them, we are not allowed to access their properties.\n try {\n obj = window[prop];\n isNamespace = obj && get(obj, 'isNamespace');\n } catch (e) {\n continue;\n }\n\n if (isNamespace) {\n Ember.deprecate(\"Namespaces should not begin with lowercase.\", /^[A-Z]/.test(prop));\n obj[NAME_KEY] = prop;\n }\n }\n}\n\nEmber.identifyNamespaces = findNamespaces;\n\n/** @private */\nsuperClassString = function(mixin) {\n var superclass = mixin.superclass;\n if (superclass) {\n if (superclass[NAME_KEY]) { return superclass[NAME_KEY]; }\n else { return superClassString(superclass); }\n } else {\n return;\n }\n};\n\n/** @private */\nclassToString = function() {\n var Namespace = Ember.Namespace, namespace;\n\n // TODO: Namespace should really be in Metal\n if (Namespace) {\n if (!this[NAME_KEY] && !classToString.processed) {\n if (!Namespace.PROCESSED) {\n findNamespaces();\n Namespace.PROCESSED = true;\n }\n\n classToString.processed = true;\n\n var namespaces = Namespace.NAMESPACES;\n for (var i=0, l=namespaces.length; i<l; i++) {\n namespace = namespaces[i];\n processNames([namespace.toString()], namespace, {});\n }\n }\n }\n\n if (this[NAME_KEY]) {\n return this[NAME_KEY];\n } else {\n var str = superClassString(this);\n if (str) {\n return \"(subclass of \" + str + \")\";\n } else {\n return \"(unknown mixin)\";\n }\n }\n};\n\nMixin.prototype.toString = classToString;\n\n// returns the mixins currently applied to the specified object\n// TODO: Make Ember.mixin\nMixin.mixins = function(obj) {\n var ret = [], mixins = meta(obj, false), key, mixin;\n for(key in mixins) {\n if (META_SKIP[key]) continue;\n mixin = mixins[key];\n\n // skip primitive mixins since these are always anonymous\n if (!mixin.properties) ret.push(mixins[key]);\n }\n return ret;\n};\n\nREQUIRED = new Ember.Descriptor();\nREQUIRED.toString = function() { return '(Required Property)'; };\n\nEmber.required = function() {\n return REQUIRED;\n};\n\n/** @private */\nAlias = function(methodName) {\n this.methodName = methodName;\n};\nAlias.prototype = new Ember.Descriptor();\n\nEmber.alias = function(methodName) {\n return new Alias(methodName);\n};\n\nEmber.MixinDelegate = Mixin.create({\n\n willApplyProperty: Ember.required(),\n didApplyProperty: Ember.required()\n\n});\n\n/** @private */\nMixinDelegate = Ember.MixinDelegate;\n\n\n// ..........................................................\n// OBSERVER HELPER\n//\n\nEmber.observer = function(func) {\n var paths = a_slice.call(arguments, 1);\n func.__ember_observes__ = paths;\n return func;\n};\n\nEmber.beforeObserver = function(func) {\n var paths = a_slice.call(arguments, 1);\n func.__ember_observesBefore__ = paths;\n return func;\n};\n\n\n\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\n/**\n * @license\n * ==========================================================================\n * Ember\n * Copyright ©2006-2011, Strobe Inc. and contributors.\n * Portions copyright ©2008-2011 Apple Inc. All rights reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n *\n * For more information about Ember, visit http://www.emberjs.com\n *\n * ==========================================================================\n */\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals ENV */\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n// ........................................\n// GLOBAL CONSTANTS\n//\n\n// ensure no undefined errors in browsers where console doesn't exist\nif (typeof console === 'undefined') {\n window.console = {};\n console.log = console.info = console.warn = console.error = function() {};\n}\n\n\n// ........................................\n// TYPING & ARRAY MESSAGING\n//\n\nvar TYPE_MAP = {};\nvar t =\"Boolean Number String Function Array Date RegExp Object\".split(\" \");\nEmber.ArrayUtils.forEach(t, function(name) {\n\tTYPE_MAP[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\nvar toString = Object.prototype.toString;\n\n/**\n Returns a consistent type for the passed item.\n\n Use this instead of the built-in Ember.typeOf() to get the type of an item.\n It will return the same result across all browsers and includes a bit\n more detail. Here is what will be returned:\n\n | Return Value | Meaning |\n |---------------|------------------------------------------------------|\n | 'string' | String primitive |\n | 'number' | Number primitive |\n | 'boolean' | Boolean primitive |\n | 'null' | Null value |\n | 'undefined' | Undefined value |\n | 'function' | A function |\n | 'array' | An instance of Array |\n | 'class' | A Ember class (created using Ember.Object.extend()) |\n | 'instance' | A Ember object instance |\n | 'error' | An instance of the Error object |\n | 'object' | A JavaScript object not inheriting from Ember.Object |\n\n Examples:\n\n Ember.typeOf(); => 'undefined'\n Ember.typeOf(null); => 'null'\n Ember.typeOf(undefined); => 'undefined'\n Ember.typeOf('michael'); => 'string'\n Ember.typeOf(101); => 'number'\n Ember.typeOf(true); => 'boolean'\n Ember.typeOf(Ember.makeArray); => 'function'\n Ember.typeOf([1,2,90]); => 'array'\n Ember.typeOf(Ember.Object.extend()); => 'class'\n Ember.typeOf(Ember.Object.create()); => 'instance'\n Ember.typeOf(new Error('teamocil')); => 'error'\n\n // \"normal\" JavaScript object\n Ember.typeOf({a: 'b'}); => 'object'\n\n @param item {Object} the item to check\n @returns {String} the type\n*/\nEmber.typeOf = function(item) {\n var ret;\n\n ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';\n\n if (ret === 'function') {\n if (Ember.Object && Ember.Object.detect(item)) ret = 'class';\n } else if (ret === 'object') {\n if (item instanceof Error) ret = 'error';\n else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';\n else ret = 'object';\n }\n\n return ret;\n};\n\n/**\n Returns true if the passed value is null or undefined. This avoids errors\n from JSLint complaining about use of ==, which can be technically\n confusing.\n\n Ember.none(); => true\n Ember.none(null); => true\n Ember.none(undefined); => true\n Ember.none(''); => false\n Ember.none([]); => false\n Ember.none(function(){}); => false\n\n @param {Object} obj Value to test\n @returns {Boolean}\n*/\nEmber.none = function(obj) {\n return obj === null || obj === undefined;\n};\n\n/**\n Verifies that a value is null or an empty string | array | function.\n\n Constrains the rules on `Ember.none` by returning false for empty\n string and empty arrays.\n\n Ember.empty(); => true\n Ember.empty(null); => true\n Ember.empty(undefined); => true\n Ember.empty(''); => true\n Ember.empty([]); => true\n Ember.empty('tobias fünke'); => false\n Ember.empty([0,1,2]); => false\n\n @param {Object} obj Value to test\n @returns {Boolean}\n*/\nEmber.empty = function(obj) {\n return obj === null || obj === undefined || (obj.length === 0 && typeof obj !== 'function');\n};\n\n/**\n This will compare two javascript values of possibly different types.\n It will tell you which one is greater than the other by returning:\n\n - -1 if the first is smaller than the second,\n - 0 if both are equal,\n - 1 if the first is greater than the second.\n\n The order is calculated based on Ember.ORDER_DEFINITION, if types are different.\n In case they have the same type an appropriate comparison for this type is made.\n\n Ember.compare('hello', 'hello'); => 0\n Ember.compare('abc', 'dfg'); => -1\n Ember.compare(2, 1); => 1\n\n @param {Object} v First value to compare\n @param {Object} w Second value to compare\n @returns {Number} -1 if v < w, 0 if v = w and 1 if v > w.\n*/\nEmber.compare = function compare(v, w) {\n if (v === w) { return 0; }\n\n var type1 = Ember.typeOf(v);\n var type2 = Ember.typeOf(w);\n\n var Comparable = Ember.Comparable;\n if (Comparable) {\n if (type1==='instance' && Comparable.detect(v.constructor)) {\n return v.constructor.compare(v, w);\n }\n\n if (type2 === 'instance' && Comparable.detect(w.constructor)) {\n return 1-w.constructor.compare(w, v);\n }\n }\n\n // If we haven't yet generated a reverse-mapping of Ember.ORDER_DEFINITION,\n // do so now.\n var mapping = Ember.ORDER_DEFINITION_MAPPING;\n if (!mapping) {\n var order = Ember.ORDER_DEFINITION;\n mapping = Ember.ORDER_DEFINITION_MAPPING = {};\n var idx, len;\n for (idx = 0, len = order.length; idx < len; ++idx) {\n mapping[order[idx]] = idx;\n }\n\n // We no longer need Ember.ORDER_DEFINITION.\n delete Ember.ORDER_DEFINITION;\n }\n\n var type1Index = mapping[type1];\n var type2Index = mapping[type2];\n\n if (type1Index < type2Index) { return -1; }\n if (type1Index > type2Index) { return 1; }\n\n // types are equal - so we have to check values now\n switch (type1) {\n case 'boolean':\n case 'number':\n if (v < w) { return -1; }\n if (v > w) { return 1; }\n return 0;\n\n case 'string':\n var comp = v.localeCompare(w);\n if (comp < 0) { return -1; }\n if (comp > 0) { return 1; }\n return 0;\n\n case 'array':\n var vLen = v.length;\n var wLen = w.length;\n var l = Math.min(vLen, wLen);\n var r = 0;\n var i = 0;\n while (r === 0 && i < l) {\n r = compare(v[i],w[i]);\n i++;\n }\n if (r !== 0) { return r; }\n\n // all elements are equal now\n // shorter array should be ordered first\n if (vLen < wLen) { return -1; }\n if (vLen > wLen) { return 1; }\n // arrays are equal now\n return 0;\n\n case 'instance':\n if (Ember.Comparable && Ember.Comparable.detect(v)) {\n return v.compare(v, w);\n }\n return 0;\n\n default:\n return 0;\n }\n};\n\n/** @private */\nfunction _copy(obj, deep, seen, copies) {\n var ret, loc, key;\n\n // primitive data types are immutable, just return them.\n if ('object' !== typeof obj || obj===null) return obj;\n\n // avoid cyclical loops\n if (deep && (loc=indexOf(seen, obj))>=0) return copies[loc];\n\n Ember.assert('Cannot clone an Ember.Object that does not implement Ember.Copyable', !(obj instanceof Ember.Object) || (Ember.Copyable && Ember.Copyable.detect(obj)));\n\n // IMPORTANT: this specific test will detect a native array only. Any other\n // object will need to implement Copyable.\n if (Ember.typeOf(obj) === 'array') {\n ret = obj.slice();\n if (deep) {\n loc = ret.length;\n while(--loc>=0) ret[loc] = _copy(ret[loc], deep, seen, copies);\n }\n } else if (Ember.Copyable && Ember.Copyable.detect(obj)) {\n ret = obj.copy(deep, seen, copies);\n } else {\n ret = {};\n for(key in obj) {\n if (!obj.hasOwnProperty(key)) continue;\n ret[key] = deep ? _copy(obj[key], deep, seen, copies) : obj[key];\n }\n }\n\n if (deep) {\n seen.push(obj);\n copies.push(ret);\n }\n\n return ret;\n}\n\n/**\n Creates a clone of the passed object. This function can take just about\n any type of object and create a clone of it, including primitive values\n (which are not actually cloned because they are immutable).\n\n If the passed object implements the clone() method, then this function\n will simply call that method and return the result.\n\n @param {Object} object The object to clone\n @param {Boolean} deep If true, a deep copy of the object is made\n @returns {Object} The cloned object\n*/\nEmber.copy = function(obj, deep) {\n // fast paths\n if ('object' !== typeof obj || obj===null) return obj; // can't copy primitives\n if (Ember.Copyable && Ember.Copyable.detect(obj)) return obj.copy(deep);\n return _copy(obj, deep, deep ? [] : null, deep ? [] : null);\n};\n\n/**\n Convenience method to inspect an object. This method will attempt to\n convert the object into a useful string description.\n\n @param {Object} obj The object you want to inspect.\n @returns {String} A description of the object\n*/\nEmber.inspect = function(obj) {\n var v, ret = [];\n for(var key in obj) {\n if (obj.hasOwnProperty(key)) {\n v = obj[key];\n if (v === 'toString') { continue; } // ignore useless items\n if (Ember.typeOf(v) === 'function') { v = \"function() { ... }\"; }\n ret.push(key + \": \" + v);\n }\n }\n return \"{\" + ret.join(\" , \") + \"}\";\n};\n\n/**\n Compares two objects, returning true if they are logically equal. This is\n a deeper comparison than a simple triple equal. For sets it will compare the\n internal objects. For any other object that implements `isEqual()` it will \n respect that method.\n\n Ember.isEqual('hello', 'hello'); => true\n Ember.isEqual(1, 2); => false\n Ember.isEqual([4,2], [4,2]); => false\n\n @param {Object} a first object to compare\n @param {Object} b second object to compare\n @returns {Boolean}\n*/\nEmber.isEqual = function(a, b) {\n if (a && 'function'===typeof a.isEqual) return a.isEqual(b);\n return a === b;\n};\n\n/**\n @private\n Used by Ember.compare\n*/\nEmber.ORDER_DEFINITION = Ember.ENV.ORDER_DEFINITION || [\n 'undefined',\n 'null',\n 'boolean',\n 'number',\n 'string',\n 'array',\n 'object',\n 'instance',\n 'function',\n 'class'\n];\n\n/**\n Returns all of the keys defined on an object or hash. This is useful\n when inspecting objects for debugging. On browsers that support it, this\n uses the native Object.keys implementation.\n\n @function\n @param {Object} obj\n @returns {Array} Array containing keys of obj\n*/\nEmber.keys = Object.keys;\n\nif (!Ember.keys) {\n Ember.keys = function(obj) {\n var ret = [];\n for(var key in obj) {\n if (obj.hasOwnProperty(key)) { ret.push(key); }\n }\n return ret;\n };\n}\n\n// ..........................................................\n// ERROR\n//\n\n/**\n @class\n\n A subclass of the JavaScript Error object for use in Ember.\n*/\nEmber.Error = function() {\n var tmp = Error.prototype.constructor.apply(this, arguments);\n\n for (var p in tmp) {\n if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }\n }\n this.message = tmp.message;\n};\n\nEmber.Error.prototype = Ember.create(Error.prototype);\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/** @private **/\nvar STRING_DASHERIZE_REGEXP = (/[ _]/g);\nvar STRING_DASHERIZE_CACHE = {};\nvar STRING_DECAMELIZE_REGEXP = (/([a-z])([A-Z])/g);\nvar STRING_CAMELIZE_REGEXP = (/(\\-|_|\\s)+(.)?/g);\nvar STRING_UNDERSCORE_REGEXP_1 = (/([a-z\\d])([A-Z]+)/g);\nvar STRING_UNDERSCORE_REGEXP_2 = (/\\-|\\s+/g);\n\n/**\n Defines the hash of localized strings for the current language. Used by\n the `Ember.String.loc()` helper. To localize, add string values to this\n hash.\n\n @property {String}\n*/\nEmber.STRINGS = {};\n\n/**\n Defines string helper methods including string formatting and localization.\n Unless Ember.EXTEND_PROTOTYPES = false these methods will also be added to the\n String.prototype as well.\n\n @namespace\n*/\nEmber.String = {\n\n /**\n Apply formatting options to the string. This will look for occurrences\n of %@ in your string and substitute them with the arguments you pass into\n this method. If you want to control the specific order of replacement,\n you can add a number after the key as well to indicate which argument\n you want to insert.\n\n Ordered insertions are most useful when building loc strings where values\n you need to insert may appear in different orders.\n\n \"Hello %@ %@\".fmt('John', 'Doe') => \"Hello John Doe\"\n \"Hello %@2, %@1\".fmt('John', 'Doe') => \"Hello Doe, John\"\n\n @param {Object...} [args]\n @returns {String} formatted string\n */\n fmt: function(str, formats) {\n // first, replace any ORDERED replacements.\n var idx = 0; // the current index for non-numerical replacements\n return str.replace(/%@([0-9]+)?/g, function(s, argIndex) {\n argIndex = (argIndex) ? parseInt(argIndex,0) - 1 : idx++ ;\n s = formats[argIndex];\n return ((s === null) ? '(null)' : (s === undefined) ? '' : s).toString();\n }) ;\n },\n\n /**\n Formats the passed string, but first looks up the string in the localized\n strings hash. This is a convenient way to localize text. See\n `Ember.String.fmt()` for more information on formatting.\n\n Note that it is traditional but not required to prefix localized string\n keys with an underscore or other character so you can easily identify\n localized strings.\n\n Ember.STRINGS = {\n '_Hello World': 'Bonjour le monde',\n '_Hello %@ %@': 'Bonjour %@ %@'\n };\n\n Ember.String.loc(\"_Hello World\");\n => 'Bonjour le monde';\n\n Ember.String.loc(\"_Hello %@ %@\", [\"John\", \"Smith\"]);\n => \"Bonjour John Smith\";\n\n @param {String} str\n The string to format\n\n @param {Array} formats\n Optional array of parameters to interpolate into string.\n\n @returns {String} formatted string\n */\n loc: function(str, formats) {\n str = Ember.STRINGS[str] || str;\n return Ember.String.fmt(str, formats) ;\n },\n\n /**\n Splits a string into separate units separated by spaces, eliminating any\n empty strings in the process. This is a convenience method for split that\n is mostly useful when applied to the String.prototype.\n\n Ember.String.w(\"alpha beta gamma\").forEach(function(key) {\n console.log(key);\n });\n > alpha\n > beta\n > gamma\n\n @param {String} str \n The string to split\n\n @returns {String} split string\n */\n w: function(str) { return str.split(/\\s+/); },\n\n /**\n Converts a camelized string into all lower case separated by underscores.\n \n 'innerHTML'.decamelize() => 'inner_html'\n 'action_name'.decamelize() => 'action_name'\n 'css-class-name'.decamelize() => 'css-class-name'\n 'my favorite items'.decamelize() => 'my favorite items'\n\n @param {String} str\n The string to decamelize.\n\n @returns {String} the decamelized string.\n */\n decamelize: function(str) {\n return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();\n },\n\n /**\n Replaces underscores or spaces with dashes.\n \n 'innerHTML'.dasherize() => 'inner-html'\n 'action_name'.dasherize() => 'action-name'\n 'css-class-name'.dasherize() => 'css-class-name'\n 'my favorite items'.dasherize() => 'my-favorite-items'\n\n @param {String} str\n The string to dasherize.\n\n @returns {String} the dasherized string.\n */\n dasherize: function(str) {\n var cache = STRING_DASHERIZE_CACHE,\n ret = cache[str];\n\n if (ret) {\n return ret;\n } else {\n ret = Ember.String.decamelize(str).replace(STRING_DASHERIZE_REGEXP,'-');\n cache[str] = ret;\n }\n\n return ret;\n },\n\n /**\n Returns the lowerCaseCamel form of a string.\n \n 'innerHTML'.camelize() => 'innerHTML'\n 'action_name'.camelize() => 'actionName'\n 'css-class-name'.camelize() => 'cssClassName'\n 'my favorite items'.camelize() => 'myFavoriteItems'\n\n @param {String} str\n The string to camelize.\n\n @returns {String} the camelized string.\n */\n camelize: function(str) {\n return str.replace(STRING_CAMELIZE_REGEXP, function(match, separator, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n /**\n More general than decamelize. Returns the lower_case_and_underscored\n form of a string.\n\n 'innerHTML'.underscore() => 'inner_html'\n 'action_name'.underscore() => 'action_name'\n 'css-class-name'.underscore() => 'css_class_name'\n 'my favorite items'.underscore() => 'my_favorite_items'\n\n @param {String} str\n The string to underscore.\n\n @returns {String} the underscored string.\n */\n underscore: function(str) {\n return str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').\n replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase();\n }\n};\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar fmt = Ember.String.fmt,\n w = Ember.String.w,\n loc = Ember.String.loc,\n camelize = Ember.String.camelize,\n decamelize = Ember.String.decamelize,\n dasherize = Ember.String.dasherize,\n underscore = Ember.String.underscore;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n @see Ember.String.fmt\n */\n String.prototype.fmt = function() {\n return fmt(this, arguments);\n };\n\n /**\n @see Ember.String.w\n */\n String.prototype.w = function() {\n return w(this);\n };\n\n /**\n @see Ember.String.loc\n */\n String.prototype.loc = function() {\n return loc(this, arguments);\n };\n\n /**\n @see Ember.String.camelize\n */\n String.prototype.camelize = function() {\n return camelize(this);\n };\n\n /**\n @see Ember.String.decamelize\n */\n String.prototype.decamelize = function() {\n return decamelize(this);\n };\n\n /**\n @see Ember.String.dasherize\n */\n String.prototype.dasherize = function() {\n return dasherize(this);\n };\n\n /**\n @see Ember.String.underscore\n */\n String.prototype.underscore = function() {\n return underscore(this);\n };\n\n}\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar a_slice = Array.prototype.slice;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n The `property` extension of Javascript's Function prototype is available\n when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n Computed properties allow you to treat a function like a property:\n\n MyApp.president = Ember.Object.create({\n firstName: \"Barack\",\n lastName: \"Obama\",\n\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Call this flag to mark the function as a property\n }.property()\n });\n\n MyApp.president.get('fullName'); => \"Barack Obama\"\n\n Treating a function like a property is useful because they can work with\n bindings, just like any other property.\n\n Many computed properties have dependencies on other properties. For\n example, in the above example, the `fullName` property depends on\n `firstName` and `lastName` to determine its value. You can tell Ember.js\n about these dependencies like this:\n\n MyApp.president = Ember.Object.create({\n firstName: \"Barack\",\n lastName: \"Obama\",\n\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Tell Ember.js that this computed property depends on firstName\n // and lastName\n }.property('firstName', 'lastName')\n });\n\n Make sure you list these dependencies so Ember.js knows when to update\n bindings that connect to a computed property. Changing a dependency\n will not immediately trigger an update of the computed property, but\n will instead clear the cache so that it is updated when the next `get`\n is called on the property.\n\n Note: you will usually want to use `property(...)` with `cacheable()`.\n\n @see Ember.ComputedProperty\n @see Ember.computed\n */\n Function.prototype.property = function() {\n var ret = Ember.computed(this);\n return ret.property.apply(ret, arguments);\n };\n\n /**\n The `observes` extension of Javascript's Function prototype is available\n when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n You can observe property changes simply by adding the `observes`\n call to the end of your method declarations in classes that you write.\n For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property changes\n }.observes('value')\n });\n \n @see Ember.Observable\n */\n Function.prototype.observes = function() {\n this.__ember_observes__ = a_slice.call(arguments);\n return this;\n };\n\n /**\n The `observesBefore` extension of Javascript's Function prototype is\n available when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n You can get notified when a property changes is about to happen by\n by adding the `observesBefore` call to the end of your method\n declarations in classes that you write. For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property is about to change\n }.observesBefore('value')\n });\n \n @see Ember.Observable\n */\n Function.prototype.observesBefore = function() {\n this.__ember_observesBefore__ = a_slice.call(arguments);\n return this;\n };\n\n}\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n\n\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set;\nvar a_slice = Array.prototype.slice;\nvar a_indexOf = Ember.ArrayUtils.indexOf;\n\nvar contexts = [];\n/** @private */\nfunction popCtx() {\n return contexts.length===0 ? {} : contexts.pop();\n}\n\n/** @private */\nfunction pushCtx(ctx) {\n contexts.push(ctx);\n return null;\n}\n\n/** @private */\nfunction iter(key, value) {\n var valueProvided = arguments.length === 2;\n\n function i(item) {\n var cur = get(item, key);\n return valueProvided ? value===cur : !!cur;\n }\n return i ;\n}\n\n/** @private */\nfunction xform(target, method, params) {\n method.call(target, params[0], params[2], params[3]);\n}\n\n/**\n @class\n\n This mixin defines the common interface implemented by enumerable objects\n in Ember. Most of these methods follow the standard Array iteration\n API defined up to JavaScript 1.8 (excluding language-specific features that\n cannot be emulated in older versions of JavaScript).\n\n This mixin is applied automatically to the Array class on page load, so you\n can use any of these methods on simple arrays. If Array already implements\n one of these methods, the mixin will not override them.\n\n h3. Writing Your Own Enumerable\n\n To make your own custom class enumerable, you need two items:\n\n 1. You must have a length property. This property should change whenever\n the number of items in your enumerable object changes. If you using this\n with an Ember.Object subclass, you should be sure to change the length\n property using set().\n\n 2. If you must implement nextObject(). See documentation.\n\n Once you have these two methods implement, apply the Ember.Enumerable mixin\n to your class and you will be able to enumerate the contents of your object\n like any other collection.\n\n h3. Using Ember Enumeration with Other Libraries\n\n Many other libraries provide some kind of iterator or enumeration like\n facility. This is often where the most common API conflicts occur.\n Ember's API is designed to be as friendly as possible with other\n libraries by implementing only methods that mostly correspond to the\n JavaScript 1.8 API.\n\n @since Ember 0.9\n*/\nEmber.Enumerable = Ember.Mixin.create( /** @lends Ember.Enumerable */ {\n\n /** @private - compatibility */\n isEnumerable: true,\n\n /**\n Implement this method to make your class enumerable.\n\n This method will be call repeatedly during enumeration. The index value\n will always begin with 0 and increment monotonically. You don't have to\n rely on the index value to determine what object to return, but you should\n always check the value and start from the beginning when you see the\n requested index is 0.\n\n The previousObject is the object that was returned from the last call\n to nextObject for the current iteration. This is a useful way to\n manage iteration if you are tracing a linked list, for example.\n\n Finally the context parameter will always contain a hash you can use as\n a \"scratchpad\" to maintain any other state you need in order to iterate\n properly. The context object is reused and is not reset between\n iterations so make sure you setup the context with a fresh state whenever\n the index parameter is 0.\n\n Generally iterators will continue to call nextObject until the index\n reaches the your current length-1. If you run out of data before this\n time for some reason, you should simply return undefined.\n\n The default implementation of this method simply looks up the index.\n This works great on any Array-like objects.\n\n @param index {Number} the current index of the iteration\n @param previousObject {Object} the value returned by the last call to nextObject.\n @param context {Object} a context object you can use to maintain state.\n @returns {Object} the next object in the iteration or undefined\n */\n nextObject: Ember.required(Function),\n\n /**\n Helper method returns the first object from a collection. This is usually\n used by bindings and other parts of the framework to extract a single\n object if the enumerable contains only one item.\n\n If you override this method, you should implement it so that it will\n always return the same value each time it is called. If your enumerable\n contains only one object, this method should always return that object.\n If your enumerable is empty, this method should return undefined.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.firstObject(); => \"a\"\n\n var arr = [];\n arr.firstObject(); => undefined\n\n @returns {Object} the object or undefined\n */\n firstObject: Ember.computed(function() {\n if (get(this, 'length')===0) return undefined ;\n\n // handle generic enumerables\n var context = popCtx(), ret;\n ret = this.nextObject(0, null, context);\n pushCtx(context);\n return ret ;\n }).property('[]').cacheable(),\n\n /**\n Helper method returns the last object from a collection. If your enumerable\n contains only one object, this method should always return that object.\n If your enumerable is empty, this method should return undefined.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.lastObject(); => \"c\"\n\n var arr = [];\n arr.lastObject(); => undefined\n\n @returns {Object} the last object or undefined\n */\n lastObject: Ember.computed(function() {\n var len = get(this, 'length');\n if (len===0) return undefined ;\n var context = popCtx(), idx=0, cur, last = null;\n do {\n last = cur;\n cur = this.nextObject(idx++, last, context);\n } while (cur !== undefined);\n pushCtx(context);\n return last;\n }).property('[]').cacheable(),\n\n /**\n Returns true if the passed object can be found in the receiver. The\n default version will iterate through the enumerable until the object\n is found. You may want to override this with a more efficient version.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.contains(\"a\"); => true\n arr.contains(\"z\"); => false\n\n @param {Object} obj\n The object to search for.\n\n @returns {Boolean} true if object is found in enumerable.\n */\n contains: function(obj) {\n return this.find(function(item) { return item===obj; }) !== undefined;\n },\n\n /**\n Iterates through the enumerable, calling the passed function on each\n item. This method corresponds to the forEach() method defined in\n JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Object} receiver\n */\n forEach: function(callback, target) {\n if (typeof callback !== \"function\") throw new TypeError() ;\n var len = get(this, 'length'), last = null, context = popCtx();\n\n if (target === undefined) target = null;\n\n for(var idx=0;idx<len;idx++) {\n var next = this.nextObject(idx, last, context) ;\n callback.call(target, next, idx, this);\n last = next ;\n }\n last = null ;\n context = pushCtx(context);\n return this ;\n },\n\n /**\n Alias for mapProperty\n\n @params key {String} name of the property\n @returns {Array} The mapped array.\n */\n getEach: function(key) {\n return this.mapProperty(key);\n },\n\n /**\n Sets the value on the named property for each member. This is more\n efficient than using other methods defined on this helper. If the object\n implements Ember.Observable, the value will be changed to set(), otherwise\n it will be set directly. null objects are skipped.\n\n @param {String} key The key to set\n @param {Object} value The object to set\n @returns {Object} receiver\n */\n setEach: function(key, value) {\n return this.forEach(function(item) {\n set(item, key, value);\n });\n },\n\n /**\n Maps all of the items in the enumeration to another value, returning\n a new array. This method corresponds to map() defined in JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the mapped value.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Array} The mapped array.\n */\n map: function(callback, target) {\n var ret = [];\n this.forEach(function(x, idx, i) {\n ret[idx] = callback.call(target, x, idx,i);\n });\n return ret ;\n },\n\n /**\n Similar to map, this specialized function returns the value of the named\n property on all items in the enumeration.\n\n @params key {String} name of the property\n @returns {Array} The mapped array.\n */\n mapProperty: function(key) {\n return this.map(function(next) {\n return get(next, key);\n });\n },\n\n /**\n Returns an array with all of the items in the enumeration that the passed\n function returns true for. This method corresponds to filter() defined in\n JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true to include the item in the results, false otherwise.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Array} A filtered array.\n */\n filter: function(callback, target) {\n var ret = [];\n this.forEach(function(x, idx, i) {\n if (callback.call(target, x, idx, i)) ret.push(x);\n });\n return ret ;\n },\n\n /**\n Returns an array with just the items with the matched property. You\n can pass an optional second argument with the target value. Otherwise\n this will match any property that evaluates to true.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Array} filtered array\n */\n filterProperty: function(key, value) {\n return this.filter(iter.apply(this, arguments));\n },\n\n /**\n Returns the first item in the array for which the callback returns true.\n This method works similar to the filter() method defined in JavaScript 1.6\n except that it will stop working on the array once a match is found.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true to include the item in the results, false otherwise.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Object} Found item or null.\n */\n find: function(callback, target) {\n var len = get(this, 'length') ;\n if (target === undefined) target = null;\n\n var last = null, next, found = false, ret ;\n var context = popCtx();\n for(var idx=0;idx<len && !found;idx++) {\n next = this.nextObject(idx, last, context) ;\n if (found = callback.call(target, next, idx, this)) ret = next ;\n last = next ;\n }\n next = last = null ;\n context = pushCtx(context);\n return ret ;\n },\n\n /**\n Returns an the first item with a property matching the passed value. You\n can pass an optional second argument with the target value. Otherwise\n this will match any property that evaluates to true.\n\n This method works much like the more generic find() method.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Object} found item or null\n */\n findProperty: function(key, value) {\n return this.find(iter.apply(this, arguments));\n },\n\n /**\n Returns true if the passed function returns true for every item in the\n enumeration. This corresponds with the every() method in JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true or false.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n Example Usage:\n\n if (people.every(isEngineer)) { Paychecks.addBigBonus(); }\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Boolean}\n */\n every: function(callback, target) {\n return !this.find(function(x, idx, i) {\n return !callback.call(target, x, idx, i);\n });\n },\n\n /**\n Returns true if the passed property resolves to true for all items in the\n enumerable. This method is often simpler/faster than using a callback.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Array} filtered array\n */\n everyProperty: function(key, value) {\n return this.every(iter.apply(this, arguments));\n },\n\n\n /**\n Returns true if the passed function returns true for any item in the\n enumeration. This corresponds with the every() method in JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true to include the item in the results, false otherwise.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n Usage Example:\n\n if (people.some(isManager)) { Paychecks.addBiggerBonus(); }\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Array} A filtered array.\n */\n some: function(callback, target) {\n return !!this.find(function(x, idx, i) {\n return !!callback.call(target, x, idx, i);\n });\n },\n\n /**\n Returns true if the passed property resolves to true for any item in the\n enumerable. This method is often simpler/faster than using a callback.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Boolean} true\n */\n someProperty: function(key, value) {\n return this.some(iter.apply(this, arguments));\n },\n\n /**\n This will combine the values of the enumerator into a single value. It\n is a useful way to collect a summary value from an enumeration. This\n corresponds to the reduce() method defined in JavaScript 1.8.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(previousValue, item, index, enumerable);\n\n - *previousValue* is the value returned by the last call to the iterator.\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n Return the new cumulative value.\n\n In addition to the callback you can also pass an initialValue. An error\n will be raised if you do not pass an initial value and the enumerator is\n empty.\n\n Note that unlike the other methods, this method does not allow you to\n pass a target object to set as this for the callback. It's part of the\n spec. Sorry.\n\n @param {Function} callback The callback to execute\n @param {Object} initialValue Initial value for the reduce\n @param {String} reducerProperty internal use only.\n @returns {Object} The reduced value.\n */\n reduce: function(callback, initialValue, reducerProperty) {\n if (typeof callback !== \"function\") { throw new TypeError(); }\n\n var ret = initialValue;\n\n this.forEach(function(item, i) {\n ret = callback.call(null, ret, item, i, this, reducerProperty);\n }, this);\n\n return ret;\n },\n\n /**\n Invokes the named method on every object in the receiver that\n implements it. This method corresponds to the implementation in\n Prototype 1.6.\n\n @param methodName {String} the name of the method\n @param args {Object...} optional arguments to pass as well.\n @returns {Array} return values from calling invoke.\n */\n invoke: function(methodName) {\n var args, ret = [];\n if (arguments.length>1) args = a_slice.call(arguments, 1);\n\n this.forEach(function(x, idx) {\n var method = x && x[methodName];\n if ('function' === typeof method) {\n ret[idx] = args ? method.apply(x, args) : method.call(x);\n }\n }, this);\n\n return ret;\n },\n\n /**\n Simply converts the enumerable into a genuine array. The order is not\n guaranteed. Corresponds to the method implemented by Prototype.\n\n @returns {Array} the enumerable as an array.\n */\n toArray: function() {\n var ret = [];\n this.forEach(function(o, idx) { ret[idx] = o; });\n return ret ;\n },\n\n /**\n Returns a copy of the array with all null elements removed.\n \n var arr = [\"a\", null, \"c\", null];\n arr.compact(); => [\"a\", \"c\"] \n\n @returns {Array} the array without null elements.\n */\n compact: function() { return this.without(null); },\n\n /**\n Returns a new enumerable that excludes the passed value. The default\n implementation returns an array regardless of the receiver type unless\n the receiver does not contain the value.\n\n var arr = [\"a\", \"b\", \"a\", \"c\"];\n arr.without(\"a\"); => [\"b\", \"c\"]\n\n @param {Object} value\n @returns {Ember.Enumerable}\n */\n without: function(value) {\n if (!this.contains(value)) return this; // nothing to do\n var ret = [] ;\n this.forEach(function(k) {\n if (k !== value) ret[ret.length] = k;\n }) ;\n return ret ;\n },\n\n /**\n Returns a new enumerable that contains only unique values. The default\n implementation returns an array regardless of the receiver type.\n\n var arr = [\"a\", \"a\", \"b\", \"b\"];\n arr.uniq(); => [\"a\", \"b\"]\n\n @returns {Ember.Enumerable}\n */\n uniq: function() {\n var ret = [];\n this.forEach(function(k){\n if (a_indexOf(ret, k)<0) ret.push(k);\n });\n return ret;\n },\n\n /**\n This property will trigger anytime the enumerable's content changes.\n You can observe this property to be notified of changes to the enumerables\n content.\n\n For plain enumerables, this property is read only. Ember.Array overrides\n this method.\n\n @property {Ember.Array}\n */\n '[]': Ember.computed(function(key, value) {\n return this;\n }).property().cacheable(),\n\n // ..........................................................\n // ENUMERABLE OBSERVERS\n //\n\n /**\n Registers an enumerable observer. Must implement Ember.EnumerableObserver\n mixin.\n */\n addEnumerableObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'enumerableWillChange',\n didChange = (opts && opts.didChange) || 'enumerableDidChange';\n\n var hasObservers = get(this, 'hasEnumerableObservers');\n if (!hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');\n Ember.addListener(this, '@enumerable:before', target, willChange, xform);\n Ember.addListener(this, '@enumerable:change', target, didChange, xform);\n if (!hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');\n return this;\n },\n\n /**\n Removes a registered enumerable observer.\n */\n removeEnumerableObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'enumerableWillChange',\n didChange = (opts && opts.didChange) || 'enumerableDidChange';\n\n var hasObservers = get(this, 'hasEnumerableObservers');\n if (hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');\n Ember.removeListener(this, '@enumerable:before', target, willChange);\n Ember.removeListener(this, '@enumerable:change', target, didChange);\n if (hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');\n return this;\n },\n\n /**\n Becomes true whenever the array currently has observers watching changes\n on the array.\n\n @property {Boolean}\n */\n hasEnumerableObservers: Ember.computed(function() {\n return Ember.hasListeners(this, '@enumerable:change') || Ember.hasListeners(this, '@enumerable:before');\n }).property().cacheable(),\n\n\n /**\n Invoke this method just before the contents of your enumerable will\n change. You can either omit the parameters completely or pass the objects\n to be removed or added if available or just a count.\n\n @param {Ember.Enumerable|Number} removing\n An enumerable of the objects to be removed or the number of items to\n be removed.\n\n @param {Ember.Enumerable|Number} adding\n An enumerable of the objects to be added or the number of items to be\n added.\n\n @returns {Ember.Enumerable} receiver\n */\n enumerableContentWillChange: function(removing, adding) {\n\n var removeCnt, addCnt, hasDelta;\n\n if ('number' === typeof removing) removeCnt = removing;\n else if (removing) removeCnt = get(removing, 'length');\n else removeCnt = removing = -1;\n\n if ('number' === typeof adding) addCnt = adding;\n else if (adding) addCnt = get(adding,'length');\n else addCnt = adding = -1;\n\n hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;\n\n if (removing === -1) removing = null;\n if (adding === -1) adding = null;\n\n Ember.propertyWillChange(this, '[]');\n if (hasDelta) Ember.propertyWillChange(this, 'length');\n Ember.sendEvent(this, '@enumerable:before', removing, adding);\n\n return this;\n },\n\n /**\n Invoke this method when the contents of your enumerable has changed.\n This will notify any observers watching for content changes. If your are\n implementing an ordered enumerable (such as an array), also pass the\n start and end values where the content changed so that it can be used to\n notify range observers.\n\n @param {Number} start\n optional start offset for the content change. For unordered\n enumerables, you should always pass -1.\n\n @param {Ember.Enumerable|Number} removing\n An enumerable of the objects to be removed or the number of items to\n be removed.\n\n @param {Ember.Enumerable|Numbe} adding\n An enumerable of the objects to be added or the number of items to be\n added.\n\n @returns {Object} receiver\n */\n enumerableContentDidChange: function(removing, adding) {\n var notify = this.propertyDidChange, removeCnt, addCnt, hasDelta;\n\n if ('number' === typeof removing) removeCnt = removing;\n else if (removing) removeCnt = get(removing, 'length');\n else removeCnt = removing = -1;\n\n if ('number' === typeof adding) addCnt = adding;\n else if (adding) addCnt = get(adding, 'length');\n else addCnt = adding = -1;\n\n hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;\n\n if (removing === -1) removing = null;\n if (adding === -1) adding = null;\n\n Ember.sendEvent(this, '@enumerable:change', removing, adding);\n if (hasDelta) Ember.propertyDidChange(this, 'length');\n Ember.propertyDidChange(this, '[]');\n\n return this ;\n }\n\n}) ;\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set, meta = Ember.meta, map = Ember.ArrayUtils.map;\n\n/** @private */\nfunction none(obj) { return obj===null || obj===undefined; }\n\n/** @private */\nfunction xform(target, method, params) {\n method.call(target, params[0], params[2], params[3], params[4]);\n}\n\n// ..........................................................\n// ARRAY\n//\n/**\n @namespace\n\n This module implements Observer-friendly Array-like behavior. This mixin is\n picked up by the Array class as well as other controllers, etc. that want to\n appear to be arrays.\n\n Unlike Ember.Enumerable, this mixin defines methods specifically for\n collections that provide index-ordered access to their contents. When you\n are designing code that needs to accept any kind of Array-like object, you\n should use these methods instead of Array primitives because these will\n properly notify observers of changes to the array.\n\n Although these methods are efficient, they do add a layer of indirection to\n your application so it is a good idea to use them only when you need the\n flexibility of using both true JavaScript arrays and \"virtual\" arrays such\n as controllers and collections.\n\n You can use the methods defined in this module to access and modify array\n contents in a KVO-friendly way. You can also be notified whenever the\n membership if an array changes by changing the syntax of the property to\n .observes('*myProperty.[]') .\n\n To support Ember.Array in your own class, you must override two\n primitives to use it: replace() and objectAt().\n\n Note that the Ember.Array mixin also incorporates the Ember.Enumerable mixin. All\n Ember.Array-like objects are also enumerable.\n\n @extends Ember.Enumerable\n @since Ember 0.9.0\n*/\nEmber.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.prototype */ {\n\n /** @private - compatibility */\n isSCArray: true,\n\n /**\n @field {Number} length\n\n Your array must support the length property. Your replace methods should\n set this property whenever it changes.\n */\n length: Ember.required(),\n\n /**\n This is one of the primitives you must implement to support Ember.Array.\n Returns the object at the named index. If your object supports retrieving\n the value of an array item using get() (i.e. myArray.get(0)), then you do\n not need to implement this method yourself.\n\n @param {Number} idx\n The index of the item to return. If idx exceeds the current length,\n return null.\n */\n objectAt: function(idx) {\n if ((idx < 0) || (idx>=get(this, 'length'))) return undefined ;\n return get(this, idx);\n },\n\n /**\n This returns the objects at the specified indexes, using objectAt.\n\n @param {Array} indexes\n An array of indexes of items to return.\n */\n objectsAt: function(indexes) {\n var self = this;\n return map(indexes, function(idx){ return self.objectAt(idx); });\n },\n\n /** @private (nodoc) - overrides Ember.Enumerable version */\n nextObject: function(idx) {\n return this.objectAt(idx);\n },\n\n /**\n @field []\n\n This is the handler for the special array content property. If you get\n this property, it will return this. If you set this property it a new\n array, it will replace the current content.\n\n This property overrides the default property defined in Ember.Enumerable.\n */\n '[]': Ember.computed(function(key, value) {\n if (value !== undefined) this.replace(0, get(this, 'length'), value) ;\n return this ;\n }).property().cacheable(),\n\n firstObject: Ember.computed(function() {\n return this.objectAt(0);\n }).property().cacheable(),\n\n lastObject: Ember.computed(function() {\n return this.objectAt(get(this, 'length')-1);\n }).property().cacheable(),\n\n /** @private (nodoc) - optimized version from Enumerable */\n contains: function(obj){\n return this.indexOf(obj) >= 0;\n },\n\n // Add any extra methods to Ember.Array that are native to the built-in Array.\n /**\n Returns a new array that is a slice of the receiver. This implementation\n uses the observable array methods to retrieve the objects for the new\n slice.\n\n var arr = ['red', 'green', 'blue'];\n arr.slice(0); => ['red', 'green', 'blue']\n arr.slice(0, 2); => ['red', 'green']\n arr.slice(1, 100); => ['green', 'blue']\n\n @param beginIndex {Integer} (Optional) index to begin slicing from.\n @param endIndex {Integer} (Optional) index to end the slice at.\n @returns {Array} New array with specified slice\n */\n slice: function(beginIndex, endIndex) {\n var ret = [];\n var length = get(this, 'length') ;\n if (none(beginIndex)) beginIndex = 0 ;\n if (none(endIndex) || (endIndex > length)) endIndex = length ;\n while(beginIndex < endIndex) {\n ret[ret.length] = this.objectAt(beginIndex++) ;\n }\n return ret ;\n },\n\n /**\n Returns the index of the given object's first occurrence.\n If no startAt argument is given, the starting location to\n search is 0. If it's negative, will count backward from\n the end of the array. Returns -1 if no match is found.\n\n var arr = [\"a\", \"b\", \"c\", \"d\", \"a\"];\n arr.indexOf(\"a\"); => 0\n arr.indexOf(\"z\"); => -1\n arr.indexOf(\"a\", 2); => 4\n arr.indexOf(\"a\", -1); => 4\n arr.indexOf(\"b\", 3); => -1\n arr.indexOf(\"a\", 100); => -1\n\n @param {Object} object the item to search for\n @param {Number} startAt optional starting location to search, default 0\n @returns {Number} index or -1 if not found\n */\n indexOf: function(object, startAt) {\n var idx, len = get(this, 'length');\n\n if (startAt === undefined) startAt = 0;\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx<len;idx++) {\n if (this.objectAt(idx, true) === object) return idx ;\n }\n return -1;\n },\n\n /**\n Returns the index of the given object's last occurrence.\n If no startAt argument is given, the search starts from\n the last position. If it's negative, will count backward\n from the end of the array. Returns -1 if no match is found.\n\n var arr = [\"a\", \"b\", \"c\", \"d\", \"a\"];\n arr.lastIndexOf(\"a\"); => 4\n arr.lastIndexOf(\"z\"); => -1\n arr.lastIndexOf(\"a\", 2); => 0\n arr.lastIndexOf(\"a\", -1); => 4\n arr.lastIndexOf(\"b\", 3); => 1\n arr.lastIndexOf(\"a\", 100); => 4\n\n @param {Object} object the item to search for\n @param {Number} startAt optional starting location to search, default 0\n @returns {Number} index or -1 if not found\n */\n lastIndexOf: function(object, startAt) {\n var idx, len = get(this, 'length');\n\n if (startAt === undefined || startAt >= len) startAt = len-1;\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx>=0;idx--) {\n if (this.objectAt(idx) === object) return idx ;\n }\n return -1;\n },\n\n // ..........................................................\n // ARRAY OBSERVERS\n //\n\n /**\n Adds an array observer to the receiving array. The array observer object\n normally must implement two methods:\n\n * `arrayWillChange(start, removeCount, addCount)` - This method will be\n called just before the array is modified.\n * `arrayDidChange(start, removeCount, addCount)` - This method will be\n called just after the array is modified.\n\n Both callbacks will be passed the starting index of the change as well a\n a count of the items to be removed and added. You can use these callbacks\n to optionally inspect the array during the change, clear caches, or do\n any other bookkeeping necessary.\n\n In addition to passing a target, you can also include an options hash\n which you can use to override the method names that will be invoked on the\n target.\n\n @param {Object} target\n The observer object.\n\n @param {Hash} opts\n Optional hash of configuration options including willChange, didChange,\n and a context option.\n\n @returns {Ember.Array} receiver\n */\n addArrayObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'arrayWillChange',\n didChange = (opts && opts.didChange) || 'arrayDidChange';\n\n var hasObservers = get(this, 'hasArrayObservers');\n if (!hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');\n Ember.addListener(this, '@array:before', target, willChange, xform);\n Ember.addListener(this, '@array:change', target, didChange, xform);\n if (!hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');\n return this;\n },\n\n /**\n Removes an array observer from the object if the observer is current\n registered. Calling this method multiple times with the same object will\n have no effect.\n\n @param {Object} target\n The object observing the array.\n\n @returns {Ember.Array} receiver\n */\n removeArrayObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'arrayWillChange',\n didChange = (opts && opts.didChange) || 'arrayDidChange';\n\n var hasObservers = get(this, 'hasArrayObservers');\n if (hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');\n Ember.removeListener(this, '@array:before', target, willChange, xform);\n Ember.removeListener(this, '@array:change', target, didChange, xform);\n if (hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');\n return this;\n },\n\n /**\n Becomes true whenever the array currently has observers watching changes\n on the array.\n\n @property {Boolean}\n */\n hasArrayObservers: Ember.computed(function() {\n return Ember.hasListeners(this, '@array:change') || Ember.hasListeners(this, '@array:before');\n }).property().cacheable(),\n\n /**\n If you are implementing an object that supports Ember.Array, call this\n method just before the array content changes to notify any observers and\n invalidate any related properties. Pass the starting index of the change\n as well as a delta of the amounts to change.\n\n @param {Number} startIdx\n The starting index in the array that will change.\n\n @param {Number} removeAmt\n The number of items that will be removed. If you pass null assumes 0\n\n @param {Number} addAmt\n The number of items that will be added. If you pass null assumes 0.\n\n @returns {Ember.Array} receiver\n */\n arrayContentWillChange: function(startIdx, removeAmt, addAmt) {\n\n // if no args are passed assume everything changes\n if (startIdx===undefined) {\n startIdx = 0;\n removeAmt = addAmt = -1;\n } else {\n if (removeAmt === undefined) removeAmt=-1;\n if (addAmt === undefined) addAmt=-1;\n }\n\n Ember.sendEvent(this, '@array:before', startIdx, removeAmt, addAmt);\n\n var removing, lim;\n if (startIdx>=0 && removeAmt>=0 && get(this, 'hasEnumerableObservers')) {\n removing = [];\n lim = startIdx+removeAmt;\n for(var idx=startIdx;idx<lim;idx++) removing.push(this.objectAt(idx));\n } else {\n removing = removeAmt;\n }\n\n this.enumerableContentWillChange(removing, addAmt);\n\n // Make sure the @each proxy is set up if anyone is observing @each\n if (Ember.isWatching(this, '@each')) { get(this, '@each'); }\n\n // Make sure we've cached these for the check in arrayContentDidChange\n get(this, 'firstObject');\n get(this, 'lastObject');\n\n return this;\n },\n\n arrayContentDidChange: function(startIdx, removeAmt, addAmt) {\n\n // if no args are passed assume everything changes\n if (startIdx===undefined) {\n startIdx = 0;\n removeAmt = addAmt = -1;\n } else {\n if (removeAmt === undefined) removeAmt=-1;\n if (addAmt === undefined) addAmt=-1;\n }\n\n var adding, lim;\n if (startIdx>=0 && addAmt>=0 && get(this, 'hasEnumerableObservers')) {\n adding = [];\n lim = startIdx+addAmt;\n for(var idx=startIdx;idx<lim;idx++) adding.push(this.objectAt(idx));\n } else {\n adding = addAmt;\n }\n\n this.enumerableContentDidChange(removeAmt, adding);\n Ember.sendEvent(this, '@array:change', startIdx, removeAmt, addAmt);\n\n var length = get(this, 'length');\n if (this.objectAt(0) !== get(this, 'firstObject')) {\n Ember.propertyWillChange(this, 'firstObject');\n Ember.propertyDidChange(this, 'firstObject');\n }\n if (this.objectAt(length-1) !== get(this, 'lastObject')) {\n Ember.propertyWillChange(this, 'lastObject');\n Ember.propertyDidChange(this, 'lastObject');\n }\n\n return this;\n },\n\n // ..........................................................\n // ENUMERATED PROPERTIES\n //\n\n /**\n Returns a special object that can be used to observe individual properties\n on the array. Just get an equivalent property on this object and it will\n return an enumerable that maps automatically to the named key on the\n member objects.\n */\n '@each': Ember.computed(function() {\n if (!this.__each) this.__each = new Ember.EachProxy(this);\n return this.__each;\n }).property().cacheable()\n\n\n\n}) ;\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/**\n @namespace\n\n Implements some standard methods for comparing objects. Add this mixin to\n any class you create that can compare its instances.\n\n You should implement the compare() method.\n\n @since Ember 0.9\n*/\nEmber.Comparable = Ember.Mixin.create( /** @scope Ember.Comparable.prototype */{\n\n /**\n walk like a duck. Indicates that the object can be compared.\n\n @type Boolean\n @default true\n @constant\n */\n isComparable: true,\n\n /**\n Override to return the result of the comparison of the two parameters. The\n compare method should return:\n\n - `-1` if `a < b`\n - `0` if `a == b`\n - `1` if `a > b`\n\n Default implementation raises an exception.\n\n @param a {Object} the first object to compare\n @param b {Object} the second object to compare\n @returns {Integer} the result of the comparison\n */\n compare: Ember.required(Function)\n\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @namespace\n\n Implements some standard methods for copying an object. Add this mixin to\n any object you create that can create a copy of itself. This mixin is\n added automatically to the built-in array.\n\n You should generally implement the copy() method to return a copy of the\n receiver.\n\n Note that frozenCopy() will only work if you also implement Ember.Freezable.\n\n @since Ember 0.9\n*/\nEmber.Copyable = Ember.Mixin.create(\n/** @scope Ember.Copyable.prototype */ {\n\n /**\n Override to return a copy of the receiver. Default implementation raises\n an exception.\n\n @param deep {Boolean} if true, a deep copy of the object should be made\n @returns {Object} copy of receiver\n */\n copy: Ember.required(Function),\n\n /**\n If the object implements Ember.Freezable, then this will return a new copy\n if the object is not frozen and the receiver if the object is frozen.\n\n Raises an exception if you try to call this method on a object that does\n not support freezing.\n\n You should use this method whenever you want a copy of a freezable object\n since a freezable object can simply return itself without actually\n consuming more memory.\n\n @returns {Object} copy of receiver or receiver\n */\n frozenCopy: function() {\n if (Ember.Freezable && Ember.Freezable.detect(this)) {\n return get(this, 'isFrozen') ? this : this.copy().freeze();\n } else {\n throw new Error(Ember.String.fmt(\"%@ does not support freezing\", [this]));\n }\n }\n});\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @namespace\n\n The Ember.Freezable mixin implements some basic methods for marking an object\n as frozen. Once an object is frozen it should be read only. No changes\n may be made the internal state of the object.\n\n ## Enforcement\n\n To fully support freezing in your subclass, you must include this mixin and\n override any method that might alter any property on the object to instead\n raise an exception. You can check the state of an object by checking the\n isFrozen property.\n\n Although future versions of JavaScript may support language-level freezing\n object objects, that is not the case today. Even if an object is freezable,\n it is still technically possible to modify the object, even though it could\n break other parts of your application that do not expect a frozen object to\n change. It is, therefore, very important that you always respect the\n isFrozen property on all freezable objects.\n\n ## Example Usage\n\n The example below shows a simple object that implement the Ember.Freezable\n protocol.\n\n Contact = Ember.Object.extend(Ember.Freezable, {\n\n firstName: null,\n\n lastName: null,\n\n // swaps the names\n swapNames: function() {\n if (this.get('isFrozen')) throw Ember.FROZEN_ERROR;\n var tmp = this.get('firstName');\n this.set('firstName', this.get('lastName'));\n this.set('lastName', tmp);\n return this;\n }\n\n });\n\n c = Context.create({ firstName: \"John\", lastName: \"Doe\" });\n c.swapNames(); => returns c\n c.freeze();\n c.swapNames(); => EXCEPTION\n\n ## Copying\n\n Usually the Ember.Freezable protocol is implemented in cooperation with the\n Ember.Copyable protocol, which defines a frozenCopy() method that will return\n a frozen object, if the object implements this method as well.\n\n @since Ember 0.9\n*/\nEmber.Freezable = Ember.Mixin.create(\n/** @scope Ember.Freezable.prototype */ {\n\n /**\n Set to true when the object is frozen. Use this property to detect whether\n your object is frozen or not.\n\n @property {Boolean}\n */\n isFrozen: false,\n\n /**\n Freezes the object. Once this method has been called the object should\n no longer allow any properties to be edited.\n\n @returns {Object} receiver\n */\n freeze: function() {\n if (get(this, 'isFrozen')) return this;\n set(this, 'isFrozen', true);\n return this;\n }\n\n});\n\nEmber.FROZEN_ERROR = \"Frozen object cannot be modified.\";\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar forEach = Ember.ArrayUtils.forEach;\n\n/**\n @class\n\n This mixin defines the API for modifying generic enumerables. These methods\n can be applied to an object regardless of whether it is ordered or\n unordered.\n\n Note that an Enumerable can change even if it does not implement this mixin.\n For example, a MappedEnumerable cannot be directly modified but if its\n underlying enumerable changes, it will change also.\n\n ## Adding Objects\n\n To add an object to an enumerable, use the addObject() method. This\n method will only add the object to the enumerable if the object is not\n already present and the object if of a type supported by the enumerable.\n\n set.addObject(contact);\n\n ## Removing Objects\n\n To remove an object form an enumerable, use the removeObject() method. This\n will only remove the object if it is already in the enumerable, otherwise\n this method has no effect.\n\n set.removeObject(contact);\n\n ## Implementing In Your Own Code\n\n If you are implementing an object and want to support this API, just include\n this mixin in your class and implement the required methods. In your unit\n tests, be sure to apply the Ember.MutableEnumerableTests to your object.\n\n @extends Ember.Mixin\n @extends Ember.Enumerable\n*/\nEmber.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,\n /** @scope Ember.MutableEnumerable.prototype */ {\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n Attempts to add the passed object to the receiver if the object is not\n already present in the collection. If the object is present, this method\n has no effect.\n\n If the passed object is of a type not supported by the receiver\n then this method should raise an exception.\n\n @param {Object} object\n The object to add to the enumerable.\n\n @returns {Object} the passed object\n */\n addObject: Ember.required(Function),\n\n /**\n Adds each object in the passed enumerable to the receiver.\n\n @param {Ember.Enumerable} objects the objects to add.\n @returns {Object} receiver\n */\n addObjects: function(objects) {\n Ember.beginPropertyChanges(this);\n forEach(objects, function(obj) { this.addObject(obj); }, this);\n Ember.endPropertyChanges(this);\n return this;\n },\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n Attempts to remove the passed object from the receiver collection if the\n object is in present in the collection. If the object is not present,\n this method has no effect.\n\n If the passed object is of a type not supported by the receiver\n then this method should raise an exception.\n\n @param {Object} object\n The object to remove from the enumerable.\n\n @returns {Object} the passed object\n */\n removeObject: Ember.required(Function),\n\n\n /**\n Removes each objects in the passed enumerable from the receiver.\n\n @param {Ember.Enumerable} objects the objects to remove\n @returns {Object} receiver\n */\n removeObjects: function(objects) {\n Ember.beginPropertyChanges(this);\n forEach(objects, function(obj) { this.removeObject(obj); }, this);\n Ember.endPropertyChanges(this);\n return this;\n }\n\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n// ..........................................................\n// CONSTANTS\n//\n\nvar OUT_OF_RANGE_EXCEPTION = \"Index out of range\" ;\nvar EMPTY = [];\n\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set, forEach = Ember.ArrayUtils.forEach;\n\n/**\n @class\n\n This mixin defines the API for modifying array-like objects. These methods\n can be applied only to a collection that keeps its items in an ordered set.\n\n Note that an Array can change even if it does not implement this mixin.\n For example, one might implement a SparseArray that cannot be directly\n modified, but if its underlying enumerable changes, it will change also.\n\n @extends Ember.Mixin\n @extends Ember.Array\n @extends Ember.MutableEnumerable\n*/\nEmber.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,\n /** @scope Ember.MutableArray.prototype */ {\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n This is one of the primitives you must implement to support Ember.Array. You\n should replace amt objects started at idx with the objects in the passed\n array. You should also call this.enumerableContentDidChange() ;\n\n @param {Number} idx\n Starting index in the array to replace. If idx >= length, then append\n to the end of the array.\n\n @param {Number} amt\n Number of elements that should be removed from the array, starting at\n *idx*.\n\n @param {Array} objects\n An array of zero or more objects that should be inserted into the array\n at *idx*\n */\n replace: Ember.required(),\n\n /**\n Remove all elements from self. This is useful if you\n want to reuse an existing array without having to recreate it.\n\n var colors = [\"red\", \"green\", \"blue\"];\n color.length(); => 3\n colors.clear(); => []\n colors.length(); => 0\n\n @returns {Ember.Array} An empty Array. \n */\n clear: function () {\n var len = get(this, 'length');\n if (len === 0) return this;\n this.replace(0, len, EMPTY);\n return this;\n },\n\n /**\n This will use the primitive replace() method to insert an object at the\n specified index.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.insertAt(2, \"yellow\"); => [\"red\", \"green\", \"yellow\", \"blue\"]\n colors.insertAt(5, \"orange\"); => Error: Index out of range\n\n @param {Number} idx index of insert the object at.\n @param {Object} object object to insert\n */\n insertAt: function(idx, object) {\n if (idx > get(this, 'length')) throw new Error(OUT_OF_RANGE_EXCEPTION) ;\n this.replace(idx, 0, [object]) ;\n return this ;\n },\n\n /**\n Remove an object at the specified index using the replace() primitive\n method. You can pass either a single index, or a start and a length.\n\n If you pass a start and length that is beyond the\n length this method will throw an Ember.OUT_OF_RANGE_EXCEPTION\n\n var colors = [\"red\", \"green\", \"blue\", \"yellow\", \"orange\"];\n colors.removeAt(0); => [\"green\", \"blue\", \"yellow\", \"orange\"]\n colors.removeAt(2, 2); => [\"green\", \"blue\"]\n colors.removeAt(4, 2); => Error: Index out of range\n\n @param {Number|Ember.IndexSet} start index, start of range, or index set\n @param {Number} len length of passing range\n @returns {Object} receiver\n */\n removeAt: function(start, len) {\n\n var delta = 0;\n\n if ('number' === typeof start) {\n\n if ((start < 0) || (start >= get(this, 'length'))) {\n throw new Error(OUT_OF_RANGE_EXCEPTION);\n }\n\n // fast case\n if (len === undefined) len = 1;\n this.replace(start, len, EMPTY);\n }\n\n return this ;\n },\n\n /**\n Push the object onto the end of the array. Works just like push() but it\n is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.pushObject(\"black\"); => [\"red\", \"green\", \"blue\", \"black\"]\n colors.pushObject([\"yellow\", \"orange\"]); => [\"red\", \"green\", \"blue\", \"black\", [\"yellow\", \"orange\"]]\n\n */\n pushObject: function(obj) {\n this.insertAt(get(this, 'length'), obj) ;\n return obj ;\n },\n\n /**\n Add the objects in the passed numerable to the end of the array. Defers\n notifying observers of the change until all objects are added.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.pushObjects(\"black\"); => [\"red\", \"green\", \"blue\", \"black\"]\n colors.pushObjects([\"yellow\", \"orange\"]); => [\"red\", \"green\", \"blue\", \"black\", \"yellow\", \"orange\"]\n\n @param {Ember.Enumerable} objects the objects to add\n @returns {Ember.Array} receiver\n */\n pushObjects: function(objects) {\n this.replace(get(this, 'length'), 0, objects);\n return this;\n },\n\n /**\n Pop object from array or nil if none are left. Works just like pop() but\n it is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.popObject(); => \"blue\"\n console.log(colors); => [\"red\", \"green\"]\n\n */\n popObject: function() {\n var len = get(this, 'length') ;\n if (len === 0) return null ;\n\n var ret = this.objectAt(len-1) ;\n this.removeAt(len-1, 1) ;\n return ret ;\n },\n\n /**\n Shift an object from start of array or nil if none are left. Works just\n like shift() but it is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.shiftObject(); => \"red\"\n console.log(colors); => [\"green\", \"blue\"]\n\n */\n shiftObject: function() {\n if (get(this, 'length') === 0) return null ;\n var ret = this.objectAt(0) ;\n this.removeAt(0) ;\n return ret ;\n },\n\n /**\n Unshift an object to start of array. Works just like unshift() but it is\n KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.unshiftObject(\"yellow\"); => [\"yellow\", \"red\", \"green\", \"blue\"]\n colors.unshiftObject([\"black\", \"white\"]); => [[\"black\", \"white\"], \"yellow\", \"red\", \"green\", \"blue\"]\n\n */\n unshiftObject: function(obj) {\n this.insertAt(0, obj) ;\n return obj ;\n },\n\n /**\n Adds the named objects to the beginning of the array. Defers notifying\n observers until all objects have been added.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.unshiftObjects([\"black\", \"white\"]); => [\"black\", \"white\", \"red\", \"green\", \"blue\"]\n colors.unshiftObjects(\"yellow\"); => Type Error: 'undefined' is not a function\n\n @param {Ember.Enumerable} objects the objects to add\n @returns {Ember.Array} receiver\n */\n unshiftObjects: function(objects) {\n this.replace(0, 0, objects);\n return this;\n },\n\n // ..........................................................\n // IMPLEMENT Ember.MutableEnumerable\n //\n\n /** @private (nodoc) */\n removeObject: function(obj) {\n var loc = get(this, 'length') || 0;\n while(--loc >= 0) {\n var curObject = this.objectAt(loc) ;\n if (curObject === obj) this.removeAt(loc) ;\n }\n return this ;\n },\n\n /** @private (nodoc) */\n addObject: function(obj) {\n if (!this.contains(obj)) this.pushObject(obj);\n return this ;\n }\n\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n ## Overview\n \n This mixin provides properties and property observing functionality, core\n features of the Ember object model.\n \n Properties and observers allow one object to observe changes to a\n property on another object. This is one of the fundamental ways that\n models, controllers and views communicate with each other in an Ember\n application.\n \n Any object that has this mixin applied can be used in observer\n operations. That includes Ember.Object and most objects you will\n interact with as you write your Ember application.\n\n Note that you will not generally apply this mixin to classes yourself,\n but you will use the features provided by this module frequently, so it\n is important to understand how to use it.\n \n ## Using get() and set()\n \n Because of Ember's support for bindings and observers, you will always\n access properties using the get method, and set properties using the\n set method. This allows the observing objects to be notified and\n computed properties to be handled properly.\n \n More documentation about `get` and `set` are below.\n \n ## Observing Property Changes\n\n You typically observe property changes simply by adding the `observes`\n call to the end of your method declarations in classes that you write.\n For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property changes\n }.observes('value')\n });\n \n Although this is the most common way to add an observer, this capability\n is actually built into the Ember.Object class on top of two methods\n defined in this mixin: `addObserver` and `removeObserver`. You can use\n these two methods to add and remove observers yourself if you need to\n do so at runtime.\n\n To add an observer for a property, call:\n\n object.addObserver('propertyKey', targetObject, targetAction)\n\n This will call the `targetAction` method on the `targetObject` to be called\n whenever the value of the `propertyKey` changes.\n \n Note that if `propertyKey` is a computed property, the observer will be \n called when any of the property dependencies are changed, even if the \n resulting value of the computed property is unchanged. This is necessary\n because computed properties are not computed until `get` is called.\n \n @extends Ember.Mixin\n*/\nEmber.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {\n\n /** @private - compatibility */\n isObserverable: true,\n\n /**\n Retrieves the value of a property from the object.\n\n This method is usually similar to using object[keyName] or object.keyName,\n however it supports both computed properties and the unknownProperty\n handler.\n \n Because `get` unifies the syntax for accessing all these kinds\n of properties, it can make many refactorings easier, such as replacing a\n simple property with a computed property, or vice versa.\n\n ### Computed Properties\n\n Computed properties are methods defined with the `property` modifier\n declared at the end, such as:\n\n fullName: function() {\n return this.getEach('firstName', 'lastName').compact().join(' ');\n }.property('firstName', 'lastName')\n\n When you call `get` on a computed property, the function will be\n called and the return value will be returned instead of the function\n itself.\n\n ### Unknown Properties\n\n Likewise, if you try to call `get` on a property whose value is\n undefined, the unknownProperty() method will be called on the object.\n If this method returns any value other than undefined, it will be returned\n instead. This allows you to implement \"virtual\" properties that are\n not defined upfront.\n\n @param {String} key The property to retrieve\n @returns {Object} The property value or undefined.\n */\n get: function(keyName) {\n return get(this, keyName);\n },\n\n /**\n To get multiple properties at once, call getProperties\n with a list of strings or an array:\n\n record.getProperties('firstName', 'lastName', 'zipCode'); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }\n\n is equivalent to:\n\n record.getProperties(['firstName', 'lastName', 'zipCode']); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }\n\n @param {String...|Array} list of keys to get\n @returns {Hash}\n */\n getProperties: function() {\n var ret = {};\n var propertyNames = arguments;\n if (arguments.length === 1 && Ember.typeOf(arguments[0]) === 'array') {\n propertyNames = arguments[0];\n }\n for(var i = 0; i < propertyNames.length; i++) {\n ret[propertyNames[i]] = get(this, propertyNames[i]);\n }\n return ret;\n },\n\n /**\n Sets the key equal to value.\n\n This method is generally very similar to calling object[key] = value or\n object.key = value, except that it provides support for computed\n properties, the unknownProperty() method and property observers.\n\n ### Computed Properties\n\n If you try to set a value on a key that has a computed property handler\n defined (see the get() method for an example), then set() will call\n that method, passing both the value and key instead of simply changing\n the value itself. This is useful for those times when you need to\n implement a property that is composed of one or more member\n properties.\n\n ### Unknown Properties\n\n If you try to set a value on a key that is undefined in the target\n object, then the unknownProperty() handler will be called instead. This\n gives you an opportunity to implement complex \"virtual\" properties that\n are not predefined on the object. If unknownProperty() returns\n undefined, then set() will simply set the value on the object.\n\n ### Property Observers\n\n In addition to changing the property, set() will also register a\n property change with the object. Unless you have placed this call\n inside of a beginPropertyChanges() and endPropertyChanges(), any \"local\"\n observers (i.e. observer methods declared on the same object), will be\n called immediately. Any \"remote\" observers (i.e. observer methods\n declared on another object) will be placed in a queue and called at a\n later time in a coalesced manner.\n\n ### Chaining\n\n In addition to property changes, set() returns the value of the object\n itself so you can do chaining like this:\n\n record.set('firstName', 'Charles').set('lastName', 'Jolley');\n\n @param {String} key The property to set\n @param {Object} value The value to set or null.\n @returns {Ember.Observable}\n */\n set: function(keyName, value) {\n set(this, keyName, value);\n return this;\n },\n\n /**\n To set multiple properties at once, call setProperties\n with a Hash:\n\n record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });\n\n @param {Hash} hash the hash of keys and values to set\n @returns {Ember.Observable}\n */\n setProperties: function(hash) {\n return Ember.setProperties(this, hash);\n },\n\n /**\n Begins a grouping of property changes.\n\n You can use this method to group property changes so that notifications\n will not be sent until the changes are finished. If you plan to make a\n large number of changes to an object at one time, you should call this\n method at the beginning of the changes to begin deferring change\n notifications. When you are done making changes, call endPropertyChanges()\n to deliver the deferred change notifications and end deferring.\n\n @returns {Ember.Observable}\n */\n beginPropertyChanges: function() {\n Ember.beginPropertyChanges();\n return this;\n },\n\n /**\n Ends a grouping of property changes.\n\n You can use this method to group property changes so that notifications\n will not be sent until the changes are finished. If you plan to make a\n large number of changes to an object at one time, you should call\n beginPropertyChanges() at the beginning of the changes to defer change\n notifications. When you are done making changes, call this method to\n deliver the deferred change notifications and end deferring.\n\n @returns {Ember.Observable}\n */\n endPropertyChanges: function() {\n Ember.endPropertyChanges();\n return this;\n },\n\n /**\n Notify the observer system that a property is about to change.\n\n Sometimes you need to change a value directly or indirectly without\n actually calling get() or set() on it. In this case, you can use this\n method and propertyDidChange() instead. Calling these two methods\n together will notify all observers that the property has potentially\n changed value.\n\n Note that you must always call propertyWillChange and propertyDidChange as\n a pair. If you do not, it may get the property change groups out of order\n and cause notifications to be delivered more often than you would like.\n\n @param {String} key The property key that is about to change.\n @returns {Ember.Observable}\n */\n propertyWillChange: function(keyName){\n Ember.propertyWillChange(this, keyName);\n return this;\n },\n\n /**\n Notify the observer system that a property has just changed.\n\n Sometimes you need to change a value directly or indirectly without\n actually calling get() or set() on it. In this case, you can use this\n method and propertyWillChange() instead. Calling these two methods\n together will notify all observers that the property has potentially\n changed value.\n\n Note that you must always call propertyWillChange and propertyDidChange as\n a pair. If you do not, it may get the property change groups out of order\n and cause notifications to be delivered more often than you would like.\n\n @param {String} keyName The property key that has just changed.\n @returns {Ember.Observable}\n */\n propertyDidChange: function(keyName) {\n Ember.propertyDidChange(this, keyName);\n return this;\n },\n \n /**\n Convenience method to call `propertyWillChange` and `propertyDidChange` in\n succession.\n \n @param {String} keyName The property key to be notified about.\n @returns {Ember.Observable}\n */\n notifyPropertyChange: function(keyName) {\n this.propertyWillChange(keyName);\n this.propertyDidChange(keyName);\n return this;\n },\n\n /**\n Adds an observer on a property.\n\n This is the core method used to register an observer for a property.\n\n Once you call this method, anytime the key's value is set, your observer\n will be notified. Note that the observers are triggered anytime the\n value is set, regardless of whether it has actually changed. Your\n observer should be prepared to handle that.\n\n You can also pass an optional context parameter to this method. The\n context will be passed to your observer method whenever it is triggered.\n Note that if you add the same target/method pair on a key multiple times\n with different context parameters, your observer will only be called once\n with the last context you passed.\n\n ### Observer Methods\n\n Observer methods you pass should generally have the following signature if\n you do not pass a \"context\" parameter:\n\n fooDidChange: function(sender, key, value, rev);\n\n The sender is the object that changed. The key is the property that\n changes. The value property is currently reserved and unused. The rev\n is the last property revision of the object when it changed, which you can\n use to detect if the key value has really changed or not.\n\n If you pass a \"context\" parameter, the context will be passed before the\n revision like so:\n\n fooDidChange: function(sender, key, value, context, rev);\n\n Usually you will not need the value, context or revision parameters at\n the end. In this case, it is common to write observer methods that take\n only a sender and key value as parameters or, if you aren't interested in\n any of these values, to write an observer that has no parameters at all.\n\n @param {String} key The key to observer\n @param {Object} target The target object to invoke\n @param {String|Function} method The method to invoke.\n @returns {Ember.Object} self\n */\n addObserver: function(key, target, method) {\n Ember.addObserver(this, key, target, method);\n },\n\n /**\n Remove an observer you have previously registered on this object. Pass\n the same key, target, and method you passed to addObserver() and your\n target will no longer receive notifications.\n\n @param {String} key The key to observer\n @param {Object} target The target object to invoke\n @param {String|Function} method The method to invoke.\n @returns {Ember.Observable} receiver\n */\n removeObserver: function(key, target, method) {\n Ember.removeObserver(this, key, target, method);\n },\n\n /**\n Returns true if the object currently has observers registered for a\n particular key. You can use this method to potentially defer performing\n an expensive action until someone begins observing a particular property\n on the object.\n\n @param {String} key Key to check\n @returns {Boolean}\n */\n hasObserverFor: function(key) {\n return Ember.hasListeners(this, key+':change');\n },\n\n /**\n This method will be called when a client attempts to get the value of a\n property that has not been defined in one of the typical ways. Override\n this method to create \"virtual\" properties.\n \n @param {String} key The name of the unknown property that was requested.\n @returns {Object} The property value or undefined. Default is undefined.\n */\n unknownProperty: function(key) {\n return undefined;\n },\n\n /**\n This method will be called when a client attempts to set the value of a\n property that has not been defined in one of the typical ways. Override\n this method to create \"virtual\" properties.\n \n @param {String} key The name of the unknown property to be set.\n @param {Object} value The value the unknown property is to be set to.\n */\n setUnknownProperty: function(key, value) {\n this[key] = value;\n },\n\n /**\n This is like `get`, but allows you to pass in a dot-separated property\n path.\n \n person.getPath('address.zip'); // return the zip\n person.getPath('children.firstObject.age'); // return the first kid's age\n\n This reads much better than chained `get` calls.\n\n @param {String} path The property path to retrieve\n @returns {Object} The property value or undefined.\n */\n getPath: function(path) {\n return Ember.getPath(this, path);\n },\n\n /**\n This is like `set`, but allows you to specify the property you want to\n set as a dot-separated property path.\n \n person.setPath('address.zip', 10011); // set the zip to 10011\n person.setPath('children.firstObject.age', 6); // set the first kid's age to 6\n\n This is not as commonly used as `getPath`, but it can be useful.\n\n @param {String} path The path to the property that will be set\n @param {Object} value The value to set or null.\n @returns {Ember.Observable}\n */\n setPath: function(path, value) {\n Ember.setPath(this, path, value);\n return this;\n },\n\n /**\n Retrieves the value of a property, or a default value in the case that the property\n returns undefined.\n \n person.getWithDefault('lastName', 'Doe');\n \n @param {String} keyName The name of the property to retrieve\n @param {Object} defaultValue The value to return if the property value is undefined\n @returns {Object} The property value or the defaultValue.\n */\n getWithDefault: function(keyName, defaultValue) {\n return Ember.getWithDefault(this, keyName, defaultValue);\n },\n\n /**\n Set the value of a property to the current value plus some amount.\n \n person.incrementProperty('age');\n team.incrementProperty('score', 2);\n \n @param {String} keyName The name of the property to increment\n @param {Object} increment The amount to increment by. Defaults to 1\n @returns {Object} The new property value\n */\n incrementProperty: function(keyName, increment) {\n if (!increment) { increment = 1; }\n set(this, keyName, (get(this, keyName) || 0)+increment);\n return get(this, keyName);\n },\n \n /**\n Set the value of a property to the current value minus some amount.\n \n player.decrementProperty('lives');\n orc.decrementProperty('health', 5);\n \n @param {String} keyName The name of the property to decrement\n @param {Object} increment The amount to decrement by. Defaults to 1\n @returns {Object} The new property value\n */\n decrementProperty: function(keyName, increment) {\n if (!increment) { increment = 1; }\n set(this, keyName, (get(this, keyName) || 0)-increment);\n return get(this, keyName);\n },\n\n /**\n Set the value of a boolean property to the opposite of it's\n current value.\n \n starship.toggleProperty('warpDriveEnaged');\n \n @param {String} keyName The name of the property to toggle\n @returns {Object} The new property value\n */\n toggleProperty: function(keyName) {\n set(this, keyName, !get(this, keyName));\n return get(this, keyName);\n },\n\n /**\n Returns the cached value of a computed property, if it exists.\n This allows you to inspect the value of a computed property\n without accidentally invoking it if it is intended to be\n generated lazily.\n\n @param {String} keyName\n @returns {Object} The cached value of the computed property, if any\n */\n cacheFor: function(keyName) {\n return Ember.cacheFor(this, keyName);\n },\n\n /** @private - intended for debugging purposes */\n observersForKey: function(keyName) {\n return Ember.observersFor(this, keyName);\n }\n});\n\n\n\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath;\n\nEmber.TargetActionSupport = Ember.Mixin.create({\n target: null,\n action: null,\n\n targetObject: Ember.computed(function() {\n var target = get(this, 'target');\n\n if (Ember.typeOf(target) === \"string\") {\n // TODO: Remove the false when deprecation is done\n var value = getPath(this, target, false);\n if (value === undefined) { value = getPath(window, target); }\n return value;\n } else {\n return target;\n }\n }).property('target').cacheable(),\n\n triggerAction: function() {\n var action = get(this, 'action'),\n target = get(this, 'targetObject');\n\n if (target && action) {\n var ret;\n\n if (typeof target.send === 'function') {\n ret = target.send(action, this);\n } else {\n if (typeof action === 'string') {\n action = target[action];\n }\n ret = action.call(target, this);\n }\n if (ret !== false) ret = true;\n\n return ret;\n } else {\n return false;\n }\n }\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set, a_slice = Array.prototype.slice;\n\n/** @private */\nfunction xform(target, method, params) {\n var args = a_slice.call(params, 2);\n method.apply(target, args);\n}\n\nEmber.Evented = Ember.Mixin.create({\n on: function(name, target, method) {\n if (!method) {\n method = target;\n target = null;\n }\n\n Ember.addListener(this, name, target, method, xform);\n },\n\n fire: function(name) {\n Ember.sendEvent.apply(null, [this, name].concat(a_slice.call(arguments, 1)));\n },\n\n off: function(name, target, method) {\n Ember.removeListener(this, name, target, method);\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n// NOTE: this object should never be included directly. Instead use Ember.\n// Ember.Object. We only define this separately so that Ember.Set can depend on it\n\n\n\nvar rewatch = Ember.rewatch;\nvar classToString = Ember.Mixin.prototype.toString;\nvar set = Ember.set, get = Ember.get;\nvar o_create = Ember.platform.create,\n o_defineProperty = Ember.platform.defineProperty,\n a_slice = Array.prototype.slice,\n meta = Ember.meta;\n\n/** @private */\nfunction makeCtor() {\n\n // Note: avoid accessing any properties on the object since it makes the\n // method a lot faster. This is glue code so we want it to be as fast as\n // possible.\n\n var wasApplied = false, initMixins, init = false, hasChains = false;\n\n var Class = function() {\n if (!wasApplied) { Class.proto(); } // prepare prototype...\n if (initMixins) {\n this.reopen.apply(this, initMixins);\n initMixins = null;\n rewatch(this); // always rewatch just in case\n Ember.Mixin.finishPartial(this);\n this.init.apply(this, arguments);\n } else {\n if (hasChains) {\n rewatch(this);\n } else {\n Ember.GUID_DESC.value = undefined;\n o_defineProperty(this, Ember.GUID_KEY, Ember.GUID_DESC);\n }\n if (init===false) { init = this.init; } // cache for later instantiations\n Ember.GUID_DESC.value = undefined;\n o_defineProperty(this, '_super', Ember.GUID_DESC);\n Ember.Mixin.finishPartial(this);\n init.apply(this, arguments);\n }\n };\n\n Class.toString = classToString;\n Class.willReopen = function() {\n if (wasApplied) {\n Class.PrototypeMixin = Ember.Mixin.create(Class.PrototypeMixin);\n }\n\n wasApplied = false;\n };\n Class._initMixins = function(args) { initMixins = args; };\n\n Class.proto = function() {\n var superclass = Class.superclass;\n if (superclass) { superclass.proto(); }\n\n if (!wasApplied) {\n wasApplied = true;\n Class.PrototypeMixin.applyPartial(Class.prototype);\n Ember.rewatch(Class.prototype); // setup watch chains if needed.\n hasChains = !!meta(Class.prototype, false).chains; // avoid rewatch\n }\n\n return this.prototype;\n };\n\n return Class;\n\n}\n\nvar CoreObject = makeCtor();\n\nCoreObject.PrototypeMixin = Ember.Mixin.create(\n/** @scope Ember.CoreObject */ {\n\n reopen: function() {\n Ember.Mixin._apply(this, arguments, true);\n return this;\n },\n\n isInstance: true,\n\n /** @private */\n init: function() {},\n\n /** @field */\n isDestroyed: false,\n\n /** @field */\n isDestroying: false,\n\n /**\n Destroys an object by setting the isDestroyed flag and removing its\n metadata, which effectively destroys observers and bindings.\n\n If you try to set a property on a destroyed object, an exception will be\n raised.\n\n Note that destruction is scheduled for the end of the run loop and does not\n happen immediately.\n\n @returns {Ember.Object} receiver\n */\n destroy: function() {\n if (this.isDestroying) { return; }\n\n this.isDestroying = true;\n\n if (this.willDestroy) { this.willDestroy(); }\n\n set(this, 'isDestroyed', true);\n Ember.run.schedule('destroy', this, this._scheduledDestroy);\n return this;\n },\n\n /**\n Invoked by the run loop to actually destroy the object. This is\n scheduled for execution by the `destroy` method.\n\n @private\n */\n _scheduledDestroy: function() {\n Ember.destroy(this);\n if (this.didDestroy) { this.didDestroy(); }\n },\n\n bind: function(to, from) {\n if (!(from instanceof Ember.Binding)) { from = Ember.Binding.from(from); }\n from.to(to).connect(this);\n return from;\n },\n\n toString: function() {\n return '<'+this.constructor.toString()+':'+Ember.guidFor(this)+'>';\n }\n});\n\nCoreObject.__super__ = null;\n\nvar ClassMixin = Ember.Mixin.create({\n\n ClassMixin: Ember.required(),\n\n PrototypeMixin: Ember.required(),\n\n isClass: true,\n\n isMethod: false,\n\n extend: function() {\n var Class = makeCtor(), proto;\n Class.ClassMixin = Ember.Mixin.create(this.ClassMixin);\n Class.PrototypeMixin = Ember.Mixin.create(this.PrototypeMixin);\n\n Class.ClassMixin.ownerConstructor = Class;\n Class.PrototypeMixin.ownerConstructor = Class;\n\n var PrototypeMixin = Class.PrototypeMixin;\n PrototypeMixin.reopen.apply(PrototypeMixin, arguments);\n\n Class.superclass = this;\n Class.__super__ = this.prototype;\n\n proto = Class.prototype = o_create(this.prototype);\n proto.constructor = Class;\n Ember.generateGuid(proto, 'ember');\n meta(proto).proto = proto; // this will disable observers on prototype\n\n\n Class.subclasses = Ember.Set ? new Ember.Set() : null;\n if (this.subclasses) { this.subclasses.add(Class); }\n\n Class.ClassMixin.apply(Class);\n return Class;\n },\n\n create: function() {\n var C = this;\n if (arguments.length>0) { this._initMixins(arguments); }\n return new C();\n },\n\n reopen: function() {\n this.willReopen();\n var PrototypeMixin = this.PrototypeMixin;\n PrototypeMixin.reopen.apply(PrototypeMixin, arguments);\n return this;\n },\n\n reopenClass: function() {\n var ClassMixin = this.ClassMixin;\n ClassMixin.reopen.apply(ClassMixin, arguments);\n Ember.Mixin._apply(this, arguments, false);\n return this;\n },\n\n detect: function(obj) {\n if ('function' !== typeof obj) { return false; }\n while(obj) {\n if (obj===this) { return true; }\n obj = obj.superclass;\n }\n return false;\n },\n\n detectInstance: function(obj) {\n return obj instanceof this;\n },\n\n /**\n In some cases, you may want to annotate computed properties with additional\n metadata about how they function or what values they operate on. For example,\n computed property functions may close over variables that are then no longer\n available for introspection.\n\n You can pass a hash of these values to a computed property like this:\n\n person: function() {\n var personId = this.get('personId');\n return App.Person.create({ id: personId });\n }.property().meta({ type: App.Person })\n\n Once you've done this, you can retrieve the values saved to the computed\n property from your class like this:\n\n MyClass.metaForProperty('person');\n\n This will return the original hash that was passed to `meta()`.\n */\n metaForProperty: function(key) {\n var desc = meta(this.proto(), false).descs[key];\n\n Ember.assert(\"metaForProperty() could not find a computed property with key '\"+key+\"'.\", !!desc && desc instanceof Ember.ComputedProperty);\n return desc._meta || {};\n },\n\n /**\n Iterate over each computed property for the class, passing its name\n and any associated metadata (see `metaForProperty`) to the callback.\n */\n eachComputedProperty: function(callback, binding) {\n var proto = this.proto(),\n descs = meta(proto).descs,\n empty = {},\n property;\n\n for (var name in descs) {\n property = descs[name];\n\n if (property instanceof Ember.ComputedProperty) {\n callback.call(binding || this, name, property._meta || empty);\n }\n }\n }\n\n});\n\nCoreObject.ClassMixin = ClassMixin;\nClassMixin.apply(CoreObject);\n\n/**\n @class\n*/\nEmber.CoreObject = CoreObject;\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, guidFor = Ember.guidFor, none = Ember.none;\n\n/**\n @class\n\n An unordered collection of objects.\n\n A Set works a bit like an array except that its items are not ordered.\n You can create a set to efficiently test for membership for an object. You\n can also iterate through a set just like an array, even accessing objects\n by index, however there is no guarantee as to their order.\n\n Starting with Ember 2.0 all Sets are now observable since there is no\n added cost to providing this support. Sets also do away with the more\n specialized Set Observer API in favor of the more generic Enumerable\n Observer API - which works on any enumerable object including both Sets and\n Arrays.\n\n ## Creating a Set\n\n You can create a set like you would most objects using\n `new Ember.Set()`. Most new sets you create will be empty, but you can\n also initialize the set with some content by passing an array or other\n enumerable of objects to the constructor.\n\n Finally, you can pass in an existing set and the set will be copied. You\n can also create a copy of a set by calling `Ember.Set#copy()`.\n\n #js\n // creates a new empty set\n var foundNames = new Ember.Set();\n\n // creates a set with four names in it.\n var names = new Ember.Set([\"Charles\", \"Tom\", \"Juan\", \"Alex\"]); // :P\n\n // creates a copy of the names set.\n var namesCopy = new Ember.Set(names);\n\n // same as above.\n var anotherNamesCopy = names.copy();\n\n ## Adding/Removing Objects\n\n You generally add or remove objects from a set using `add()` or\n `remove()`. You can add any type of object including primitives such as\n numbers, strings, and booleans.\n\n Unlike arrays, objects can only exist one time in a set. If you call `add()`\n on a set with the same object multiple times, the object will only be added\n once. Likewise, calling `remove()` with the same object multiple times will\n remove the object the first time and have no effect on future calls until\n you add the object to the set again.\n\n NOTE: You cannot add/remove null or undefined to a set. Any attempt to do so\n will be ignored.\n\n In addition to add/remove you can also call `push()`/`pop()`. Push behaves\n just like `add()` but `pop()`, unlike `remove()` will pick an arbitrary\n object, remove it and return it. This is a good way to use a set as a job\n queue when you don't care which order the jobs are executed in.\n\n ## Testing for an Object\n\n To test for an object's presence in a set you simply call\n `Ember.Set#contains()`.\n\n ## Observing changes\n\n When using `Ember.Set`, you can observe the `\"[]\"` property to be\n alerted whenever the content changes. You can also add an enumerable\n observer to the set to be notified of specific objects that are added and\n removed from the set. See `Ember.Enumerable` for more information on\n enumerables.\n\n This is often unhelpful. If you are filtering sets of objects, for instance,\n it is very inefficient to re-filter all of the items each time the set\n changes. It would be better if you could just adjust the filtered set based\n on what was changed on the original set. The same issue applies to merging\n sets, as well.\n\n ## Other Methods\n\n `Ember.Set` primary implements other mixin APIs. For a complete reference\n on the methods you will use with `Ember.Set`, please consult these mixins.\n The most useful ones will be `Ember.Enumerable` and\n `Ember.MutableEnumerable` which implement most of the common iterator\n methods you are used to on Array.\n\n Note that you can also use the `Ember.Copyable` and `Ember.Freezable`\n APIs on `Ember.Set` as well. Once a set is frozen it can no longer be\n modified. The benefit of this is that when you call frozenCopy() on it,\n Ember will avoid making copies of the set. This allows you to write\n code that can know with certainty when the underlying set data will or\n will not be modified.\n\n @extends Ember.Enumerable\n @extends Ember.MutableEnumerable\n @extends Ember.Copyable\n @extends Ember.Freezable\n\n @since Ember 0.9\n*/\nEmber.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Ember.Freezable,\n /** @scope Ember.Set.prototype */ {\n\n // ..........................................................\n // IMPLEMENT ENUMERABLE APIS\n //\n\n /**\n This property will change as the number of objects in the set changes.\n\n @property Number\n @default 0\n */\n length: 0,\n\n /**\n Clears the set. This is useful if you want to reuse an existing set\n without having to recreate it.\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.length; => 3\n colors.clear();\n colors.length; => 0\n\n @returns {Ember.Set} An empty Set\n */\n clear: function() {\n if (this.isFrozen) { throw new Error(Ember.FROZEN_ERROR); }\n\n var len = get(this, 'length');\n if (len === 0) { return this; }\n\n var guid;\n\n this.enumerableContentWillChange(len, 0);\n Ember.propertyWillChange(this, 'firstObject');\n Ember.propertyWillChange(this, 'lastObject');\n\n for (var i=0; i < len; i++){\n guid = guidFor(this[i]);\n delete this[guid];\n delete this[i];\n }\n\n set(this, 'length', 0);\n\n Ember.propertyDidChange(this, 'firstObject');\n Ember.propertyDidChange(this, 'lastObject');\n this.enumerableContentDidChange(len, 0);\n\n return this;\n },\n\n /**\n Returns true if the passed object is also an enumerable that contains the\n same objects as the receiver.\n\n var colors = [\"red\", \"green\", \"blue\"],\n same_colors = new Ember.Set(colors);\n same_colors.isEqual(colors); => true\n same_colors.isEqual([\"purple\", \"brown\"]); => false\n\n @param {Ember.Set} obj the other object.\n @returns {Boolean}\n */\n isEqual: function(obj) {\n // fail fast\n if (!Ember.Enumerable.detect(obj)) return false;\n\n var loc = get(this, 'length');\n if (get(obj, 'length') !== loc) return false;\n\n while(--loc >= 0) {\n if (!obj.contains(this[loc])) return false;\n }\n\n return true;\n },\n\n /**\n Adds an object to the set. Only non-null objects can be added to a set\n and those can only be added once. If the object is already in the set or\n the passed value is null this method will have no effect.\n\n This is an alias for `Ember.MutableEnumerable.addObject()`.\n\n var colors = new Ember.Set();\n colors.add(\"blue\"); => [\"blue\"]\n colors.add(\"blue\"); => [\"blue\"]\n colors.add(\"red\"); => [\"blue\", \"red\"]\n colors.add(null); => [\"blue\", \"red\"]\n colors.add(undefined); => [\"blue\", \"red\"]\n\n @function\n @param {Object} obj The object to add.\n @returns {Ember.Set} The set itself.\n */\n add: Ember.alias('addObject'),\n\n /**\n Removes the object from the set if it is found. If you pass a null value\n or an object that is already not in the set, this method will have no\n effect. This is an alias for `Ember.MutableEnumerable.removeObject()`.\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.remove(\"red\"); => [\"blue\", \"green\"]\n colors.remove(\"purple\"); => [\"blue\", \"green\"]\n colors.remove(null); => [\"blue\", \"green\"]\n\n @function\n @param {Object} obj The object to remove\n @returns {Ember.Set} The set itself.\n */\n remove: Ember.alias('removeObject'),\n\n /**\n Removes the last element from the set and returns it, or null if it's empty.\n \n var colors = new Ember.Set([\"green\", \"blue\"]);\n colors.pop(); => \"blue\"\n colors.pop(); => \"green\"\n colors.pop(); => null\n\n @returns {Object} The removed object from the set or null.\n */\n pop: function() {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n var obj = this.length > 0 ? this[this.length-1] : null;\n this.remove(obj);\n return obj;\n },\n\n /**\n Inserts the given object on to the end of the set. It returns\n the set itself.\n\n This is an alias for `Ember.MutableEnumerable.addObject()`.\n\n var colors = new Ember.Set();\n colors.push(\"red\"); => [\"red\"]\n colors.push(\"green\"); => [\"red\", \"green\"]\n colors.push(\"blue\"); => [\"red\", \"green\", \"blue\"]\n\n @function\n @returns {Ember.Set} The set itself.\n */\n push: Ember.alias('addObject'),\n\n /**\n Removes the last element from the set and returns it, or null if it's empty.\n\n This is an alias for `Ember.Set.pop()`.\n\n var colors = new Ember.Set([\"green\", \"blue\"]);\n colors.shift(); => \"blue\"\n colors.shift(); => \"green\"\n colors.shift(); => null\n\n @function\n @returns {Object} The removed object from the set or null.\n */\n shift: Ember.alias('pop'),\n\n /**\n Inserts the given object on to the end of the set. It returns\n the set itself.\n\n This is an alias of `Ember.Set.push()`\n\n var colors = new Ember.Set();\n colors.unshift(\"red\"); => [\"red\"]\n colors.unshift(\"green\"); => [\"red\", \"green\"]\n colors.unshift(\"blue\"); => [\"red\", \"green\", \"blue\"]\n\n @function\n @returns {Ember.Set} The set itself.\n */\n unshift: Ember.alias('push'),\n\n /**\n Adds each object in the passed enumerable to the set.\n\n This is an alias of `Ember.MutableEnumerable.addObjects()`\n\n var colors = new Ember.Set();\n colors.addEach([\"red\", \"green\", \"blue\"]); => [\"red\", \"green\", \"blue\"]\n\n @function\n @param {Ember.Enumerable} objects the objects to add.\n @returns {Ember.Set} The set itself.\n */\n addEach: Ember.alias('addObjects'),\n\n /**\n Removes each object in the passed enumerable to the set.\n\n This is an alias of `Ember.MutableEnumerable.removeObjects()`\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.removeEach([\"red\", \"blue\"]); => [\"green\"]\n\n @function\n @param {Ember.Enumerable} objects the objects to remove.\n @returns {Ember.Set} The set itself.\n */\n removeEach: Ember.alias('removeObjects'),\n\n // ..........................................................\n // PRIVATE ENUMERABLE SUPPORT\n //\n\n /** @private */\n init: function(items) {\n this._super();\n if (items) this.addObjects(items);\n },\n\n /** @private (nodoc) - implement Ember.Enumerable */\n nextObject: function(idx) {\n return this[idx];\n },\n\n /** @private - more optimized version */\n firstObject: Ember.computed(function() {\n return this.length > 0 ? this[0] : undefined;\n }).property().cacheable(),\n\n /** @private - more optimized version */\n lastObject: Ember.computed(function() {\n return this.length > 0 ? this[this.length-1] : undefined;\n }).property().cacheable(),\n\n /** @private (nodoc) - implements Ember.MutableEnumerable */\n addObject: function(obj) {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n if (none(obj)) return this; // nothing to do\n\n var guid = guidFor(obj),\n idx = this[guid],\n len = get(this, 'length'),\n added ;\n\n if (idx>=0 && idx<len && (this[idx] === obj)) return this; // added\n\n added = [obj];\n\n this.enumerableContentWillChange(null, added);\n Ember.propertyWillChange(this, 'lastObject');\n\n len = get(this, 'length');\n this[guid] = len;\n this[len] = obj;\n set(this, 'length', len+1);\n\n Ember.propertyDidChange(this, 'lastObject');\n this.enumerableContentDidChange(null, added);\n\n return this;\n },\n\n /** @private (nodoc) - implements Ember.MutableEnumerable */\n removeObject: function(obj) {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n if (none(obj)) return this; // nothing to do\n\n var guid = guidFor(obj),\n idx = this[guid],\n len = get(this, 'length'),\n isFirst = idx === 0,\n isLast = idx === len-1,\n last, removed;\n\n\n if (idx>=0 && idx<len && (this[idx] === obj)) {\n removed = [obj];\n\n this.enumerableContentWillChange(removed, null);\n if (isFirst) { Ember.propertyWillChange(this, 'firstObject'); }\n if (isLast) { Ember.propertyWillChange(this, 'lastObject'); }\n\n // swap items - basically move the item to the end so it can be removed\n if (idx < len-1) {\n last = this[len-1];\n this[idx] = last;\n this[guidFor(last)] = idx;\n }\n\n delete this[guid];\n delete this[len-1];\n set(this, 'length', len-1);\n\n if (isFirst) { Ember.propertyDidChange(this, 'firstObject'); }\n if (isLast) { Ember.propertyDidChange(this, 'lastObject'); }\n this.enumerableContentDidChange(removed, null);\n }\n\n return this;\n },\n\n /** @private (nodoc) - optimized version */\n contains: function(obj) {\n return this[guidFor(obj)]>=0;\n },\n\n /** @private (nodoc) */\n copy: function() {\n var C = this.constructor, ret = new C(), loc = get(this, 'length');\n set(ret, 'length', loc);\n while(--loc>=0) {\n ret[loc] = this[loc];\n ret[guidFor(this[loc])] = loc;\n }\n return ret;\n },\n\n /** @private */\n toString: function() {\n var len = this.length, idx, array = [];\n for(idx = 0; idx < len; idx++) {\n array[idx] = this[idx];\n }\n return \"Ember.Set<%@>\".fmt(array.join(','));\n },\n\n // ..........................................................\n // DEPRECATED\n //\n\n /** @deprecated\n\n This property is often used to determine that a given object is a set.\n Instead you should use instanceof:\n\n #js:\n // SproutCore 1.x:\n isSet = myobject && myobject.isSet;\n\n // Ember:\n isSet = myobject instanceof Ember.Set\n\n @type Boolean\n @default true\n */\n isSet: true\n\n});\n\n// Support the older API\nvar o_create = Ember.Set.create;\nEmber.Set.create = function(items) {\n if (items && Ember.Enumerable.detect(items)) {\n Ember.deprecate('Passing an enumerable to Ember.Set.create() is deprecated and will be removed in a future version of Ember. Use new Ember.Set(items) instead.');\n return new Ember.Set(items);\n } else {\n return o_create.apply(this, arguments);\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nEmber.CoreObject.subclasses = new Ember.Set();\n\n/**\n @class\n @extends Ember.CoreObject\n @extends Ember.Observable\n*/\nEmber.Object = Ember.CoreObject.extend(Ember.Observable);\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n/**\n @private\n A Namespace is an object usually used to contain other objects or methods\n such as an application or framework. Create a namespace anytime you want\n to define one of these new containers.\n\n # Example Usage\n\n MyFramework = Ember.Namespace.create({\n VERSION: '1.0.0'\n });\n\n*/\nEmber.Namespace = Ember.Object.extend({\n isNamespace: true,\n\n init: function() {\n Ember.Namespace.NAMESPACES.push(this);\n Ember.Namespace.PROCESSED = false;\n },\n\n toString: function() {\n Ember.identifyNamespaces();\n return this[Ember.GUID_KEY+'_name'];\n },\n\n destroy: function() {\n var namespaces = Ember.Namespace.NAMESPACES;\n window[this.toString()] = undefined;\n namespaces.splice(indexOf(namespaces, this), 1);\n this._super();\n }\n});\n\nEmber.Namespace.NAMESPACES = [Ember];\nEmber.Namespace.PROCESSED = false;\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/**\n @private\n\n Defines a namespace that will contain an executable application. This is\n very similar to a normal namespace except that it is expected to include at\n least a 'ready' function which can be run to initialize the application.\n\n Currently Ember.Application is very similar to Ember.Namespace. However, this\n class may be augmented by additional frameworks so it is important to use\n this instance when building new applications.\n\n # Example Usage\n\n MyApp = Ember.Application.create({\n VERSION: '1.0.0',\n store: Ember.Store.create().from(Ember.fixtures)\n });\n\n MyApp.ready = function() {\n //..init code goes here...\n }\n\n*/\nEmber.Application = Ember.Namespace.extend();\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n An ArrayProxy wraps any other object that implements Ember.Array and/or\n Ember.MutableArray, forwarding all requests. This makes it very useful for\n a number of binding use cases or other cases where being able to swap\n out the underlying array is useful.\n\n A simple example of usage:\n\n var pets = ['dog', 'cat', 'fish'];\n var arrayProxy = Ember.ArrayProxy.create({ content: Ember.A(pets) });\n ap.get('firstObject'); // => 'dog'\n ap.set('content', ['amoeba', 'paramecium']);\n ap.get('firstObject'); // => 'amoeba'\n\n This class can also be useful as a layer to transform the contents of\n an array, as they are accessed. This can be done by overriding\n `objectAtContent`:\n\n var pets = ['dog', 'cat', 'fish'];\n var ap = Ember.ArrayProxy.create({\n content: Ember.A(pets),\n objectAtContent: function(idx) {\n return this.get('content').objectAt(idx).toUpperCase();\n }\n });\n ap.get('firstObject'); // => 'DOG'\n\n\n @extends Ember.Object\n @extends Ember.Array\n @extends Ember.MutableArray\n*/\nEmber.ArrayProxy = Ember.Object.extend(Ember.MutableArray,\n/** @scope Ember.ArrayProxy.prototype */ {\n\n /**\n The content array. Must be an object that implements Ember.Array and/or\n Ember.MutableArray.\n\n @property {Ember.Array}\n */\n content: null,\n\n /**\n Should actually retrieve the object at the specified index from the\n content. You can override this method in subclasses to transform the\n content item to something new.\n\n This method will only be called if content is non-null.\n\n @param {Number} idx\n The index to retrieve.\n\n @returns {Object} the value or undefined if none found\n */\n objectAtContent: function(idx) {\n return get(this, 'content').objectAt(idx);\n },\n\n /**\n Should actually replace the specified objects on the content array.\n You can override this method in subclasses to transform the content item\n into something new.\n\n This method will only be called if content is non-null.\n\n @param {Number} idx\n The starting index\n\n @param {Number} amt\n The number of items to remove from the content.\n\n @param {Array} objects\n Optional array of objects to insert or null if no objects.\n\n @returns {void}\n */\n replaceContent: function(idx, amt, objects) {\n get(this, 'content').replace(idx, amt, objects);\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 contentWillChange: Ember.beforeObserver(function() {\n var content = get(this, 'content'),\n len = content ? get(content, 'length') : 0;\n this.arrayWillChange(content, 0, len, undefined);\n if (content) content.removeArrayObserver(this);\n }, 'content'),\n\n /**\n Invoked when the content property changes. Notifies observers that the\n entire array content has changed.\n */\n contentDidChange: Ember.observer(function() {\n var content = get(this, 'content'),\n len = content ? get(content, 'length') : 0;\n if (content) content.addArrayObserver(this);\n this.arrayDidChange(content, 0, undefined, len);\n }, 'content'),\n\n /** @private (nodoc) */\n objectAt: function(idx) {\n return get(this, 'content') && this.objectAtContent(idx);\n },\n\n /** @private (nodoc) */\n length: Ember.computed(function() {\n var content = get(this, 'content');\n return content ? get(content, 'length') : 0;\n // No dependencies since Enumerable notifies length of change\n }).property().cacheable(),\n\n /** @private (nodoc) */\n replace: function(idx, amt, objects) {\n if (get(this, 'content')) this.replaceContent(idx, amt, objects);\n return this;\n },\n\n /** @private (nodoc) */\n arrayWillChange: function(item, idx, removedCnt, addedCnt) {\n this.arrayContentWillChange(idx, removedCnt, addedCnt);\n },\n\n /** @private (nodoc) */\n arrayDidChange: function(item, idx, removedCnt, addedCnt) {\n this.arrayContentDidChange(idx, removedCnt, addedCnt);\n },\n\n /** @private (nodoc) */\n init: function() {\n this._super();\n this.contentWillChange();\n this.contentDidChange();\n }\n\n});\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar set = Ember.set, get = Ember.get, guidFor = Ember.guidFor;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar EachArray = Ember.Object.extend(Ember.Array, {\n\n init: function(content, keyName, owner) {\n this._super();\n this._keyName = keyName;\n this._owner = owner;\n this._content = content;\n },\n\n objectAt: function(idx) {\n var item = this._content.objectAt(idx);\n return item && get(item, this._keyName);\n },\n\n length: Ember.computed(function() {\n var content = this._content;\n return content ? get(content, 'length') : 0;\n }).property().cacheable()\n\n});\n\nvar IS_OBSERVER = /^.+:(before|change)$/;\n\n/** @private */\nfunction addObserverForContentKey(content, keyName, proxy, idx, loc) {\n var objects = proxy._objects, guid;\n if (!objects) objects = proxy._objects = {};\n\n while(--loc>=idx) {\n var item = content.objectAt(loc);\n if (item) {\n Ember.addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');\n Ember.addObserver(item, keyName, proxy, 'contentKeyDidChange');\n\n // keep track of the indicies each item was found at so we can map\n // it back when the obj changes.\n guid = guidFor(item);\n if (!objects[guid]) objects[guid] = [];\n objects[guid].push(loc);\n }\n }\n}\n\n/** @private */\nfunction removeObserverForContentKey(content, keyName, proxy, idx, loc) {\n var objects = proxy._objects;\n if (!objects) objects = proxy._objects = {};\n var indicies, guid;\n\n while(--loc>=idx) {\n var item = content.objectAt(loc);\n if (item) {\n Ember.removeBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');\n Ember.removeObserver(item, keyName, proxy, 'contentKeyDidChange');\n\n guid = guidFor(item);\n indicies = objects[guid];\n indicies[indicies.indexOf(loc)] = null;\n }\n }\n}\n\n/**\n @private\n @class\n\n This is the object instance returned when you get the @each property on an\n array. It uses the unknownProperty handler to automatically create\n EachArray instances for property names.\n\n @extends Ember.Object\n*/\nEmber.EachProxy = Ember.Object.extend({\n\n init: function(content) {\n this._super();\n this._content = content;\n content.addArrayObserver(this);\n\n // in case someone is already observing some keys make sure they are\n // added\n forEach(Ember.watchedEvents(this), function(eventName) {\n this.didAddListener(eventName);\n }, this);\n },\n\n /**\n You can directly access mapped properties by simply requesting them.\n The unknownProperty handler will generate an EachArray of each item.\n */\n unknownProperty: function(keyName, value) {\n var ret;\n ret = new EachArray(this._content, keyName, this);\n new Ember.Descriptor().setup(this, keyName, ret);\n this.beginObservingContentKey(keyName);\n return ret;\n },\n\n // ..........................................................\n // ARRAY CHANGES\n // Invokes whenever the content array itself changes.\n\n arrayWillChange: function(content, idx, removedCnt, addedCnt) {\n var keys = this._keys, key, array, lim;\n\n lim = removedCnt>0 ? idx+removedCnt : -1;\n Ember.beginPropertyChanges(this);\n\n for(key in keys) {\n if (!keys.hasOwnProperty(key)) { continue; }\n\n if (lim>0) removeObserverForContentKey(content, key, this, idx, lim);\n\n Ember.propertyWillChange(this, key);\n }\n\n Ember.propertyWillChange(this._content, '@each');\n Ember.endPropertyChanges(this);\n },\n\n arrayDidChange: function(content, idx, removedCnt, addedCnt) {\n var keys = this._keys, key, array, lim;\n\n lim = addedCnt>0 ? idx+addedCnt : -1;\n Ember.beginPropertyChanges(this);\n\n for(key in keys) {\n if (!keys.hasOwnProperty(key)) { continue; }\n\n if (lim>0) addObserverForContentKey(content, key, this, idx, lim);\n\n Ember.propertyDidChange(this, key);\n }\n\n Ember.propertyDidChange(this._content, '@each');\n Ember.endPropertyChanges(this);\n },\n\n // ..........................................................\n // LISTEN FOR NEW OBSERVERS AND OTHER EVENT LISTENERS\n // Start monitoring keys based on who is listening...\n\n didAddListener: function(eventName) {\n if (IS_OBSERVER.test(eventName)) {\n this.beginObservingContentKey(eventName.slice(0, -7));\n }\n },\n\n didRemoveListener: function(eventName) {\n if (IS_OBSERVER.test(eventName)) {\n this.stopObservingContentKey(eventName.slice(0, -7));\n }\n },\n\n // ..........................................................\n // CONTENT KEY OBSERVING\n // Actual watch keys on the source content.\n\n beginObservingContentKey: function(keyName) {\n var keys = this._keys;\n if (!keys) keys = this._keys = {};\n if (!keys[keyName]) {\n keys[keyName] = 1;\n var content = this._content,\n len = get(content, 'length');\n addObserverForContentKey(content, keyName, this, 0, len);\n } else {\n keys[keyName]++;\n }\n },\n\n stopObservingContentKey: function(keyName) {\n var keys = this._keys;\n if (keys && (keys[keyName]>0) && (--keys[keyName]<=0)) {\n var content = this._content,\n len = get(content, 'length');\n removeObserverForContentKey(content, keyName, this, 0, len);\n }\n },\n\n contentKeyWillChange: function(obj, keyName) {\n Ember.propertyWillChange(this, keyName);\n },\n\n contentKeyDidChange: function(obj, keyName) {\n Ember.propertyDidChange(this, keyName);\n }\n\n});\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n// Add Ember.Array to Array.prototype. Remove methods with native\n// implementations and supply some more optimized versions of generic methods\n// because they are so common.\nvar NativeArray = Ember.Mixin.create(Ember.MutableArray, Ember.Observable, Ember.Copyable, {\n\n // because length is a built-in property we need to know to just get the\n // original property.\n get: function(key) {\n if (key==='length') return this.length;\n else if ('number' === typeof key) return this[key];\n else return this._super(key);\n },\n\n objectAt: function(idx) {\n return this[idx];\n },\n\n // primitive for array support.\n replace: function(idx, amt, objects) {\n\n if (this.isFrozen) throw Ember.FROZEN_ERROR ;\n\n // if we replaced exactly the same number of items, then pass only the\n // replaced range. Otherwise, pass the full remaining array length\n // since everything has shifted\n var len = objects ? get(objects, 'length') : 0;\n this.arrayContentWillChange(idx, amt, len);\n\n if (!objects || objects.length === 0) {\n this.splice(idx, amt) ;\n } else {\n var args = [idx, amt].concat(objects) ;\n this.splice.apply(this,args) ;\n }\n\n this.arrayContentDidChange(idx, amt, len);\n return this ;\n },\n\n // If you ask for an unknown property, then try to collect the value\n // from member items.\n unknownProperty: function(key, value) {\n var ret;// = this.reducedProperty(key, value) ;\n if ((value !== undefined) && ret === undefined) {\n ret = this[key] = value;\n }\n return ret ;\n },\n\n // If browser did not implement indexOf natively, then override with\n // specialized version\n indexOf: function(object, startAt) {\n var idx, len = this.length;\n\n if (startAt === undefined) startAt = 0;\n else startAt = (startAt < 0) ? Math.ceil(startAt) : Math.floor(startAt);\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx<len;idx++) {\n if (this[idx] === object) return idx ;\n }\n return -1;\n },\n\n lastIndexOf: function(object, startAt) {\n var idx, len = this.length;\n\n if (startAt === undefined) startAt = len-1;\n else startAt = (startAt < 0) ? Math.ceil(startAt) : Math.floor(startAt);\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx>=0;idx--) {\n if (this[idx] === object) return idx ;\n }\n return -1;\n },\n\n copy: function() {\n return this.slice();\n }\n});\n\n// Remove any methods implemented natively so we don't override them\nvar ignore = ['length'];\nEmber.ArrayUtils.forEach(NativeArray.keys(), function(methodName) {\n if (Array.prototype[methodName]) ignore.push(methodName);\n});\n\nif (ignore.length>0) {\n NativeArray = NativeArray.without.apply(NativeArray, ignore);\n}\n\n/**\n The NativeArray mixin contains the properties needed to to make the native\n Array support Ember.MutableArray and all of its dependent APIs. Unless you\n have Ember.EXTEND_PROTOTYPES set to false, this will be applied automatically.\n Otherwise you can apply the mixin at anytime by calling\n `Ember.NativeArray.activate`.\n\n @namespace\n @extends Ember.MutableArray\n @extends Ember.Array\n @extends Ember.Enumerable\n @extends Ember.MutableEnumerable\n @extends Ember.Copyable\n @extends Ember.Freezable\n*/\nEmber.NativeArray = NativeArray;\n\n/**\n Creates an Ember.NativeArray from an Array like object.\n Does not modify the original object.\n\n @returns {Ember.NativeArray}\n*/\nEmber.A = function(arr){\n if (arr === undefined) { arr = []; }\n return Ember.NativeArray.apply(arr);\n};\n\n/**\n Activates the mixin on the Array.prototype if not already applied. Calling\n this method more than once is safe.\n\n @returns {void}\n*/\nEmber.NativeArray.activate = function() {\n NativeArray.apply(Array.prototype);\n\n Ember.A = function(arr) { return arr || []; };\n};\n\nif (Ember.EXTEND_PROTOTYPES) Ember.NativeArray.activate();\n\n\n\n})();\n\n\n\n(function() {\n/**\n JavaScript (before ES6) does not have a Map implementation. Objects,\n which are often used as dictionaries, may only have Strings as keys.\n\n Because Ember has a way to get a unique identifier for every object\n via `Ember.guidFor`, we can implement a performant Map with arbitrary\n keys. Because it is commonly used in low-level bookkeeping, Map is\n implemented as a pure JavaScript object for performance.\n\n This implementation follows the current iteration of the ES6 proposal\n for maps (http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets),\n with two exceptions. First, because we need our implementation to be\n pleasant on older browsers, we do not use the `delete` name (using\n `remove` instead). Second, as we do not have the luxury of in-VM\n iteration, we implement a forEach method for iteration.\n\n Map is mocked out to look like an Ember object, so you can do\n `Ember.Map.create()` for symmetry with other Ember classes.\n*/\n\n/** @private */\nvar guidFor = Ember.guidFor;\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n// This class is used internally by Ember.js and Ember Data.\n// Please do not use it at this time. We plan to clean it up\n// and add many tests soon.\nvar OrderedSet = Ember.OrderedSet = function() {\n this.clear();\n};\n\nOrderedSet.create = function() {\n return new OrderedSet();\n};\n\nOrderedSet.prototype = {\n clear: function() {\n this.presenceSet = {};\n this.list = [];\n },\n\n add: function(obj) {\n var guid = guidFor(obj),\n presenceSet = this.presenceSet,\n list = this.list;\n\n if (guid in presenceSet) { return; }\n\n presenceSet[guid] = true;\n list.push(obj);\n },\n\n remove: function(obj) {\n var guid = guidFor(obj),\n presenceSet = this.presenceSet,\n list = this.list;\n\n delete presenceSet[guid];\n\n var index = indexOf(list, obj);\n if (index > -1) {\n list.splice(index, 1);\n }\n },\n\n isEmpty: function() {\n return this.list.length === 0;\n },\n\n forEach: function(fn, self) {\n // allow mutation during iteration\n var list = this.list.slice();\n\n for (var i = 0, j = list.length; i < j; i++) {\n fn.call(self, list[i]);\n }\n },\n\n toArray: function() {\n return this.list.slice();\n }\n};\n\n/**\n A Map stores values indexed by keys. Unlike JavaScript's\n default Objects, the keys of a Map can be any JavaScript\n object.\n\n Internally, a Map has two data structures:\n\n `keys`: an OrderedSet of all of the existing keys\n `values`: a JavaScript Object indexed by the\n Ember.guidFor(key)\n\n When a key/value pair is added for the first time, we\n add the key to the `keys` OrderedSet, and create or\n replace an entry in `values`. When an entry is deleted,\n we delete its entry in `keys` and `values`.\n*/\n\n/** @private */\nvar Map = Ember.Map = function() {\n this.keys = Ember.OrderedSet.create();\n this.values = {};\n};\n\nMap.create = function() {\n return new Map();\n};\n\nMap.prototype = {\n /**\n Retrieve the value associated with a given key.\n\n @param {anything} key\n @return {anything} the value associated with the key, or undefined\n */\n get: function(key) {\n var values = this.values,\n guid = guidFor(key);\n\n return values[guid];\n },\n\n /**\n Adds a value to the map. If a value for the given key has already been\n provided, the new value will replace the old value.\n\n @param {anything} key\n @param {anything} value\n */\n set: function(key, value) {\n var keys = this.keys,\n values = this.values,\n guid = guidFor(key);\n\n keys.add(key);\n values[guid] = value;\n },\n\n /**\n Removes a value from the map for an associated key.\n\n @param {anything} key\n @returns {Boolean} true if an item was removed, false otherwise\n */\n remove: function(key) {\n // don't use ES6 \"delete\" because it will be annoying\n // to use in browsers that are not ES6 friendly;\n var keys = this.keys,\n values = this.values,\n guid = guidFor(key),\n value;\n\n if (values.hasOwnProperty(guid)) {\n keys.remove(key);\n value = values[guid];\n delete values[guid];\n return true;\n } else {\n return false;\n }\n },\n\n /**\n Check whether a key is present.\n\n @param {anything} key\n @returns {Boolean} true if the item was present, false otherwise\n */\n has: function(key) {\n var values = this.values,\n guid = guidFor(key);\n\n return values.hasOwnProperty(guid);\n },\n\n /**\n Iterate over all the keys and values. Calls the function once\n for each key, passing in the key and value, in that order.\n\n The keys are guaranteed to be iterated over in insertion order.\n\n @param {Function} callback\n @param {anything} self if passed, the `this` value inside the\n callback. By default, `this` is the map.\n */\n forEach: function(callback, self) {\n var keys = this.keys,\n values = this.values;\n\n keys.forEach(function(key) {\n var guid = guidFor(key);\n callback.call(self, key, values[guid]);\n });\n }\n};\n\n})();\n\n\n\n(function() {\nvar loadHooks = {};\nvar loaded = {};\n\nEmber.onLoad = function(name, callback) {\n var object;\n\n loadHooks[name] = loadHooks[name] || Ember.A();\n loadHooks[name].pushObject(callback);\n\n if (object = loaded[name]) {\n callback(object);\n }\n};\n\nEmber.runLoadHooks = function(name, object) {\n loaded[name] = object;\n\n var hooks = loadHooks[name];\n\n loadHooks[name].forEach(function(callback) {\n callback(object);\n });\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/**\n @class\n\n Ember.ArrayController provides a way for you to publish a collection of objects\n so that you can easily bind to the collection from a Handlebars #each helper,\n an Ember.CollectionView, or other controllers.\n\n The advantage of using an ArrayController is that you only have to set up\n your view bindings once; to change what's displayed, simply swap out the\n `content` property on the controller.\n\n For example, imagine you wanted to display a list of items fetched via an XHR\n request. Create an Ember.ArrayController and set its `content` property:\n\n MyApp.listController = Ember.ArrayController.create();\n\n $.get('people.json', function(data) {\n MyApp.listController.set('content', data);\n });\n\n Then, create a view that binds to your new controller:\n\n {{#each MyApp.listController}}\n {{firstName}} {{lastName}}\n {{/each}}\n\n Although you are binding to the controller, the behavior of this controller\n is to pass through any methods or properties to the underlying array. This\n capability comes from `Ember.ArrayProxy`, which this class inherits from.\n\n Note: As of this writing, `ArrayController` does not add any functionality\n to its superclass, `ArrayProxy`. The Ember team plans to add additional\n controller-specific functionality in the future, e.g. single or multiple\n selection support. If you are creating something that is conceptually a\n controller, use this class.\n\n @extends Ember.ArrayProxy\n*/\n\nEmber.ArrayController = Ember.ArrayProxy.extend();\n\n})();\n\n\n\n(function() {\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n An Ember.Application instance serves as the namespace in which you define your\n application's classes. You can also override the configuration of your\n application.\n\n By default, Ember.Application will begin listening for events on the document.\n If your application is embedded inside a page, instead of controlling the\n entire document, you can specify which DOM element to attach to by setting\n the `rootElement` property:\n\n MyApp = Ember.Application.create({\n rootElement: $('#my-app')\n });\n\n The root of an Ember.Application must not be removed during the course of the\n page's lifetime. If you have only a single conceptual application for the\n entire page, and are not embedding any third-party Ember applications\n in your page, use the default document root for your application.\n\n You only need to specify the root if your page contains multiple instances\n of Ember.Application.\n\n @extends Ember.Object\n*/\nEmber.Application = Ember.Namespace.extend(\n/** @scope Ember.Application.prototype */{\n\n /**\n The root DOM element of the Application.\n\n Can be specified as DOMElement or a selector string.\n\n @type DOMElement\n @default 'body'\n */\n rootElement: 'body',\n\n /**\n @type Ember.EventDispatcher\n @default null\n */\n eventDispatcher: null,\n\n /**\n @type Object\n @default null\n */\n customEvents: null,\n\n /** @private */\n init: function() {\n var eventDispatcher,\n rootElement = get(this, 'rootElement');\n this._super();\n\n eventDispatcher = Ember.EventDispatcher.create({\n rootElement: rootElement\n });\n\n set(this, 'eventDispatcher', eventDispatcher);\n\n // jQuery 1.7 doesn't call the ready callback if already ready\n if (Ember.$.isReady) {\n Ember.run.once(this, this.didBecomeReady);\n } else {\n var self = this;\n Ember.$(document).ready(function() {\n Ember.run.once(self, self.didBecomeReady);\n });\n }\n },\n\n /**\n Instantiate all controllers currently available on the namespace\n and inject them onto a state manager.\n\n Example:\n\n App.PostsController = Ember.ArrayController.create();\n App.CommentsController = Ember.ArrayController.create();\n\n var stateManager = Ember.StateManager.create({\n ...\n });\n\n App.injectControllers(stateManager);\n\n stateManager.get('postsController') // <App.PostsController:ember1234>\n stateManager.get('commentsController') // <App.CommentsController:ember1235>\n\n stateManager.getPath('postsController.stateManager') // stateManager\n */\n inject: function(stateManager) {\n var properties = Ember.A(Ember.keys(this)),\n injections = get(this.constructor, 'injections'),\n namespace = this, controller, name;\n\n properties.forEach(function(property) {\n injections.forEach(function(injection) {\n injection(namespace, stateManager, property);\n });\n });\n },\n\n /** @private */\n didBecomeReady: function() {\n var eventDispatcher = get(this, 'eventDispatcher'),\n stateManager = get(this, 'stateManager'),\n customEvents = get(this, 'customEvents');\n\n eventDispatcher.setup(customEvents);\n\n this.ready();\n\n if (stateManager) {\n this.setupStateManager(stateManager);\n }\n },\n\n /**\n @private\n\n If the application has a state manager, use it to route\n to the current URL, and trigger a new call to `route`\n whenever the URL changes.\n */\n setupStateManager: function(stateManager) {\n var location = get(stateManager, 'location');\n\n stateManager.route(location.getURL());\n location.onUpdateURL(function(url) {\n stateManager.route(url);\n });\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 ready: Ember.K,\n\n /** @private */\n destroy: function() {\n get(this, 'eventDispatcher').destroy();\n return this._super();\n }\n});\n\nEmber.Application.reopenClass({\n concatenatedProperties: ['injections'],\n injections: Ember.A(),\n registerInjection: function(callback) {\n get(this, 'injections').pushObject(callback);\n }\n});\n\nEmber.Application.registerInjection(function(app, stateManager, property) {\n if (!/^[A-Z].*Controller$/.test(property)) { return; }\n\n var name = property[0].toLowerCase() + property.substr(1),\n controller = app[property].create();\n\n stateManager.set(name, controller);\n controller.set('target', stateManager);\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n This file implements the `location` API used by Ember's router.\n\n That API is:\n\n getURL: returns the current URL\n setURL(path): sets the current URL\n onUpdateURL(callback): triggers the callback when the URL changes\n\n Calling setURL will not trigger onUpdateURL callbacks.\n*/\n\n/**\n Ember.HashLocation implements the location API using the browser's\n hash. At present, it relies on a hashchange event existing in the\n browser.\n*/\nEmber.HashLocation = Ember.Object.extend({\n init: function() {\n set(this, 'location', get(this, 'location') || window.location);\n set(this, 'callbacks', Ember.A());\n },\n\n /**\n @private\n\n Returns the current `location.hash`, minus the '#' at the front.\n */\n getURL: function() {\n return get(this, 'location').hash.substr(1);\n },\n\n /**\n @private\n\n Set the `location.hash` and remembers what was set. This prevents\n `onUpdateURL` callbacks from triggering when the hash was set by\n `HashLocation`.\n */\n setURL: function(path) {\n get(this, 'location').hash = path;\n set(this, 'lastSetURL', path);\n },\n\n /**\n @private\n\n Register a callback to be invoked when the hash changes. These\n callbacks will execute when the user presses the back or forward\n button, but not after `setURL` is invoked.\n */\n onUpdateURL: function(callback) {\n var self = this;\n\n var hashchange = function() {\n var path = location.hash.substr(1);\n if (get(self, 'lastSetURL') === path) { return; }\n\n set(self, 'lastSetURL', null);\n\n callback(location.hash.substr(1));\n };\n\n get(this, 'callbacks').pushObject(hashchange);\n window.addEventListener('hashchange', hashchange);\n },\n\n willDestroy: function() {\n get(this, 'callbacks').forEach(function(callback) {\n window.removeEventListener('hashchange', callback);\n });\n set(this, 'callbacks', null);\n }\n});\n\n/**\n Ember.Location returns an instance of the correct implementation of\n the `location` API.\n\n You can pass it a `style` ('hash', 'html5', 'none') to force a\n particular implementation.\n*/\nEmber.Location = {\n create: function(options) {\n var style = options && options.style;\n Ember.assert(\"you must provide a style to Ember.Location.create\", !!style);\n\n if (style === \"hash\") {\n return Ember.HashLocation.create.apply(Ember.HashLocation, arguments);\n }\n }\n};\n\n})();\n\n\n\n(function() {\n\n})();\n\n\n\n(function() {\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nEmber.assert(\"Ember requires jQuery 1.6 or 1.7\", window.jQuery && window.jQuery().jquery.match(/^1\\.[67](\\.\\d+)?(pre|rc\\d?)?/));\nEmber.$ = window.jQuery;\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\nvar forEach = Ember.ArrayUtils.forEach;\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n/** @private */\nvar ClassSet = function() {\n this.seen = {};\n this.list = [];\n};\n\nClassSet.prototype = {\n add: function(string) {\n if (string in this.seen) { return; }\n this.seen[string] = true;\n\n this.list.push(string);\n },\n\n toDOM: function() {\n return this.list.join(\" \");\n }\n};\n\n/**\n @class\n\n Ember.RenderBuffer gathers information regarding the a view and generates the\n final representation. Ember.RenderBuffer will generate HTML which can be pushed\n to the DOM.\n\n @extends Ember.Object\n*/\nEmber.RenderBuffer = function(tagName) {\n return new Ember._RenderBuffer(tagName);\n};\n\nEmber._RenderBuffer = function(tagName) {\n this.elementTag = tagName;\n this.childBuffers = [];\n};\n\nEmber._RenderBuffer.prototype =\n/** @scope Ember.RenderBuffer.prototype */ {\n\n /**\n Array of class-names which will be applied in the class=\"\" attribute\n\n You should not maintain this array yourself, rather, you should use\n the addClass() method of Ember.RenderBuffer.\n\n @type Array\n @default []\n */\n elementClasses: null,\n\n /**\n The id in of the element, to be applied in the id=\"\" attribute\n\n You should not set this property yourself, rather, you should use\n the id() method of Ember.RenderBuffer.\n\n @type String\n @default null\n */\n elementId: null,\n\n /**\n A hash keyed on the name of the attribute and whose value will be\n applied to that attribute. For example, if you wanted to apply a\n data-view=\"Foo.bar\" property to an element, you would set the\n elementAttributes hash to {'data-view':'Foo.bar'}\n\n You should not maintain this hash yourself, rather, you should use\n the attr() method of Ember.RenderBuffer.\n\n @type Hash\n @default {}\n */\n elementAttributes: null,\n\n /**\n The tagname of the element an instance of Ember.RenderBuffer represents.\n\n Usually, this gets set as the first parameter to Ember.RenderBuffer. For\n example, if you wanted to create a `p` tag, then you would call\n\n Ember.RenderBuffer('p')\n\n @type String\n @default null\n */\n elementTag: null,\n\n /**\n A hash keyed on the name of the style attribute and whose value will\n be applied to that attribute. For example, if you wanted to apply a\n background-color:black;\" style to an element, you would set the\n elementStyle hash to {'background-color':'black'}\n\n You should not maintain this hash yourself, rather, you should use\n the style() method of Ember.RenderBuffer.\n\n @type Hash\n @default {}\n */\n elementStyle: null,\n\n /**\n Nested RenderBuffers will set this to their parent RenderBuffer\n instance.\n\n @type Ember._RenderBuffer\n */\n parentBuffer: null,\n\n /**\n Adds a string of HTML to the RenderBuffer.\n\n @param {String} string HTML to push into the buffer\n @returns {Ember.RenderBuffer} this\n */\n push: function(string) {\n this.childBuffers.push(String(string));\n return this;\n },\n\n /**\n Adds a class to the buffer, which will be rendered to the class attribute.\n\n @param {String} className Class name to add to the buffer\n @returns {Ember.RenderBuffer} this\n */\n addClass: function(className) {\n // lazily create elementClasses\n var elementClasses = this.elementClasses = (this.elementClasses || new ClassSet());\n this.elementClasses.add(className);\n\n return this;\n },\n\n /**\n Sets the elementID to be used for the element.\n\n @param {String} id\n @returns {Ember.RenderBuffer} this\n */\n id: function(id) {\n this.elementId = id;\n return this;\n },\n\n // duck type attribute functionality like jQuery so a render buffer\n // can be used like a jQuery object in attribute binding scenarios.\n\n /**\n Adds an attribute which will be rendered to the element.\n\n @param {String} name The name of the attribute\n @param {String} value The value to add to the attribute\n @returns {Ember.RenderBuffer|String} this or the current attribute value\n */\n attr: function(name, value) {\n var attributes = this.elementAttributes = (this.elementAttributes || {});\n\n if (arguments.length === 1) {\n return attributes[name];\n } else {\n attributes[name] = value;\n }\n\n return this;\n },\n\n /**\n Remove an attribute from the list of attributes to render.\n\n @param {String} name The name of the attribute\n @returns {Ember.RenderBuffer} this\n */\n removeAttr: function(name) {\n var attributes = this.elementAttributes;\n if (attributes) { delete attributes[name]; }\n\n return this;\n },\n\n /**\n Adds a style to the style attribute which will be rendered to the element.\n\n @param {String} name Name of the style\n @param {String} value\n @returns {Ember.RenderBuffer} this\n */\n style: function(name, value) {\n var style = this.elementStyle = (this.elementStyle || {});\n\n this.elementStyle[name] = value;\n return this;\n },\n\n /**\n Create a new child render buffer from a parent buffer. Optionally set\n additional properties on the buffer. Optionally invoke a callback\n with the newly created buffer.\n\n This is a primitive method used by other public methods: `begin`,\n `prepend`, `replaceWith`, `insertAfter`.\n\n @private\n @param {String} tagName Tag name to use for the child buffer's element\n @param {Ember._RenderBuffer} parent The parent render buffer that this\n buffer should be appended to.\n @param {Function} fn A callback to invoke with the newly created buffer.\n @param {Object} other Additional properties to add to the newly created\n buffer.\n */\n newBuffer: function(tagName, parent, fn, other) {\n var buffer = new Ember._RenderBuffer(tagName);\n buffer.parentBuffer = parent;\n\n if (other) { buffer.setProperties(other); }\n if (fn) { fn.call(this, buffer); }\n\n return buffer;\n },\n\n /**\n Replace the current buffer with a new buffer. This is a primitive\n used by `remove`, which passes `null` for `newBuffer`, and `replaceWith`,\n which passes the new buffer it created.\n\n @private\n @param {Ember._RenderBuffer} buffer The buffer to insert in place of\n the existing buffer.\n */\n replaceWithBuffer: function(newBuffer) {\n var parent = this.parentBuffer;\n if (!parent) { return; }\n\n var childBuffers = parent.childBuffers;\n\n var index = indexOf(childBuffers, this);\n\n if (newBuffer) {\n childBuffers.splice(index, 1, newBuffer);\n } else {\n childBuffers.splice(index, 1);\n }\n },\n\n /**\n Creates a new Ember.RenderBuffer object with the provided tagName as\n the element tag and with its parentBuffer property set to the current\n Ember.RenderBuffer.\n\n @param {String} tagName Tag name to use for the child buffer's element\n @returns {Ember.RenderBuffer} A new RenderBuffer object\n */\n begin: function(tagName) {\n return this.newBuffer(tagName, this, function(buffer) {\n this.childBuffers.push(buffer);\n });\n },\n\n /**\n Prepend a new child buffer to the current render buffer.\n\n @param {String} tagName Tag name to use for the child buffer's element\n */\n prepend: function(tagName) {\n return this.newBuffer(tagName, this, function(buffer) {\n this.childBuffers.splice(0, 0, buffer);\n });\n },\n\n /**\n Replace the current buffer with a new render buffer.\n\n @param {String} tagName Tag name to use for the new buffer's element\n */\n replaceWith: function(tagName) {\n var parentBuffer = this.parentBuffer;\n\n return this.newBuffer(tagName, parentBuffer, function(buffer) {\n this.replaceWithBuffer(buffer);\n });\n },\n\n /**\n Insert a new render buffer after the current render buffer.\n\n @param {String} tagName Tag name to use for the new buffer's element\n */\n insertAfter: function(tagName) {\n var parentBuffer = get(this, 'parentBuffer');\n\n return this.newBuffer(tagName, parentBuffer, function(buffer) {\n var siblings = parentBuffer.childBuffers;\n var index = indexOf(siblings, this);\n siblings.splice(index + 1, 0, buffer);\n });\n },\n\n /**\n Closes the current buffer and adds its content to the parentBuffer.\n\n @returns {Ember.RenderBuffer} The parentBuffer, if one exists. Otherwise, this\n */\n end: function() {\n var parent = this.parentBuffer;\n return parent || this;\n },\n\n remove: function() {\n this.replaceWithBuffer(null);\n },\n\n /**\n @returns {DOMElement} The element corresponding to the generated HTML\n of this buffer\n */\n element: function() {\n return Ember.$(this.string())[0];\n },\n\n /**\n Generates the HTML content for this buffer.\n\n @returns {String} The generated HTMl\n */\n string: function() {\n var content = '', tag = this.elementTag, openTag;\n\n if (tag) {\n var id = this.elementId,\n classes = this.elementClasses,\n attrs = this.elementAttributes,\n style = this.elementStyle,\n styleBuffer = '', prop;\n\n openTag = [\"<\" + tag];\n\n if (id) { openTag.push('id=\"' + this._escapeAttribute(id) + '\"'); }\n if (classes) { openTag.push('class=\"' + this._escapeAttribute(classes.toDOM()) + '\"'); }\n\n if (style) {\n for (prop in style) {\n if (style.hasOwnProperty(prop)) {\n styleBuffer += (prop + ':' + this._escapeAttribute(style[prop]) + ';');\n }\n }\n\n openTag.push('style=\"' + styleBuffer + '\"');\n }\n\n if (attrs) {\n for (prop in attrs) {\n if (attrs.hasOwnProperty(prop)) {\n openTag.push(prop + '=\"' + this._escapeAttribute(attrs[prop]) + '\"');\n }\n }\n }\n\n openTag = openTag.join(\" \") + '>';\n }\n\n var childBuffers = this.childBuffers;\n\n forEach(childBuffers, function(buffer) {\n var stringy = typeof buffer === 'string';\n content += (stringy ? buffer : buffer.string());\n });\n\n if (tag) {\n return openTag + content + \"</\" + tag + \">\";\n } else {\n return content;\n }\n },\n\n _escapeAttribute: function(value) {\n // Stolen shamelessly from Handlebars\n\n var escape = {\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n '\"': \"&quot;\",\n \"'\": \"&#x27;\",\n \"`\": \"&#x60;\"\n };\n\n var badChars = /&(?!\\w+;)|[<>\"'`]/g;\n var possible = /[&<>\"'`]/;\n\n var escapeChar = function(chr) {\n return escape[chr] || \"&amp;\";\n };\n\n var string = value.toString();\n\n if(!possible.test(string)) { return string; }\n return string.replace(badChars, escapeChar);\n }\n\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\n\n/**\n @ignore\n\n Ember.EventDispatcher handles delegating browser events to their corresponding\n Ember.Views. For example, when you click on a view, Ember.EventDispatcher ensures\n that that view's `mouseDown` method gets called.\n*/\nEmber.EventDispatcher = Ember.Object.extend(\n/** @scope Ember.EventDispatcher.prototype */{\n\n /**\n @private\n\n The root DOM element to which event listeners should be attached. Event\n listeners will be attached to the document unless this is overridden.\n\n Can be specified as a DOMElement or a selector string.\n\n The default body is a string since this may be evaluated before document.body\n exists in the DOM.\n\n @type DOMElement\n @default 'body'\n */\n rootElement: 'body',\n\n /**\n @private\n\n Sets up event listeners for standard browser events.\n\n This will be called after the browser sends a DOMContentReady event. By\n default, it will set up all of the listeners on the document body. If you\n would like to register the listeners on a different element, set the event\n dispatcher's `root` property.\n */\n setup: function(addedEvents) {\n var event, events = {\n touchstart : 'touchStart',\n touchmove : 'touchMove',\n touchend : 'touchEnd',\n touchcancel : 'touchCancel',\n keydown : 'keyDown',\n keyup : 'keyUp',\n keypress : 'keyPress',\n mousedown : 'mouseDown',\n mouseup : 'mouseUp',\n contextmenu : 'contextMenu',\n click : 'click',\n dblclick : 'doubleClick',\n mousemove : 'mouseMove',\n focusin : 'focusIn',\n focusout : 'focusOut',\n mouseenter : 'mouseEnter',\n mouseleave : 'mouseLeave',\n submit : 'submit',\n change : 'change',\n dragstart : 'dragStart',\n drag : 'drag',\n dragenter : 'dragEnter',\n dragleave : 'dragLeave',\n dragover : 'dragOver',\n drop : 'drop',\n dragend : 'dragEnd'\n };\n\n Ember.$.extend(events, addedEvents || {});\n\n var rootElement = Ember.$(get(this, 'rootElement'));\n\n Ember.assert(fmt('You cannot use the same root element (%@) multiple times in an Ember.Application', [rootElement.selector || rootElement[0].tagName]), !rootElement.is('.ember-application'));\n Ember.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest('.ember-application').length);\n Ember.assert('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find('.ember-application').length);\n\n rootElement.addClass('ember-application');\n\n Ember.assert('Unable to add \"ember-application\" class to rootElement. Make sure you set rootElement to the body or an element in the body.', rootElement.is('.ember-application'));\n\n for (event in events) {\n if (events.hasOwnProperty(event)) {\n this.setupHandler(rootElement, event, events[event]);\n }\n }\n },\n\n /**\n @private\n\n Registers an event listener on the document. If the given event is\n triggered, the provided event handler will be triggered on the target\n view.\n\n If the target view does not implement the event handler, or if the handler\n returns false, the parent view will be called. The event will continue to\n bubble to each successive parent view until it reaches the top.\n\n For example, to have the `mouseDown` method called on the target view when\n a `mousedown` event is received from the browser, do the following:\n\n setupHandler('mousedown', 'mouseDown');\n\n @param {String} event the browser-originated event to listen to\n @param {String} eventName the name of the method to call on the view\n */\n setupHandler: function(rootElement, event, eventName) {\n var self = this;\n\n rootElement.delegate('.ember-view', event + '.ember', function(evt, triggeringManager) {\n\n var view = Ember.View.views[this.id],\n result = true, manager = null;\n\n manager = self._findNearestEventManager(view,eventName);\n\n if (manager && manager !== triggeringManager) {\n result = self._dispatchEvent(manager, evt, eventName, view);\n } else if (view) {\n result = self._bubbleEvent(view,evt,eventName);\n } else {\n evt.stopPropagation();\n }\n\n return result;\n });\n\n rootElement.delegate('[data-ember-action]', event + '.ember', function(evt) {\n var actionId = Ember.$(evt.currentTarget).attr('data-ember-action'),\n action = Ember.Handlebars.ActionHelper.registeredActions[actionId],\n handler = action.handler;\n\n if (action.eventName === eventName) {\n return handler(evt);\n }\n });\n },\n\n /** @private */\n _findNearestEventManager: function(view, eventName) {\n var manager = null;\n\n while (view) {\n manager = get(view, 'eventManager');\n if (manager && manager[eventName]) { break; }\n\n view = get(view, 'parentView');\n }\n\n return manager;\n },\n\n /** @private */\n _dispatchEvent: function(object, evt, eventName, view) {\n var result = true;\n\n var handler = object[eventName];\n if (Ember.typeOf(handler) === 'function') {\n result = handler.call(object, evt, view);\n evt.stopPropagation();\n }\n else {\n result = this._bubbleEvent(view, evt, eventName);\n }\n\n return result;\n },\n\n /** @private */\n _bubbleEvent: function(view, evt, eventName) {\n return Ember.run(function() {\n return view.handleEvent(eventName, evt);\n });\n },\n\n /** @private */\n destroy: function() {\n var rootElement = get(this, 'rootElement');\n Ember.$(rootElement).undelegate('.ember').removeClass('ember-application');\n return this._super();\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n// Add a new named queue for rendering views that happens\n// after bindings have synced.\nvar queues = Ember.run.queues;\nqueues.splice(Ember.$.inArray('actions', queues)+1, 0, 'render');\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, addObserver = Ember.addObserver;\nvar getPath = Ember.getPath, meta = Ember.meta, fmt = Ember.String.fmt;\nvar a_slice = Array.prototype.slice;\nvar a_forEach = Ember.ArrayUtils.forEach;\n\nvar childViewsProperty = Ember.computed(function() {\n var childViews = get(this, '_childViews');\n\n var ret = Ember.A();\n\n a_forEach(childViews, function(view) {\n if (view.isVirtual) {\n ret.pushObjects(get(view, 'childViews'));\n } else {\n ret.push(view);\n }\n });\n\n return ret;\n}).property().cacheable();\n\nvar VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;\nEmber.warn(\"The way that the {{view}} helper affects templates is about to change. Previously, templates inside child views would use the new view as the context. Soon, views will preserve their parent context when rendering their template. You can opt-in early to the new behavior by setting `ENV.VIEW_PRESERVES_CONTEXT = true`. For more information, see https://gist.github.com/2494968. You should update your templates as soon as possible; this default will change soon, and the option will be eliminated entirely before the 1.0 release.\", VIEW_PRESERVES_CONTEXT);\n\n/**\n @static\n\n Global hash of shared templates. This will automatically be populated\n by the build tools so that you can store your Handlebars templates in\n separate files that get loaded into JavaScript at buildtime.\n\n @type Hash\n*/\nEmber.TEMPLATES = {};\n\nvar invokeForState = {\n preRender: {},\n inBuffer: {},\n hasElement: {},\n inDOM: {},\n destroyed: {}\n};\n\n/**\n @class\n\n `Ember.View` is the class in Ember responsible for encapsulating templates of HTML\n content, combining templates with data to render as sections of a page's DOM, and\n registering and responding to user-initiated events.\n \n ## HTML Tag\n The default HTML tag name used for a view's DOM representation is `div`. This can be\n customized by setting the `tagName` property. The following view class:\n\n ParagraphView = Ember.View.extend({\n tagName: 'em'\n })\n\n Would result in instances with the following HTML:\n\n <em id=\"ember1\" class=\"ember-view\"></em>\n\n ## HTML `class` Attribute\n The HTML `class` attribute of a view's tag can be set by providing a `classNames` property\n that is set to an array of strings:\n\n MyView = Ember.View.extend({\n classNames: ['my-class', 'my-other-class']\n })\n\n Will result view instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view my-class my-other-class\"></div>\n\n `class` attribute values can also be set by providing a `classNameBindings` property\n set to an array of properties names for the view. The return value of these properties \n will be added as part of the value for the view's `class` attribute. These properties\n can be computed properties:\n\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 Will result view instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view from-a from-b\"></div>\n\n If the value of a class name binding returns a boolean the property name itself\n will be used as the class name if the property is true. The class name will\n not be added if the value is `false` or `undefined`.\n\n MyView = Ember.View.extend({\n classNameBindings: ['hovered'],\n hovered: true\n })\n\n Will result view instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view hovered\"></div>\n\n When using boolean class name bindings you can supply a string value other than the \n property name for use as the `class` HTML attribute by appending the preferred value after\n a \":\" character when defining the binding:\n\n MyView = Ember.View.extend({\n classNameBindings: ['awesome:so-very-cool'],\n awesome: true\n })\n\n Will result view instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view so-very-cool\"></div>\n\n\n Boolean value class name bindings whose property names are in a camelCase-style\n format will be converted to a dasherized format:\n\n MyView = Ember.View.extend({\n classNameBindings: ['isUrgent'],\n isUrgent: true\n })\n\n Will result view instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view is-urgent\"></div>\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 MyView = Ember.View.extend({\n classNameBindings: ['messages.empty']\n messages: Ember.Object.create({\n empty: true\n })\n })\n\n Will result view instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view empty\"></div>\n\n Updates to the the value of a class name binding will result in automatic update \n of the HTML `class` attribute in the view's rendered HTML representation.\n If the value becomes `false` or `undefined` the class name will be removed.\n\n Both `classNames` and `classNameBindings` are concatenated properties. \n See `Ember.Object` documentation for more information about concatenated properties.\n\n ## HTML Attributes\n The HTML attribute section of a view's tag can be set by providing an `attributeBindings`\n property set to an array of property names on the view. The return value of these properties\n will be used as the value of the view's HTML associated attribute:\n\n AnchorView = Ember.View.extend({\n tagName: 'a',\n attributeBindings: ['href'],\n href: 'http://google.com'\n })\n\n Will result view instances with HTML representation of:\n\n <a id=\"ember1\" class=\"ember-view\" href=\"http://google.com\"></a>\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 MyTextInput = Ember.View.extend({\n tagName: 'input',\n attributeBindings: ['disabled'],\n disabled: true\n })\n\n Will result view instances with HTML representation of:\n\n <input id=\"ember1\" class=\"ember-view\" disabled=\"disabled\" />\n\n `attributeBindings` can refer to computed properties:\n\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 Updates to the the property of an attribute binding will result in automatic update \n of the HTML attribute in the view's rendered HTML representation.\n\n `attributeBindings` is a concatenated property. See `Ember.Object` documentation\n for more information about concatenated properties.\n\n ## Templates\n The HTML contents of a view's rendered representation are determined by its template.\n Templates can be any function that accepts an optional context parameter and returns\n a string of HTML that will be inserted within the view's tag. Most\n typically in Ember this function will be a compiled Ember.Handlebars template.\n\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('I am the template')\n })\n\n Will result view instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">I am the template</div>\n\n The default context of the compiled template will be the view instance itself:\n\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('Hello {{excitedGreeting}}')\n })\n\n aView = AView.create({\n content: Ember.Object.create({\n firstName: 'Barry'\n })\n excitedGreeting: function(){\n return this.getPath(\"contnet.firstName\") + \"!!!\"\n }\n })\n\n Will result in HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">Hello Barry!!!</div>\n\n Within an Ember application is more common to define a Handlebars templates as\n part of a page:\n\n <script type='text/x-handlebars' data-template-name='some-template'>\n Hello\n </script>\n\n And associate it by name using a view's `templateName` property:\n\n AView = Ember.View.extend({\n templateName: 'some-template'\n })\n\n Using a value for `templateName` that does not have a Handlebars template with a\n matching `data-template-name` attribute will throw an error.\n\n Assigning a value to both `template` and `templateName` properties will throw an error.\n\n For views classes that may have a template later defined (e.g. as the block portion of a `{{view}}`\n Handlebars helper call in another template or in a subclass), you can provide a `defaultTemplate`\n property set to compiled template function. If a template is not later provided for the view\n instance the `defaultTemplate` value will be used:\n\n AView = Ember.View.extend({\n defaultTemplate: Ember.Handlebars.compile('I was the default'),\n template: null,\n templateName: null\n })\n\n Will result in instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">I was the default</div>\n\n If a `template` or `templateName` is provided it will take precedence over `defaultTemplate`:\n\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 Will result in HTML representation when rendered:\n\n <div id=\"ember1\" class=\"ember-view\">I was the template, not default</div>\n\n ## Layouts\n Views can have a secondary outer template that wraps their main template. Like\n primary templates, layouts can be any function that accepts an optional context\n parameter and returns a string of HTML that will be inserted a view's tag.\n Most typically in Ember this function will be a compiled Ember.Handlebars template.\n\n A view's layout can be set directly with the `layout` property or reference an\n 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 `{{yield}}`\n helper. The HTML contents of a view's rendered `template` will be inserted at this location:\n\n AViewWithLayout = Ember.View.extend({\n layout: Ember.Handlebars.compile(\"<div class='my-decorative-class'>{{yield}}</div>\")\n template: Ember.Handlebars.compile(\"I got wrapped\"),\n })\n\n\n Will result in instances with HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">\n <div class=\"my-decorative-class\">\n I got wrapped\n </div>\n </div>\n\n See `Handlebars.helpers.yield` for more information.\n\n ## Responding to Browser Events\n Views can respond to user-initiated events in one of three ways: method implementation, \n through an event manager, and through `{{action}}` helper use in their template or layout.\n\n ### Method Implementation\n Views can respond to user-initiated events by implementing a method that matches the\n event name. A `jQuery.Event` object will be passed as the argument to this method.\n\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 ### Event Managers\n Views can define an object as their `eventManager` property. This object can then\n implement methods that match the desired event names. Matching events that occur\n on the view's rendered HTML or the rendered HTML of any of its DOM descendants \n will trigger this method. A `jQuery.Event` object will be passed as the first \n argument to the method and an `Ember.View` object as the second. The `Ember.View`\n will be the view whose rendered HTML was interacted with. This may be the view with\n the `eventManager` property or one of its descendent views.\n\n AView = Ember.View.extend({\n eventManager: Ember.Object.create({\n dblclick: 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 same\n name handled through methods on the view.\n\n\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 presedence over AView#mouseenter\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 be called\n if the view instance was rendered inside the HTML representation of a view that has \n an `eventManager` property defined that handles events of the name. Events not handled\n by the event manager will still trigger method calls on the descendent.\n\n OuterView = Ember.View.extend({\n eventManager: Ember.Object.create({\n template: Ember.Handlebars.compile(\"outer {{#view InnerView}}inner{{/view}} outer\"),\n mouseenter: function(event, view){\n // view might be instance of either\n // OutsideView 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 ### Handlebars `{{action}}` Helper\n See `Handlebars.helpers.action`.\n\n ### Event Names\n Possible events names for any of the responding approaches described above are:\n\n Touch events: 'touchStart', 'touchMove', 'touchEnd', 'touchCancel'\n\n Keyboard events: 'keyDown', 'keyUp', 'keyPress'\n\n Mouse events: 'mouseDown', 'mouseUp', 'contextMenu', 'click', 'doubleClick', 'mouseMove',\n 'focusIn', 'focusOut', 'mouseEnter', 'mouseLeave'\n\n Form events: 'submit', 'change', 'focusIn', 'focusOut', 'input'\n\n HTML5 drag and drop events: 'dragStart', 'drag', 'dragEnter', 'dragLeave', 'drop', 'dragEnd'\n \n ## Handlebars `{{view}}` Helper\n Other `Ember.View` instances can be included as part of a view's template by using the `{{view}}`\n Handlebars helper. See `Handlebars.helpers.view` for additional information.\n\n @extends Ember.Object\n*/\nEmber.View = Ember.Object.extend(Ember.Evented,\n/** @scope Ember.View.prototype */ {\n\n /** @private */\n concatenatedProperties: ['classNames', 'classNameBindings', 'attributeBindings'],\n\n /**\n @type Boolean\n @default true\n @constant\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 Ember.View will look for a template with this name in this view's\n `templates` object. By default, this will be a global object\n shared in `Ember.TEMPLATES`.\n\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 Ember.View will look for a template with this name in this view's\n `templates` object. By default, this will be a global object\n shared in `Ember.TEMPLATES`.\n\n @type String\n @default null\n */\n layoutName: null,\n\n /**\n The hash in which to look for `templateName`.\n\n @type Ember.Object\n @default Ember.TEMPLATES\n */\n templates: Ember.TEMPLATES,\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 @field\n @type Function\n */\n template: Ember.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 return template || get(this, 'defaultTemplate');\n }).property('templateName').cacheable(),\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 @type Object\n */\n controller: null,\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 and 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 @field\n @type Function\n */\n layout: Ember.computed(function(key, value) {\n if (arguments.length === 2) { return value; }\n\n var layoutName = get(this, 'layoutName'),\n layout = this.templateForName(layoutName, 'layout');\n\n return layout || get(this, 'defaultLayout');\n }).property('layoutName').cacheable(),\n\n templateForName: function(name, type) {\n if (!name) { return; }\n\n var templates = get(this, 'templates'),\n template = get(templates, name);\n\n if (!template) {\n throw new Ember.Error(fmt('%@ - Unable to find %@ \"%@\".', [this, type, name]));\n }\n\n return template;\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 itself.\n\n @type Object\n */\n templateContext: Ember.computed(function(key, value) {\n if (arguments.length === 2) {\n set(this, '_templateContext', value);\n return value;\n } else {\n return get(this, '_templateContext');\n }\n }).cacheable(),\n\n /**\n @private\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 _templateContext: Ember.computed(function(key, value) {\n var parentView;\n\n if (arguments.length === 2) {\n return value;\n }\n\n if (VIEW_PRESERVES_CONTEXT) {\n parentView = get(this, '_parentView');\n if (parentView) {\n return get(parentView, '_templateContext');\n }\n }\n\n return this;\n }).cacheable(),\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 @private\n */\n _displayPropertyDidChange: Ember.observer(function() {\n this.rerender();\n }, 'templateContext', 'controller'),\n\n /**\n If the view is currently inserted into the DOM of a parent view, this\n property will point to the parent of the view.\n\n @type Ember.View\n @default null\n */\n _parentView: null,\n\n parentView: Ember.computed(function() {\n var parent = get(this, '_parentView');\n\n if (parent && parent.isVirtual) {\n return get(parent, 'parentView');\n } else {\n return parent;\n }\n }).property('_parentView').volatile(),\n\n // return the current view, not including virtual views\n concreteView: Ember.computed(function() {\n if (!this.isVirtual) { return this; }\n else { return get(this, 'parentView'); }\n }).property('_parentView').volatile(),\n\n /**\n If false, the view will appear hidden in DOM.\n\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 @private\n @type Array\n @default []\n */\n childViews: childViewsProperty,\n\n _childViews: [],\n\n /**\n Return the nearest ancestor that is an instance of the provided\n class.\n\n @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @returns Ember.View\n */\n nearestInstanceOf: function(klass) {\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 has a given property.\n\n @param {String} property A property name\n @returns 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 that is a direct child of a\n view of.\n\n @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @returns 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 Return the nearest ancestor that is an Ember.CollectionView\n\n @returns Ember.CollectionView\n */\n collectionView: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.CollectionView);\n }).cacheable(),\n\n /**\n Return the nearest ancestor that is a direct child of\n an Ember.CollectionView\n\n @returns Ember.View\n */\n itemView: Ember.computed(function() {\n return this.nearestChildOf(Ember.CollectionView);\n }).cacheable(),\n\n /**\n Return the nearest ancestor that has the property\n `content`.\n\n @returns Ember.View\n */\n contentView: Ember.computed(function() {\n return this.nearestWithProperty('content');\n }).cacheable(),\n\n /**\n @private\n\n When the parent view changes, recursively invalidate\n collectionView, itemView, and contentView\n */\n _parentViewDidChange: Ember.observer(function() {\n if (this.isDestroying) { return; }\n\n this.invokeRecursively(function(view) {\n view.propertyDidChange('collectionView');\n view.propertyDidChange('itemView');\n view.propertyDidChange('contentView');\n });\n }, '_parentView'),\n\n cloneKeywords: function() {\n var templateData = get(this, 'templateData'),\n controller = get(this, 'controller');\n\n var keywords = templateData ? Ember.copy(templateData.keywords) : {};\n keywords.view = get(this, 'concreteView');\n\n // If the view has a controller specified, make it available to the\n // template. If not, pass along the parent template's controller,\n // if it exists.\n if (controller) {\n keywords.controller = controller;\n }\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 `templateContext`. The value of\n `templateContext` will be the view itself unless you override it.\n\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, '_templateContext');\n var keywords = this.cloneKeywords();\n\n var data = {\n view: this,\n buffer: buffer,\n isRenderData: true,\n keywords: keywords\n };\n\n // Invoke the template with the provided template context, which\n // is the view 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 specify templateName instead?', typeof template === 'function');\n // The template should write directly to the render buffer instead\n // of returning a string.\n var 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 invokeForState: function(name) {\n var stateName = this.state, args;\n\n // try to find the function for the state in the cache\n if (fn = invokeForState[stateName][name]) {\n args = a_slice.call(arguments);\n args[0] = this;\n\n return fn.apply(this, args);\n }\n\n // otherwise, find and cache the function for this state\n var parent = this, states = parent.states, state;\n\n while (states) {\n state = states[stateName];\n\n while (state) {\n var fn = state[name];\n\n if (fn) {\n invokeForState[stateName][name] = fn;\n\n args = a_slice.call(arguments, 1);\n args.unshift(this);\n\n return fn.apply(this, args);\n }\n\n state = state.parentState;\n }\n\n states = states.parent;\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 rerender: function() {\n return this.invokeForState('rerender');\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 = get(this, '_childViews');\n for (var i=lengthAfter-1; i>=lengthBefore; i--) {\n if (childViews[i]) { childViews[i].destroy(); }\n }\n },\n\n /**\n @private\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 _applyClassNameBindings: function() {\n var classBindings = get(this, 'classNameBindings'),\n classNames = get(this, 'classNames'),\n elem, newClass, dasherizedClass;\n\n if (!classBindings) { return; }\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 // 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, property;\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 classNames.push(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 // Extract just the property name from bindings like 'foo:bar'\n property = binding.split(':')[0];\n addObserver(this, property, observer);\n }, this);\n },\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 @param {Ember.RenderBuffer} buffer\n */\n _applyAttributeBindings: function(buffer) {\n var attributeBindings = get(this, 'attributeBindings'),\n attributeValue, elem, type;\n\n if (!attributeBindings) { return; }\n\n a_forEach(attributeBindings, function(binding) {\n var split = binding.split(':'),\n property = split[0],\n attributeName = split[1] || property;\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 attributeValue = get(this, property);\n\n Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);\n };\n\n addObserver(this, property, observer);\n\n // Determine the current value and add it to the render buffer\n // if necessary.\n attributeValue = get(this, property);\n Ember.View.applyAttributeBindings(buffer, attributeName, attributeValue);\n }, this);\n },\n\n /**\n @private\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 _classStringForProperty: function(property) {\n var split = property.split(':'),\n className = split[1];\n\n property = split[0];\n\n // TODO: Remove this `false` when the `getPath` globals support is removed\n var val = Ember.getPath(this, property, false);\n if (val === undefined && Ember.isGlobalPath(property)) {\n val = Ember.getPath(window, property);\n }\n\n // If the value is truthy and we're using the colon syntax,\n // we should return the className directly\n if (!!val && className) {\n return className;\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 = property.split('.');\n return Ember.String.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 !== undefined && 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 // ELEMENT SUPPORT\n //\n\n /**\n Returns the current DOM element for the view.\n\n @field\n @type DOMElement\n */\n element: Ember.computed(function(key, value) {\n if (value !== undefined) {\n return this.invokeForState('setElement', value);\n } else {\n return this.invokeForState('getElement');\n }\n }).property('_parentView').cacheable(),\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 @param {String} [selector] a jQuery-compatible selector string\n @returns {Ember.CoreQuery} the CoreQuery object for the DOM node\n */\n $: function(sel) {\n return this.invokeForState('$', sel);\n },\n\n /** @private */\n mutateChildViews: function(callback) {\n var childViews = get(this, '_childViews'),\n idx = get(childViews, 'length'),\n view;\n\n while(--idx >= 0) {\n view = childViews[idx];\n callback.call(this, view, idx);\n }\n\n return this;\n },\n\n /** @private */\n forEachChildView: function(callback) {\n var childViews = get(this, '_childViews');\n\n if (!childViews) { return this; }\n\n var len = get(childViews, 'length'),\n view, idx;\n\n for(idx = 0; idx < len; idx++) {\n view = childViews[idx];\n callback.call(this, 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\n when building your application. You might consider using Ember.ContainerView\n instead. If you do need to use appendTo, be sure that the target element you\n are providing is associated with an Ember.Application and does not have an\n ancestor element that is associated with an Ember view.\n\n @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object\n @returns {Ember.View} receiver\n */\n appendTo: function(target) {\n Ember.assert(\"You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.\", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));\n\n // Schedule the DOM element to be created and appended to the given\n // element after bindings have synchronized.\n this._insertElementLater(function() {\n this.$().appendTo(target);\n });\n\n return this;\n },\n\n /**\n Replaces the view's element to the specified parent element.\n If the view does not have an HTML representation yet, `createElement()`\n will be called automatically.\n If the parent element already has some content, it will be removed.\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 @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object\n @returns {Ember.View} received\n */\n replaceIn: function(target) {\n Ember.assert(\"You cannot replace an existing Ember.View. Consider using Ember.ContainerView instead.\", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));\n\n this._insertElementLater(function() {\n Ember.$(target).empty();\n this.$().appendTo(target);\n });\n\n return this;\n },\n\n /**\n @private\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 view._insertElementLater(function() {\n this.createElement();\n this.$().appendTo('body');\n });\n\n @param {Function} fn the function that inserts the element into the DOM\n */\n _insertElementLater: function(fn) {\n this._lastInsert = Ember.guidFor(fn);\n Ember.run.schedule('render', this, this.invokeForState, 'insertElement', 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 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 @returns {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 @returns {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 this.destroyElement();\n this.invokeRecursively(function(view) {\n view.clearRenderedChildren();\n });\n },\n\n /**\n The ID to use when trying to locate the element in the DOM. If you do not\n set the elementId explicitly, then the view's GUID will be used instead.\n This ID must be set at the time the view is created.\n\n @type String\n @readOnly\n */\n elementId: Ember.computed(function(key, value) {\n return value !== undefined ? value : Ember.guidFor(this);\n }).cacheable(),\n\n /** @private */\n _elementIdDidChange: Ember.beforeObserver(function() {\n throw \"Changing a view's elementId after creation is not allowed.\";\n }, 'elementId'),\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 view's\n guid if elementId is null). You can override this method to provide your\n own form of lookup. For example, if you want to discover your element\n using a CSS class name instead of an ID.\n\n @param {DOMElement} parentElement The parent's DOM element\n @returns {DOMElement} The discovered element\n */\n findElementInParentElement: function(parentElem) {\n var id = \"#\" + get(this, 'elementId');\n return Ember.$(id)[0] || Ember.$(id, parentElem)[0];\n },\n\n /**\n Creates a new renderBuffer with the passed tagName. You can override this\n method to provide further customization to the buffer if needed. Normally\n you will not need to call or override this method.\n\n @returns {Ember.RenderBuffer}\n */\n renderBuffer: function(tagName) {\n tagName = tagName || get(this, 'tagName');\n\n // Explicitly check for null or undefined, as tagName\n // may be an empty string, which would evaluate to false.\n if (tagName === null || tagName === undefined) {\n tagName = 'div';\n }\n\n return Ember.RenderBuffer(tagName);\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 @returns {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 willInsertElement: Ember.K,\n\n /**\n Called when the element of the view has been inserted into the DOM.\n Override this function to do any set up that requires an element in the\n document body.\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 willRerender: Ember.K,\n\n /**\n Run this callback on the current view and recursively on child views.\n\n @private\n */\n invokeRecursively: function(fn) {\n fn.call(this, this);\n\n this.forEachChildView(function(view) {\n view.invokeRecursively(fn);\n });\n },\n\n /**\n Invalidates the cache for a property on all child views.\n */\n invalidateRecursively: function(key) {\n this.forEachChildView(function(view) {\n view.propertyDidChange(key);\n });\n },\n\n /**\n @private\n\n Invokes the receiver's willInsertElement() method if it exists and then\n invokes the same on all child views.\n\n NOTE: In some cases this was called when the element existed. This no longer\n works so we let people know. We can remove this warning code later.\n */\n _notifyWillInsertElement: function(fromPreRender) {\n this.invokeRecursively(function(view) {\n if (fromPreRender) { view._willInsertElementAccessUnsupported = true; }\n view.fire('willInsertElement');\n view._willInsertElementAccessUnsupported = false;\n });\n },\n\n /**\n @private\n\n Invokes the receiver's didInsertElement() method if it exists and then\n invokes the same on all child views.\n */\n _notifyDidInsertElement: function() {\n this.invokeRecursively(function(view) {\n view.fire('didInsertElement');\n });\n },\n\n /**\n @private\n\n Invokes the receiver's willRerender() method if it exists and then\n invokes the same on all child views.\n */\n _notifyWillRerender: function() {\n this.invokeRecursively(function(view) {\n view.fire('willRerender');\n });\n },\n\n /**\n Destroys any existing element along with the element for any child views\n as well. If the view does not currently have a element, then this method\n will do nothing.\n\n If you implement willDestroyElement() on your view, then this method will\n be invoked on your view before your element is destroyed to give you a\n chance to clean up any event handlers, etc.\n\n If you write a willDestroyElement() handler, you can assume that your\n didInsertElement() handler was called earlier for the same element.\n\n Normally you will not call or override this method yourself, but you may\n want to implement the above callbacks when it is run.\n\n @returns {Ember.View} receiver\n */\n destroyElement: function() {\n return this.invokeForState('destroyElement');\n },\n\n /**\n Called when the element of the view is going to be destroyed. Override\n this function to do any teardown that requires an element, like removing\n event listeners.\n */\n willDestroyElement: function() {},\n\n /**\n @private\n\n Invokes the `willDestroyElement` callback on the view and child views.\n */\n _notifyWillDestroyElement: function() {\n this.invokeRecursively(function(view) {\n view.fire('willDestroyElement');\n });\n },\n\n /** @private (nodoc) */\n _elementWillChange: Ember.beforeObserver(function() {\n this.forEachChildView(function(view) {\n Ember.propertyWillChange(view, 'element');\n });\n }, 'element'),\n\n /**\n @private\n\n If this view's element changes, we need to invalidate the caches of our\n child views so that we do not retain references to DOM elements that are\n no longer needed.\n\n @observes element\n */\n _elementDidChange: Ember.observer(function() {\n this.forEachChildView(function(view) {\n Ember.propertyDidChange(view, 'element');\n });\n }, 'element'),\n\n /**\n Called when the parentView property has changed.\n\n @function\n */\n parentViewDidChange: Ember.K,\n\n /**\n @private\n\n Invoked by the view system when this view needs to produce an HTML\n representation. This method will create a new render buffer, if needed,\n then apply any default attributes, such as class names and visibility.\n Finally, the `render()` method is invoked, which is responsible for\n doing the bulk of the rendering.\n\n You should not need to override this method; instead, implement the\n `template` property, or if you need more control, override the `render`\n method.\n\n @param {Ember.RenderBuffer} buffer the render buffer. If no buffer is\n passed, a default buffer, using the current view's `tagName`, will\n be used.\n */\n renderToBuffer: function(parentBuffer, bufferOperation) {\n var buffer;\n\n Ember.run.sync();\n\n // Determine where in the parent buffer to start the new buffer.\n // By default, a new buffer will be appended to the parent buffer.\n // The buffer operation may be changed if the child views array is\n // mutated by Ember.ContainerView.\n bufferOperation = bufferOperation || 'begin';\n\n // If this is the top-most view, start a new buffer. Otherwise,\n // create a new buffer relative to the original using the\n // provided buffer operation (for example, `insertAfter` will\n // insert a new buffer after the \"parent buffer\").\n if (parentBuffer) {\n var tagName = get(this, 'tagName');\n if (tagName === null || tagName === undefined) {\n tagName = 'div';\n }\n\n buffer = parentBuffer[bufferOperation](tagName);\n } else {\n buffer = this.renderBuffer();\n }\n\n this.buffer = buffer;\n this.transitionTo('inBuffer', false);\n\n this.lengthBeforeRender = get(get(this, '_childViews'), 'length');\n\n this.beforeRender(buffer);\n this.render(buffer);\n this.afterRender(buffer);\n\n this.lengthAfterRender = get(get(this, '_childViews'), 'length');\n\n return buffer;\n },\n\n beforeRender: function(buffer) {\n this.applyAttributesToBuffer(buffer);\n },\n\n afterRender: Ember.K,\n\n /**\n @private\n */\n applyAttributesToBuffer: function(buffer) {\n // Creates observers for all registered class name and attribute bindings,\n // then adds them to the element.\n this._applyClassNameBindings();\n\n // Pass the render buffer so the method can apply attributes directly.\n // This isn't needed for class name bindings because they use the\n // existing classNames infrastructure.\n this._applyAttributeBindings(buffer);\n\n\n a_forEach(get(this, 'classNames'), function(name){ buffer.addClass(name); });\n buffer.id(get(this, 'elementId'));\n\n var role = get(this, 'ariaRole');\n if (role) {\n buffer.attr('role', role);\n }\n\n if (get(this, 'isVisible') === false) {\n buffer.style('display', 'none');\n }\n },\n\n // ..........................................................\n // STANDARD RENDER PROPERTIES\n //\n\n /**\n Tag name for the view's outer element. The tag name is only used when\n an element is first created. If you change the tagName for an element, you\n must destroy and recreate the view element.\n\n By default, the render buffer will use a `<div>` tag for views.\n\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\n\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 @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 // Applies the 'high' class to the view element\n Ember.View.create({\n classNameBindings: ['priority']\n priority: 'high'\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 // Applies the 'is-urgent' class to the view element\n Ember.View.create({\n classNameBindings: ['isUrgent']\n isUrgent: true\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 // Applies the 'urgent' class to the view element\n Ember.View.create({\n classNameBindings: ['isUrgent:urgent']\n isUrgent: true\n });\n\n This list of properties is inherited from the view's superclasses as well.\n\n @type Array\n @default []\n */\n classNameBindings: [],\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 // Applies the type attribute to the element\n // with the value \"button\", like <div type=\"button\">\n Ember.View.create({\n attributeBindings: ['type'],\n type: 'button'\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 // Renders something like <div enabled=\"enabled\">\n Ember.View.create({\n attributeBindings: ['enabled'],\n enabled: true\n });\n */\n attributeBindings: [],\n\n state: 'preRender',\n\n // .......................................................\n // CORE DISPLAY METHODS\n //\n\n /**\n @private\n\n Setup a view, but do not finish waking it up.\n - configure childViews\n - register the view with the global views hash, which is used for event\n dispatch\n */\n init: function() {\n this._super();\n\n // Register the view for event handling. This hash is used by\n // Ember.RootResponder to dispatch incoming events.\n Ember.View.views[get(this, 'elementId')] = this;\n\n var childViews = get(this, '_childViews').slice();\n\n // setup child views. be sure to clone the child views array first\n set(this, '_childViews', childViews);\n\n Ember.assert(\"Only arrays are allowed for 'classNameBindings'\", Ember.typeOf(this.classNameBindings) === 'array');\n this.classNameBindings = Ember.A(this.classNameBindings.slice());\n\n Ember.assert(\"Only arrays are allowed for 'classNames'\", Ember.typeOf(this.classNames) === 'array');\n this.classNames = Ember.A(this.classNames.slice());\n\n var viewController = get(this, 'viewController');\n if (viewController) {\n viewController = Ember.getPath(viewController);\n if (viewController) {\n set(viewController, 'view', this);\n }\n }\n },\n\n appendChild: function(view, options) {\n return this.invokeForState('appendChild', view, options);\n },\n\n /**\n Removes the child view from the parent view.\n\n @param {Ember.View} view\n @returns {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 = get(this, '_childViews');\n Ember.ArrayUtils.removeObject(childViews, view);\n\n this.propertyDidChange('childViews');\n\n return this;\n },\n\n /**\n Removes all children from the parentView.\n\n @returns {Ember.View} receiver\n */\n removeAllChildren: function() {\n return this.mutateChildViews(function(view) {\n this.removeChild(view);\n });\n },\n\n destroyAllChildren: function() {\n return this.mutateChildViews(function(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 @returns {Ember.View} receiver\n */\n removeFromParent: function() {\n var parent = get(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 willDestroy: function() {\n // calling this._super() will nuke computed properties and observers,\n // so collect any information we need before calling super.\n var childViews = get(this, '_childViews'),\n parent = get(this, '_parentView'),\n elementId = get(this, 'elementId'),\n childLen;\n\n // destroy the element -- this will avoid each child view destroying\n // the element over and over again...\n if (!this.removedFromDOM) { this.destroyElement(); }\n\n // remove from non-virtual parent view if viewName was specified\n if (this.viewName) {\n var nonVirtualParentView = get(this, 'parentView');\n if (nonVirtualParentView) {\n set(nonVirtualParentView, this.viewName, null);\n }\n }\n\n // remove from parent if found. Don't call removeFromParent,\n // as removeFromParent will try to remove the element from\n // the DOM again.\n if (parent) { parent.removeChild(this); }\n\n this.state = 'destroyed';\n\n childLen = get(childViews, 'length');\n for (var i=childLen-1; i>=0; i--) {\n childViews[i].removedFromDOM = true;\n childViews[i].destroy();\n }\n\n // next remove view from global hash\n delete Ember.View.views[get(this, 'elementId')];\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 @param {Class} viewClass\n @param {Hash} [attrs] Attributes to add\n @returns {Ember.View} new instance\n @test in createChildViews\n */\n createChildView: function(view, attrs) {\n var coreAttrs, templateData;\n\n if (Ember.View.detect(view)) {\n coreAttrs = { _parentView: this, templateData: get(this, 'templateData') };\n\n if (attrs) {\n view = view.create(coreAttrs, attrs);\n } else {\n view = view.create(coreAttrs);\n }\n\n var viewName = view.viewName;\n\n // don't set the property on a virtual view, as they are invisible to\n // consumers of the view API\n if (viewName) { set(get(this, 'concreteView'), viewName, view); }\n } else {\n if (attrs) { throw \"EWOT\"; }\n\n Ember.assert('must pass instance of View', view instanceof Ember.View);\n\n if (!get(view, 'templateData')) {\n set(view, 'templateData', get(this, 'templateData'));\n }\n\n set(view, '_parentView', this);\n }\n\n return view;\n },\n\n becameVisible: Ember.K,\n becameHidden: Ember.K,\n\n /**\n @private\n\n When the view's `isVisible` property changes, toggle the visibility\n element of the actual DOM element.\n */\n _isVisibleDidChange: Ember.observer(function() {\n var isVisible = get(this, 'isVisible');\n\n this.$().toggle(isVisible);\n\n if (this._isAncestorHidden()) { return; }\n\n if (isVisible) {\n this._notifyBecameVisible();\n } else {\n this._notifyBecameHidden();\n }\n }, 'isVisible'),\n\n _notifyBecameVisible: function() {\n this.fire('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.fire('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(function(view) {\n this.buffer = null;\n });\n },\n\n transitionTo: function(state, children) {\n this.state = state;\n\n if (children !== false) {\n this.forEachChildView(function(view) {\n view.transitionTo(state);\n });\n }\n },\n\n /**\n @private\n\n Override the default event firing from Ember.Evented to\n also call methods with the given name.\n */\n fire: function(name) {\n if (this[name]) {\n this[name].apply(this, [].slice.call(arguments, 1));\n }\n this._super.apply(this, arguments);\n },\n\n // .......................................................\n // EVENT HANDLING\n //\n\n /**\n @private\n\n Handle events from `Ember.EventDispatcher`\n */\n handleEvent: function(eventName, evt) {\n return this.invokeForState('handleEvent', eventName, evt);\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 * 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/** @private */\nvar DOMManager = {\n prepend: function(view, childView) {\n childView._insertElementLater(function() {\n var element = view.$();\n element.prepend(childView.$());\n });\n },\n\n after: function(view, nextView) {\n nextView._insertElementLater(function() {\n var element = view.$();\n element.after(nextView.$());\n });\n },\n\n replace: function(view) {\n var element = get(view, 'element');\n\n set(view, 'element', null);\n\n view._insertElementLater(function() {\n Ember.$(element).replaceWith(get(view, 'element'));\n });\n },\n\n remove: function(view) {\n var elem = get(view, 'element');\n\n set(view, 'element', null);\n view._lastInsert = null;\n\n Ember.$(elem).remove();\n },\n\n empty: function(view) {\n view.$().empty();\n }\n};\n\nEmber.View.reopen({\n states: Ember.View.states,\n domManager: DOMManager\n});\n\n// Create a global view hash.\nEmber.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.\nEmber.View.childViewsProperty = childViewsProperty;\n\nEmber.View.applyAttributeBindings = function(elem, name, value) {\n var type = Ember.typeOf(value);\n var currentValue = elem.attr(name);\n\n // if this changes, also change the logic in ember-handlebars/lib/helpers/binding.js\n if ((type === 'string' || (type === 'number' && !isNaN(value))) && value !== currentValue) {\n elem.attr(name, value);\n } else if (value && type === 'boolean') {\n elem.attr(name, name);\n } else if (!value) {\n elem.removeAttr(name);\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\nEmber.View.states = {\n _default: {\n // appendChild is only legal while rendering the buffer.\n appendChild: function() {\n throw \"You can't use appendChild outside of the rendering process\";\n },\n\n $: function() {\n return Ember.$();\n },\n\n getElement: function() {\n return null;\n },\n\n // Handle events from `Ember.EventDispatcher`\n handleEvent: function() {\n return true; // continue event propagation\n },\n\n destroyElement: function(view) {\n set(view, 'element', null);\n view._lastInsert = null;\n return view;\n }\n }\n};\n\nEmber.View.reopen({\n states: Ember.View.states\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nEmber.View.states.preRender = {\n parentState: Ember.View.states._default,\n\n // a view leaves the preRender state once its element has been\n // created (createElement).\n insertElement: function(view, fn) {\n if (view._lastInsert !== Ember.guidFor(fn)){\n return;\n }\n view.createElement();\n view._notifyWillInsertElement(true);\n // after createElement, the view will be in the hasElement state.\n fn.call(view);\n view.transitionTo('inDOM');\n view._notifyDidInsertElement();\n },\n\n // This exists for the removal warning, remove later\n $: function(view){\n if (view._willInsertElementAccessUnsupported) {\n console.error(\"Getting element from willInsertElement is unreliable and no longer supported.\");\n }\n return Ember.$();\n },\n\n empty: Ember.K,\n\n // This exists for the removal warning, remove later\n getElement: function(view){\n if (view._willInsertElementAccessUnsupported) {\n console.error(\"Getting element from willInsertElement is unreliable and no longer supported.\");\n }\n return null;\n },\n\n setElement: function(view, value) {\n view.beginPropertyChanges();\n view.invalidateRecursively('element');\n\n if (value !== null) {\n view.transitionTo('hasElement');\n }\n\n view.endPropertyChanges();\n\n return value;\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\n\nEmber.View.states.inBuffer = {\n parentState: Ember.View.states._default,\n\n $: function(view, sel) {\n // if we don't have an element yet, someone calling this.$() is\n // trying to update an element that isn't in the DOM. Instead,\n // rerender the view to allow the render method to reflect the\n // changes.\n view.rerender();\n return Ember.$();\n },\n\n // when a view is rendered in a buffer, rerendering it simply\n // replaces the existing buffer with a new one\n rerender: function(view) {\n Ember.deprecate(\"Something you did caused a view to re-render after it rendered but before it was inserted into the DOM. Because this is avoidable and the cause of significant performance issues in applications, this behavior is deprecated. If you want to use the debugger to find out what caused this, you can set ENV.RAISE_ON_DEPRECATION to true.\");\n\n view._notifyWillRerender();\n\n view.clearRenderedChildren();\n view.renderToBuffer(view.buffer, 'replaceWith');\n },\n\n // when a view is rendered in a buffer, appending a child\n // view will render that view and append the resulting\n // buffer into its buffer.\n appendChild: function(view, childView, options) {\n var buffer = view.buffer;\n\n childView = this.createChildView(childView, options);\n get(view, '_childViews').push(childView);\n\n childView.renderToBuffer(buffer);\n\n view.propertyDidChange('childViews');\n\n return childView;\n },\n\n // when a view is rendered in a buffer, destroying the\n // element will simply destroy the buffer and put the\n // state back into the preRender state.\n destroyElement: function(view) {\n view.clearBuffer();\n view._notifyWillDestroyElement();\n view.transitionTo('preRender');\n\n return view;\n },\n\n empty: function() {\n throw \"EWOT\";\n },\n\n // It should be impossible for a rendered view to be scheduled for\n // insertion.\n insertElement: function() {\n throw \"You can't insert an element that has already been rendered\";\n },\n\n setElement: function(view, value) {\n view.invalidateRecursively('element');\n\n if (value === null) {\n view.transitionTo('preRender');\n } else {\n view.clearBuffer();\n view.transitionTo('hasElement');\n }\n\n return value;\n }\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\n\nEmber.View.states.hasElement = {\n parentState: Ember.View.states._default,\n\n $: function(view, sel) {\n var elem = get(view, 'element');\n return sel ? Ember.$(sel, elem) : Ember.$(elem);\n },\n\n getElement: function(view) {\n var parent = get(view, 'parentView');\n if (parent) { parent = get(parent, 'element'); }\n if (parent) { return view.findElementInParentElement(parent); }\n return Ember.$(\"#\" + get(view, 'elementId'))[0];\n },\n\n setElement: function(view, value) {\n if (value === null) {\n view.invalidateRecursively('element');\n\n view.transitionTo('preRender');\n } else {\n throw \"You cannot set an element to a non-null value when the element is already in the DOM.\";\n }\n\n return value;\n },\n\n // once the view has been inserted into the DOM, rerendering is\n // deferred to allow bindings to synchronize.\n rerender: function(view) {\n view._notifyWillRerender();\n\n view.clearRenderedChildren();\n\n view.domManager.replace(view);\n return view;\n },\n\n // once the view is already in the DOM, destroying it removes it\n // from the DOM, nukes its element, and puts it back into the\n // preRender state if inDOM.\n\n destroyElement: function(view) {\n view._notifyWillDestroyElement();\n view.domManager.remove(view);\n return view;\n },\n\n empty: function(view) {\n var _childViews = get(view, '_childViews'), len, idx;\n if (_childViews) {\n len = get(_childViews, 'length');\n for (idx = 0; idx < len; idx++) {\n _childViews[idx]._notifyWillDestroyElement();\n }\n }\n view.domManager.empty(view);\n },\n\n // Handle events from `Ember.EventDispatcher`\n handleEvent: function(view, eventName, evt) {\n var handler = view[eventName];\n if (Ember.typeOf(handler) === 'function') {\n return handler.call(view, evt);\n } else {\n return true; // continue event propagation\n }\n }\n};\n\nEmber.View.states.inDOM = {\n parentState: Ember.View.states.hasElement,\n\n insertElement: function(view, fn) {\n if (view._lastInsert !== Ember.guidFor(fn)){\n return;\n }\n throw \"You can't insert an element into the DOM that has already been inserted\";\n }\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar destroyedError = \"You can't call %@ on a destroyed view\", fmt = Ember.String.fmt;\n\nEmber.View.states.destroyed = {\n parentState: Ember.View.states._default,\n\n appendChild: function() {\n throw fmt(destroyedError, ['appendChild']);\n },\n rerender: function() {\n throw fmt(destroyedError, ['rerender']);\n },\n destroyElement: function() {\n throw fmt(destroyedError, ['destroyElement']);\n },\n empty: function() {\n throw fmt(destroyedError, ['empty']);\n },\n\n setElement: function() {\n throw fmt(destroyedError, [\"set('element', ...)\"]);\n },\n\n // Since element insertion is scheduled, don't do anything if\n // the view has been destroyed between scheduling and execution\n insertElement: Ember.K\n};\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar childViewsProperty = Ember.computed(function() {\n return get(this, '_childViews');\n}).property('_childViews').cacheable();\n\n/**\n @class\n\n A `ContainerView` is an `Ember.View` subclass that allows for manual or programatic\n management of a view's `childViews` array that will correctly update the `ContainerView`\n instance's rendered DOM representation.\n\n ## Setting Initial Child Views\n The initial array of child views can be set in one of two ways. You can provide\n a `childViews` property at creation time that contains instance of `Ember.View`:\n\n\n aContainer = Ember.ContainerView.create({\n childViews: [Ember.View.create(), Ember.View.create()]\n })\n\n You can also provide a list of property names whose values are instances of `Ember.View`:\n\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 The two strategies can be combined:\n\n aContainer = Ember.ContainerView.create({\n childViews: ['aView', Ember.View.create()],\n aView: Ember.View.create()\n })\n\n Each child view's rendering will be inserted into the container's rendered HTML in the same\n order as its position in the `childViews` property.\n\n ## Adding and Removing Child Views\n The views in a container's `childViews` array should be added and removed by manipulating\n the `childViews` property directly.\n\n To remove a view pass that view into a `removeObject` call on the container's `childViews` property. \n\n Given an empty `<body>` the following code\n\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 Results in the HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">B</div>\n </div>\n\n Removing a view\n\n aContainer.get('childViews') // [aContainer.aView, aContainer.bView]\n aContainer.get('childViews').removeObject(aContainer.get('bView'))\n aContainer.get('childViews') // [aContainer.aView]\n\n Will result in the following HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n </div>\n\n\n Similarly, adding a child view is accomplished by adding `Ember.View` instances to the \n container's `childViews` property.\n\n Given an empty `<body>` the following code\n\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 Results in the HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">B</div>\n </div>\n\n Adding a view\n\n AnotherViewClass = Ember.View.extend({\n template: Ember.Handlebars.compile(\"Another view\")\n })\n\n aContainer.get('childViews') // [aContainer.aView, aContainer.bView]\n aContainer.get('childViews').pushObject(AnotherViewClass.create())\n aContainer.get('childViews') // [aContainer.aView, <AnotherViewClass instance>]\n\n Will result in the following HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">Another view</div>\n </div>\n\n\n Direct manipulation of childViews presence or absence in the DOM via calls to \n `remove` or `removeFromParent` or calls to a container's `removeChild` may not behave\n correctly.\n\n Calling `remove()` on a child view will remove the view's HTML, but it will remain as part of its\n container's `childView`s property.\n\n Calling `removeChild()` on the container will remove the passed view instance from the container's\n `childView`s but keep its HTML within the container's rendered view.\n\n Calling `removeFromParent()` behaves as expected but should be avoided in favor of direct\n manipulation of a container's `childViews` property.\n\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 Results in the HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">B</div>\n </div>\n\n Calling `aContainer.get('aView').removeFromParent()` will result in the following HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">B</div>\n </div>\n\n And the `Ember.View` instance stored in `aContainer.aView` will be removed from `aContainer`'s\n `childViews` array.\n\n ## Templates and Layout\n A `template`, `templateName`, `defaultTemplate`, `layout`, `layoutName` or `defaultLayout`\n property on a container view will not result in the template or layout being rendered. \n The HTML contents of a `Ember.ContainerView`'s DOM representation will only be the rendered HTML\n of its child views.\n\n ## Binding a View to Display\n\n If you would like to display a single view in your ContainerView, you can set its `currentView`\n property. When the `currentView` property is set to a view instance, it will be added to the\n ContainerView's `childViews` array. If the `currentView` property is later changed to a\n different view, the new view will replace the old view. If `currentView` is set to `null`, the\n last `currentView` will be removed.\n\n This functionality is useful for cases where you want to bind the display of a ContainerView to\n a controller or state manager. For example, you can bind the `currentView` of a container to\n a controller like this:\n\n // Controller\n App.appController = Ember.Object.create({\n view: Ember.View.create({\n templateName: 'person_template'\n })\n });\n\n // Handlebars template\n {{view Ember.ContainerView currentViewBinding=\"App.appController.view\"}}\n\n @extends Ember.View\n*/\n\nEmber.ContainerView = Ember.View.extend({\n\n init: function() {\n var childViews = get(this, 'childViews');\n Ember.defineProperty(this, 'childViews', childViewsProperty);\n\n this._super();\n\n var _childViews = get(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 // Make the _childViews array observable\n Ember.A(_childViews);\n\n // Sets up an array observer on the child views array. This\n // observer will detect when child views are added or removed\n // and update the DOM to reflect the mutation.\n get(this, 'childViews').addArrayObserver(this, {\n willChange: 'childViewsWillChange',\n didChange: 'childViewsDidChange'\n });\n },\n\n /**\n Instructs each child view to render to the passed render buffer.\n\n @param {Ember.RenderBuffer} buffer the buffer to render to\n @private\n */\n render: function(buffer) {\n this.forEachChildView(function(view) {\n view.renderToBuffer(buffer);\n });\n },\n\n /**\n When the container view is destroyed, tear down the child views\n array observer.\n\n @private\n */\n willDestroy: function() {\n get(this, 'childViews').removeArrayObserver(this, {\n willChange: 'childViewsWillChange',\n didChange: 'childViewsDidChange'\n });\n\n this._super();\n },\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 @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 if (removed === 0) { return; }\n\n var changedViews = views.slice(start, start+removed);\n this.initializeViews(changedViews, null, null);\n\n this.invokeForState('childViewsWillChange', views, start, removed);\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 view\n has already written to a buffer, but not yet converted that buffer into an\n element, we insert the string representation of the child into the appropriate\n place in the buffer.\n\n @private\n @param {Ember.Array} views the array of child views afte 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} the number of child views added\n */\n childViewsDidChange: function(views, start, removed, added) {\n var len = get(views, 'length');\n\n // No new child views were added; bail out.\n if (added === 0) return;\n\n var changedViews = views.slice(start, start+added);\n this.initializeViews(changedViews, this, get(this, 'templateData'));\n\n // Let the current state handle the changes\n this.invokeForState('childViewsDidChange', views, start, added);\n },\n\n initializeViews: function(views, parentView, templateData) {\n forEach(views, function(view) {\n set(view, '_parentView', parentView);\n\n if (!get(view, 'templateData')) {\n set(view, 'templateData', templateData);\n }\n });\n },\n\n /**\n Schedules a child view to be inserted into the DOM after bindings have\n finished syncing for this run loop.\n\n @param {Ember.View} view the child view to insert\n @param {Ember.View} prev the child view after which the specified view should\n be inserted\n @private\n */\n _scheduleInsertion: function(view, prev) {\n if (prev) {\n prev.domManager.after(prev, view);\n } else {\n this.domManager.prepend(this, view);\n }\n },\n\n currentView: null,\n\n _currentViewWillChange: Ember.beforeObserver(function() {\n var childViews = get(this, 'childViews'),\n currentView = get(this, 'currentView');\n\n if (currentView) {\n childViews.removeObject(currentView);\n }\n }, 'currentView'),\n\n _currentViewDidChange: Ember.observer(function() {\n var childViews = get(this, 'childViews'),\n currentView = get(this, 'currentView');\n\n if (currentView) {\n childViews.pushObject(currentView);\n }\n }, 'currentView')\n});\n\n// Ember.ContainerView extends the default view states to provide different\n// behavior for childViewsWillChange and childViewsDidChange.\nEmber.ContainerView.states = {\n parent: Ember.View.states,\n\n inBuffer: {\n childViewsDidChange: function(parentView, views, start, added) {\n var buffer = parentView.buffer,\n startWith, prev, prevBuffer, view;\n\n // Determine where to begin inserting the child view(s) in the\n // render buffer.\n if (start === 0) {\n // If views were inserted at the beginning, prepend the first\n // view to the render buffer, then begin inserting any\n // additional views at the beginning.\n view = views[start];\n startWith = start + 1;\n view.renderToBuffer(buffer, 'prepend');\n } else {\n // Otherwise, just insert them at the same place as the child\n // views mutation.\n view = views[start - 1];\n startWith = start;\n }\n\n for (var i=startWith; i<start+added; i++) {\n prev = view;\n view = views[i];\n prevBuffer = prev.buffer;\n view.renderToBuffer(prevBuffer, 'insertAfter');\n }\n }\n },\n\n hasElement: {\n childViewsWillChange: function(view, views, start, removed) {\n for (var i=start; i<start+removed; i++) {\n views[i].remove();\n }\n },\n\n childViewsDidChange: function(view, views, start, added) {\n // If the DOM element for this container view already exists,\n // schedule each child view to insert its DOM representation after\n // bindings have finished syncing.\n var prev = start === 0 ? null : views[start-1];\n\n for (var i=start; i<start+added; i++) {\n view = views[i];\n this._scheduleInsertion(view, prev);\n prev = view;\n }\n }\n }\n};\n\nEmber.ContainerView.states.inDOM = {\n parentState: Ember.ContainerView.states.hasElement\n};\n\nEmber.ContainerView.reopen({\n states: Ember.ContainerView.states\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\n\n/**\n @class\n\n `Ember.CollectionView` is an `Ember.View` descendent responsible for managing a\n collection (an array or array-like object) by maintaing a child view object and \n associated DOM representation for each item in the array and ensuring that child\n views and their associated rendered HTML are updated when items in the array\n are added, removed, or replaced.\n\n ## Setting content\n The managed collection of objects is referenced as the `Ember.CollectionView` instance's\n `content` property.\n\n someItemsView = Ember.CollectionView.create({\n content: ['A', 'B','C']\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 By default the view class for each item in the managed collection will be an instance\n of `Ember.View`. You can supply a different class by setting the `CollectionView`'s\n `itemViewClass` property.\n\n Given an empty `<body>` and the following code:\n\n\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: {{content}}\")\n })\n })\n\n someItemsView.appendTo('body')\n\n Will result in the following HTML structure\n\n <div class=\"ember-view a-collection\">\n <div class=\"ember-view\">the letter: A</div>\n <div class=\"ember-view\">the letter: B</div>\n <div class=\"ember-view\">the letter: C</div>\n </div>\n\n\n ## Automatic matching of parent/child tagNames\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\n Given an empty `<body>` and the following code:\n\n anUndorderedListView = Ember.CollectionView.create({\n tagName: 'ul',\n content: ['A','B','C'],\n itemViewClass: Ember.View.extend({\n template: Ember.Handlebars.compile(\"the letter: {{content}}\")\n })\n })\n\n anUndorderedListView.appendTo('body')\n\n Will result in the following HTML structure\n\n <ul class=\"ember-view a-collection\">\n <li class=\"ember-view\">the letter: A</li>\n <li class=\"ember-view\">the letter: B</li>\n <li class=\"ember-view\">the letter: C</li>\n </ul>\n\n Additional tagName pairs can be provided by adding to `Ember.CollectionView.CONTAINER_MAP `\n\n Ember.CollectionView.CONTAINER_MAP['article'] = 'section'\n\n\n ## Empty View\n You can provide an `Ember.View` subclass to the `Ember.CollectionView` instance as its\n `emptyView` property. If the `content` property of a `CollectionView` is set to `null`\n or an empty array, an instance of this view will be the `CollectionView`s only child.\n\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 Will result in the following HTML structure\n\n <div class=\"ember-view nothing\">\n <div class=\"ember-view\">\n The collection is empty\n </div>\n </div>\n\n ## Adding and Removing items\n The `childViews` property of a `CollectionView` should not be directly manipulated. Instead,\n add, remove, replace items from its `content` property. This will trigger\n appropriate changes to its rendered HTML.\n\n ## Use in templates via the `{{collection}}` Ember.Handlebars helper\n Ember.Handlebars provides a helper specifically for adding `CollectionView`s to templates.\n See `Ember.Handlebars.collection` for more details\n\n @since Ember 0.9\n @extends Ember.ContainerView\n*/\nEmber.CollectionView = Ember.ContainerView.extend(\n/** @scope Ember.CollectionView.prototype */ {\n\n /**\n A list of items to be displayed by the Ember.CollectionView.\n\n @type Ember.Array\n @default null\n */\n content: null,\n\n /**\n @private\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 emptyViewClass: Ember.View,\n\n /**\n An optional view to display if content is set to an empty array.\n\n @type Ember.View\n @default null\n */\n emptyView: null,\n\n /**\n @type Ember.View\n @default Ember.View\n */\n itemViewClass: Ember.View,\n\n /** @private */\n init: function() {\n var ret = this._super();\n this._contentDidChange();\n return ret;\n },\n\n _contentWillChange: Ember.beforeObserver(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 }, 'content'),\n\n /**\n @private\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 _contentDidChange: Ember.observer(function() {\n var content = get(this, 'content');\n\n if (content) {\n Ember.assert(fmt(\"an Ember.CollectionView's content must implement Ember.Array. You passed %@\", [content]), Ember.Array.detect(content));\n content.addArrayObserver(this);\n }\n\n var len = content ? get(content, 'length') : 0;\n this.arrayDidChange(content, 0, null, len);\n }, 'content'),\n\n willDestroy: function() {\n var content = get(this, 'content');\n if (content) { content.removeArrayObserver(this); }\n\n this._super();\n },\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 Ember.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 = get(this, 'childViews'), childView, idx, len;\n\n len = get(childViews, 'length');\n\n var removingAll = removedCount === len;\n\n if (removingAll) {\n this.invokeForState('empty');\n }\n\n for (idx = start + removedCount - 1; idx >= start; idx--) {\n childView = childViews[idx];\n if (removingAll) { childView.removedFromDOM = true; }\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 @param {Array} addedObjects\n the objects that were added to the content\n\n @param {Array} removedObjects\n the objects that were removed from the content\n\n @param {Number} changeIndex\n the index at which the changes occurred\n */\n arrayDidChange: function(content, start, removed, added) {\n var itemViewClass = get(this, 'itemViewClass'),\n childViews = get(this, 'childViews'),\n addedViews = [], view, item, idx, len, itemTagName;\n\n if ('string' === typeof itemViewClass) {\n itemViewClass = Ember.getPath(itemViewClass);\n }\n\n Ember.assert(fmt(\"itemViewClass must be a subclass of Ember.View, not %@\", [itemViewClass]), Ember.View.detect(itemViewClass));\n\n len = content ? get(content, 'length') : 0;\n if (len) {\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 var emptyView = get(this, 'emptyView');\n if (!emptyView) { return; }\n\n emptyView = this.createChildView(emptyView);\n addedViews.push(emptyView);\n set(this, 'emptyView', emptyView);\n }\n childViews.replace(start, 0, addedViews);\n },\n\n createChildView: function(view, attrs) {\n view = this._super(view, attrs);\n\n var itemTagName = get(view, 'tagName');\n var tagName = (itemTagName === null || itemTagName === undefined) ? Ember.CollectionView.CONTAINER_MAP[get(this, 'tagName')] : itemTagName;\n\n set(view, 'tagName', tagName);\n\n return view;\n }\n});\n\n/**\n @static\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 @type Hash\n @constant\n*/\nEmber.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})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/*globals jQuery*/\n\n})();\n\n(function() {\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath;\n\nEmber.State = Ember.Object.extend(Ember.Evented, {\n isState: true,\n parentState: null,\n start: null,\n name: null,\n path: Ember.computed(function() {\n var parentPath = getPath(this, 'parentState.path'),\n path = get(this, 'name');\n\n if (parentPath) {\n path = parentPath + '.' + path;\n }\n\n return path;\n }).property().cacheable(),\n\n /**\n @private\n\n Override the default event firing from Ember.Evented to\n also call methods with the given name.\n */\n fire: function(name) {\n if (this[name]) {\n this[name].apply(this, [].slice.call(arguments, 1));\n }\n this._super.apply(this, arguments);\n },\n\n init: function() {\n var states = get(this, 'states'), foundStates;\n set(this, 'childStates', Ember.A());\n\n var name;\n\n // As a convenience, loop over the properties\n // of this state and look for any that are other\n // Ember.State instances or classes, and move them\n // to the `states` hash. This avoids having to\n // create an explicit separate hash.\n\n if (!states) {\n states = {};\n\n for (name in this) {\n if (name === \"constructor\") { continue; }\n this.setupChild(states, name, this[name]);\n }\n\n set(this, 'states', states);\n } else {\n for (name in states) {\n this.setupChild(states, name, states[name]);\n }\n }\n\n set(this, 'routes', {});\n },\n\n setupChild: function(states, name, value) {\n if (!value) { return false; }\n\n if (Ember.State.detect(value)) {\n value = value.create({\n name: name\n });\n } else if (value.isState) {\n set(value, 'name', name);\n }\n\n if (value.isState) {\n set(value, 'parentState', this);\n get(this, 'childStates').pushObject(value);\n states[name] = value;\n }\n },\n\n /**\n A Boolean value indicating whether the state is a leaf state\n in the state hierarchy. This is false if the state has child\n states; otherwise it is true.\n\n @property {Boolean}\n */\n isLeaf: Ember.computed(function() {\n return !get(this, 'childStates').length;\n }).cacheable(),\n\n setupControllers: Ember.K,\n enter: Ember.K,\n exit: Ember.K\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt;\n/**\n @class\n \n StateManager is part of Ember's implementation of a finite state machine. A StateManager\n instance manages a number of properties that are instances of `Ember.State`,\n tracks the current active state, and triggers callbacks when states have changed.\n\n ## Defining States\n\n The states of StateManager can be declared in one of two ways. First, you can define\n a `states` property that contains all the states:\n\n managerA = Ember.StateManager.create({\n states: {\n stateOne: Ember.State.create(),\n stateTwo: Ember.State.create()\n }\n })\n\n managerA.get('states')\n // {\n // stateOne: Ember.State.create(),\n // stateTwo: Ember.State.create()\n // }\n\n You can also add instances of `Ember.State` (or an `Ember.State` subclass) directly as properties\n of a StateManager. These states will be collected into the `states` property for you.\n\n managerA = Ember.StateManager.create({\n stateOne: Ember.State.create(),\n stateTwo: Ember.State.create()\n })\n\n managerA.get('states')\n // {\n // stateOne: Ember.State.create(),\n // stateTwo: Ember.State.create()\n // }\n\n ## The Initial State\n When created a StateManager instance will immediately enter into the state\n defined as its `start` property or the state referenced by name in its \n `initialState` property:\n\n managerA = Ember.StateManager.create({\n start: Ember.State.create({})\n })\n\n managerA.getPath('currentState.name') // 'start'\n\n managerB = Ember.StateManager.create({\n initialState: 'beginHere',\n beginHere: Ember.State.create({})\n })\n\n managerB.getPath('currentState.name') // 'beginHere'\n\n Because it is a property you may also provided a computed function if you wish to derive\n an `initialState` programmatically:\n\n managerC = Ember.StateManager.create({\n initialState: function(){\n if (someLogic) {\n return 'active';\n } else {\n return 'passive';\n }\n }.property(),\n active: Ember.State.create({})\n passive: Ember.State.create({})\n })\n\n ## Moving Between States\n A StateManager can have any number of Ember.State objects as properties\n and can have a single one of these states as its current state.\n\n Calling `goToState` transitions between states:\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({}),\n poweredUp: Ember.State.create({})\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n robotManager.goToState('poweredUp')\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n Before transitioning into a new state the existing `currentState` will have its\n `exit` method called with the StateManager instance as its first argument and \n an object representing the transition as its second argument.\n\n After transitioning into a new state the new `currentState` will have its\n `enter` method called with the StateManager instance as its first argument and \n an object representing the transition as its second argument.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n exit: function(stateManager, transition){\n console.log(\"exiting the poweredDown state\")\n }\n }),\n poweredUp: Ember.State.create({\n enter: function(stateManager, transition){\n console.log(\"entering the poweredUp state. Destroy all humans.\")\n }\n })\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n robotManager.goToState('poweredUp')\n // will log\n // 'exiting the poweredDown state'\n // 'entering the poweredUp state. Destroy all humans.'\n\n\n Once a StateManager is already in a state, subsequent attempts to enter that state will\n not trigger enter or exit method calls. Attempts to transition into a state that the \n manager does not have will result in no changes in the StateManager's current state:\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n exit: function(stateManager, transition){\n console.log(\"exiting the poweredDown state\")\n }\n }),\n poweredUp: Ember.State.create({\n enter: function(stateManager, transition){\n console.log(\"entering the poweredUp state. Destroy all humans.\")\n }\n })\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n robotManager.goToState('poweredUp')\n // will log\n // 'exiting the poweredDown state'\n // 'entering the poweredUp state. Destroy all humans.'\n robotManager.goToState('poweredUp') // no logging, no state change\n\n robotManager.goToState('someUnknownState') // silently fails\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n\n Each state property may itself contain properties that are instances of Ember.State. \n The StateManager can transition to specific sub-states in a series of goToState method calls or\n via a single goToState with the full path to the specific state. The StateManager will also \n keep track of the full path to its currentState\n\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n charging: Ember.State.create(),\n charged: Ember.State.create()\n }),\n poweredUp: Ember.State.create({\n mobile: Ember.State.create(),\n stationary: Ember.State.create()\n })\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n\n robotManager.goToState('poweredUp')\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n robotManager.goToState('mobile')\n robotManager.getPath('currentState.name') // 'mobile'\n\n // transition via a state path\n robotManager.goToState('poweredDown.charging')\n robotManager.getPath('currentState.name') // 'charging'\n\n robotManager.getPath('currentState.get.path') // 'poweredDown.charging'\n\n Enter transition methods will be called for each state and nested child state in their \n hierarchical order. Exit methods will be called for each state and its nested states in\n reverse hierarchical order.\n\n Exit transitions for a parent state are not called when entering into one of its child states,\n only when transitioning to a new section of possible states in the hierarchy.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n enter: function(){},\n exit: function(){\n console.log(\"exited poweredDown state\")\n },\n charging: Ember.State.create({\n enter: function(){},\n exit: function(){}\n }),\n charged: Ember.State.create({\n enter: function(){\n console.log(\"entered charged state\")\n },\n exit: function(){\n console.log(\"exited charged state\")\n }\n })\n }),\n poweredUp: Ember.State.create({\n enter: function(){\n console.log(\"entered poweredUp state\")\n },\n exit: function(){},\n mobile: Ember.State.create({\n enter: function(){\n console.log(\"entered mobile state\")\n },\n exit: function(){}\n }),\n stationary: Ember.State.create({\n enter: function(){},\n exit: function(){}\n })\n })\n })\n\n\n robotManager.get('currentState.get.path') // 'poweredDown'\n robotManager.goToState('charged')\n // logs 'entered charged state'\n // but does *not* log 'exited poweredDown state'\n robotManager.getPath('currentState.name') // 'charged\n\n robotManager.goToState('poweredUp.mobile')\n // logs\n // 'exited charged state'\n // 'exited poweredDown state'\n // 'entered poweredUp state'\n // 'entered mobile state'\n\n During development you can set a StateManager's `enableLogging` property to `true` to\n receive console messages of state transitions.\n\n robotManager = Ember.StateManager.create({\n enableLogging: true\n })\n\n ## Managing currentState with Actions\n To control which transitions between states are possible for a given state, StateManager\n can receive and route action messages to its states via the `send` method. Calling to `send` with\n an action name will begin searching for a method with the same name starting at the current state\n and moving up through the parent states in a state hierarchy until an appropriate method is found\n or the StateManager instance itself is reached. \n\n If an appropriately named method is found it will be called with the state manager as the first\n argument and an optional `context` object as the second argument.\n\n managerA = Ember.StateManager.create({\n initialState: 'stateOne.substateOne.subsubstateOne',\n stateOne: Ember.State.create({\n substateOne: Ember.State.create({\n anAction: function(manager, context){\n console.log(\"an action was called\")\n },\n subsubstateOne: Ember.State.create({})\n })\n })\n })\n\n managerA.getPath('currentState.name') // 'subsubstateOne'\n managerA.send('anAction')\n // 'stateOne.substateOne.subsubstateOne' has no anAction method\n // so the 'anAction' method of 'stateOne.substateOne' is called\n // and logs \"an action was called\"\n // with managerA as the first argument\n // and no second argument\n\n someObject = {}\n managerA.send('anAction', someObject)\n // the 'anAction' method of 'stateOne.substateOne' is called again\n // with managerA as the first argument and\n // someObject as the second argument.\n\n\n If the StateManager attempts to send an action but does not find an appropriately named\n method in the current state or while moving upwards through the state hierarchy\n it will throw a new Ember.Error. Action detection only moves upwards through the state hierarchy\n from the current state. It does not search in other portions of the hierarchy.\n\n managerB = Ember.StateManager.create({\n initialState: 'stateOne.substateOne.subsubstateOne',\n stateOne: Ember.State.create({\n substateOne: Ember.State.create({\n subsubstateOne: Ember.State.create({})\n })\n }),\n stateTwo: Ember.State.create({\n anAction: function(manager, context){\n // will not be called below because it is\n // not a parent of the current state\n }\n })\n })\n\n managerB.getPath('currentState.name') // 'subsubstateOne'\n managerB.send('anAction')\n // Error: <Ember.StateManager:ember132> could not\n // respond to event anAction in state stateOne.substateOne.subsubstateOne.\n\n Inside of an action method the given state should delegate `goToState` calls on its\n StateManager.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown.charging',\n poweredDown: Ember.State.create({\n charging: Ember.State.create({\n chargeComplete: function(manager, context){\n manager.goToState('charged')\n }\n }),\n charged: Ember.State.create({\n boot: function(manager, context){\n manager.goToState('poweredUp')\n }\n })\n }),\n poweredUp: Ember.State.create({\n beginExtermination: function(manager, context){\n manager.goToState('rampaging')\n },\n rampaging: Ember.State.create()\n })\n })\n\n robotManager.getPath('currentState.name') // 'charging'\n robotManager.send('boot') // throws error, no boot action \n // in current hierarchy\n robotManager.getPath('currentState.name') // remains 'charging'\n\n robotManager.send('beginExtermination') // throws error, no beginExtermination\n // action in current hierarchy\n robotManager.getPath('currentState.name') // remains 'charging'\n\n robotManager.send('chargeComplete')\n robotManager.getPath('currentState.name') // 'charged'\n\n robotManager.send('boot')\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n robotManager.send('beginExtermination', allHumans)\n robotManager.getPath('currentState.name') // 'rampaging'\n\n**/\nEmber.StateManager = Ember.State.extend(\n/** @scope Ember.State.prototype */ {\n\n /**\n When creating a new statemanager, look for a default state to transition\n into. This state can either be named `start`, or can be specified using the\n `initialState` property.\n */\n init: function() {\n this._super();\n\n set(this, 'stateMeta', Ember.Map.create());\n\n var initialState = get(this, 'initialState');\n\n if (!initialState && getPath(this, 'states.start')) {\n initialState = 'start';\n }\n\n if (initialState) {\n this.goToState(initialState);\n }\n },\n\n currentState: null,\n\n /**\n @property\n\n If set to true, `errorOnUnhandledEvents` will cause an exception to be\n raised if you attempt to send an event to a state manager that is not\n handled by the current state or any of its parent states.\n */\n errorOnUnhandledEvent: true,\n\n send: function(event, context) {\n this.sendRecursively(event, get(this, 'currentState'), context);\n },\n\n sendRecursively: function(event, currentState, context) {\n var log = this.enableLogging;\n\n var action = currentState[event];\n\n // Test to see if the action is a method that\n // can be invoked. Don't blindly check just for\n // existence, because it is possible the state\n // manager has a child state of the given name,\n // and we should still raise an exception in that\n // case.\n if (typeof action === 'function') {\n if (log) { console.log(fmt(\"STATEMANAGER: Sending event '%@' to state %@.\", [event, get(currentState, 'path')])); }\n action.call(currentState, this, context);\n } else {\n var parentState = get(currentState, 'parentState');\n if (parentState) {\n this.sendRecursively(event, parentState, context);\n } else if (get(this, 'errorOnUnhandledEvent')) {\n throw new Ember.Error(this.toString() + \" could not respond to event \" + event + \" in state \" + getPath(this, 'currentState.path') + \".\");\n }\n }\n },\n\n findStatesByRoute: function(state, route) {\n if (!route || route === \"\") { return undefined; }\n var r = route.split('.'), ret = [];\n\n for (var i=0, len = r.length; i < len; i += 1) {\n var states = get(state, 'states') ;\n\n if (!states) { return undefined; }\n\n var s = get(states, r[i]);\n if (s) { state = s; ret.push(s); }\n else { return undefined; }\n }\n\n return ret;\n },\n\n goToState: function() {\n // not deprecating this yet so people don't constantly need to\n // make trivial changes for little reason.\n return this.transitionTo.apply(this, arguments);\n },\n\n pathForSegments: function(array) {\n return Ember.ArrayUtils.map(array, function(tuple) {\n Ember.assert(\"A segment passed to transitionTo must be an Array\", Ember.typeOf(tuple) === \"array\");\n return tuple[0];\n }).join(\".\");\n },\n\n transitionTo: function(name, context) {\n // 1. Normalize arguments\n // 2. Ensure that we are in the correct state\n // 3. Map provided path to context objects and send\n // appropriate setupControllers events\n\n if (Ember.empty(name)) { return; }\n\n var segments;\n\n if (Ember.typeOf(name) === \"array\") {\n segments = Array.prototype.slice.call(arguments);\n } else {\n segments = [[name, context]];\n }\n\n var path = this.pathForSegments(segments);\n\n var currentState = get(this, 'currentState') || this, state, newState;\n\n var exitStates = [], enterStates, resolveState;\n\n state = currentState;\n\n if (state.routes[path]) {\n // cache hit\n\n var route = state.routes[path];\n exitStates = route.exitStates;\n enterStates = route.enterStates;\n state = route.futureState;\n resolveState = route.resolveState;\n } else {\n // cache miss\n\n newState = this.findStatesByRoute(currentState, path);\n\n while (state && !newState) {\n exitStates.unshift(state);\n\n state = get(state, 'parentState');\n if (!state) {\n newState = this.findStatesByRoute(this, path);\n if (!newState) { return; }\n }\n newState = this.findStatesByRoute(state, path);\n }\n\n resolveState = state;\n\n enterStates = newState.slice(0);\n exitStates = exitStates.slice(0);\n\n if (enterStates.length > 0) {\n state = enterStates[enterStates.length - 1];\n\n while (enterStates.length > 0 && enterStates[0] === exitStates[0]) {\n enterStates.shift();\n exitStates.shift();\n }\n }\n\n currentState.routes[path] = {\n exitStates: exitStates,\n enterStates: enterStates,\n futureState: state,\n resolveState: resolveState\n };\n }\n\n this.enterState(exitStates, enterStates, state);\n this.triggerSetupContext(resolveState, segments);\n },\n\n triggerSetupContext: function(root, segments) {\n var state = root;\n\n Ember.ArrayUtils.forEach(segments, function(tuple) {\n var path = tuple[0], context = tuple[1];\n\n state = this.findStatesByRoute(state, path);\n state = state[state.length-1];\n\n state.fire('setupControllers', this, context);\n }, this);\n //getPath(root, path).setupControllers(this, context);\n },\n\n getState: function(name) {\n var state = get(this, name),\n parentState = get(this, 'parentState');\n\n if (state) {\n return state;\n } else if (parentState) {\n return parentState.getState(name);\n }\n },\n\n asyncEach: function(list, callback, doneCallback) {\n var async = false, self = this;\n\n if (!list.length) {\n if (doneCallback) { doneCallback.call(this); }\n return;\n }\n\n var head = list[0];\n var tail = list.slice(1);\n\n var transition = {\n async: function() { async = true; },\n resume: function() {\n self.asyncEach(tail, callback, doneCallback);\n }\n };\n\n callback.call(this, head, transition);\n\n if (!async) { transition.resume(); }\n },\n\n enterState: function(exitStates, enterStates, state) {\n var log = this.enableLogging;\n\n var stateManager = this;\n\n exitStates = exitStates.slice(0).reverse();\n this.asyncEach(exitStates, function(state, transition) {\n state.fire('exit', stateManager, transition);\n }, function() {\n this.asyncEach(enterStates, function(state, transition) {\n if (log) { console.log(\"STATEMANAGER: Entering \" + get(state, 'path')); }\n state.fire('enter', stateManager, transition);\n }, function() {\n var startState = state, enteredState, initialState;\n\n initialState = get(startState, 'initialState');\n\n if (!initialState) {\n initialState = 'start';\n }\n\n // right now, start states cannot be entered asynchronously\n while (startState = get(get(startState, 'states'), initialState)) {\n enteredState = startState;\n\n if (log) { console.log(\"STATEMANAGER: Entering \" + get(startState, 'path')); }\n startState.fire('enter', stateManager);\n\n initialState = get(startState, 'initialState');\n\n if (!initialState) {\n initialState = 'start';\n }\n }\n\n set(this, 'currentState', enteredState || state);\n });\n });\n }\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, getPath = Ember.getPath;\n\n// The Ember Routable mixin assumes the existance of a simple\n// routing shim that supports the following three behaviors:\n//\n// * .getURL() - this is called when the page loads\n// * .setURL(newURL) - this is called from within the state\n// manager when the state changes to a routable state\n// * .onURLChange(callback) - this happens when the user presses\n// the back or forward button\n\nvar escapeForRegex = function(text) {\n return text.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^\\$|#\\s]/g, \"\\\\$&\");\n};\n\nEmber._RouteMatcher = Ember.Object.extend({\n state: null,\n\n init: function() {\n var route = this.route,\n identifiers = [],\n count = 1,\n escaped;\n\n // Strip off leading slash if present\n if (route[0] === '/') {\n route = this.route = route.substr(1);\n }\n\n escaped = escapeForRegex(route);\n\n var regex = escaped.replace(/:([a-z_]+)(?=$|\\/)/gi, function(match, id) {\n identifiers[count++] = id;\n return \"([^/]+)\";\n });\n\n this.identifiers = identifiers;\n this.regex = new RegExp(\"^/?\" + regex);\n },\n\n match: function(path) {\n var match = path.match(this.regex);\n\n if (match) {\n var identifiers = this.identifiers,\n hash = {};\n\n for (var i=1, l=identifiers.length; i<l; i++) {\n hash[identifiers[i]] = match[i];\n }\n\n return {\n remaining: path.substr(match[0].length),\n hash: hash\n };\n }\n },\n\n generate: function(hash) {\n var identifiers = this.identifiers, route = this.route, id;\n for (var i=1, l=identifiers.length; i<l; i++) {\n id = identifiers[i];\n route = route.replace(new RegExp(\":\" + id), hash[id]);\n }\n return route;\n }\n});\n\nEmber.Routable = Ember.Mixin.create({\n init: function() {\n this.on('setupControllers', this, this.stashContext);\n\n this._super();\n },\n\n stashContext: function(manager, context) {\n var meta = get(manager, 'stateMeta'),\n serialized = this.serialize(manager, context);\n\n meta.set(this, serialized);\n\n if (get(this, 'isRoutable')) {\n this.updateRoute(manager, get(manager, 'location'));\n }\n },\n\n updateRoute: function(manager, location) {\n if (location && get(this, 'isLeaf')) {\n var path = this.absoluteRoute(manager);\n location.setURL(path);\n }\n },\n\n absoluteRoute: function(manager) {\n var parentState = get(this, 'parentState');\n var path = '';\n\n if (get(parentState, 'isRoutable')) {\n path = parentState.absoluteRoute(manager);\n }\n\n var matcher = get(this, 'routeMatcher'),\n hash = get(manager, 'stateMeta').get(this);\n\n var generated = matcher.generate(hash);\n\n if (generated !== \"\") {\n return path + '/' + matcher.generate(hash);\n } else {\n return path;\n }\n },\n\n isRoutable: Ember.computed(function() {\n return typeof this.route === \"string\";\n }).cacheable(),\n\n routeMatcher: Ember.computed(function() {\n return Ember._RouteMatcher.create({ route: get(this, 'route') });\n }).cacheable(),\n\n deserialize: function(manager, context) {\n return context;\n },\n\n serialize: function(manager, context) {\n return context;\n },\n\n routePath: function(manager, path) {\n if (get(this, 'isLeaf')) { return; }\n\n var childStates = get(this, 'childStates'), match;\n\n childStates = childStates.sort(function(a, b) {\n return getPath(b, 'route.length') - getPath(a, 'route.length');\n });\n\n var state = childStates.find(function(state) {\n var matcher = get(state, 'routeMatcher');\n if (match = matcher.match(path)) { return true; }\n });\n\n Ember.assert(\"Could not find state for path \" + path, !!state);\n\n var object = state.deserialize(manager, match.hash) || {};\n manager.transitionTo(get(state, 'path'), object);\n manager.send('routePath', match.remaining);\n }\n});\n\nEmber.State.reopen(Ember.Routable);\n\nEmber.RoutableStateManager = Ember.Mixin.create({\n route: function(path) {\n if (path[0] === '/') {\n path = path.substr(1);\n }\n\n this.send('routePath', path);\n }\n});\n\nEmber.StateManager.reopen(Ember.RoutableStateManager);\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Statecharts\n// Copyright: ©2011 Living Social Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\nvar get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt;\n\n/**\n @class\n \n ## Interactions with Ember's View System.\n When combined with instances of `Ember.ViewState`, StateManager is designed to \n interact with Ember's view system to control which views are added to \n and removed from the DOM based on the manager's current state.\n\n By default, a StateManager will manage views inside the 'body' element. This can be\n customized by setting the `rootElement` property to a CSS selector of an existing \n HTML element you would prefer to receive view rendering.\n\n\n viewStates = Ember.StateManager.create({\n rootElement: '#some-other-element'\n })\n\n You can also specify a particular instance of `Ember.ContainerView` you would like to receive\n view rendering by setting the `rootView` property. You will be responsible for placing\n this element into the DOM yourself.\n\n aLayoutView = Ember.ContainerView.create()\n\n // make sure this view instance is added to the browser\n aLayoutView.appendTo('body') \n\n App.viewStates = Ember.StateManager.create({\n rootView: aLayoutView\n })\n\n\n Once you have an instance of StateManager controlling a view, you can provide states\n that are instances of `Ember.ViewState`. When the StateManager enters a state\n that is an instance of `Ember.ViewState` that `ViewState`'s `view` property will be\n instantiated and inserted into the StateManager's `rootView` or `rootElement`.\n When a state is exited, the `ViewState`'s view will be removed from the StateManager's\n view.\n\n ContactListView = Ember.View.extend({\n classNames: ['my-contacts-css-class'],\n template: Ember.Handlebars.compile('<h2>People</h2>')\n })\n\n PhotoListView = Ember.View.extend({\n classNames: ['my-photos-css-class'],\n template: Ember.Handlebars.compile('<h2>Photos</h2>')\n })\n\n viewStates = Ember.StateManager.create({\n showingPeople: Ember.ViewState.create({\n view: ContactListView\n }),\n showingPhotos: Ember.ViewState.create({\n view: PhotoListView\n })\n })\n\n viewStates.goToState('showingPeople')\n\n The above code will change the rendered HTML from\n\n <body></body>\n\n to\n\n <body>\n <div id=\"ember1\" class=\"ember-view my-contacts-css-class\">\n <h2>People</h2>\n </div>\n </body>\n\n Changing the current state via `goToState` from `showingPeople` to\n `showingPhotos` will remove the `showingPeople` view and add the `showingPhotos` view:\n\n viewStates.goToState('showingPhotos')\n\n will change the rendered HTML to\n\n <body>\n <div id=\"ember2\" class=\"ember-view my-photos-css-class\">\n <h2>Photos</h2>\n </div>\n </body>\n\n\n When entering nested `ViewState`s, each state's view will be draw into the the StateManager's\n `rootView` or `rootElement` as siblings.\n\n\n ContactListView = Ember.View.extend({\n classNames: ['my-contacts-css-class'],\n template: Ember.Handlebars.compile('<h2>People</h2>')\n })\n\n EditAContactView = Ember.View.extend({\n classNames: ['editing-a-contact-css-class'],\n template: Ember.Handlebars.compile('Editing...')\n })\n\n viewStates = Ember.StateManager.create({\n showingPeople: Ember.ViewState.create({\n view: ContactListView,\n\n withEditingPanel: Ember.ViewState.create({\n view: EditAContactView\n })\n })\n })\n\n\n viewStates.goToState('showingPeople.withEditingPanel')\n\n\n Will result in the following rendered HTML:\n\n <body>\n <div id=\"ember2\" class=\"ember-view my-contacts-css-class\">\n <h2>People</h2>\n </div>\n\n <div id=\"ember2\" class=\"ember-view editing-a-contact-css-class\">\n Editing...\n </div>\n </body>\n\n\n ViewState views are added and removed from their StateManager's view via their\n `enter` and `exit` methods. If you need to override these methods, be sure to call\n `_super` to maintain the adding and removing behavior:\n\n viewStates = Ember.StateManager.create({\n aState: Ember.ViewState.create({\n view: Ember.View.extend({}),\n enter: function(manager, transition){\n // calling _super ensures this view will be\n // properly inserted\n this._super(manager, transition);\n\n // now you can do other things\n }\n })\n })\n\n ## Managing Multiple Sections of A Page With States\n Multiple StateManagers can be combined to control multiple areas of an application's rendered views.\n Given the following HTML body:\n\n <body>\n <div id='sidebar-nav'>\n </div>\n <div id='content-area'>\n </div>\n </body>\n\n You could separately manage view state for each section with two StateManagers\n\n navigationStates = Ember.StateManager.create({\n rootElement: '#sidebar-nav',\n userAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n userNotAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n contentStates = Ember.StateManager.create({\n rootElement: '#content-area',\n books: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n music: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n\n If you prefer to start with an empty body and manage state programmatically you\n can also take advantage of StateManager's `rootView` property and the ability of \n `Ember.ContainerView`s to manually manage their child views. \n\n\n dashboard = Ember.ContainerView.create({\n childViews: ['navigationAreaView', 'contentAreaView'],\n navigationAreaView: Ember.ContainerView.create({}),\n contentAreaView: Ember.ContainerView.create({})\n })\n\n navigationStates = Ember.StateManager.create({\n rootView: dashboard.get('navigationAreaView'),\n userAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n userNotAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n contentStates = Ember.StateManager.create({\n rootView: dashboard.get('contentAreaView'),\n books: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n music: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n dashboard.appendTo('body')\n\n ## User Manipulation of State via `{{action}}` Helpers\n The Handlebars `{{action}}` helper is StateManager-aware and will use StateManager action sending \n to connect user interaction to action-based state transitions.\n\n Given the following body and handlebars template\n\n <body>\n <script type='text/x-handlebars'>\n <a href=\"#\" {{action \"anAction\" target=\"App.appStates\"}}> Go </a>\n </script>\n </body>\n\n And application code\n\n App = Ember.Application.create()\n App.appStates = Ember.StateManager.create({\n initialState: 'aState',\n aState: Ember.State.create({\n anAction: function(manager, context){}\n }),\n bState: Ember.State.create({})\n })\n\n A user initiated click or touch event on \"Go\" will trigger the 'anAction' method of\n `App.appStates.aState` with `App.appStates` as the first argument and a\n `jQuery.Event` object as the second object. The `jQuery.Event` will include a property\n `view` that references the `Ember.View` object that was interacted with.\n \n**/\n\nEmber.StateManager.reopen({\n\n /**\n @property\n\n If the current state is a view state or the descendent of a view state,\n this property will be the view associated with it. If there is no\n view state active in this state manager, this value will be null.\n */\n currentView: Ember.computed(function() {\n var currentState = get(this, 'currentState'),\n view;\n\n while (currentState) {\n if (get(currentState, 'isViewState')) {\n view = get(currentState, 'view');\n if (view) { return view; }\n }\n\n currentState = get(currentState, 'parentState');\n }\n\n return null;\n }).property('currentState').cacheable()\n\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\nEmber.ViewState = Ember.State.extend({\n isViewState: true,\n\n enter: function(stateManager) {\n var view = get(this, 'view'), root, childViews;\n\n if (view) {\n if (Ember.View.detect(view)) {\n view = view.create();\n set(this, 'view', view);\n }\n\n Ember.assert('view must be an Ember.View', view instanceof Ember.View);\n\n root = stateManager.get('rootView');\n\n if (root) {\n childViews = get(root, 'childViews');\n childViews.pushObject(view);\n } else {\n root = stateManager.get('rootElement') || 'body';\n view.appendTo(root);\n }\n }\n },\n\n exit: function(stateManager) {\n var view = get(this, 'view');\n\n if (view) {\n // If the view has a parent view, then it is\n // part of a view hierarchy and should be removed\n // from its parent.\n if (get(view, 'parentView')) {\n view.removeFromParent();\n } else {\n\n // Otherwise, the view is a \"root view\" and\n // was appended directly to the DOM.\n view.remove();\n }\n }\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Statecharts\n// Copyright: ©2011 Living Social Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: metamorph\n// Copyright: ©2011 My Company Inc. All rights reserved.\n// ==========================================================================\n\n(function(window) {\n\n var K = function(){},\n guid = 0,\n document = window.document,\n\n // Feature-detect the W3C range API, the extended check is for IE9 which only partially supports ranges\n supportsRange = ('createRange' in document) && (typeof Range !== 'undefined') && Range.prototype.createContextualFragment,\n\n // Internet Explorer prior to 9 does not allow setting innerHTML if the first element\n // is a \"zero-scope\" element. This problem can be worked around by making\n // the first node an invisible text node. We, like Modernizr, use &shy;\n needsShy = (function(){\n var testEl = document.createElement('div');\n testEl.innerHTML = \"<div></div>\";\n testEl.firstChild.innerHTML = \"<script></script>\";\n return testEl.firstChild.innerHTML === '';\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 return \"<script id='\" + this.start + \"' type='text/x-placeholder'></script>\";\n };\n\n endTagFunc = function() {\n return \"<script id='\" + this.end + \"' type='text/x-placeholder'></script>\";\n };\n\n // If we have the W3C range API, this process is relatively straight forward.\n if (supportsRange) {\n\n // Get a range for the current morph. Optionally include the starting and\n // ending placeholders.\n rangeFor = function(morph, outerToo) {\n var range = document.createRange();\n var before = document.getElementById(morph.start);\n var after = document.getElementById(morph.end);\n\n if (outerToo) {\n range.setStartBefore(before);\n range.setEndAfter(after);\n } else {\n range.setStartAfter(before);\n range.setEndBefore(after);\n }\n\n return range;\n };\n\n htmlFunc = function(html, outerToo) {\n // get a range for the current metamorph object\n var range = rangeFor(this, outerToo);\n\n // delete the contents of the range, which will be the\n // nodes between the starting and ending placeholder.\n range.deleteContents();\n\n // create a new document fragment for the HTML\n var fragment = range.createContextualFragment(html);\n\n // insert the fragment into the range\n range.insertNode(fragment);\n };\n\n removeFunc = function() {\n // get a range for the current metamorph object including\n // the starting and ending placeholders.\n var range = rangeFor(this, true);\n\n // delete the entire range.\n range.deleteContents();\n };\n\n appendToFunc = function(node) {\n var range = document.createRange();\n range.setStart(node);\n range.collapse(false);\n var frag = range.createContextualFragment(this.outerHTML());\n node.appendChild(frag);\n };\n\n afterFunc = function(html) {\n var range = document.createRange();\n var after = document.getElementById(this.end);\n\n range.setStartAfter(after);\n range.setEndAfter(after);\n\n var fragment = range.createContextualFragment(html);\n range.insertNode(fragment);\n };\n\n prependFunc = function(html) {\n var range = document.createRange();\n var start = document.getElementById(this.start);\n\n range.setStartAfter(start);\n range.setEndAfter(start);\n\n var fragment = range.createContextualFragment(html);\n range.insertNode(fragment);\n };\n\n } else {\n /**\n * This code is mostly taken from jQuery, with one exception. In jQuery's case, we\n * have some HTML and we need to figure out how to convert it into some nodes.\n *\n * In this case, jQuery needs to scan the HTML looking for an opening tag and use\n * that as the key for the wrap map. In our case, we know the parent node, and\n * can use its type as the key for the wrap map.\n **/\n var wrapMap = {\n select: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n fieldset: [ 1, \"<fieldset>\", \"</fieldset>\" ],\n table: [ 1, \"<table>\", \"</table>\" ],\n tbody: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n tr: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n colgroup: [ 2, \"<table><tbody></tbody><colgroup>\", \"</colgroup></table>\" ],\n map: [ 1, \"<map>\", \"</map>\" ],\n _default: [ 0, \"\", \"\" ]\n };\n\n /**\n * Given a parent node and some HTML, generate a set of nodes. Return the first\n * node, which will allow us to traverse the rest using nextSibling.\n *\n * We need to do this because innerHTML in IE does not really parse the nodes.\n **/\n var firstNodeFor = function(parentNode, html) {\n var arr = wrapMap[parentNode.tagName.toLowerCase()] || wrapMap._default;\n var depth = arr[0], start = arr[1], end = arr[2];\n\n if (needsShy) { html = '&shy;'+html; }\n\n var element = document.createElement('div');\n element.innerHTML = start + html + end;\n\n for (var i=0; i<=depth; i++) {\n element = element.firstChild;\n }\n\n // Look for &shy; to remove it.\n if (needsShy) {\n var shyElement = element;\n\n // Sometimes we get nameless elements with the shy inside\n while (shyElement.nodeType === 1 && !shyElement.nodeName) {\n shyElement = shyElement.firstChild;\n }\n\n // At this point it's the actual unicode character.\n if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === \"\\u00AD\") {\n shyElement.nodeValue = shyElement.nodeValue.slice(1);\n }\n }\n\n return element;\n };\n\n /**\n * In some cases, Internet Explorer can create an anonymous node in\n * the hierarchy with no tagName. You can create this scenario via:\n *\n * div = document.createElement(\"div\");\n * div.innerHTML = \"<table>&shy<script></script><tr><td>hi</td></tr></table>\";\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 <tr>. 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 = \"<table><script id='first'></script><tr><td>hi</td></tr><script id='last'></script></table>\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 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 // 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\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 window.Metamorph = Metamorph;\n})(this);\n\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n/**\n @namespace\n @name Handlebars\n @private\n*/\n\n/**\n @namespace\n @name Handlebars.helpers\n @description Helpers for Handlebars templates\n*/\n\n/**\n @class\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 use\n 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(). This will\n return a function that can be used by Ember.View for rendering.\n*/\nEmber.Handlebars = Ember.create(Handlebars);\n\nEmber.Handlebars.helpers = Ember.create(Handlebars.helpers);\n\n/**\n Override the the opcode compiler and JavaScript compiler for Handlebars.\n*/\nEmber.Handlebars.Compiler = function() {};\nEmber.Handlebars.Compiler.prototype = Ember.create(Handlebars.Compiler.prototype);\nEmber.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;\n\nEmber.Handlebars.JavaScriptCompiler = function() {};\nEmber.Handlebars.JavaScriptCompiler.prototype = Ember.create(Handlebars.JavaScriptCompiler.prototype);\nEmber.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;\nEmber.Handlebars.JavaScriptCompiler.prototype.namespace = \"Ember.Handlebars\";\n\n\nEmber.Handlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {\n return \"''\";\n};\n\n/**\n Override the default buffer for Ember Handlebars. By default, Handlebars creates\n an empty String at the beginning of each invocation and appends to it. Ember's\n Handlebars overrides this to append to a single shared buffer.\n\n @private\n*/\nEmber.Handlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {\n return \"data.buffer.push(\"+string+\");\";\n};\n\n/**\n Rewrite simple mustaches from {{foo}} to {{bind \"foo\"}}. This means that all simple\n mustaches in Ember's Handlebars will also set up an observer to keep the DOM\n up to date when the underlying property changes.\n\n @private\n*/\nEmber.Handlebars.Compiler.prototype.mustache = function(mustache) {\n if (mustache.params.length || mustache.hash) {\n return Handlebars.Compiler.prototype.mustache.call(this, mustache);\n } else {\n var id = new Handlebars.AST.IdNode(['_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([\"escaped\", new Handlebars.AST.StringNode(\"true\")]);\n }\n mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);\n return Handlebars.Compiler.prototype.mustache.call(this, mustache);\n }\n};\n\n/**\n Used for precompilation of Ember Handlebars templates. This will not be used during normal\n app execution.\n\n @param {String} string The template to precompile\n*/\nEmber.Handlebars.precompile = function(string) {\n var ast = Handlebars.parse(string);\n var options = { data: true, stringParams: true };\n var environment = new Ember.Handlebars.Compiler().compile(ast, options);\n return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n};\n\n/**\n The entry point for Ember Handlebars. This replaces the default Handlebars.compile and turns on\n template-local data and String parameters.\n\n @param {String} string The template to compile\n*/\nEmber.Handlebars.compile = function(string) {\n var ast = Handlebars.parse(string);\n var options = { data: true, stringParams: true };\n var environment = new Ember.Handlebars.Compiler().compile(ast, options);\n var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n\n return Handlebars.template(templateSpec);\n};\n\n/**\n If a path starts with a reserved keyword, returns the root\n that should be used.\n\n @private\n*/\nvar normalizePath = Ember.Handlebars.normalizePath = function(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);\n }\n }\n\n return { root: root, path: path, isKeyword: isKeyword };\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 @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\nEmber.Handlebars.getPath = function(root, path, options) {\n var data = options && options.data,\n normalizedPath = normalizePath(root, path, data),\n value;\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 root = normalizedPath.root;\n path = normalizedPath.path;\n\n // TODO: Remove this `false` when the `getPath` globals support is removed\n value = Ember.getPath(root, path, false);\n\n if (value === undefined && root !== window && Ember.isGlobalPath(path)) {\n value = Ember.getPath(window, path);\n }\n return value;\n};\n\n/**\n Registers a helper in Handlebars that will be called if no property with the\n given name can be found on the current context object, and no helper with\n that name is registered.\n\n This throws an exception with a more helpful error message so the user can\n track down where the problem is happening.\n\n @name Handlebars.helpers.helperMissing\n @param {String} path\n @param {Hash} options\n*/\nEmber.Handlebars.registerHelper('helperMissing', function(path, options) {\n var error, view = \"\";\n\n error = \"%@ Handlebars error: Could not find property '%@' on object %@.\";\n if (options.data){\n view = options.data.view;\n }\n throw new Ember.Error(Ember.String.fmt(error, [view, path, this]));\n});\n\n\n})();\n\n\n\n(function() {\n\nEmber.String.htmlSafe = function(str) {\n return new Handlebars.SafeString(str);\n};\n\nvar htmlSafe = Ember.String.htmlSafe;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n @see Ember.String.htmlSafe\n */\n String.prototype.htmlSafe = function() {\n return htmlSafe(this);\n };\n\n}\n\n})();\n\n\n\n(function() {\n/*jshint newcap:false*/\nvar set = Ember.set, get = Ember.get, getPath = Ember.getPath;\n\nvar DOMManager = {\n remove: function(view) {\n var morph = view.morph;\n if (morph.isRemoved()) { return; }\n set(view, 'element', null);\n view._lastInsert = null;\n morph.remove();\n },\n\n prepend: function(view, childView) {\n childView._insertElementLater(function() {\n var morph = view.morph;\n morph.prepend(childView.outerHTML);\n childView.outerHTML = null;\n });\n },\n\n after: function(view, nextView) {\n nextView._insertElementLater(function() {\n var morph = view.morph;\n morph.after(nextView.outerHTML);\n nextView.outerHTML = null;\n });\n },\n\n replace: function(view) {\n var morph = view.morph;\n\n view.transitionTo('preRender');\n view.clearRenderedChildren();\n var buffer = view.renderToBuffer();\n\n Ember.run.schedule('render', this, function() {\n if (get(view, 'isDestroyed')) { return; }\n view.invalidateRecursively('element');\n view._notifyWillInsertElement();\n morph.replaceWith(buffer.string());\n view.transitionTo('inDOM');\n view._notifyDidInsertElement();\n });\n },\n\n empty: function(view) {\n view.morph.html(\"\");\n }\n};\n\n// The `morph` and `outerHTML` properties are internal only\n// and not observable.\n\nEmber._Metamorph = Ember.Mixin.create({\n isVirtual: true,\n tagName: '',\n\n init: function() {\n this._super();\n this.morph = Metamorph();\n },\n\n beforeRender: function(buffer) {\n buffer.push(this.morph.startTag());\n },\n\n afterRender: function(buffer) {\n buffer.push(this.morph.endTag());\n },\n\n createElement: function() {\n var buffer = this.renderToBuffer();\n this.outerHTML = buffer.string();\n this.clearBuffer();\n },\n\n domManager: DOMManager\n});\n\nEmber._MetamorphView = Ember.View.extend(Ember._Metamorph);\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\nvar get = Ember.get, set = Ember.set, getPath = Ember.Handlebars.getPath;\n/**\n @ignore\n @private\n @class\n\n Ember._HandlebarsBoundView is a private view created by the Handlebars `{{bind}}`\n helpers that is used to keep track of bound properties.\n\n Every time a property is bound using a `{{mustache}}`, an anonymous subclass\n of Ember._HandlebarsBoundView is created with the appropriate sub-template and\n context set up. When the associated property changes, just the template for\n this view will re-render.\n*/\nEmber._HandlebarsBoundView = Ember._MetamorphView.extend({\n/** @scope Ember._HandlebarsBoundView.prototype */\n\n /**\n The function used to determine if the `displayTemplate` or\n `inverseTemplate` should be rendered. This should be a function that takes\n a value and returns a Boolean.\n\n @type Function\n @default null\n */\n shouldDisplayFunc: null,\n\n /**\n Whether the template rendered by this view gets passed the context object\n of its parent template, or gets passed the value of retrieving `path`\n from the `pathRoot`.\n\n For example, this is true when using the `{{#if}}` helper, because the\n template inside the helper should look up properties relative to the same\n object as outside the block. This would be false when used with `{{#with\n foo}}` because the template should receive the object found by evaluating\n `foo`.\n\n @type Boolean\n @default false\n */\n preserveContext: false,\n\n /**\n If `preserveContext` is true, this is the object that will be used\n to render the template.\n\n @type Object\n */\n previousContext: null,\n\n /**\n The template to render when `shouldDisplayFunc` evaluates to true.\n\n @type Function\n @default null\n */\n displayTemplate: null,\n\n /**\n The template to render when `shouldDisplayFunc` evaluates to false.\n\n @type Function\n @default null\n */\n inverseTemplate: null,\n\n\n /**\n The path to look up on `pathRoot` that is passed to\n `shouldDisplayFunc` to determine which template to render.\n\n In addition, if `preserveContext` is false, the object at this path will\n be passed to the template when rendering.\n\n @type String\n @default null\n */\n path: null,\n\n /**\n The object from which the `path` will be looked up. Sometimes this is the\n same as the `previousContext`, but in cases where this view has been generated\n for paths that start with a keyword such as `view` or `controller`, the\n path root will be that resolved object.\n\n @type Object\n */\n pathRoot: null,\n\n normalizedValue: Ember.computed(function() {\n var path = get(this, 'path'),\n pathRoot = get(this, 'pathRoot'),\n valueNormalizer = get(this, 'valueNormalizerFunc'),\n result, templateData;\n\n // Use the pathRoot as the result if no path is provided. This\n // happens if the path is `this`, which gets normalized into\n // a `pathRoot` of the current Handlebars context and a path\n // of `''`.\n if (path === '') {\n result = pathRoot;\n } else {\n templateData = get(this, 'templateData');\n result = getPath(pathRoot, path, { data: templateData });\n }\n\n return valueNormalizer ? valueNormalizer(result) : result;\n }).property('path', 'pathRoot', 'valueNormalizerFunc').volatile(),\n\n rerenderIfNeeded: function() {\n if (!get(this, 'isDestroyed') && get(this, 'normalizedValue') !== this._lastNormalizedValue) {\n this.rerender();\n }\n },\n\n /**\n Determines which template to invoke, sets up the correct state based on\n that logic, then invokes the default Ember.View `render` implementation.\n\n This method will first look up the `path` key on `pathRoot`,\n then pass that value to the `shouldDisplayFunc` function. If that returns\n true, the `displayTemplate` function will be rendered to DOM. Otherwise,\n `inverseTemplate`, if specified, will be rendered.\n\n For example, if this Ember._BindableSpan represented the {{#with foo}}\n helper, it would look up the `foo` property of its context, and\n `shouldDisplayFunc` would always return true. The object found by looking\n up `foo` would be passed to `displayTemplate`.\n\n @param {Ember.RenderBuffer} buffer\n */\n render: function(buffer) {\n // If not invoked via a triple-mustache ({{{foo}}}), escape\n // the content of the template.\n var escape = get(this, 'isEscaped');\n\n var shouldDisplay = get(this, 'shouldDisplayFunc'),\n preserveContext = get(this, 'preserveContext'),\n context = get(this, 'previousContext');\n\n var inverseTemplate = get(this, 'inverseTemplate'),\n displayTemplate = get(this, 'displayTemplate');\n\n var result = get(this, 'normalizedValue');\n this._lastNormalizedValue = result;\n\n // First, test the conditional to see if we should\n // render the template or not.\n if (shouldDisplay(result)) {\n set(this, 'template', displayTemplate);\n\n // If we are preserving the context (for example, if this\n // is an #if block, call the template with the same object.\n if (preserveContext) {\n set(this, '_templateContext', context);\n } else {\n // Otherwise, determine if this is a block bind or not.\n // If so, pass the specified object to the template\n if (displayTemplate) {\n set(this, '_templateContext', result);\n } else {\n // This is not a bind block, just push the result of the\n // expression to the render context and return.\n if (result === null || result === undefined) {\n result = \"\";\n } else if (!(result instanceof Handlebars.SafeString)) {\n result = String(result);\n }\n\n if (escape) { result = Handlebars.Utils.escapeExpression(result); }\n buffer.push(result);\n return;\n }\n }\n } else if (inverseTemplate) {\n set(this, 'template', inverseTemplate);\n\n if (preserveContext) {\n set(this, '_templateContext', context);\n } else {\n set(this, '_templateContext', result);\n }\n } else {\n set(this, 'template', function() { return ''; });\n }\n\n return this._super(buffer);\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, getPath = Ember.Handlebars.getPath, set = Ember.set, fmt = Ember.String.fmt;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar EmberHandlebars = Ember.Handlebars, helpers = EmberHandlebars.helpers;\n\n// Binds a property into the DOM. This will create a hook in DOM that the\n// KVO system will look for and update if the property changes.\nvar bind = function(property, options, preserveContext, shouldDisplay, valueNormalizer) {\n var data = options.data,\n fn = options.fn,\n inverse = options.inverse,\n view = data.view,\n currentContext = this,\n pathRoot, path, normalized;\n\n normalized = Ember.Handlebars.normalizePath(currentContext, property, data);\n\n pathRoot = normalized.root;\n path = normalized.path;\n\n // Set up observers for observable objects\n if ('object' === typeof this) {\n // Create the view that will wrap the output of this template/property\n // and add it to the nearest view's childViews array.\n // See the documentation of Ember._HandlebarsBoundView for more.\n var bindView = view.createChildView(Ember._HandlebarsBoundView, {\n preserveContext: preserveContext,\n shouldDisplayFunc: shouldDisplay,\n valueNormalizerFunc: valueNormalizer,\n displayTemplate: fn,\n inverseTemplate: inverse,\n path: path,\n pathRoot: pathRoot,\n previousContext: currentContext,\n isEscaped: options.hash.escaped,\n templateData: options.data\n });\n\n view.appendChild(bindView);\n\n /** @private */\n var observer = function() {\n Ember.run.once(bindView, 'rerenderIfNeeded');\n };\n\n // Observes the given property on the context and\n // tells the Ember._BindableSpan to re-render. If property\n // is an empty string, we are printing the current context\n // object ({{this}}) so updating it is not our responsibility.\n if (path !== '') {\n Ember.addObserver(pathRoot, path, observer);\n }\n } else {\n // The object is not observable, so just render it out and\n // be done with it.\n data.buffer.push(getPath(pathRoot, path, options));\n }\n};\n\n/**\n '_triageMustache' is used internally select between a binding and helper for\n the given context. Until this point, it would be hard to determine if the\n mustache is a property reference or a regular helper reference. This triage\n helper resolves that.\n\n This would not be typically invoked by directly.\n\n @private\n @name Handlebars.helpers._triageMustache\n @param {String} property Property/helperID to triage\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('_triageMustache', function(property, fn) {\n Ember.assert(\"You cannot pass more than one argument to the _triageMustache helper\", arguments.length <= 2);\n if (helpers[property]) {\n return helpers[property].call(this, fn);\n }\n else {\n return helpers.bind.apply(this, arguments);\n }\n});\n\n/**\n `bind` can be used to display a value, then update that value if it\n changes. For example, if you wanted to print the `title` property of\n `content`:\n\n {{bind \"content.title\"}}\n\n This will return the `title` property as a string, then create a new\n observer at the specified path. If it changes, it will update the value in\n DOM. Note that if you need to support IE7 and IE8 you must modify the\n model objects properties using Ember.get() and Ember.set() for this to work as\n it relies on Ember's KVO system. For all other browsers this will be handled\n for you automatically.\n\n @private\n @name Handlebars.helpers.bind\n @param {String} property Property to bind\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('bind', function(property, fn) {\n Ember.assert(\"You cannot pass more than one argument to the bind helper\", arguments.length <= 2);\n\n var context = (fn.contexts && fn.contexts[0]) || this;\n\n return bind.call(context, property, fn, false, function(result) {\n return !Ember.none(result);\n });\n});\n\n/**\n Use the `boundIf` helper to create a conditional that re-evaluates\n whenever the bound value changes.\n\n {{#boundIf \"content.shouldDisplayTitle\"}}\n {{content.title}}\n {{/boundIf}}\n\n @private\n @name Handlebars.helpers.boundIf\n @param {String} property Property to bind\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('boundIf', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n var func = function(result) {\n if (Ember.typeOf(result) === 'array') {\n return get(result, 'length') !== 0;\n } else {\n return !!result;\n }\n };\n\n return bind.call(context, property, fn, true, func, func);\n});\n\n/**\n @name Handlebars.helpers.with\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('with', function(context, options) {\n if (arguments.length === 4) {\n var keywordName, path;\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 // 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 = Ember.$.expando + Ember.guidFor(this);\n options.data.keywords[contextKey] = this;\n Ember.bind(options.data.keywords, keywordName, contextKey + '.' + path);\n\n return bind.call(this, path, options.fn, true, function(result) {\n return !Ember.none(result);\n });\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 @name Handlebars.helpers.if\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('if', function(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\n return helpers.boundIf.call(options.contexts[0], context, options);\n});\n\n/**\n @name Handlebars.helpers.unless\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('unless', function(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 return helpers.boundIf.call(options.contexts[0], context, options);\n});\n\n/**\n `bindAttr` allows you to create a binding between DOM element attributes and\n Ember objects. For example:\n\n <img {{bindAttr src=\"imageUrl\" alt=\"imageTitle\"}}>\n\n @name Handlebars.helpers.bindAttr\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('bindAttr', function(options) {\n\n var attrs = options.hash;\n\n Ember.assert(\"You must specify at least one hash argument to bindAttr\", !!Ember.keys(attrs).length);\n\n var view = options.data.view;\n var ret = [];\n var ctx = this;\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 && classBindings !== undefined) {\n var classResults = EmberHandlebars.bindClasses(this, classBindings, view, dataId, options);\n ret.push('class=\"' + Handlebars.Utils.escapeExpression(classResults.join(' ')) + '\"');\n delete attrs['class'];\n }\n\n var attrKeys = Ember.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(attrKeys, function(attr) {\n var property = attrs[attr];\n\n Ember.assert(fmt(\"You must provide a String for a bound attribute, not %@\", [property]), typeof property === 'string');\n\n var value = (property === 'this') ? ctx : getPath(ctx, property, options),\n type = Ember.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 /** @private */\n observer = function observer() {\n var result = getPath(ctx, property, options);\n\n Ember.assert(fmt(\"Attributes must be numbers, strings or booleans, not %@\", [result]), result === null || result === undefined || typeof result === 'number' || 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.length === 0) {\n Ember.removeObserver(ctx, property, invoker);\n return;\n }\n\n Ember.View.applyAttributeBindings(elem, attr, result);\n };\n\n /** @private */\n invoker = function() {\n Ember.run.once(observer);\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 if (property !== 'this') {\n Ember.addObserver(ctx, property, invoker);\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 EmberHandlebars.SafeString(ret.join(' '));\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 @param {Ember.Object} context\n The context from which to lookup properties\n\n @param {String} classBindings\n A string, space-separated, of class bindings to use\n\n @param {Ember.View} view\n The view in which observers should look for the element to update\n\n @param {Srting} bindAttrId\n Optional bindAttr id used to lookup elements\n\n @returns {Array} An array of class names to add\n*/\nEmberHandlebars.bindClasses = function(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 classStringForProperty = function(property) {\n var split = property.split(':'),\n className = split[1];\n\n property = split[0];\n\n var val = property !== '' ? getPath(context, property, options) : true;\n\n // If the value is truthy and we're using the colon syntax,\n // we should return the className directly\n if (!!val && className) {\n return className;\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 = property.split('.');\n return Ember.String.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 !== undefined && 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 // For each property passed, loop through and setup\n // an observer.\n forEach(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 // Set up an observer on the context. If the property changes, toggle the\n // class name.\n /** @private */\n observer = function() {\n // Get the current value of the property\n newClass = classStringForProperty(binding);\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.length === 0) {\n Ember.removeObserver(context, binding, 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 /** @private */\n invoker = function() {\n Ember.run.once(observer);\n };\n\n var property = binding.split(':')[0];\n if (property !== '') {\n Ember.addObserver(context, property, invoker);\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 = classStringForProperty(binding);\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\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\n// TODO: Don't require the entire module\nvar get = Ember.get, set = Ember.set;\nvar indexOf = Ember.ArrayUtils.indexOf;\nvar PARENT_VIEW_PATH = /^parentView\\./;\nvar EmberHandlebars = Ember.Handlebars;\n\n/** @private */\nEmberHandlebars.ViewHelper = Ember.Object.create({\n\n viewClassFromHTMLOptions: function(viewClass, options, thisContext) {\n var hash = options.hash, data = options.data;\n var extensions = {},\n classes = hash['class'],\n dup = false;\n\n if (hash.id) {\n extensions.elementId = hash.id;\n dup = true;\n }\n\n if (classes) {\n classes = classes.split(' ');\n extensions.classNames = classes;\n dup = true;\n }\n\n if (hash.classBinding) {\n extensions.classNameBindings = hash.classBinding.split(' ');\n dup = true;\n }\n\n if (hash.classNameBindings) {\n extensions.classNameBindings = hash.classNameBindings.split(' ');\n dup = true;\n }\n\n if (hash.attributeBindings) {\n Ember.assert(\"Setting 'attributeBindings' via Handlebars is not allowed. Please subclass Ember.View and set it there instead.\");\n extensions.attributeBindings = null;\n dup = true;\n }\n\n if (dup) {\n hash = Ember.$.extend({}, hash);\n delete hash.id;\n delete hash['class'];\n delete hash.classBinding;\n }\n\n // Look for bindings passed to the helper and, if they are\n // local, make them relative to the current context instead of the\n // view.\n var path, normalized;\n\n for (var prop in hash) {\n if (!hash.hasOwnProperty(prop)) { continue; }\n\n // Test if the property ends in \"Binding\"\n if (Ember.IS_BINDING.test(prop)) {\n path = hash[prop];\n\n normalized = Ember.Handlebars.normalizePath(null, path, data);\n if (normalized.isKeyword) {\n hash[prop] = 'templateData.keywords.'+path;\n } else if (!Ember.isGlobalPath(path)) {\n if (path === 'this') {\n hash[prop] = 'bindingContext';\n } else {\n hash[prop] = 'bindingContext.'+path;\n }\n }\n }\n }\n\n // Make the current template context available to the view\n // for the bindings set up above.\n extensions.bindingContext = thisContext;\n\n return viewClass.extend(hash, extensions);\n },\n\n helper: function(thisContext, path, options) {\n var inverse = options.inverse,\n data = options.data,\n view = data.view,\n fn = options.fn,\n hash = options.hash,\n newView;\n\n if ('string' === typeof path) {\n newView = EmberHandlebars.getPath(thisContext, path, options);\n Ember.assert(\"Unable to find view at path '\" + path + \"'\", !!newView);\n } else {\n newView = path;\n }\n\n Ember.assert(Ember.String.fmt('You must pass a view class to the #view helper, not %@ (%@)', [path, newView]), Ember.View.detect(newView));\n\n newView = this.viewClassFromHTMLOptions(newView, options, thisContext);\n var currentView = data.view;\n var viewOptions = {\n templateData: options.data\n };\n\n if (fn) {\n Ember.assert(\"You cannot provide a template block if you also specified a templateName\", !get(viewOptions, 'templateName') && !get(newView.proto(), 'templateName'));\n viewOptions.template = fn;\n }\n\n currentView.appendChild(newView, viewOptions);\n }\n});\n\n/**\n`{{view}}` inserts a new instance of `Ember.View` into a template passing its options\nto the `Ember.View`'s `create` method and using the supplied block as the view's own template.\n\nAn empty `<body>` and the following template:\n\n <script type=\"text/x-handlebars\">\n A span:\n {{#view tagName=\"span\"}}\n hello.\n {{/view}}\n </script>\n\nWill result in HTML structure:\n\n <body>\n <!-- Note: the handlebars template script \n also results in a rendered Ember.View\n which is the outer <div> here -->\n\n <div class=\"ember-view\">\n A span:\n <span id=\"ember1\" class=\"ember-view\">\n Hello.\n </span>\n </div>\n </body>\n\n### parentView setting\nThe `parentView` property of the new `Ember.View` instance created through `{{view}}`\nwill be set to the `Ember.View` instance of the template where `{{view}}` was called.\n \n aView = Ember.View.create({\n template: Ember.Handlebars.compile(\"{{#view}} my parent: {{parentView.elementId}} {{/view}}\")\n })\n\n aView.appendTo('body')\n \nWill result in HTML structure:\n\n <div id=\"ember1\" class=\"ember-view\">\n <div id=\"ember2\" class=\"ember-view\">\n my parent: ember1\n </div>\n </div>\n\n\n\n### Setting CSS id and class attributes\nThe HTML `id` attribute can be set on the `{{view}}`'s resulting element with the `id` option.\nThis option will _not_ be passed to `Ember.View.create`.\n\n <script type=\"text/x-handlebars\">\n {{#view tagName=\"span\" id=\"a-custom-id\"}}\n hello.\n {{/view}}\n </script>\n\nResults in the following HTML structure:\n\n <div class=\"ember-view\">\n <span id=\"a-custom-id\" class=\"ember-view\">\n hello.\n </span>\n </div>\n\nThe HTML `class` attribute can be set on the `{{view}}`'s resulting element with\nthe `class` or `classNameBindings` options. The `class` option\nwill directly set the CSS `class` attribute and will not be passed to\n`Ember.View.create`. `classNameBindings` will be passed to `create` and use\n`Ember.View`'s class name binding functionality:\n\n <script type=\"text/x-handlebars\">\n {{#view tagName=\"span\" class=\"a-custom-class\"}}\n hello.\n {{/view}}\n </script>\n\nResults in the following HTML structure:\n\n <div class=\"ember-view\">\n <span id=\"ember2\" class=\"ember-view a-custom-class\">\n hello.\n </span>\n </div>\n\n### Supplying a different view class\n`{{view}}` can take an optional first argument before its supplied options to specify a\npath to a custom view class.\n\n <script type=\"text/x-handlebars\">\n {{#view \"MyApp.CustomView\"}}\n hello.\n {{/view}}\n </script>\n\nThe first argument can also be a relative path. Ember will search for the view class \nstarting at the `Ember.View` of the template where `{{view}}` was used as the root object:\n\n\n MyApp = Ember.Application.create({})\n MyApp.OuterView = Ember.View.extend({\n innerViewClass: Ember.View.extend({\n classNames: ['a-custom-view-class-as-property']\n }),\n template: Ember.Handlebars.compile('{{#view \"innerViewClass\"}} hi {{/view}}')\n })\n\n MyApp.OuterView.create().appendTo('body')\n\nWill result in the following HTML:\n\n <div id=\"ember1\" class=\"ember-view\">\n <div id=\"ember2\" class=\"ember-view a-custom-view-class-as-property\"> \n hi\n </div>\n </div>\n \n### Blockless use\nIf you supply a custom `Ember.View` subclass that specifies its own template \nor provide a `templateName` option to `{{view}}` it can be used without supplying a block.\nAttempts to use both a `templateName` option and supply a block will throw an error.\n\n <script type=\"text/x-handlebars\">\n {{view \"MyApp.ViewWithATemplateDefined\"}}\n </script>\n\n### viewName property\nYou can supply a `viewName` option to `{{view}}`. The `Ember.View` instance will\nbe referenced as a property of its parent view by this name.\n\n aView = Ember.View.create({\n template: Ember.Handlebars.compile('{{#view viewName=\"aChildByName\"}} hi {{/view}}')\n })\n\n aView.appendTo('body')\n aView.get('aChildByName') // the instance of Ember.View created by {{view}} helper\n \n @name Handlebars.helpers.view\n @param {String} path\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('view', function(path, options) {\n Ember.assert(\"The view helper only takes a single argument\", arguments.length <= 2);\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 = \"Ember.View\";\n }\n\n return EmberHandlebars.ViewHelper.helper(this, path, options);\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\n// TODO: Don't require all of this module\nvar get = Ember.get, getPath = Ember.Handlebars.getPath, fmt = Ember.String.fmt;\n\n/**\n @name Handlebars.helpers.collection\n @param {String} path\n @param {Hash} options\n @returns {String} HTML string\n \n `{{collection}}` is a `Ember.Handlebars` helper for adding instances of\n `Ember.CollectionView` to a template. See `Ember.CollectionView` for additional\n information on how a `CollectionView` functions.\n\n `{{collection}}`'s primary use is as a block helper with a `contentBinding` option\n pointing towards an `Ember.Array`-compatible object. An `Ember.View` instance will\n be created for each item in its `content` property. Each view will have its own\n `content` property set to the appropriate item in the collection.\n\n The provided block will be applied as the template for each item's view.\n\n Given an empty `<body>` the following template:\n\n <script type=\"text/x-handlebars\">\n {{#collection contentBinding=\"App.items\"}}\n Hi {{content.name}}\n {{/collection}}\n </script>\n\n And the following application code\n\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 Will result in the HTML structure below\n\n <div class=\"ember-view\">\n <div class=\"ember-view\">Hi Dave</div>\n <div class=\"ember-view\">Hi Mary</div>\n <div class=\"ember-view\">Hi Sara</div>\n </div>\n\n ### Blockless Use\n If you provide an `itemViewClass` option that has its own `template` you can omit\n the block.\n\n The following template:\n\n <script type=\"text/x-handlebars\">\n {{collection contentBinding=\"App.items\" itemViewClass=\"App.AnItemView\"}}\n </script>\n\n And application code\n\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 {{content.name}}\")\n })\n\n Will result in the HTML structure below\n\n <div class=\"ember-view\">\n <div class=\"ember-view\">Greetings Dave</div>\n <div class=\"ember-view\">Greetings Mary</div>\n <div class=\"ember-view\">Greetings Sara</div>\n </div>\n\n ### Specifying a CollectionView subclass\n By default the `{{collection}}` helper will create an instance of `Ember.CollectionView`.\n You can supply a `Ember.CollectionView` subclass to the helper by passing it\n as the first argument:\n\n <script type=\"text/x-handlebars\">\n {{#collection App.MyCustomCollectionClass contentBinding=\"App.items\"}}\n Hi {{content.name}}\n {{/collection}}\n </script>\n\n\n ### Forwarded `item.*`-named Options\n As with the `{{view}}`, helper options passed to the `{{collection}}` will be set on\n the resulting `Ember.CollectionView` as properties. Additionally, options prefixed with\n `item` will be applied to the views rendered for each item (note the camelcasing):\n\n <script type=\"text/x-handlebars\">\n {{#collection contentBinding=\"App.items\"\n itemTagName=\"p\"\n itemClassNames=\"greeting\"}}\n Howdy {{content.name}}\n {{/collection}}\n </script>\n\n Will result in the following HTML structure:\n\n <div class=\"ember-view\">\n <p class=\"ember-view greeting\">Howdy Dave</p>\n <p class=\"ember-view greeting\">Howdy Mary</p>\n <p class=\"ember-view greeting\">Howdy Sara</p>\n </div>\n \n \n*/\nEmber.Handlebars.registerHelper('collection', function(path, options) {\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\n // If passed a path string, convert that into an object.\n // Otherwise, just default to the standard class.\n var collectionClass;\n collectionClass = path ? getPath(this, path, options) : Ember.CollectionView;\n Ember.assert(fmt(\"%@ #collection: Could not find %@\", data.view, path), !!collectionClass);\n\n var hash = options.hash, itemHash = {}, match;\n\n // Extract item view class if provided else default to the standard class\n var itemViewClass, itemViewPath = hash.itemViewClass;\n var collectionPrototype = collectionClass.proto();\n delete hash.itemViewClass;\n itemViewClass = itemViewPath ? getPath(collectionPrototype, itemViewPath, options) : collectionPrototype.itemViewClass;\n Ember.assert(fmt(\"%@ #collection: Could not find %@\", data.view, itemViewPath), !!itemViewClass);\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) {\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 var tagName = hash.tagName || collectionPrototype.tagName;\n\n if (fn) {\n itemHash.template = fn;\n delete options.fn;\n }\n\n if (inverse && inverse !== Handlebars.VM.noop) {\n var emptyViewClass = get(collectionPrototype, 'emptyViewClass');\n\n hash.emptyView = emptyViewClass.extend({\n template: inverse,\n tagName: itemHash.tagName\n });\n }\n\n if (hash.eachHelper === 'each') {\n itemHash._templateContext = Ember.computed(function() {\n return get(this, 'content');\n }).property('content');\n delete hash.eachHelper;\n }\n\n hash.itemViewClass = Ember.Handlebars.ViewHelper.viewClassFromHTMLOptions(itemViewClass, { data: data, hash: itemHash }, this);\n\n return Ember.Handlebars.helpers.view.call(this, collectionClass, options);\n});\n\n\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\nvar getPath = Ember.Handlebars.getPath;\n\n/**\n `unbound` allows you to output a property without binding. *Important:* The\n output will not be updated if the property changes. Use with caution.\n\n <div>{{unbound somePropertyThatDoesntChange}}</div>\n\n @name Handlebars.helpers.unbound\n @param {String} property\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('unbound', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n return getPath(context, property, fn);\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/*jshint debug:true*/\nvar getPath = Ember.getPath;\n\n/**\n `log` allows you to output the value of a value in the current rendering\n context.\n\n {{log myVariable}}\n\n @name Handlebars.helpers.log\n @param {String} property\n*/\nEmber.Handlebars.registerHelper('log', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n Ember.Logger.log(getPath(context, property));\n});\n\n/**\n The `debugger` helper executes the `debugger` statement in the current\n context.\n\n {{debugger}}\n\n @name Handlebars.helpers.debugger\n @param {String} property\n*/\nEmber.Handlebars.registerHelper('debugger', function() {\n debugger;\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\nEmber.Handlebars.EachView = Ember.CollectionView.extend(Ember._Metamorph, {\n itemViewClass: Ember._MetamorphView,\n emptyViewClass: Ember._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\n if (keyword) {\n var data = get(view, 'templateData');\n\n data = Ember.copy(data);\n data.keywords = view.cloneKeywords();\n set(view, 'templateData', data);\n\n var content = get(view, 'content');\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 return view;\n }\n});\n\nEmber.Handlebars.registerHelper('each', function(path, options) {\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\n options.hash.keyword = keywordName;\n } else {\n options.hash.eachHelper = 'each';\n }\n\n Ember.assert(\"You must pass a block to the each helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n options.hash.contentBinding = path;\n // Set up emptyView as a metamorph with no tag\n //options.hash.emptyViewClass = Ember._MetamorphView;\n\n return Ember.Handlebars.helpers.collection.call(this, 'Ember.Handlebars.EachView', options);\n});\n\n})();\n\n\n\n(function() {\n/**\n `template` allows you to render a template from inside another template.\n This allows you to re-use the same template in multiple places. For example:\n\n <script type=\"text/x-handlebars\">\n {{#with loggedInUser}}\n Last Login: {{lastLogin}}\n User Info: {{template \"user_info\"}}\n {{/with}}\n </script>\n\n <script type=\"text/x-handlebars\" data-template-name=\"user_info\">\n Name: <em>{{name}}</em>\n Karma: <em>{{karma}}</em>\n </script>\n\n This helper looks for templates in the global Ember.TEMPLATES hash. If you\n add &lt;script&gt; tags to your page with the `data-template-name` attribute set,\n they will be compiled and placed in this hash automatically.\n\n You can also manually register templates by adding them to the hash:\n\n Ember.TEMPLATES[\"my_cool_template\"] = Ember.Handlebars.compile('<b>{{user}}</b>');\n\n @name Handlebars.helpers.template\n @param {String} templateName the template to render\n*/\n\nEmber.Handlebars.registerHelper('template', function(name, options) {\n var template = Ember.TEMPLATES[name];\n\n Ember.assert(\"Unable to find template with name '\"+name+\"'.\", !!template);\n\n Ember.TEMPLATES[name](this, { data: options.data });\n});\n\n})();\n\n\n\n(function() {\nvar EmberHandlebars = Ember.Handlebars, getPath = EmberHandlebars.getPath, get = Ember.get;\n\nvar ActionHelper = EmberHandlebars.ActionHelper = {\n registeredActions: {}\n};\n\nActionHelper.registerAction = function(actionName, eventName, target, view, context) {\n var actionId = (++Ember.$.uuid).toString();\n\n ActionHelper.registeredActions[actionId] = {\n eventName: eventName,\n handler: function(event) {\n event.view = view;\n event.context = context;\n\n // Check for StateManager (or compatible object)\n if (target.isState && typeof target.send === 'function') {\n return target.send(actionName, event);\n } else {\n return target[actionName].call(target, event);\n }\n }\n };\n\n view.on('willRerender', function() {\n delete ActionHelper.registeredActions[actionId];\n });\n\n return actionId;\n};\n\n/**\n The `{{action}}` helper registers an HTML element within a template for\n DOM event handling. User interaction with that element will call the method\n on the template's associated `Ember.View` instance that has the same name\n as the first provided argument to `{{action}}`:\n\n Given the following Handlebars template on the page\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"anActionName\"}}>\n click me\n </div>\n </script>\n\n And application code\n\n AView = Ember.View.extend({\n templateName; 'a-template',\n anActionName: function(event){}\n })\n\n aView = AView.create()\n aView.appendTo('body')\n\n Will results in the following rendered HTML\n\n <div class=\"ember-view\">\n <div data-ember-action=\"1\">\n click me\n </div>\n </div>\n\n Clicking \"click me\" will trigger the `anActionName` method of the `aView` object with a \n `jQuery.Event` object as its argument. The `jQuery.Event` object will be extended to include\n a `view` property that is set to the original view interacted with (in this case the `aView` object).\n\n\n ### Specifying an Action Target\n A `target` option can be provided to change which object will receive the method call. This option must be\n a string representing a path to an object:\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"anActionName\" target=\"MyApplication.someObject\"}}>\n click me\n </div>\n </script>\n\n Clicking \"click me\" in the rendered HTML of the above template will trigger the \n `anActionName` method of the object at `MyApplication.someObject`. The first argument \n to this method will be a `jQuery.Event` extended to include a `view` property that is \n set to the original view interacted with.\n\n A path relative to the template's `Ember.View` instance can also be used as a target:\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"anActionName\" target=\"parentView\"}}>\n click me\n </div>\n </script>\n\n Clicking \"click me\" in the rendered HTML of the above template will trigger the \n `anActionName` method of the view's parent view.\n\n The `{{action}}` helper is `Ember.StateManager` aware. If the target of\n the action is an `Ember.StateManager` instance `{{action}}` will use the `send`\n functionality of StateManagers. The documentation for `Ember.StateManager` has additional\n information about this use.\n\n If an action's target does not implement a method that matches the supplied action name\n an error will be thrown.\n\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"aMethodNameThatIsMissing\"}}>\n click me\n </div>\n </script>\n\n With the following application code\n\n AView = Ember.View.extend({\n templateName; 'a-template',\n // note: no method 'aMethodNameThatIsMissing'\n anActionName: function(event){}\n })\n\n aView = AView.create()\n aView.appendTo('body')\n\n Will throw `Uncaught TypeError: Cannot call method 'call' of undefined` when \"click me\" is clicked.\n\n\n ### Specifying DOM event type\n By default the `{{action}}` helper registers for DOM `click` events. You can supply an\n `on` option to the helper to specify a different DOM event name:\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"aMethodNameThatIsMissing\" on=\"doubleClick\"}}>\n click me\n </div>\n </script>\n\n See `Ember.EventDispatcher` for a list of acceptable DOM event names.\n\n Because `{{action}}` depends on Ember's event dispatch system it will only function if\n an `Ember.EventDispatcher` instance is available. An `Ember.EventDispatcher` instance \n will be created when a new `Ember.Application` is created. Having an instance of\n `Ember.Application` will satisfy this requirement.\n\n @name Handlebars.helpers.action\n @param {String} actionName\n @param {Hash} options\n*/\nEmberHandlebars.registerHelper('action', function(actionName, options) {\n var hash = options.hash || {},\n eventName = hash.on || \"click\",\n view = options.data.view,\n target, context, controller;\n\n if (view.isVirtual) { view = view.get('parentView'); }\n\n if (hash.target) {\n target = getPath(this, hash.target, options);\n } else if (controller = options.data.keywords.controller) {\n target = get(controller, 'target');\n }\n\n target = target || view;\n\n context = options.contexts[0];\n\n var actionId = ActionHelper.registerAction(actionName, eventName, target, view, context);\n return new EmberHandlebars.SafeString('data-ember-action=\"' + actionId + '\"');\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, set = Ember.set;\n\n/**\n\n When used in a Handlebars template that is assigned to an `Ember.View` instance's\n `layout` property Ember will render the layout template first, inserting the view's\n own rendered output at the `{{ yield }}` location.\n\n An empty `<body>` and the following application code:\n\n AView = Ember.View.extend({\n classNames: ['a-view-with-layout'],\n layout: Ember.Handlebars.compile('<div class=\"wrapper\">{{ yield }}</div>'),\n template: Ember.Handlebars.compile('<span>I am wrapped</span>')\n })\n\n aView = AView.create()\n aView.appendTo('body')\n\n Will result in the following HTML output:\n\n <body>\n <div class='ember-view a-view-with-layout'>\n <div class=\"wrapper\">\n <span>I am wrapped</span>\n </div>\n </div>\n </body>\n\n\n The yield helper cannot be used outside of a template assigned to an `Ember.View`'s `layout` property\n and will throw an error if attempted.\n\n BView = Ember.View.extend({\n classNames: ['a-view-with-layout'],\n template: Ember.Handlebars.compile('{{yield}}')\n })\n\n bView = BView.create()\n bView.appendTo('body')\n\n // throws\n // Uncaught Error: assertion failed: You called yield in a template that was not a layout\n\n @name Handlebars.helpers.yield\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('yield', function(options) {\n var view = options.data.view, template;\n\n while (view && !get(view, 'layout')) {\n view = get(view, 'parentView');\n }\n\n Ember.assert(\"You called yield in a template that was not a layout\", !!view);\n\n template = get(view, 'template');\n\n if (template) { template(this, options); }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar set = Ember.set, get = Ember.get;\n\n/**\n @class\n \n Creates an HTML input view in one of two formats.\n \n If a `title` property or binding is provided the input will be wrapped in\n a `div` and `label` tag. View properties like `classNames` will be applied to\n the outermost `div`. This behavior is deprecated and will issue a warning in development.\n \n \n {{view Ember.Checkbox classNames=\"applicaton-specific-checkbox\" title=\"Some title\"}}\n \n \n <div id=\"ember1\" class=\"ember-view ember-checkbox applicaton-specific-checkbox\">\n <label><input type=\"checkbox\" />Some title</label>\n </div>\n \n If `title` isn't provided the view will render as an input element of the 'checkbox' type and HTML\n related properties will be applied directly to the input.\n \n {{view Ember.Checkbox classNames=\"applicaton-specific-checkbox\"}}\n \n <input id=\"ember1\" class=\"ember-view ember-checkbox applicaton-specific-checkbox\" type=\"checkbox\">\n \n You can add a `label` tag yourself in the template where the Ember.Checkbox is being used.\n \n <label>\n Some Title\n {{view Ember.Checkbox classNames=\"applicaton-specific-checkbox\"}}\n </label>\n \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 representation\n via the mouse, keyboard, or touch. Updating the value of the checkbox via jQuery will\n result in the checked value of the object and its element losing synchronization.\n\n*/\nEmber.Checkbox = Ember.View.extend({\n classNames: ['ember-checkbox'],\n\n tagName: 'input',\n\n attributeBindings: ['type', 'checked', 'disabled'],\n\n type: \"checkbox\",\n checked: false,\n disabled: false,\n\n /** @deprecated */\n title: null,\n\n value: Ember.computed(function(propName, value){\n Ember.deprecate(\"Ember.Checkbox's 'value' property has been renamed to 'checked' to match the html element attribute name\");\n if (value !== undefined) {\n return set(this, 'checked', value);\n } else {\n return get(this, 'checked');\n }\n }).property('checked').volatile(),\n\n change: function() {\n Ember.run.once(this, this._updateElementValue);\n // returning false will cause IE to not change checkbox state\n },\n\n /**\n @private\n */\n _updateElementValue: function() {\n var input = get(this, 'title') ? this.$('input:checkbox') : this.$();\n set(this, 'checked', input.prop('checked'));\n },\n\n init: function() {\n if (get(this, 'title') || get(this, 'titleBinding')) {\n Ember.deprecate(\"Automatically surrounding Ember.Checkbox inputs with a label by providing a 'title' property is deprecated\");\n this.tagName = undefined;\n this.attributeBindings = [];\n this.defaultTemplate = Ember.Handlebars.compile('<label><input type=\"checkbox\" {{bindAttr checked=\"checked\" disabled=\"disabled\"}}>{{title}}</label>');\n }\n\n this._super();\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/** @class */\nEmber.TextSupport = Ember.Mixin.create(\n/** @scope Ember.TextSupport.prototype */ {\n\n value: \"\",\n\n attributeBindings: ['placeholder', 'disabled', 'maxlength'],\n placeholder: null,\n disabled: false,\n maxlength: null,\n\n insertNewline: Ember.K,\n cancel: Ember.K,\n\n focusOut: function(event) {\n this._elementValueDidChange();\n },\n\n change: function(event) {\n this._elementValueDidChange();\n },\n\n keyUp: function(event) {\n this.interpretKeyEvents(event);\n },\n\n /**\n @private\n */\n interpretKeyEvents: function(event) {\n var map = Ember.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\nEmber.TextSupport.KEY_EVENTS = {\n 13: 'insertNewline',\n 27: 'cancel'\n};\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n The `Ember.TextField` view class renders a text\n [input](https://developer.mozilla.org/en/HTML/Element/Input) element. It\n allows for binding Ember properties to the text field contents (`value`),\n live-updating as the user inputs text.\n\n Example:\n\n {{view Ember.TextField valueBinding=\"firstName\"}}\n\n @extends Ember.TextSupport\n*/\nEmber.TextField = Ember.View.extend(Ember.TextSupport,\n /** @scope Ember.TextField.prototype */ {\n\n classNames: ['ember-text-field'],\n tagName: \"input\",\n attributeBindings: ['type', 'value', 'size'],\n\n /**\n The value attribute of the input element. As the user inputs text, this\n property is updated live.\n\n @type String\n @default \"\"\n */\n value: \"\",\n\n /**\n The type attribute of the input element.\n\n @type String\n @default \"text\"\n */\n type: \"text\",\n\n /**\n The size of the text field in characters.\n\n @type String\n @default null\n */\n size: null\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\nEmber.Button = Ember.View.extend(Ember.TargetActionSupport, {\n classNames: ['ember-button'],\n classNameBindings: ['isActive'],\n\n tagName: 'button',\n\n propagateEvents: false,\n\n attributeBindings: ['type', 'disabled', 'href'],\n\n /** @private\n Overrides TargetActionSupport's targetObject computed\n property to use Handlebars-specific path resolution.\n */\n targetObject: Ember.computed(function() {\n var target = get(this, 'target'),\n root = get(this, 'templateContext'),\n data = get(this, 'templateData');\n\n if (typeof target !== 'string') { return target; }\n\n return Ember.Handlebars.getPath(root, target, { data: data });\n }).property('target').cacheable(),\n\n // Defaults to 'button' if tagName is 'input' or 'button'\n type: Ember.computed(function(key, value) {\n var tagName = this.get('tagName');\n if (value !== undefined) { this._type = value; }\n if (this._type !== undefined) { return this._type; }\n if (tagName === 'input' || tagName === 'button') { return 'button'; }\n }).property('tagName').cacheable(),\n\n disabled: false,\n\n // Allow 'a' tags to act like buttons\n href: Ember.computed(function() {\n return this.get('tagName') === 'a' ? '#' : null;\n }).property('tagName').cacheable(),\n\n mouseDown: function() {\n if (!get(this, 'disabled')) {\n set(this, 'isActive', true);\n this._mouseDown = true;\n this._mouseEntered = true;\n }\n return get(this, 'propagateEvents');\n },\n\n mouseLeave: function() {\n if (this._mouseDown) {\n set(this, 'isActive', false);\n this._mouseEntered = false;\n }\n },\n\n mouseEnter: function() {\n if (this._mouseDown) {\n set(this, 'isActive', true);\n this._mouseEntered = true;\n }\n },\n\n mouseUp: function(event) {\n if (get(this, 'isActive')) {\n // Actually invoke the button's target and action.\n // This method comes from the Ember.TargetActionSupport mixin.\n this.triggerAction();\n set(this, 'isActive', false);\n }\n\n this._mouseDown = false;\n this._mouseEntered = false;\n return get(this, 'propagateEvents');\n },\n\n keyDown: function(event) {\n // Handle space or enter\n if (event.keyCode === 13 || event.keyCode === 32) {\n this.mouseDown();\n }\n },\n\n keyUp: function(event) {\n // Handle space or enter\n if (event.keyCode === 13 || event.keyCode === 32) {\n this.mouseUp();\n }\n },\n\n // TODO: Handle proper touch behavior. Including should make inactive when\n // finger moves more than 20x outside of the edge of the button (vs mouse\n // which goes inactive as soon as mouse goes out of edges.)\n\n touchStart: function(touch) {\n return this.mouseDown(touch);\n },\n\n touchEnd: function(touch) {\n return this.mouseUp(touch);\n },\n\n init: function() {\n Ember.deprecate(\"Ember.Button is deprecated and will be removed from future releases. Consider using the `{{action}}` helper.\");\n this._super();\n }\n});\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n @extends Ember.TextSupport\n*/\nEmber.TextArea = Ember.View.extend(Ember.TextSupport,\n/** @scope Ember.TextArea.prototype */ {\n\n classNames: ['ember-text-area'],\n\n tagName: \"textarea\",\n attributeBindings: ['rows', 'cols'],\n rows: null,\n cols: null,\n\n _updateElementValue: Ember.observer(function() {\n this.$().val(get(this, 'value'));\n }, 'value'),\n\n init: function() {\n this._super();\n this.on(\"didInsertElement\", this, this._updateElementValue);\n }\n\n});\n\n})();\n\n\n\n(function() {\nEmber.TabContainerView = Ember.View.extend();\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, getPath = Ember.getPath;\n\nEmber.TabPaneView = Ember.View.extend({\n tabsContainer: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.TabContainerView);\n }).property().volatile(),\n\n isVisible: Ember.computed(function() {\n return get(this, 'viewName') === getPath(this, 'tabsContainer.currentView');\n }).property('tabsContainer.currentView').volatile()\n});\n\n})();\n\n\n\n(function() {\nvar get = Ember.get, setPath = Ember.setPath;\n\nEmber.TabView = Ember.View.extend({\n tabsContainer: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.TabContainerView);\n }).property().volatile(),\n\n mouseUp: function() {\n setPath(this, 'tabsContainer.currentView', get(this, 'value'));\n }\n});\n\n})();\n\n\n\n(function() {\n\n})();\n\n\n\n(function() {\n/*jshint eqeqeq:false */\n\nvar set = Ember.set, get = Ember.get, getPath = Ember.getPath;\nvar indexOf = Ember.ArrayUtils.indexOf, indexesOf = Ember.ArrayUtils.indexesOf;\n\n/**\n @class\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. The selected option(s)\n are updated live in the `selection` property.\n\n @extends Ember.View\n*/\nEmber.Select = Ember.View.extend(\n /** @scope Ember.Select.prototype */ {\n\n tagName: 'select',\n defaultTemplate: Ember.Handlebars.compile('{{#if view.prompt}}<option>{{view.prompt}}</option>{{/if}}{{#each view.content}}{{view Ember.SelectOption contentBinding=\"this\"}}{{/each}}'),\n attributeBindings: ['multiple'],\n\n /**\n The `multiple` attribute of the select element. Indicates whether multiple\n options can be selected.\n\n @type Boolean\n @default false\n */\n multiple: 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 content: Ember.A([\n { id: 1, firstName: 'Yehuda' },\n { id: 2, firstName: 'Tom' }\n ])),\n optionLabelPath: 'content.firstName',\n optionValuePath: 'content.id'\n\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 @type Object or Array\n @default null\n */\n selection: null,\n\n /**\n If given, a top-most dummy option will be rendered to serve as a user\n prompt.\n\n @type String\n @default null\n */\n prompt: null,\n\n /**\n The path of the option labels. See `content`.\n\n @type String\n @default 'content'\n */\n optionLabelPath: 'content',\n\n /**\n The path of the option values. See `content`.\n\n @type String\n @default 'content'\n */\n optionValuePath: 'content',\n\n change: function() {\n if (get(this, 'multiple')) {\n this._changeMultiple();\n } else {\n this._changeSingle();\n }\n },\n\n selectionDidChange: Ember.observer(function() {\n var selection = get(this, 'selection'),\n isArray = Ember.isArray(selection);\n if (get(this, 'multiple')) {\n if (!isArray) {\n set(this, 'selection', Ember.A([selection]));\n return;\n }\n this._selectionDidChangeMultiple();\n } else {\n this._selectionDidChangeSingle();\n }\n }, 'selection'),\n\n _triggerChange: function() {\n var selection = get(this, 'selection');\n\n if (selection) { this.selectionDidChange(); }\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) { 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 _changeMultiple: function() {\n var options = this.$('option:selected'),\n prompt = get(this, 'prompt'),\n offset = prompt ? 1 : 0,\n content = get(this, 'content');\n\n if (!content){ return; }\n if (options) {\n var selectedIndexes = options.map(function(){\n return this.index - offset;\n }).toArray();\n set(this, 'selection', content.objectsAt(selectedIndexes));\n }\n },\n\n _selectionDidChangeSingle: function() {\n var el = this.$()[0],\n content = get(this, 'content'),\n selection = get(this, 'selection'),\n selectionIndex = indexOf(content, selection),\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 = indexesOf(content, selection),\n prompt = get(this, 'prompt'),\n offset = prompt ? 1 : 0,\n options = this.$('option');\n\n if (options) {\n options.each(function() {\n this.selected = indexOf(selectedIndexes, this.index + offset) > -1;\n });\n }\n },\n\n init: function() {\n this._super();\n this.on(\"didInsertElement\", this, this._triggerChange);\n }\n\n});\n\nEmber.SelectOption = Ember.View.extend({\n tagName: 'option',\n defaultTemplate: Ember.Handlebars.compile(\"{{view.label}}\"),\n attributeBindings: ['value', 'selected'],\n\n init: function() {\n this.labelPathDidChange();\n this.valuePathDidChange();\n\n this._super();\n },\n\n selected: Ember.computed(function() {\n var content = get(this, 'content'),\n selection = getPath(this, 'parentView.selection');\n if (getPath(this, 'parentView.multiple')) {\n return selection && indexOf(selection, content) > -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').volatile(),\n\n labelPathDidChange: Ember.observer(function() {\n var labelPath = getPath(this, 'parentView.optionLabelPath');\n\n if (!labelPath) { return; }\n\n Ember.defineProperty(this, 'label', Ember.computed(function() {\n return getPath(this, labelPath);\n }).property(labelPath).cacheable());\n }, 'parentView.optionLabelPath'),\n\n valuePathDidChange: Ember.observer(function() {\n var valuePath = getPath(this, 'parentView.optionValuePath');\n\n if (!valuePath) { return; }\n\n Ember.defineProperty(this, 'value', Ember.computed(function() {\n return getPath(this, valuePath);\n }).property(valuePath).cacheable());\n }, 'parentView.optionValuePath')\n});\n\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n// Find templates stored in the head tag as script tags and make them available\n// to Ember.CoreView in the global Ember.TEMPLATES object. This will be run as as\n// jQuery DOM-ready callback.\n//\n// Script tags with \"text/x-handlebars\" will be compiled\n// with Ember's Handlebars and are suitable for use as a view's template.\n// Those with type=\"text/x-raw-handlebars\" will be compiled with regular\n// Handlebars and are suitable for use in views' computed properties.\nEmber.Handlebars.bootstrap = function(ctx) {\n var selectors = 'script[type=\"text/x-handlebars\"], script[type=\"text/x-raw-handlebars\"]';\n\n if (Ember.ENV.LEGACY_HANDLEBARS_TAGS) { selectors += ', script[type=\"text/html\"]'; }\n\n Ember.warn(\"Ember no longer parses text/html script tags by default. Set ENV.LEGACY_HANDLEBARS_TAGS = true to restore this functionality.\", Ember.ENV.LEGACY_HANDLEBARS_TAGS || Ember.$('script[type=\"text/html\"]').length === 0);\n\n Ember.$(selectors, ctx)\n .each(function() {\n // Get a reference to the script tag\n var script = Ember.$(this),\n type = script.attr('type');\n\n var compile = (script.attr('type') === 'text/x-raw-handlebars') ?\n Ember.$.proxy(Handlebars.compile, Handlebars) :\n Ember.$.proxy(Ember.Handlebars.compile, Ember.Handlebars),\n // Get the name of the script, used by Ember.View's templateName property.\n // First look for data-template-name attribute, then fall back to its\n // id if no name is found.\n templateName = script.attr('data-template-name') || script.attr('id'),\n template = compile(script.html()),\n view, viewPath, elementId, tagName, options;\n\n if (templateName) {\n // For templates which have a name, we save them and then remove them from the DOM\n Ember.TEMPLATES[templateName] = template;\n\n // Remove script tag from DOM\n script.remove();\n } else {\n if (script.parents('head').length !== 0) {\n // don't allow inline templates in the head\n throw new Ember.Error(\"Template found in <head> without a name specified. \" +\n \"Please provide a data-template-name attribute.\\n\" +\n script.html());\n }\n\n // For templates which will be evaluated inline in the HTML document, instantiates a new\n // view, and replaces the script tag holding the template with the new\n // view's DOM representation.\n //\n // Users can optionally specify a custom view subclass to use by setting the\n // data-view attribute of the script tag.\n viewPath = script.attr('data-view');\n view = viewPath ? Ember.getPath(viewPath) : Ember.View;\n\n // Get the id of the script, used by Ember.View's elementId property,\n // Look for data-element-id attribute.\n elementId = script.attr('data-element-id');\n\n // Users can optionally specify a custom tag name to use by setting the\n // data-tag-name attribute on the script tag.\n tagName = script.attr('data-tag-name');\n\n options = { template: template };\n if (elementId) { options.elementId = elementId; }\n if (tagName) { options.tagName = tagName; }\n\n view = view.create(options);\n\n view._insertElementLater(function() {\n script.replaceWith(this.$());\n\n // Avoid memory leak in IE\n script = null;\n });\n }\n });\n};\n\nEmber.$(document).ready(\n function(){\n Ember.Handlebars.bootstrap( Ember.$(document) );\n }\n);\n\n})();\n\n\n\n(function() {\n// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n(function() {\n// ==========================================================================\n// Project: Ember\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n})();\n\n\n})();\n//@ sourceURL=ember");
@@ -0,0 +1 @@
1
+ minispade.register('ember-application', "(function() {minispade.require('ember-views');\nminispade.require('ember-states');\nminispade.require('ember-application/system');\n\n})();\n//@ sourceURL=ember-application");minispade.register('ember-application/system', "(function() {minispade.require('ember-application/system/application');\nminispade.require('ember-application/system/location');\n\n})();\n//@ sourceURL=ember-application/system");minispade.register('ember-application/system/application', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n An Ember.Application instance serves as the namespace in which you define your\n application's classes. You can also override the configuration of your\n application.\n\n By default, Ember.Application will begin listening for events on the document.\n If your application is embedded inside a page, instead of controlling the\n entire document, you can specify which DOM element to attach to by setting\n the `rootElement` property:\n\n MyApp = Ember.Application.create({\n rootElement: $('#my-app')\n });\n\n The root of an Ember.Application must not be removed during the course of the\n page's lifetime. If you have only a single conceptual application for the\n entire page, and are not embedding any third-party Ember applications\n in your page, use the default document root for your application.\n\n You only need to specify the root if your page contains multiple instances\n of Ember.Application.\n\n @extends Ember.Object\n*/\nEmber.Application = Ember.Namespace.extend(\n/** @scope Ember.Application.prototype */{\n\n /**\n The root DOM element of the Application.\n\n Can be specified as DOMElement or a selector string.\n\n @type DOMElement\n @default 'body'\n */\n rootElement: 'body',\n\n /**\n @type Ember.EventDispatcher\n @default null\n */\n eventDispatcher: null,\n\n /**\n @type Object\n @default null\n */\n customEvents: null,\n\n /** @private */\n init: function() {\n var eventDispatcher,\n rootElement = get(this, 'rootElement');\n this._super();\n\n eventDispatcher = Ember.EventDispatcher.create({\n rootElement: rootElement\n });\n\n set(this, 'eventDispatcher', eventDispatcher);\n\n // jQuery 1.7 doesn't call the ready callback if already ready\n if (Ember.$.isReady) {\n Ember.run.once(this, this.didBecomeReady);\n } else {\n var self = this;\n Ember.$(document).ready(function() {\n Ember.run.once(self, self.didBecomeReady);\n });\n }\n },\n\n /**\n Instantiate all controllers currently available on the namespace\n and inject them onto a state manager.\n\n Example:\n\n App.PostsController = Ember.ArrayController.extend();\n App.CommentsController = Ember.ArrayController.extend();\n\n var stateManager = Ember.StateManager.create({\n ...\n });\n\n App.initialize(stateManager);\n\n stateManager.get('postsController') // <App.PostsController:ember1234>\n stateManager.get('commentsController') // <App.CommentsController:ember1235>\n\n stateManager.getPath('postsController.stateManager') // stateManager\n */\n initialize: function(stateManager) {\n var properties = Ember.A(Ember.keys(this)),\n injections = get(this.constructor, 'injections'),\n namespace = this, controller, name;\n\n Ember.runLoadHooks('application', this);\n\n properties.forEach(function(property) {\n injections.forEach(function(injection) {\n injection(namespace, stateManager, property);\n });\n });\n },\n\n /** @private */\n didBecomeReady: function() {\n var eventDispatcher = get(this, 'eventDispatcher'),\n stateManager = get(this, 'stateManager'),\n customEvents = get(this, 'customEvents');\n\n eventDispatcher.setup(customEvents);\n\n this.ready();\n\n if (stateManager && stateManager instanceof Ember.Router) {\n this.setupStateManager(stateManager);\n }\n },\n\n /**\n @private\n\n If the application has a state manager, use it to route\n to the current URL, and trigger a new call to `route`\n whenever the URL changes.\n */\n setupStateManager: function(stateManager) {\n var location = get(stateManager, 'location');\n\n stateManager.route(location.getURL());\n location.onUpdateURL(function(url) {\n stateManager.route(url);\n });\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 ready: Ember.K,\n\n /** @private */\n destroy: function() {\n get(this, 'eventDispatcher').destroy();\n return this._super();\n },\n\n registerInjection: function(callback) {\n this.constructor.registerInjection(callback);\n }\n});\n\nEmber.Application.reopenClass({\n concatenatedProperties: ['injections'],\n injections: Ember.A(),\n registerInjection: function(callback) {\n get(this, 'injections').pushObject(callback);\n }\n});\n\nEmber.Application.registerInjection(function(app, stateManager, property) {\n if (!/^[A-Z].*Controller$/.test(property)) { return; }\n\n var name = property[0].toLowerCase() + property.substr(1),\n controller = app[property].create();\n\n stateManager.set(name, controller);\n controller.set('target', stateManager);\n});\n\n})();\n//@ sourceURL=ember-application/system/application");minispade.register('ember-application/system/location', "(function() {var get = Ember.get, set = Ember.set;\n\n/**\n This file implements the `location` API used by Ember's router.\n\n That API is:\n\n getURL: returns the current URL\n setURL(path): sets the current URL\n onUpdateURL(callback): triggers the callback when the URL changes\n\n Calling setURL will not trigger onUpdateURL callbacks.\n*/\n\n/**\n Ember.HashLocation implements the location API using the browser's\n hash. At present, it relies on a hashchange event existing in the\n browser.\n*/\nEmber.HashLocation = Ember.Object.extend({\n init: function() {\n set(this, 'location', get(this, 'location') || window.location);\n set(this, 'callbacks', Ember.A());\n },\n\n /**\n @private\n\n Returns the current `location.hash`, minus the '#' at the front.\n */\n getURL: function() {\n return get(this, 'location').hash.substr(1);\n },\n\n /**\n @private\n\n Set the `location.hash` and remembers what was set. This prevents\n `onUpdateURL` callbacks from triggering when the hash was set by\n `HashLocation`.\n */\n setURL: function(path) {\n get(this, 'location').hash = path;\n set(this, 'lastSetURL', path);\n },\n\n /**\n @private\n\n Register a callback to be invoked when the hash changes. These\n callbacks will execute when the user presses the back or forward\n button, but not after `setURL` is invoked.\n */\n onUpdateURL: function(callback) {\n var self = this;\n\n var hashchange = function() {\n var path = location.hash.substr(1);\n if (get(self, 'lastSetURL') === path) { return; }\n\n set(self, 'lastSetURL', null);\n\n callback(location.hash.substr(1));\n };\n\n get(this, 'callbacks').pushObject(hashchange);\n window.addEventListener('hashchange', hashchange);\n },\n\n willDestroy: function() {\n get(this, 'callbacks').forEach(function(callback) {\n window.removeEventListener('hashchange', callback);\n });\n set(this, 'callbacks', null);\n }\n});\n\n/**\n Ember.Location returns an instance of the correct implementation of\n the `location` API.\n\n You can pass it a `style` ('hash', 'html5', 'none') to force a\n particular implementation.\n*/\nEmber.Location = {\n create: function(options) {\n var style = options && options.style;\n Ember.assert(\"you must provide a style to Ember.Location.create\", !!style);\n\n if (style === \"hash\") {\n return Ember.HashLocation.create.apply(Ember.HashLocation, arguments);\n }\n }\n};\n\n})();\n//@ sourceURL=ember-application/system/location");minispade.register('ember-debug', "(function() {/*global __fail__*/\n\nif ('undefined' === typeof Ember) {\n Ember = {};\n\n if ('undefined' !== typeof window) {\n window.Em = window.Ember = Em = Ember;\n }\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.\n\n ## Examples\n\n #js:\n\n // pass a simple Boolean value\n Ember.assert('must pass a valid object', !!obj);\n\n // pass a function. If the function returns false the assertion fails\n // any other return value (including void) will pass.\n Ember.assert('a passed record must have a firstName', function() {\n if (obj instanceof Ember.Record) {\n return !Ember.empty(obj.firstName);\n }\n });\n\n @static\n @function\n @param {String} desc\n A description of the assertion. This will become the text of the Error\n thrown if the assertion fails.\n\n @param {Boolean} test\n Must return true for the assertion to pass. If you pass a function it\n will be executed. If the function returns false an exception will be\n thrown.\n*/\nEmber.assert = function(desc, test) {\n if ('function' === typeof test) test = test()!==false;\n if (!test) throw new Error(\"assertion failed: \"+desc);\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 @static\n @function\n @param {String} message\n A warning to display.\n\n @param {Boolean} test\n An optional boolean or function. If the test returns false, the warning\n will be displayed.\n*/\nEmber.warn = function(message, test) {\n if (arguments.length === 1) { test = false; }\n if ('function' === typeof test) test = test()!==false;\n if (!test) Ember.Logger.warn(\"WARNING: \"+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 @static\n @function\n @param {String} message\n A description of the deprecation.\n\n @param {Boolean} test\n An optional boolean or function. If the test returns false, the deprecation\n will be displayed.\n*/\nEmber.deprecate = function(message, test) {\n if (Ember && Ember.TESTING_DEPRECATION) { return; }\n\n if (arguments.length === 1) { test = false; }\n if ('function' === typeof test) { test = test()!==false; }\n if (test) { return; }\n\n if (Ember && Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); }\n\n var error, stackStr = '';\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 (error.stack) {\n var stack;\n\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.<anonymous>\\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 }\n\n Ember.Logger.warn(\"DEPRECATION: \"+message+stackStr);\n};\n\n\n\n/**\n Display a deprecation warning with the provided message and a stack trace\n (Chrome and Firefox only) when the wrapped 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 @static\n @function\n @param {String} message\n A description of the deprecation.\n\n @param {Function} func\n The function to be deprecated.\n*/\nEmber.deprecateFunc = function(message, func) {\n return function() {\n Ember.deprecate(message);\n return func.apply(this, arguments);\n };\n};\n\n\nwindow.ember_assert = Ember.deprecateFunc(\"ember_assert is deprecated. Please use Ember.assert instead.\", Ember.assert);\nwindow.ember_warn = Ember.deprecateFunc(\"ember_warn is deprecated. Please use Ember.warn instead.\", Ember.warn);\nwindow.ember_deprecate = Ember.deprecateFunc(\"ember_deprecate is deprecated. Please use Ember.deprecate instead.\", Ember.deprecate);\nwindow.ember_deprecateFunc = Ember.deprecateFunc(\"ember_deprecateFunc is deprecated. Please use Ember.deprecateFunc instead.\", Ember.deprecateFunc);\n\n})();\n//@ sourceURL=ember-debug");minispade.register('ember-handlebars/controls', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-handlebars/controls/checkbox\");\nminispade.require(\"ember-handlebars/controls/text_field\");\nminispade.require(\"ember-handlebars/controls/button\");\nminispade.require(\"ember-handlebars/controls/text_area\");\nminispade.require(\"ember-handlebars/controls/tabs\");\nminispade.require(\"ember-handlebars/controls/select\");\n\n})();\n//@ sourceURL=ember-handlebars/controls");minispade.register('ember-handlebars/controls/button', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/target_action_support');\n\nvar get = Ember.get, set = Ember.set;\n\nEmber.Button = Ember.View.extend(Ember.TargetActionSupport, {\n classNames: ['ember-button'],\n classNameBindings: ['isActive'],\n\n tagName: 'button',\n\n propagateEvents: false,\n\n attributeBindings: ['type', 'disabled', 'href'],\n\n /** @private\n Overrides TargetActionSupport's targetObject computed\n property to use Handlebars-specific path resolution.\n */\n targetObject: Ember.computed(function() {\n var target = get(this, 'target'),\n root = get(this, 'templateContext'),\n data = get(this, 'templateData');\n\n if (typeof target !== 'string') { return target; }\n\n return Ember.Handlebars.getPath(root, target, { data: data });\n }).property('target').cacheable(),\n\n // Defaults to 'button' if tagName is 'input' or 'button'\n type: Ember.computed(function(key, value) {\n var tagName = this.get('tagName');\n if (value !== undefined) { this._type = value; }\n if (this._type !== undefined) { return this._type; }\n if (tagName === 'input' || tagName === 'button') { return 'button'; }\n }).property('tagName').cacheable(),\n\n disabled: false,\n\n // Allow 'a' tags to act like buttons\n href: Ember.computed(function() {\n return this.get('tagName') === 'a' ? '#' : null;\n }).property('tagName').cacheable(),\n\n mouseDown: function() {\n if (!get(this, 'disabled')) {\n set(this, 'isActive', true);\n this._mouseDown = true;\n this._mouseEntered = true;\n }\n return get(this, 'propagateEvents');\n },\n\n mouseLeave: function() {\n if (this._mouseDown) {\n set(this, 'isActive', false);\n this._mouseEntered = false;\n }\n },\n\n mouseEnter: function() {\n if (this._mouseDown) {\n set(this, 'isActive', true);\n this._mouseEntered = true;\n }\n },\n\n mouseUp: function(event) {\n if (get(this, 'isActive')) {\n // Actually invoke the button's target and action.\n // This method comes from the Ember.TargetActionSupport mixin.\n this.triggerAction();\n set(this, 'isActive', false);\n }\n\n this._mouseDown = false;\n this._mouseEntered = false;\n return get(this, 'propagateEvents');\n },\n\n keyDown: function(event) {\n // Handle space or enter\n if (event.keyCode === 13 || event.keyCode === 32) {\n this.mouseDown();\n }\n },\n\n keyUp: function(event) {\n // Handle space or enter\n if (event.keyCode === 13 || event.keyCode === 32) {\n this.mouseUp();\n }\n },\n\n // TODO: Handle proper touch behavior. Including should make inactive when\n // finger moves more than 20x outside of the edge of the button (vs mouse\n // which goes inactive as soon as mouse goes out of edges.)\n\n touchStart: function(touch) {\n return this.mouseDown(touch);\n },\n\n touchEnd: function(touch) {\n return this.mouseUp(touch);\n },\n\n init: function() {\n Ember.deprecate(\"Ember.Button is deprecated and will be removed from future releases. Consider using the `{{action}}` helper.\");\n this._super();\n }\n});\n\n})();\n//@ sourceURL=ember-handlebars/controls/button");minispade.register('ember-handlebars/controls/checkbox', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-views/views/view\");\nminispade.require(\"ember-handlebars/ext\");\n\nvar set = Ember.set, get = Ember.get;\n\n/**\n @class\n\n Creates an HTML input view in one of two formats.\n\n If a `title` property or binding is provided the input will be wrapped in\n a `div` and `label` tag. View properties like `classNames` will be applied to\n the outermost `div`. This behavior is deprecated and will issue a warning in development.\n\n\n {{view Ember.Checkbox classNames=\"applicaton-specific-checkbox\" title=\"Some title\"}}\n\n\n <div id=\"ember1\" class=\"ember-view ember-checkbox applicaton-specific-checkbox\">\n <label><input type=\"checkbox\" />Some title</label>\n </div>\n\n If `title` isn't provided the view will render as an input element of the 'checkbox' type and HTML\n related properties will be applied directly to the input.\n\n {{view Ember.Checkbox classNames=\"applicaton-specific-checkbox\"}}\n\n <input id=\"ember1\" class=\"ember-view ember-checkbox applicaton-specific-checkbox\" type=\"checkbox\">\n\n You can add a `label` tag yourself in the template where the Ember.Checkbox is being used.\n\n <label>\n Some Title\n {{view Ember.Checkbox classNames=\"applicaton-specific-checkbox\"}}\n </label>\n\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 representation\n via the mouse, keyboard, or touch. Updating the value of the checkbox via jQuery will\n result in the checked value of the object and its element losing synchronization.\n\n*/\nEmber.Checkbox = Ember.View.extend({\n classNames: ['ember-checkbox'],\n\n tagName: 'input',\n\n attributeBindings: ['type', 'checked', 'disabled'],\n\n type: \"checkbox\",\n checked: false,\n disabled: false,\n\n /** @deprecated */\n title: null,\n\n value: Ember.computed(function(propName, value){\n Ember.deprecate(\"Ember.Checkbox's 'value' property has been renamed to 'checked' to match the html element attribute name\");\n if (value !== undefined) {\n return set(this, 'checked', value);\n } else {\n return get(this, 'checked');\n }\n }).property('checked').volatile(),\n\n change: function() {\n Ember.run.once(this, this._updateElementValue);\n // returning false will cause IE to not change checkbox state\n },\n\n /**\n @private\n */\n _updateElementValue: function() {\n var input = get(this, 'title') ? this.$('input:checkbox') : this.$();\n set(this, 'checked', input.prop('checked'));\n },\n\n init: function() {\n if (get(this, 'title') || get(this, 'titleBinding')) {\n Ember.deprecate(\"Automatically surrounding Ember.Checkbox inputs with a label by providing a 'title' property is deprecated\");\n this.tagName = undefined;\n this.attributeBindings = [];\n this.defaultTemplate = Ember.Handlebars.compile('<label><input type=\"checkbox\" {{bindAttr checked=\"checked\" disabled=\"disabled\"}}>{{title}}</label>');\n }\n\n this._super();\n }\n});\n\n})();\n//@ sourceURL=ember-handlebars/controls/checkbox");minispade.register('ember-handlebars/controls/select', "(function() {/*jshint eqeqeq:false */\n\nvar set = Ember.set, get = Ember.get, getPath = Ember.getPath;\nvar indexOf = Ember.ArrayUtils.indexOf, indexesOf = Ember.ArrayUtils.indexesOf;\n\n/**\n @class\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. The selected option(s)\n are updated live in the `selection` property.\n\n @extends Ember.View\n*/\nEmber.Select = Ember.View.extend(\n /** @scope Ember.Select.prototype */ {\n\n tagName: 'select',\n defaultTemplate: Ember.Handlebars.compile('{{#if view.prompt}}<option>{{view.prompt}}</option>{{/if}}{{#each view.content}}{{view Ember.SelectOption contentBinding=\"this\"}}{{/each}}'),\n attributeBindings: ['multiple'],\n\n /**\n The `multiple` attribute of the select element. Indicates whether multiple\n options can be selected.\n\n @type Boolean\n @default false\n */\n multiple: 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 content: Ember.A([\n { id: 1, firstName: 'Yehuda' },\n { id: 2, firstName: 'Tom' }\n ])),\n optionLabelPath: 'content.firstName',\n optionValuePath: 'content.id'\n\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 @type Object or Array\n @default null\n */\n selection: null,\n\n /**\n If given, a top-most dummy option will be rendered to serve as a user\n prompt.\n\n @type String\n @default null\n */\n prompt: null,\n\n /**\n The path of the option labels. See `content`.\n\n @type String\n @default 'content'\n */\n optionLabelPath: 'content',\n\n /**\n The path of the option values. See `content`.\n\n @type String\n @default 'content'\n */\n optionValuePath: 'content',\n\n change: function() {\n if (get(this, 'multiple')) {\n this._changeMultiple();\n } else {\n this._changeSingle();\n }\n },\n\n selectionDidChange: Ember.observer(function() {\n var selection = get(this, 'selection'),\n isArray = Ember.isArray(selection);\n if (get(this, 'multiple')) {\n if (!isArray) {\n set(this, 'selection', Ember.A([selection]));\n return;\n }\n this._selectionDidChangeMultiple();\n } else {\n this._selectionDidChangeSingle();\n }\n }, 'selection'),\n\n _triggerChange: function() {\n var selection = get(this, 'selection');\n\n if (selection) { this.selectionDidChange(); }\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) { 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 _changeMultiple: function() {\n var options = this.$('option:selected'),\n prompt = get(this, 'prompt'),\n offset = prompt ? 1 : 0,\n content = get(this, 'content');\n\n if (!content){ return; }\n if (options) {\n var selectedIndexes = options.map(function(){\n return this.index - offset;\n }).toArray();\n set(this, 'selection', content.objectsAt(selectedIndexes));\n }\n },\n\n _selectionDidChangeSingle: function() {\n var el = this.$()[0],\n 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) { 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 }\n\n});\n\nEmber.SelectOption = Ember.View.extend({\n tagName: 'option',\n defaultTemplate: Ember.Handlebars.compile(\"{{view.label}}\"),\n attributeBindings: ['value', 'selected'],\n\n init: function() {\n this.labelPathDidChange();\n this.valuePathDidChange();\n\n this._super();\n },\n\n selected: Ember.computed(function() {\n var content = get(this, 'content'),\n selection = getPath(this, 'parentView.selection');\n if (getPath(this, 'parentView.multiple')) {\n return selection && indexOf(selection, content) > -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').volatile(),\n\n labelPathDidChange: Ember.observer(function() {\n var labelPath = getPath(this, 'parentView.optionLabelPath');\n\n if (!labelPath) { return; }\n\n Ember.defineProperty(this, 'label', Ember.computed(function() {\n return getPath(this, labelPath);\n }).property(labelPath).cacheable());\n }, 'parentView.optionLabelPath'),\n\n valuePathDidChange: Ember.observer(function() {\n var valuePath = getPath(this, 'parentView.optionValuePath');\n\n if (!valuePath) { return; }\n\n Ember.defineProperty(this, 'value', Ember.computed(function() {\n return getPath(this, valuePath);\n }).property(valuePath).cacheable());\n }, 'parentView.optionValuePath')\n});\n\n\n})();\n//@ sourceURL=ember-handlebars/controls/select");minispade.register('ember-handlebars/controls/tabs', "(function() {minispade.require(\"ember-handlebars/controls/tabs/tab_container_view\");\nminispade.require(\"ember-handlebars/controls/tabs/tab_pane_view\");\nminispade.require(\"ember-handlebars/controls/tabs/tab_view\");\n\n\n})();\n//@ sourceURL=ember-handlebars/controls/tabs");minispade.register('ember-handlebars/controls/tabs/tab_container_view', "(function() {Ember.TabContainerView = Ember.View.extend();\n\n})();\n//@ sourceURL=ember-handlebars/controls/tabs/tab_container_view");minispade.register('ember-handlebars/controls/tabs/tab_pane_view', "(function() {var get = Ember.get, getPath = Ember.getPath;\n\nEmber.TabPaneView = Ember.View.extend({\n tabsContainer: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.TabContainerView);\n }).property().volatile(),\n\n isVisible: Ember.computed(function() {\n return get(this, 'viewName') === getPath(this, 'tabsContainer.currentView');\n }).property('tabsContainer.currentView').volatile()\n});\n\n})();\n//@ sourceURL=ember-handlebars/controls/tabs/tab_pane_view");minispade.register('ember-handlebars/controls/tabs/tab_view', "(function() {var get = Ember.get, setPath = Ember.setPath;\n\nEmber.TabView = Ember.View.extend({\n tabsContainer: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.TabContainerView);\n }).property().volatile(),\n\n mouseUp: function() {\n setPath(this, 'tabsContainer.currentView', get(this, 'value'));\n }\n});\n\n})();\n//@ sourceURL=ember-handlebars/controls/tabs/tab_view");minispade.register('ember-handlebars/controls/text_area', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-handlebars/ext\");\nminispade.require(\"ember-views/views/view\");\nminispade.require(\"ember-handlebars/controls/text_support\");\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n @extends Ember.TextSupport\n*/\nEmber.TextArea = Ember.View.extend(Ember.TextSupport,\n/** @scope Ember.TextArea.prototype */ {\n\n classNames: ['ember-text-area'],\n\n tagName: \"textarea\",\n attributeBindings: ['rows', 'cols'],\n rows: null,\n cols: null,\n\n _updateElementValue: Ember.observer(function() {\n this.$().val(get(this, 'value'));\n }, 'value'),\n\n init: function() {\n this._super();\n this.on(\"didInsertElement\", this, this._updateElementValue);\n }\n\n});\n\n})();\n//@ sourceURL=ember-handlebars/controls/text_area");minispade.register('ember-handlebars/controls/text_field', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-handlebars/ext\");\nminispade.require(\"ember-views/views/view\");\nminispade.require(\"ember-handlebars/controls/text_support\");\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n The `Ember.TextField` view class renders a text\n [input](https://developer.mozilla.org/en/HTML/Element/Input) element. It\n allows for binding Ember properties to the text field contents (`value`),\n live-updating as the user inputs text.\n\n Example:\n\n {{view Ember.TextField valueBinding=\"firstName\"}}\n\n @extends Ember.TextSupport\n*/\nEmber.TextField = Ember.View.extend(Ember.TextSupport,\n /** @scope Ember.TextField.prototype */ {\n\n classNames: ['ember-text-field'],\n tagName: \"input\",\n attributeBindings: ['type', 'value', 'size'],\n\n /**\n The value attribute of the input element. As the user inputs text, this\n property is updated live.\n\n @type String\n @default \"\"\n */\n value: \"\",\n\n /**\n The type attribute of the input element.\n\n @type String\n @default \"text\"\n */\n type: \"text\",\n\n /**\n The size of the text field in characters.\n\n @type String\n @default null\n */\n size: null\n});\n\n})();\n//@ sourceURL=ember-handlebars/controls/text_field");minispade.register('ember-handlebars/controls/text_support', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-handlebars/ext\");\nminispade.require(\"ember-views/views/view\");\n\nvar get = Ember.get, set = Ember.set;\n\n/** @class */\nEmber.TextSupport = Ember.Mixin.create(\n/** @scope Ember.TextSupport.prototype */ {\n\n value: \"\",\n\n attributeBindings: ['placeholder', 'disabled', 'maxlength'],\n placeholder: null,\n disabled: false,\n maxlength: null,\n\n insertNewline: Ember.K,\n cancel: Ember.K,\n\n focusOut: function(event) {\n this._elementValueDidChange();\n },\n\n change: function(event) {\n this._elementValueDidChange();\n },\n\n keyUp: function(event) {\n this.interpretKeyEvents(event);\n },\n\n /**\n @private\n */\n interpretKeyEvents: function(event) {\n var map = Ember.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\nEmber.TextSupport.KEY_EVENTS = {\n 13: 'insertNewline',\n 27: 'cancel'\n};\n\n})();\n//@ sourceURL=ember-handlebars/controls/text_support");minispade.register('ember-handlebars/ext', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\nminispade.require(\"ember-views/system/render_buffer\");\n\n/**\n @namespace\n @name Handlebars\n @private\n*/\n\n/**\n @namespace\n @name Handlebars.helpers\n @description Helpers for Handlebars templates\n*/\n\n/**\n @class\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 use\n 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(). This will\n return a function that can be used by Ember.View for rendering.\n*/\nEmber.Handlebars = Ember.create(Handlebars);\n\nEmber.Handlebars.helpers = Ember.create(Handlebars.helpers);\n\n/**\n Override the the opcode compiler and JavaScript compiler for Handlebars.\n*/\nEmber.Handlebars.Compiler = function() {};\nEmber.Handlebars.Compiler.prototype = Ember.create(Handlebars.Compiler.prototype);\nEmber.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;\n\nEmber.Handlebars.JavaScriptCompiler = function() {};\nEmber.Handlebars.JavaScriptCompiler.prototype = Ember.create(Handlebars.JavaScriptCompiler.prototype);\nEmber.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;\nEmber.Handlebars.JavaScriptCompiler.prototype.namespace = \"Ember.Handlebars\";\n\n\nEmber.Handlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {\n return \"''\";\n};\n\n/**\n Override the default buffer for Ember Handlebars. By default, Handlebars creates\n an empty String at the beginning of each invocation and appends to it. Ember's\n Handlebars overrides this to append to a single shared buffer.\n\n @private\n*/\nEmber.Handlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {\n return \"data.buffer.push(\"+string+\");\";\n};\n\n/**\n Rewrite simple mustaches from {{foo}} to {{bind \"foo\"}}. This means that all simple\n mustaches in Ember's Handlebars will also set up an observer to keep the DOM\n up to date when the underlying property changes.\n\n @private\n*/\nEmber.Handlebars.Compiler.prototype.mustache = function(mustache) {\n if (mustache.params.length || mustache.hash) {\n return Handlebars.Compiler.prototype.mustache.call(this, mustache);\n } else {\n var id = new Handlebars.AST.IdNode(['_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([\"escaped\", new Handlebars.AST.StringNode(\"true\")]);\n }\n mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);\n return Handlebars.Compiler.prototype.mustache.call(this, mustache);\n }\n};\n\n/**\n Used for precompilation of Ember Handlebars templates. This will not be used during normal\n app execution.\n\n @param {String} string The template to precompile\n*/\nEmber.Handlebars.precompile = function(string) {\n var ast = Handlebars.parse(string);\n var options = { data: true, stringParams: true };\n var environment = new Ember.Handlebars.Compiler().compile(ast, options);\n return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n};\n\n/**\n The entry point for Ember Handlebars. This replaces the default Handlebars.compile and turns on\n template-local data and String parameters.\n\n @param {String} string The template to compile\n*/\nEmber.Handlebars.compile = function(string) {\n var ast = Handlebars.parse(string);\n var options = { data: true, stringParams: true };\n var environment = new Ember.Handlebars.Compiler().compile(ast, options);\n var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n\n return Handlebars.template(templateSpec);\n};\n\n/**\n If a path starts with a reserved keyword, returns the root\n that should be used.\n\n @private\n*/\nvar normalizePath = Ember.Handlebars.normalizePath = function(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);\n }\n }\n\n return { root: root, path: path, isKeyword: isKeyword };\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 @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\nEmber.Handlebars.getPath = function(root, path, options) {\n var data = options && options.data,\n normalizedPath = normalizePath(root, path, data),\n value;\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 root = normalizedPath.root;\n path = normalizedPath.path;\n\n value = Ember.getPath(root, path);\n\n if (value === undefined && root !== window && Ember.isGlobalPath(path)) {\n value = Ember.getPath(window, path);\n }\n return value;\n};\n\n/**\n Registers a helper in Handlebars that will be called if no property with the\n given name can be found on the current context object, and no helper with\n that name is registered.\n\n This throws an exception with a more helpful error message so the user can\n track down where the problem is happening.\n\n @name Handlebars.helpers.helperMissing\n @param {String} path\n @param {Hash} options\n*/\nEmber.Handlebars.registerHelper('helperMissing', function(path, options) {\n var error, view = \"\";\n\n error = \"%@ Handlebars error: Could not find property '%@' on object %@.\";\n if (options.data){\n view = options.data.view;\n }\n throw new Ember.Error(Ember.String.fmt(error, [view, path, this]));\n});\n\n\n})();\n//@ sourceURL=ember-handlebars/ext");minispade.register('ember-handlebars/helpers', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-handlebars/helpers/binding\");\nminispade.require(\"ember-handlebars/helpers/collection\");\nminispade.require(\"ember-handlebars/helpers/view\");\nminispade.require(\"ember-handlebars/helpers/unbound\");\nminispade.require(\"ember-handlebars/helpers/debug\");\nminispade.require(\"ember-handlebars/helpers/each\");\nminispade.require(\"ember-handlebars/helpers/template\");\nminispade.require(\"ember-handlebars/helpers/action\");\nminispade.require(\"ember-handlebars/helpers/yield\");\n\n})();\n//@ sourceURL=ember-handlebars/helpers");minispade.register('ember-handlebars/helpers/action', "(function() {minispade.require('ember-handlebars/ext');\n\nvar EmberHandlebars = Ember.Handlebars, getPath = EmberHandlebars.getPath, get = Ember.get;\n\nvar ActionHelper = EmberHandlebars.ActionHelper = {\n registeredActions: {}\n};\n\nActionHelper.registerAction = function(actionName, eventName, target, view, context) {\n var actionId = (++Ember.$.uuid).toString();\n\n ActionHelper.registeredActions[actionId] = {\n eventName: eventName,\n handler: function(event) {\n event.view = view;\n event.context = context;\n\n // Check for StateManager (or compatible object)\n if (target.isState && typeof target.send === 'function') {\n return target.send(actionName, event);\n } else {\n return target[actionName].call(target, event);\n }\n }\n };\n\n view.on('willRerender', function() {\n delete ActionHelper.registeredActions[actionId];\n });\n\n return actionId;\n};\n\n/**\n The `{{action}}` helper registers an HTML element within a template for\n DOM event handling. User interaction with that element will call the method\n on the template's associated `Ember.View` instance that has the same name\n as the first provided argument to `{{action}}`:\n\n Given the following Handlebars template on the page\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"anActionName\"}}>\n click me\n </div>\n </script>\n\n And application code\n\n AView = Ember.View.extend({\n templateName; 'a-template',\n anActionName: function(event){}\n })\n\n aView = AView.create()\n aView.appendTo('body')\n\n Will results in the following rendered HTML\n\n <div class=\"ember-view\">\n <div data-ember-action=\"1\">\n click me\n </div>\n </div>\n\n Clicking \"click me\" will trigger the `anActionName` method of the `aView` object with a \n `jQuery.Event` object as its argument. The `jQuery.Event` object will be extended to include\n a `view` property that is set to the original view interacted with (in this case the `aView` object).\n\n\n ### Specifying an Action Target\n A `target` option can be provided to change which object will receive the method call. This option must be\n a string representing a path to an object:\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"anActionName\" target=\"MyApplication.someObject\"}}>\n click me\n </div>\n </script>\n\n Clicking \"click me\" in the rendered HTML of the above template will trigger the \n `anActionName` method of the object at `MyApplication.someObject`. The first argument \n to this method will be a `jQuery.Event` extended to include a `view` property that is \n set to the original view interacted with.\n\n A path relative to the template's `Ember.View` instance can also be used as a target:\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"anActionName\" target=\"parentView\"}}>\n click me\n </div>\n </script>\n\n Clicking \"click me\" in the rendered HTML of the above template will trigger the \n `anActionName` method of the view's parent view.\n\n The `{{action}}` helper is `Ember.StateManager` aware. If the target of\n the action is an `Ember.StateManager` instance `{{action}}` will use the `send`\n functionality of StateManagers. The documentation for `Ember.StateManager` has additional\n information about this use.\n\n If an action's target does not implement a method that matches the supplied action name\n an error will be thrown.\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"aMethodNameThatIsMissing\"}}>\n click me\n </div>\n </script>\n\n With the following application code\n\n AView = Ember.View.extend({\n templateName; 'a-template',\n // note: no method 'aMethodNameThatIsMissing'\n anActionName: function(event){}\n })\n\n aView = AView.create()\n aView.appendTo('body')\n\n Will throw `Uncaught TypeError: Cannot call method 'call' of undefined` when \"click me\" is clicked.\n\n\n ### Specifying DOM event type\n By default the `{{action}}` helper registers for DOM `click` events. You can supply an\n `on` option to the helper to specify a different DOM event name:\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n <div {{action \"aMethodNameThatIsMissing\" on=\"doubleClick\"}}>\n click me\n </div>\n </script>\n\n See `Ember.EventDispatcher` for a list of acceptable DOM event names.\n\n Because `{{action}}` depends on Ember's event dispatch system it will only function if\n an `Ember.EventDispatcher` instance is available. An `Ember.EventDispatcher` instance \n will be created when a new `Ember.Application` is created. Having an instance of\n `Ember.Application` will satisfy this requirement.\n\n ### Specifying a context\n By default the `{{action}}` helper passes the current Handlebars context along in the\n `jQuery.Event` object. You may specify an alternative object to pass as the context by\n providing a property path:\n\n <script type=\"text/x-handlebars\" data-template-name='a-template'>\n {{#each person in people}}\n <div {{action \"edit\" context=\"person\"}}>\n click me\n </div>\n {{/each}}\n </script>\n\n @name Handlebars.helpers.action\n @param {String} actionName\n @param {Hash} options\n*/\nEmberHandlebars.registerHelper('action', function(actionName, options) {\n var hash = options.hash || {},\n eventName = hash.on || \"click\",\n view = options.data.view,\n target, context, controller;\n\n if (view.isVirtual) { view = view.get('parentView'); }\n\n if (hash.target) {\n target = getPath(this, hash.target, options);\n } else if (controller = options.data.keywords.controller) {\n target = get(controller, 'target');\n }\n\n target = target || view;\n\n context = hash.context ? getPath(this, hash.context, options) : options.contexts[0];\n\n var actionId = ActionHelper.registerAction(actionName, eventName, target, view, context);\n return new EmberHandlebars.SafeString('data-ember-action=\"' + actionId + '\"');\n});\n\n})();\n//@ sourceURL=ember-handlebars/helpers/action");minispade.register('ember-handlebars/helpers/binding', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-handlebars/ext');\nminispade.require('ember-handlebars/views/handlebars_bound_view');\nminispade.require('ember-handlebars/views/metamorph_view');\n\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\nvar getPath = Ember.Handlebars.getPath, normalizePath = Ember.Handlebars.normalizePath;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar EmberHandlebars = Ember.Handlebars, helpers = EmberHandlebars.helpers;\n\n// Binds a property into the DOM. This will create a hook in DOM that the\n// KVO system will look for and update if the property changes.\n/** @private */\nvar bind = function(property, options, preserveContext, shouldDisplay, valueNormalizer) {\n var data = options.data,\n fn = options.fn,\n inverse = options.inverse,\n view = data.view,\n currentContext = this,\n pathRoot, path, normalized;\n\n normalized = normalizePath(currentContext, property, data);\n\n pathRoot = normalized.root;\n path = normalized.path;\n\n // Set up observers for observable objects\n if ('object' === typeof this) {\n // Create the view that will wrap the output of this template/property\n // and add it to the nearest view's childViews array.\n // See the documentation of Ember._HandlebarsBoundView for more.\n var bindView = view.createChildView(Ember._HandlebarsBoundView, {\n preserveContext: preserveContext,\n shouldDisplayFunc: shouldDisplay,\n valueNormalizerFunc: valueNormalizer,\n displayTemplate: fn,\n inverseTemplate: inverse,\n path: path,\n pathRoot: pathRoot,\n previousContext: currentContext,\n isEscaped: options.hash.escaped,\n templateData: options.data\n });\n\n view.appendChild(bindView);\n\n /** @private */\n var observer = function() {\n Ember.run.once(bindView, 'rerenderIfNeeded');\n };\n\n // Observes the given property on the context and\n // tells the Ember._BindableSpan to re-render. If property\n // is an empty string, we are printing the current context\n // object ({{this}}) so updating it is not our responsibility.\n if (path !== '') {\n Ember.addObserver(pathRoot, path, observer);\n }\n } else {\n // The object is not observable, so just render it out and\n // be done with it.\n data.buffer.push(getPath(pathRoot, path, options));\n }\n};\n\n/**\n '_triageMustache' is used internally select between a binding and helper for\n the given context. Until this point, it would be hard to determine if the\n mustache is a property reference or a regular helper reference. This triage\n helper resolves that.\n\n This would not be typically invoked by directly.\n\n @private\n @name Handlebars.helpers._triageMustache\n @param {String} property Property/helperID to triage\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('_triageMustache', function(property, fn) {\n Ember.assert(\"You cannot pass more than one argument to the _triageMustache helper\", arguments.length <= 2);\n if (helpers[property]) {\n return helpers[property].call(this, fn);\n }\n else {\n return helpers.bind.apply(this, arguments);\n }\n});\n\n/**\n `bind` can be used to display a value, then update that value if it\n changes. For example, if you wanted to print the `title` property of\n `content`:\n\n {{bind \"content.title\"}}\n\n This will return the `title` property as a string, then create a new\n observer at the specified path. If it changes, it will update the value in\n DOM. Note that if you need to support IE7 and IE8 you must modify the\n model objects properties using Ember.get() and Ember.set() for this to work as\n it relies on Ember's KVO system. For all other browsers this will be handled\n for you automatically.\n\n @private\n @name Handlebars.helpers.bind\n @param {String} property Property to bind\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('bind', function(property, fn) {\n Ember.assert(\"You cannot pass more than one argument to the bind helper\", arguments.length <= 2);\n\n var context = (fn.contexts && fn.contexts[0]) || this;\n\n return bind.call(context, property, fn, false, function(result) {\n return !Ember.none(result);\n });\n});\n\n/**\n Use the `boundIf` helper to create a conditional that re-evaluates\n whenever the bound value changes.\n\n {{#boundIf \"content.shouldDisplayTitle\"}}\n {{content.title}}\n {{/boundIf}}\n\n @private\n @name Handlebars.helpers.boundIf\n @param {String} property Property to bind\n @param {Function} fn Context to provide for rendering\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('boundIf', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n var func = function(result) {\n if (Ember.typeOf(result) === 'array') {\n return get(result, 'length') !== 0;\n } else {\n return !!result;\n }\n };\n\n return bind.call(context, property, fn, true, func, func);\n});\n\n/**\n @name Handlebars.helpers.with\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('with', function(context, options) {\n if (arguments.length === 4) {\n var keywordName, path;\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 // 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 = Ember.$.expando + Ember.guidFor(this);\n options.data.keywords[contextKey] = this;\n Ember.bind(options.data.keywords, keywordName, contextKey + '.' + path);\n\n return bind.call(this, path, options.fn, true, function(result) {\n return !Ember.none(result);\n });\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 @name Handlebars.helpers.if\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('if', function(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\n return helpers.boundIf.call(options.contexts[0], context, options);\n});\n\n/**\n @name Handlebars.helpers.unless\n @param {Function} context\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('unless', function(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 return helpers.boundIf.call(options.contexts[0], context, options);\n});\n\n/**\n `bindAttr` allows you to create a binding between DOM element attributes and\n Ember objects. For example:\n\n <img {{bindAttr src=\"imageUrl\" alt=\"imageTitle\"}}>\n\n @name Handlebars.helpers.bindAttr\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('bindAttr', function(options) {\n\n var attrs = options.hash;\n\n Ember.assert(\"You must specify at least one hash argument to bindAttr\", !!Ember.keys(attrs).length);\n\n var view = options.data.view;\n var ret = [];\n var ctx = this;\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 && classBindings !== undefined) {\n var classResults = EmberHandlebars.bindClasses(this, classBindings, view, dataId, options);\n ret.push('class=\"' + Handlebars.Utils.escapeExpression(classResults.join(' ')) + '\"');\n delete attrs['class'];\n }\n\n var attrKeys = Ember.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(attrKeys, function(attr) {\n var path = attrs[attr],\n pathRoot, normalized;\n\n Ember.assert(fmt(\"You must provide a String for a bound attribute, not %@\", [path]), typeof path === 'string');\n\n normalized = normalizePath(ctx, path, options.data);\n\n pathRoot = normalized.root;\n path = normalized.path;\n\n var value = (path === 'this') ? pathRoot : getPath(pathRoot, path, options),\n type = Ember.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 /** @private */\n observer = function observer() {\n var result = getPath(pathRoot, path, options);\n\n Ember.assert(fmt(\"Attributes must be numbers, strings or booleans, not %@\", [result]), result === null || result === undefined || typeof result === 'number' || 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.length === 0) {\n Ember.removeObserver(pathRoot, path, invoker);\n return;\n }\n\n Ember.View.applyAttributeBindings(elem, attr, result);\n };\n\n /** @private */\n invoker = function() {\n Ember.run.once(observer);\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 if (path !== 'this') {\n Ember.addObserver(pathRoot, path, invoker);\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 EmberHandlebars.SafeString(ret.join(' '));\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 @param {Ember.Object} context\n The context from which to lookup properties\n\n @param {String} classBindings\n A string, space-separated, of class bindings to use\n\n @param {Ember.View} view\n The view in which observers should look for the element to update\n\n @param {Srting} bindAttrId\n Optional bindAttr id used to lookup elements\n\n @returns {Array} An array of class names to add\n*/\nEmberHandlebars.bindClasses = function(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, path, className, options) {\n var val = path !== '' ? getPath(root, path, options) : true;\n\n // If the value is truthy and we're using the colon syntax,\n // we should return the className directly\n if (!!val && className) {\n return className;\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 Ember.String.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 !== undefined && 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 // For each property passed, loop through and setup\n // an observer.\n forEach(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 split = binding.split(':'),\n path = split[0],\n className = split[1],\n pathRoot = context,\n normalized;\n\n if (path !== '') {\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 /** @private */\n observer = function() {\n // Get the current value of the property\n newClass = classStringForPath(pathRoot, path, className, 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.length === 0) {\n Ember.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 /** @private */\n invoker = function() {\n Ember.run.once(observer);\n };\n\n if (path !== '') {\n Ember.addObserver(pathRoot, path, invoker);\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(pathRoot, path, className, 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\n})();\n//@ sourceURL=ember-handlebars/helpers/binding");minispade.register('ember-handlebars/helpers/collection', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\n// TODO: Don't require all of this module\nminispade.require('ember-handlebars');\nminispade.require('ember-handlebars/helpers/view');\n\nvar get = Ember.get, getPath = Ember.Handlebars.getPath, fmt = Ember.String.fmt;\n\n/**\n `{{collection}}` is a `Ember.Handlebars` helper for adding instances of\n `Ember.CollectionView` to a template. See `Ember.CollectionView` for additional\n information on how a `CollectionView` functions.\n\n `{{collection}}`'s primary use is as a block helper with a `contentBinding` option\n pointing towards an `Ember.Array`-compatible object. An `Ember.View` instance will\n be created for each item in its `content` property. Each view will have its own\n `content` property set to the appropriate item in the collection.\n\n The provided block will be applied as the template for each item's view.\n\n Given an empty `<body>` the following template:\n\n <script type=\"text/x-handlebars\">\n {{#collection contentBinding=\"App.items\"}}\n Hi {{content.name}}\n {{/collection}}\n </script>\n\n And the following application code\n\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 Will result in the HTML structure below\n\n <div class=\"ember-view\">\n <div class=\"ember-view\">Hi Dave</div>\n <div class=\"ember-view\">Hi Mary</div>\n <div class=\"ember-view\">Hi Sara</div>\n </div>\n\n ### Blockless Use\n If you provide an `itemViewClass` option that has its own `template` you can omit\n the block.\n\n The following template:\n\n <script type=\"text/x-handlebars\">\n {{collection contentBinding=\"App.items\" itemViewClass=\"App.AnItemView\"}}\n </script>\n\n And application code\n\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 {{content.name}}\")\n })\n\n Will result in the HTML structure below\n\n <div class=\"ember-view\">\n <div class=\"ember-view\">Greetings Dave</div>\n <div class=\"ember-view\">Greetings Mary</div>\n <div class=\"ember-view\">Greetings Sara</div>\n </div>\n\n ### Specifying a CollectionView subclass\n By default the `{{collection}}` helper will create an instance of `Ember.CollectionView`.\n You can supply a `Ember.CollectionView` subclass to the helper by passing it\n as the first argument:\n\n <script type=\"text/x-handlebars\">\n {{#collection App.MyCustomCollectionClass contentBinding=\"App.items\"}}\n Hi {{content.name}}\n {{/collection}}\n </script>\n\n\n ### Forwarded `item.*`-named Options\n As with the `{{view}}`, helper options passed to the `{{collection}}` will be set on\n the resulting `Ember.CollectionView` as properties. Additionally, options prefixed with\n `item` will be applied to the views rendered for each item (note the camelcasing):\n\n <script type=\"text/x-handlebars\">\n {{#collection contentBinding=\"App.items\"\n itemTagName=\"p\"\n itemClassNames=\"greeting\"}}\n Howdy {{content.name}}\n {{/collection}}\n </script>\n\n Will result in the following HTML structure:\n\n <div class=\"ember-view\">\n <p class=\"ember-view greeting\">Howdy Dave</p>\n <p class=\"ember-view greeting\">Howdy Mary</p>\n <p class=\"ember-view greeting\">Howdy Sara</p>\n </div>\n \n @name Handlebars.helpers.collection\n @param {String} path\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('collection', function(path, options) {\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\n // If passed a path string, convert that into an object.\n // Otherwise, just default to the standard class.\n var collectionClass;\n collectionClass = path ? getPath(this, path, options) : Ember.CollectionView;\n Ember.assert(fmt(\"%@ #collection: Could not find %@\", data.view, path), !!collectionClass);\n\n var hash = options.hash, itemHash = {}, match;\n\n // Extract item view class if provided else default to the standard class\n var itemViewClass, itemViewPath = hash.itemViewClass;\n var collectionPrototype = collectionClass.proto();\n delete hash.itemViewClass;\n itemViewClass = itemViewPath ? getPath(collectionPrototype, itemViewPath, options) : collectionPrototype.itemViewClass;\n Ember.assert(fmt(\"%@ #collection: Could not find %@\", data.view, itemViewPath), !!itemViewClass);\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) {\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 var tagName = hash.tagName || collectionPrototype.tagName;\n\n if (fn) {\n itemHash.template = fn;\n delete options.fn;\n }\n\n if (inverse && inverse !== Handlebars.VM.noop) {\n var emptyViewClass = get(collectionPrototype, 'emptyViewClass');\n\n hash.emptyView = emptyViewClass.extend({\n template: inverse,\n tagName: itemHash.tagName\n });\n }\n\n if (hash.eachHelper === 'each') {\n itemHash._templateContext = Ember.computed(function() {\n return get(this, 'content');\n }).property('content');\n delete hash.eachHelper;\n }\n\n hash.itemViewClass = Ember.Handlebars.ViewHelper.viewClassFromHTMLOptions(itemViewClass, { data: data, hash: itemHash }, this);\n\n return Ember.Handlebars.helpers.view.call(this, collectionClass, options);\n});\n\n\n\n\n})();\n//@ sourceURL=ember-handlebars/helpers/collection");minispade.register('ember-handlebars/helpers/debug', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/*jshint debug:true*/\nminispade.require('ember-handlebars/ext');\n\nvar getPath = Ember.getPath;\n\n/**\n `log` allows you to output the value of a value in the current rendering\n context.\n\n {{log myVariable}}\n\n @name Handlebars.helpers.log\n @param {String} property\n*/\nEmber.Handlebars.registerHelper('log', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n Ember.Logger.log(getPath(context, property));\n});\n\n/**\n The `debugger` helper executes the `debugger` statement in the current\n context.\n\n {{debugger}}\n\n @name Handlebars.helpers.debugger\n @param {String} property\n*/\nEmber.Handlebars.registerHelper('debugger', function() {\n debugger;\n});\n\n})();\n//@ sourceURL=ember-handlebars/helpers/debug");minispade.register('ember-handlebars/helpers/each', "(function() {minispade.require(\"ember-handlebars/ext\");\nminispade.require(\"ember-views/views/collection_view\");\nminispade.require(\"ember-handlebars/views/metamorph_view\");\n\nvar get = Ember.get, set = Ember.set;\n\nEmber.Handlebars.EachView = Ember.CollectionView.extend(Ember._Metamorph, {\n itemViewClass: Ember._MetamorphView,\n emptyViewClass: Ember._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\n if (keyword) {\n var data = get(view, 'templateData');\n\n data = Ember.copy(data);\n data.keywords = view.cloneKeywords();\n set(view, 'templateData', data);\n\n var content = get(view, 'content');\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 return view;\n }\n});\n\nEmber.Handlebars.registerHelper('each', function(path, options) {\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\n options.hash.keyword = keywordName;\n } else {\n options.hash.eachHelper = 'each';\n }\n\n Ember.assert(\"You must pass a block to the each helper\", options.fn && options.fn !== Handlebars.VM.noop);\n\n options.hash.contentBinding = path;\n // Set up emptyView as a metamorph with no tag\n //options.hash.emptyViewClass = Ember._MetamorphView;\n\n return Ember.Handlebars.helpers.collection.call(this, 'Ember.Handlebars.EachView', options);\n});\n\n})();\n//@ sourceURL=ember-handlebars/helpers/each");minispade.register('ember-handlebars/helpers/template', "(function() {minispade.require('ember-handlebars/ext');\n\n/**\n `template` allows you to render a template from inside another template.\n This allows you to re-use the same template in multiple places. For example:\n\n <script type=\"text/x-handlebars\">\n {{#with loggedInUser}}\n Last Login: {{lastLogin}}\n User Info: {{template \"user_info\"}}\n {{/with}}\n </script>\n\n <script type=\"text/x-handlebars\" data-template-name=\"user_info\">\n Name: <em>{{name}}</em>\n Karma: <em>{{karma}}</em>\n </script>\n\n This helper looks for templates in the global Ember.TEMPLATES hash. If you\n add &lt;script&gt; tags to your page with the `data-template-name` attribute set,\n they will be compiled and placed in this hash automatically.\n\n You can also manually register templates by adding them to the hash:\n\n Ember.TEMPLATES[\"my_cool_template\"] = Ember.Handlebars.compile('<b>{{user}}</b>');\n\n @name Handlebars.helpers.template\n @param {String} templateName the template to render\n*/\n\nEmber.Handlebars.registerHelper('template', function(name, options) {\n var template = Ember.TEMPLATES[name];\n\n Ember.assert(\"Unable to find template with name '\"+name+\"'.\", !!template);\n\n Ember.TEMPLATES[name](this, { data: options.data });\n});\n\n})();\n//@ sourceURL=ember-handlebars/helpers/template");minispade.register('ember-handlebars/helpers/unbound', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\nminispade.require('ember-handlebars/ext');\n\nvar getPath = Ember.Handlebars.getPath;\n\n/**\n `unbound` allows you to output a property without binding. *Important:* The\n output will not be updated if the property changes. Use with caution.\n\n <div>{{unbound somePropertyThatDoesntChange}}</div>\n\n @name Handlebars.helpers.unbound\n @param {String} property\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('unbound', function(property, fn) {\n var context = (fn.contexts && fn.contexts[0]) || this;\n return getPath(context, property, fn);\n});\n\n})();\n//@ sourceURL=ember-handlebars/helpers/unbound");minispade.register('ember-handlebars/helpers/view', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\n// TODO: Don't require the entire module\nminispade.require(\"ember-handlebars\");\n\nvar get = Ember.get, set = Ember.set;\nvar indexOf = Ember.ArrayUtils.indexOf;\nvar PARENT_VIEW_PATH = /^parentView\\./;\nvar EmberHandlebars = Ember.Handlebars;\n\n/** @private */\nEmberHandlebars.ViewHelper = Ember.Object.create({\n\n viewClassFromHTMLOptions: function(viewClass, options, thisContext) {\n var hash = options.hash, data = options.data;\n var extensions = {},\n classes = hash['class'],\n dup = false;\n\n if (hash.id) {\n extensions.elementId = hash.id;\n dup = true;\n }\n\n if (classes) {\n classes = classes.split(' ');\n extensions.classNames = classes;\n dup = true;\n }\n\n if (hash.classBinding) {\n extensions.classNameBindings = hash.classBinding.split(' ');\n dup = true;\n }\n\n if (hash.classNameBindings) {\n extensions.classNameBindings = hash.classNameBindings.split(' ');\n dup = true;\n }\n\n if (hash.attributeBindings) {\n Ember.assert(\"Setting 'attributeBindings' via Handlebars is not allowed. Please subclass Ember.View and set it there instead.\");\n extensions.attributeBindings = null;\n dup = true;\n }\n\n if (dup) {\n hash = Ember.$.extend({}, hash);\n delete hash.id;\n delete hash['class'];\n delete hash.classBinding;\n }\n\n // Look for bindings passed to the helper and, if they are\n // local, make them relative to the current context instead of the\n // view.\n var path, normalized;\n\n for (var prop in hash) {\n if (!hash.hasOwnProperty(prop)) { continue; }\n\n // Test if the property ends in \"Binding\"\n if (Ember.IS_BINDING.test(prop)) {\n path = hash[prop];\n\n normalized = Ember.Handlebars.normalizePath(null, path, data);\n if (normalized.isKeyword) {\n hash[prop] = 'templateData.keywords.'+path;\n } else if (!Ember.isGlobalPath(path)) {\n if (path === 'this') {\n hash[prop] = 'bindingContext';\n } else {\n hash[prop] = 'bindingContext.'+path;\n }\n }\n }\n }\n\n // Make the current template context available to the view\n // for the bindings set up above.\n extensions.bindingContext = thisContext;\n\n return viewClass.extend(hash, extensions);\n },\n\n helper: function(thisContext, path, options) {\n var inverse = options.inverse,\n data = options.data,\n view = data.view,\n fn = options.fn,\n hash = options.hash,\n newView;\n\n if ('string' === typeof path) {\n newView = EmberHandlebars.getPath(thisContext, path, options);\n Ember.assert(\"Unable to find view at path '\" + path + \"'\", !!newView);\n } else {\n newView = path;\n }\n\n Ember.assert(Ember.String.fmt('You must pass a view class to the #view helper, not %@ (%@)', [path, newView]), Ember.View.detect(newView));\n\n newView = this.viewClassFromHTMLOptions(newView, options, thisContext);\n var currentView = data.view;\n var viewOptions = {\n templateData: options.data\n };\n\n if (fn) {\n Ember.assert(\"You cannot provide a template block if you also specified a templateName\", !get(viewOptions, 'templateName') && !get(newView.proto(), 'templateName'));\n viewOptions.template = fn;\n }\n\n currentView.appendChild(newView, viewOptions);\n }\n});\n\n/**\n `{{view}}` inserts a new instance of `Ember.View` into a template passing its options\n to the `Ember.View`'s `create` method and using the supplied block as the view's own template.\n\n An empty `<body>` and the following template:\n\n <script type=\"text/x-handlebars\">\n A span:\n {{#view tagName=\"span\"}}\n hello.\n {{/view}}\n </script>\n\n Will result in HTML structure:\n\n <body>\n <!-- Note: the handlebars template script \n also results in a rendered Ember.View\n which is the outer <div> here -->\n\n <div class=\"ember-view\">\n A span:\n <span id=\"ember1\" class=\"ember-view\">\n Hello.\n </span>\n </div>\n </body>\n\n ### parentView setting\n\n The `parentView` property of the new `Ember.View` instance created through `{{view}}`\n will be set to the `Ember.View` instance of the template where `{{view}}` was called.\n\n aView = Ember.View.create({\n template: Ember.Handlebars.compile(\"{{#view}} my parent: {{parentView.elementId}} {{/view}}\")\n })\n\n aView.appendTo('body')\n \n Will result in HTML structure:\n\n <div id=\"ember1\" class=\"ember-view\">\n <div id=\"ember2\" class=\"ember-view\">\n my parent: ember1\n </div>\n </div>\n\n ### Setting CSS id and class attributes\n\n The HTML `id` attribute can be set on the `{{view}}`'s resulting element with the `id` option.\n This option will _not_ be passed to `Ember.View.create`.\n\n <script type=\"text/x-handlebars\">\n {{#view tagName=\"span\" id=\"a-custom-id\"}}\n hello.\n {{/view}}\n </script>\n\n Results in the following HTML structure:\n\n <div class=\"ember-view\">\n <span id=\"a-custom-id\" class=\"ember-view\">\n hello.\n </span>\n </div>\n\n The HTML `class` attribute can be set on the `{{view}}`'s resulting element with\n the `class` or `classNameBindings` options. The `class` option\n will directly set the CSS `class` attribute and will not be passed to\n `Ember.View.create`. `classNameBindings` will be passed to `create` and use\n `Ember.View`'s class name binding functionality:\n\n <script type=\"text/x-handlebars\">\n {{#view tagName=\"span\" class=\"a-custom-class\"}}\n hello.\n {{/view}}\n </script>\n\n Results in the following HTML structure:\n\n <div class=\"ember-view\">\n <span id=\"ember2\" class=\"ember-view a-custom-class\">\n hello.\n </span>\n </div>\n\n ### Supplying a different view class\n `{{view}}` can take an optional first argument before its supplied options to specify a\n path to a custom view class.\n\n <script type=\"text/x-handlebars\">\n {{#view \"MyApp.CustomView\"}}\n hello.\n {{/view}}\n </script>\n\n The first argument can also be a relative path. Ember will search for the view class\n starting at the `Ember.View` of the template where `{{view}}` was used as the root object:\n\n MyApp = Ember.Application.create({})\n MyApp.OuterView = Ember.View.extend({\n innerViewClass: Ember.View.extend({\n classNames: ['a-custom-view-class-as-property']\n }),\n template: Ember.Handlebars.compile('{{#view \"innerViewClass\"}} hi {{/view}}')\n })\n\n MyApp.OuterView.create().appendTo('body')\n\nWill result in the following HTML:\n\n <div id=\"ember1\" class=\"ember-view\">\n <div id=\"ember2\" class=\"ember-view a-custom-view-class-as-property\"> \n hi\n </div>\n </div>\n\n ### Blockless use\n\n If you supply a custom `Ember.View` subclass that specifies its own template\n or provide a `templateName` option to `{{view}}` it can be used without supplying a block.\n Attempts to use both a `templateName` option and supply a block will throw an error.\n\n <script type=\"text/x-handlebars\">\n {{view \"MyApp.ViewWithATemplateDefined\"}}\n </script>\n\n ### viewName property\n\n You can supply a `viewName` option to `{{view}}`. The `Ember.View` instance will\n be referenced as a property of its parent view by this name.\n\n aView = Ember.View.create({\n template: Ember.Handlebars.compile('{{#view viewName=\"aChildByName\"}} hi {{/view}}')\n })\n\n aView.appendTo('body')\n aView.get('aChildByName') // the instance of Ember.View created by {{view}} helper\n\n @name Handlebars.helpers.view\n @param {String} path\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmberHandlebars.registerHelper('view', function(path, options) {\n Ember.assert(\"The view helper only takes a single argument\", arguments.length <= 2);\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 = \"Ember.View\";\n }\n\n return EmberHandlebars.ViewHelper.helper(this, path, options);\n});\n\n\n})();\n//@ sourceURL=ember-handlebars/helpers/view");minispade.register('ember-handlebars/helpers/yield', "(function() {var get = Ember.get, set = Ember.set;\n\n/**\n\n When used in a Handlebars template that is assigned to an `Ember.View` instance's\n `layout` property Ember will render the layout template first, inserting the view's\n own rendered output at the `{{ yield }}` location.\n\n An empty `<body>` and the following application code:\n\n AView = Ember.View.extend({\n classNames: ['a-view-with-layout'],\n layout: Ember.Handlebars.compile('<div class=\"wrapper\">{{ yield }}</div>'),\n template: Ember.Handlebars.compile('<span>I am wrapped</span>')\n })\n\n aView = AView.create()\n aView.appendTo('body')\n\n Will result in the following HTML output:\n\n <body>\n <div class='ember-view a-view-with-layout'>\n <div class=\"wrapper\">\n <span>I am wrapped</span>\n </div>\n </div>\n </body>\n\n The yield helper cannot be used outside of a template assigned to an `Ember.View`'s `layout` property\n and will throw an error if attempted.\n\n BView = Ember.View.extend({\n classNames: ['a-view-with-layout'],\n template: Ember.Handlebars.compile('{{yield}}')\n })\n\n bView = BView.create()\n bView.appendTo('body')\n\n // throws\n // Uncaught Error: assertion failed: You called yield in a template that was not a layout\n\n @name Handlebars.helpers.yield\n @param {Hash} options\n @returns {String} HTML string\n*/\nEmber.Handlebars.registerHelper('yield', function(options) {\n var view = options.data.view, template;\n\n while (view && !get(view, 'layout')) {\n view = get(view, 'parentView');\n }\n\n Ember.assert(\"You called yield in a template that was not a layout\", !!view);\n\n template = get(view, 'template');\n\n if (template) { template(this, options); }\n});\n\n})();\n//@ sourceURL=ember-handlebars/helpers/yield");minispade.register('ember-handlebars/loader', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\nminispade.require(\"ember-handlebars/ext\");\n\n// Find templates stored in the head tag as script tags and make them available\n// to Ember.CoreView in the global Ember.TEMPLATES object. This will be run as as\n// jQuery DOM-ready callback.\n//\n// Script tags with \"text/x-handlebars\" will be compiled\n// with Ember's Handlebars and are suitable for use as a view's template.\n// Those with type=\"text/x-raw-handlebars\" will be compiled with regular\n// Handlebars and are suitable for use in views' computed properties.\nEmber.Handlebars.bootstrap = function(ctx) {\n var selectors = 'script[type=\"text/x-handlebars\"], script[type=\"text/x-raw-handlebars\"]';\n\n if (Ember.ENV.LEGACY_HANDLEBARS_TAGS) { selectors += ', script[type=\"text/html\"]'; }\n\n Ember.warn(\"Ember no longer parses text/html script tags by default. Set ENV.LEGACY_HANDLEBARS_TAGS = true to restore this functionality.\", Ember.ENV.LEGACY_HANDLEBARS_TAGS || Ember.$('script[type=\"text/html\"]').length === 0);\n\n Ember.$(selectors, ctx)\n .each(function() {\n // Get a reference to the script tag\n var script = Ember.$(this),\n type = script.attr('type');\n\n var compile = (script.attr('type') === 'text/x-raw-handlebars') ?\n Ember.$.proxy(Handlebars.compile, Handlebars) :\n Ember.$.proxy(Ember.Handlebars.compile, Ember.Handlebars),\n // Get the name of the script, used by Ember.View's templateName property.\n // First look for data-template-name attribute, then fall back to its\n // id if no name is found.\n templateName = script.attr('data-template-name') || script.attr('id'),\n template = compile(script.html()),\n view, viewPath, elementId, tagName, options;\n\n if (templateName) {\n // For templates which have a name, we save them and then remove them from the DOM\n Ember.TEMPLATES[templateName] = template;\n\n // Remove script tag from DOM\n script.remove();\n } else {\n if (script.parents('head').length !== 0) {\n // don't allow inline templates in the head\n throw new Ember.Error(\"Template found in <head> without a name specified. \" +\n \"Please provide a data-template-name attribute.\\n\" +\n script.html());\n }\n\n // For templates which will be evaluated inline in the HTML document, instantiates a new\n // view, and replaces the script tag holding the template with the new\n // view's DOM representation.\n //\n // Users can optionally specify a custom view subclass to use by setting the\n // data-view attribute of the script tag.\n viewPath = script.attr('data-view');\n view = viewPath ? Ember.getPath(viewPath) : Ember.View;\n\n // Get the id of the script, used by Ember.View's elementId property,\n // Look for data-element-id attribute.\n elementId = script.attr('data-element-id');\n\n // Users can optionally specify a custom tag name to use by setting the\n // data-tag-name attribute on the script tag.\n tagName = script.attr('data-tag-name');\n\n options = { template: template };\n if (elementId) { options.elementId = elementId; }\n if (tagName) { options.tagName = tagName; }\n\n view = view.create(options);\n\n view._insertElementLater(function() {\n script.replaceWith(this.$());\n\n // Avoid memory leak in IE\n script = null;\n });\n }\n });\n};\n\nEmber.$(document).ready(\n function(){\n Ember.Handlebars.bootstrap( Ember.$(document) );\n }\n);\n\n})();\n//@ sourceURL=ember-handlebars/loader");minispade.register('ember-handlebars', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-runtime\");\nminispade.require(\"ember-views\");\nminispade.require(\"ember-handlebars/ext\");\nminispade.require(\"ember-handlebars/string\");\nminispade.require(\"ember-handlebars/helpers\");\nminispade.require(\"ember-handlebars/views\");\nminispade.require(\"ember-handlebars/controls\");\nminispade.require(\"ember-handlebars/loader\");\n\n})();\n//@ sourceURL=ember-handlebars");minispade.register('ember-handlebars/string', "(function() {\nEmber.String.htmlSafe = function(str) {\n return new Handlebars.SafeString(str);\n};\n\nvar htmlSafe = Ember.String.htmlSafe;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n @see Ember.String.htmlSafe\n */\n String.prototype.htmlSafe = function() {\n return htmlSafe(this);\n };\n\n}\n\n})();\n//@ sourceURL=ember-handlebars/string");minispade.register('ember-handlebars/views', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-handlebars/views/handlebars_bound_view\");\nminispade.require(\"ember-handlebars/views/metamorph_view\");\n\n})();\n//@ sourceURL=ember-handlebars/views");minispade.register('ember-handlebars/views/handlebars_bound_view', "(function() {// ==========================================================================\n// Project: Ember Handlebar Views\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Handlebars */\n\nvar get = Ember.get, set = Ember.set, getPath = Ember.Handlebars.getPath;\nminispade.require('ember-views/views/view');\nminispade.require('ember-handlebars/views/metamorph_view');\n\n/**\n @ignore\n @private\n @class\n\n Ember._HandlebarsBoundView is a private view created by the Handlebars `{{bind}}`\n helpers that is used to keep track of bound properties.\n\n Every time a property is bound using a `{{mustache}}`, an anonymous subclass\n of Ember._HandlebarsBoundView is created with the appropriate sub-template and\n context set up. When the associated property changes, just the template for\n this view will re-render.\n*/\nEmber._HandlebarsBoundView = Ember._MetamorphView.extend({\n/** @scope Ember._HandlebarsBoundView.prototype */\n\n /**\n The function used to determine if the `displayTemplate` or\n `inverseTemplate` should be rendered. This should be a function that takes\n a value and returns a Boolean.\n\n @type Function\n @default null\n */\n shouldDisplayFunc: null,\n\n /**\n Whether the template rendered by this view gets passed the context object\n of its parent template, or gets passed the value of retrieving `path`\n from the `pathRoot`.\n\n For example, this is true when using the `{{#if}}` helper, because the\n template inside the helper should look up properties relative to the same\n object as outside the block. This would be false when used with `{{#with\n foo}}` because the template should receive the object found by evaluating\n `foo`.\n\n @type Boolean\n @default false\n */\n preserveContext: false,\n\n /**\n If `preserveContext` is true, this is the object that will be used\n to render the template.\n\n @type Object\n */\n previousContext: null,\n\n /**\n The template to render when `shouldDisplayFunc` evaluates to true.\n\n @type Function\n @default null\n */\n displayTemplate: null,\n\n /**\n The template to render when `shouldDisplayFunc` evaluates to false.\n\n @type Function\n @default null\n */\n inverseTemplate: null,\n\n\n /**\n The path to look up on `pathRoot` that is passed to\n `shouldDisplayFunc` to determine which template to render.\n\n In addition, if `preserveContext` is false, the object at this path will\n be passed to the template when rendering.\n\n @type String\n @default null\n */\n path: null,\n\n /**\n The object from which the `path` will be looked up. Sometimes this is the\n same as the `previousContext`, but in cases where this view has been generated\n for paths that start with a keyword such as `view` or `controller`, the\n path root will be that resolved object.\n\n @type Object\n */\n pathRoot: null,\n\n normalizedValue: Ember.computed(function() {\n var path = get(this, 'path'),\n pathRoot = get(this, 'pathRoot'),\n valueNormalizer = get(this, 'valueNormalizerFunc'),\n result, templateData;\n\n // Use the pathRoot as the result if no path is provided. This\n // happens if the path is `this`, which gets normalized into\n // a `pathRoot` of the current Handlebars context and a path\n // of `''`.\n if (path === '') {\n result = pathRoot;\n } else {\n templateData = get(this, 'templateData');\n result = getPath(pathRoot, path, { data: templateData });\n }\n\n return valueNormalizer ? valueNormalizer(result) : result;\n }).property('path', 'pathRoot', 'valueNormalizerFunc').volatile(),\n\n rerenderIfNeeded: function() {\n if (!get(this, 'isDestroyed') && get(this, 'normalizedValue') !== this._lastNormalizedValue) {\n this.rerender();\n }\n },\n\n /**\n Determines which template to invoke, sets up the correct state based on\n that logic, then invokes the default Ember.View `render` implementation.\n\n This method will first look up the `path` key on `pathRoot`,\n then pass that value to the `shouldDisplayFunc` function. If that returns\n true, the `displayTemplate` function will be rendered to DOM. Otherwise,\n `inverseTemplate`, if specified, will be rendered.\n\n For example, if this Ember._BindableSpan represented the {{#with foo}}\n helper, it would look up the `foo` property of its context, and\n `shouldDisplayFunc` would always return true. The object found by looking\n up `foo` would be passed to `displayTemplate`.\n\n @param {Ember.RenderBuffer} buffer\n */\n render: function(buffer) {\n // If not invoked via a triple-mustache ({{{foo}}}), escape\n // the content of the template.\n var escape = get(this, 'isEscaped');\n\n var shouldDisplay = get(this, 'shouldDisplayFunc'),\n preserveContext = get(this, 'preserveContext'),\n context = get(this, 'previousContext');\n\n var inverseTemplate = get(this, 'inverseTemplate'),\n displayTemplate = get(this, 'displayTemplate');\n\n var result = get(this, 'normalizedValue');\n this._lastNormalizedValue = result;\n\n // First, test the conditional to see if we should\n // render the template or not.\n if (shouldDisplay(result)) {\n set(this, 'template', displayTemplate);\n\n // If we are preserving the context (for example, if this\n // is an #if block, call the template with the same object.\n if (preserveContext) {\n set(this, '_templateContext', context);\n } else {\n // Otherwise, determine if this is a block bind or not.\n // If so, pass the specified object to the template\n if (displayTemplate) {\n set(this, '_templateContext', result);\n } else {\n // This is not a bind block, just push the result of the\n // expression to the render context and return.\n if (result === null || result === undefined) {\n result = \"\";\n } else if (!(result instanceof Handlebars.SafeString)) {\n result = String(result);\n }\n\n if (escape) { result = Handlebars.Utils.escapeExpression(result); }\n buffer.push(result);\n return;\n }\n }\n } else if (inverseTemplate) {\n set(this, 'template', inverseTemplate);\n\n if (preserveContext) {\n set(this, '_templateContext', context);\n } else {\n set(this, '_templateContext', result);\n }\n } else {\n set(this, 'template', function() { return ''; });\n }\n\n return this._super(buffer);\n }\n});\n\n})();\n//@ sourceURL=ember-handlebars/views/handlebars_bound_view");minispade.register('ember-handlebars/views/metamorph_view', "(function() {/*jshint newcap:false*/\nminispade.require(\"metamorph\");\nminispade.require(\"ember-views/views/view\");\n\nvar set = Ember.set, get = Ember.get, getPath = Ember.getPath;\n\nvar DOMManager = {\n remove: function(view) {\n var morph = view.morph;\n if (morph.isRemoved()) { return; }\n set(view, 'element', null);\n view._lastInsert = null;\n morph.remove();\n },\n\n prepend: function(view, childView) {\n childView._insertElementLater(function() {\n var morph = view.morph;\n morph.prepend(childView.outerHTML);\n childView.outerHTML = null;\n });\n },\n\n after: function(view, nextView) {\n nextView._insertElementLater(function() {\n var morph = view.morph;\n morph.after(nextView.outerHTML);\n nextView.outerHTML = null;\n });\n },\n\n replace: function(view) {\n var morph = view.morph;\n\n view.transitionTo('preRender');\n view.clearRenderedChildren();\n var buffer = view.renderToBuffer();\n\n Ember.run.schedule('render', this, function() {\n if (get(view, 'isDestroyed')) { return; }\n view.invalidateRecursively('element');\n view._notifyWillInsertElement();\n morph.replaceWith(buffer.string());\n view.transitionTo('inDOM');\n view._notifyDidInsertElement();\n });\n },\n\n empty: function(view) {\n view.morph.html(\"\");\n }\n};\n\n// The `morph` and `outerHTML` properties are internal only\n// and not observable.\n\nEmber._Metamorph = Ember.Mixin.create({\n isVirtual: true,\n tagName: '',\n\n init: function() {\n this._super();\n this.morph = Metamorph();\n },\n\n beforeRender: function(buffer) {\n buffer.push(this.morph.startTag());\n },\n\n afterRender: function(buffer) {\n buffer.push(this.morph.endTag());\n },\n\n createElement: function() {\n var buffer = this.renderToBuffer();\n this.outerHTML = buffer.string();\n this.clearBuffer();\n },\n\n domManager: DOMManager\n});\n\nEmber._MetamorphView = Ember.View.extend(Ember._Metamorph);\n\n\n})();\n//@ sourceURL=ember-handlebars/views/metamorph_view");minispade.register('ember-metal/accessors', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\nminispade.require('ember-metal/utils');\n\nvar USE_ACCESSORS = Ember.platform.hasPropertyAccessors && Ember.ENV.USE_ACCESSORS;\nEmber.USE_ACCESSORS = !!USE_ACCESSORS;\n\nvar meta = Ember.meta;\n\n// ..........................................................\n// GET AND SET\n//\n// If we are on a platform that supports accessors we can get use those.\n// Otherwise simulate accessors by looking up the property directly on the\n// object.\n\nvar get, set;\n\n/** @private */\nget = function get(obj, keyName) {\n if (keyName === undefined && 'string' === typeof obj) {\n keyName = obj;\n obj = Ember;\n }\n\n if (!obj) return undefined;\n var ret = obj[keyName];\n if (ret===undefined && 'function'===typeof obj.unknownProperty) {\n ret = obj.unknownProperty(keyName);\n }\n return ret;\n};\n\n/** @private */\nset = function set(obj, keyName, value) {\n if (('object'===typeof obj) && !(keyName in obj)) {\n if ('function' === typeof obj.setUnknownProperty) {\n obj.setUnknownProperty(keyName, value);\n } else if ('function' === typeof obj.unknownProperty) {\n obj.unknownProperty(keyName, value);\n } else obj[keyName] = value;\n } else {\n obj[keyName] = value;\n }\n return value;\n};\n\nif (!USE_ACCESSORS) {\n\n var o_get = get, o_set = set;\n\n /** @private */\n get = function(obj, keyName) {\n if (keyName === undefined && 'string' === typeof obj) {\n keyName = obj;\n obj = Ember;\n }\n\n Ember.assert(\"You need to provide an object and key to `get`.\", !!obj && keyName);\n\n if (!obj) return undefined;\n var desc = meta(obj, false).descs[keyName];\n if (desc) return desc.get(obj, keyName);\n else return o_get(obj, keyName);\n };\n\n /** @private */\n set = function(obj, keyName, value) {\n Ember.assert(\"You need to provide an object and key to `set`.\", !!obj && keyName !== undefined);\n var desc = meta(obj, false).descs[keyName];\n if (desc) desc.set(obj, keyName, value);\n else o_set(obj, keyName, value);\n return value;\n };\n\n}\n\n/**\n @function\n\n Gets the value of a property on an object. If the property is computed,\n the function will be invoked. If the property is not defined but the\n object implements the unknownProperty() method then that will be invoked.\n\n If you plan to run on IE8 and older browsers then you should use this\n method anytime you want to retrieve a property on an object that you don't\n know for sure is private. (My convention only properties beginning with\n an underscore '_' are considered private.)\n\n On all newer browsers, you only need to use this method to retrieve\n properties if the property might not be defined on the object and you want\n to respect the unknownProperty() handler. Otherwise you can ignore this\n method.\n\n Note that if the obj itself is null, this method will simply return\n undefined.\n\n @param {Object} obj\n The object to retrieve from.\n\n @param {String} keyName\n The property key to retrieve\n\n @returns {Object} the property value or null.\n*/\nEmber.get = get;\n\n/**\n @function\n\n Sets the value of a property on an object, respecting computed properties\n and notifying observers and other listeners of the change. If the\n property is not defined but the object implements the unknownProperty()\n method then that will be invoked as well.\n\n If you plan to run on IE8 and older browsers then you should use this\n method anytime you want to set a property on an object that you don't\n know for sure is private. (My convention only properties beginning with\n an underscore '_' are considered private.)\n\n On all newer browsers, you only need to use this method to set\n properties if the property might not be defined on the object and you want\n to respect the unknownProperty() handler. Otherwise you can ignore this\n method.\n\n @param {Object} obj\n The object to modify.\n\n @param {String} keyName\n The property key to set\n\n @param {Object} value\n The value to set\n\n @returns {Object} the passed value.\n*/\nEmber.set = set;\n\n// ..........................................................\n// PATHS\n//\n\n/** @private */\nfunction cleanupStars(path) {\n if (path.indexOf('*') === -1 || path === '*') return path;\n\n Ember.deprecate('Star paths are now treated the same as normal paths', !/(^|[^\\.])\\*/.test(path));\n\n return path.replace(/(^|.)\\*/, function(match, char){\n return (char === '.') ? match : (char + '.');\n });\n}\n\n/** @private */\nfunction normalizePath(path) {\n Ember.assert('must pass non-empty string to normalizePath()', path && path!=='');\n path = cleanupStars(path);\n\n if (path==='*') return path; //special case...\n var first = path.charAt(0);\n if(first==='.') return 'this'+path;\n return path;\n}\n\n// assumes normalized input; no *, normalized path, always a target...\n/** @private */\nfunction getPath(target, path) {\n var len = path.length, idx, next, key;\n\n path = cleanupStars(path);\n\n idx = 0;\n while(target && idx<len) {\n next = path.indexOf('.', idx);\n if (next<0) next = len;\n key = path.slice(idx, next);\n target = key==='*' ? target : get(target, key);\n\n if (target && target.isDestroyed) { return undefined; }\n\n idx = next+1;\n }\n return target ;\n}\n\nvar TUPLE_RET = [];\nvar IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;\nvar IS_GLOBAL_PATH = /^([A-Z$]|([0-9][A-Z$])).*[\\.\\*]/;\nvar HAS_THIS = /^this[\\.\\*]/;\nvar FIRST_KEY = /^([^\\.\\*]+)/;\n\n/** @private */\nfunction firstKey(path) {\n return path.match(FIRST_KEY)[0];\n}\n\n// assumes path is already normalized\n/** @private */\nfunction normalizeTuple(target, path) {\n var hasThis = HAS_THIS.test(path),\n isGlobal = !hasThis && IS_GLOBAL_PATH.test(path),\n key;\n\n if (!target || isGlobal) target = window;\n if (hasThis) path = path.slice(5);\n\n path = cleanupStars(path);\n\n if (target === window) {\n key = firstKey(path);\n target = get(target, key);\n path = path.slice(key.length+1);\n }\n\n // must return some kind of path to be valid else other things will break.\n if (!path || path.length===0) throw new Error('Invalid Path');\n\n TUPLE_RET[0] = target;\n TUPLE_RET[1] = path;\n return TUPLE_RET;\n}\n\n/**\n @private\n\n Normalizes a path to support older-style property paths beginning with . or\n\n @function\n @param {String} path path to normalize\n @returns {String} normalized path\n*/\nEmber.normalizePath = normalizePath;\n\n/**\n @private\n\n Normalizes a target/path pair to reflect that actual target/path that should\n be observed, etc. This takes into account passing in global property\n paths (i.e. a path beginning with a captial letter not defined on the\n target) and * separators.\n\n @param {Object} target\n The current target. May be null.\n\n @param {String} path\n A path on the target or a global property path.\n\n @returns {Array} a temporary array with the normalized target/path pair.\n*/\nEmber.normalizeTuple = function(target, path) {\n return normalizeTuple(target, normalizePath(path));\n};\n\nEmber.normalizeTuple.primitive = normalizeTuple;\n\nEmber.getWithDefault = function(root, key, defaultValue) {\n var value = Ember.get(root, key);\n\n if (value === undefined) { return defaultValue; }\n return value;\n};\n\nEmber.getPath = function(root, path) {\n var hasThis, isGlobal, ret;\n\n // Helpers that operate with 'this' within an #each\n if (path === '') {\n return root;\n }\n\n if (!path && 'string'===typeof root) {\n path = root;\n root = null;\n }\n\n path = cleanupStars(path);\n\n // If there is no root and path is a key name, return that\n // property from the global object.\n // E.g. getPath('Ember') -> Ember\n if (root === null && path.indexOf('.') < 0) { return get(window, path); }\n\n // detect complicated paths and normalize them\n path = normalizePath(path);\n hasThis = HAS_THIS.test(path);\n\n if (!root || hasThis) {\n var tuple = normalizeTuple(root, path);\n root = tuple[0];\n path = tuple[1];\n tuple.length = 0;\n }\n\n return getPath(root, path);\n};\n\nEmber.setPath = function(root, path, value, tolerant) {\n var keyName;\n\n if (arguments.length===2 && 'string' === typeof root) {\n value = path;\n path = root;\n root = null;\n }\n\n path = normalizePath(path);\n\n if (path.indexOf('.') > 0) {\n keyName = path.slice(path.lastIndexOf('.')+1);\n path = path.slice(0, path.length-(keyName.length+1));\n if (path !== 'this') {\n root = Ember.getPath(root, path);\n }\n\n } else {\n if (IS_GLOBAL.test(path)) throw new Error('Invalid Path');\n keyName = path;\n }\n\n if (!keyName || keyName.length===0 || keyName==='*') {\n throw new Error('Invalid Path');\n }\n\n if (!root) {\n if (tolerant) { return; }\n else { throw new Error('Object in path '+path+' could not be found or was destroyed.'); }\n }\n\n return Ember.set(root, keyName, value);\n};\n\n/**\n Error-tolerant form of Ember.setPath. Will not blow up if any part of the\n chain is undefined, null, or destroyed.\n\n This is primarily used when syncing bindings, which may try to update after\n an object has been destroyed.\n*/\nEmber.trySetPath = function(root, path, value) {\n if (arguments.length===2 && 'string' === typeof root) {\n value = path;\n path = root;\n root = null;\n }\n\n return Ember.setPath(root, path, value, true);\n};\n\n/**\n Returns true if the provided path is global (e.g., \"MyApp.fooController.bar\")\n instead of local (\"foo.bar.baz\").\n\n @param {String} path\n @returns Boolean\n*/\nEmber.isGlobalPath = function(path) {\n return !HAS_THIS.test(path) && IS_GLOBAL.test(path);\n};\n\n})();\n//@ sourceURL=ember-metal/accessors");minispade.register('ember-metal/array', "(function() {/*jshint newcap:false*/\n\n// NOTE: There is a bug in jshint that doesn't recognize `Object()` without `new`\n// as being ok unless both `newcap:false` and not `use strict`.\n// https://github.com/jshint/jshint/issues/392\n\n// Testing this is not ideal, but we want ArrayUtils to use native functions\n// if available, but not to use versions created by libraries like Prototype\n/** @private */\nvar isNativeFunc = function(func) {\n // This should probably work in all browsers likely to have ES5 array methods\n return func && Function.prototype.toString.call(func).indexOf('[native code]') > -1;\n};\n\n// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/map\n/** @private */\nvar arrayMap = isNativeFunc(Array.prototype.map) ? Array.prototype.map : function(fun /*, thisp */) {\n //\"use strict\";\n\n if (this === void 0 || this === null) {\n throw new TypeError();\n }\n\n var t = Object(this);\n var len = t.length >>> 0;\n if (typeof fun !== \"function\") {\n throw new TypeError();\n }\n\n var res = new Array(len);\n var thisp = arguments[1];\n for (var i = 0; i < len; i++) {\n if (i in t) {\n res[i] = fun.call(thisp, t[i], i, t);\n }\n }\n\n return res;\n};\n\n// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach\n/** @private */\nvar arrayForEach = isNativeFunc(Array.prototype.forEach) ? Array.prototype.forEach : function(fun /*, thisp */) {\n //\"use strict\";\n\n if (this === void 0 || this === null) {\n throw new TypeError();\n }\n\n var t = Object(this);\n var len = t.length >>> 0;\n if (typeof fun !== \"function\") {\n throw new TypeError();\n }\n\n var thisp = arguments[1];\n for (var i = 0; i < len; i++) {\n if (i in t) {\n fun.call(thisp, t[i], i, t);\n }\n }\n};\n\n/** @private */\nvar arrayIndexOf = isNativeFunc(Array.prototype.indexOf) ? Array.prototype.indexOf : function (obj, fromIndex) {\n if (fromIndex === null || fromIndex === undefined) { fromIndex = 0; }\n else if (fromIndex < 0) { fromIndex = Math.max(0, this.length + fromIndex); }\n for (var i = fromIndex, j = this.length; i < j; i++) {\n if (this[i] === obj) { return i; }\n }\n return -1;\n};\n\n\nEmber.ArrayUtils = {\n map: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return obj.map ? obj.map.apply(obj, args) : arrayMap.apply(obj, args);\n },\n\n forEach: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return obj.forEach ? obj.forEach.apply(obj, args) : arrayForEach.apply(obj, args);\n },\n\n indexOf: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return obj.indexOf ? obj.indexOf.apply(obj, args) : arrayIndexOf.apply(obj, args);\n },\n\n indexesOf: function(obj) {\n var args = Array.prototype.slice.call(arguments, 1);\n return args[0] === undefined ? [] : Ember.ArrayUtils.map(args[0], function(item) {\n return Ember.ArrayUtils.indexOf(obj, item);\n });\n },\n\n removeObject: function(array, item) {\n var index = this.indexOf(array, item);\n if (index !== -1) { array.splice(index, 1); }\n }\n};\n\n\nif (Ember.SHIM_ES5) {\n if (!Array.prototype.map) {\n /** @private */\n Array.prototype.map = arrayMap;\n }\n\n if (!Array.prototype.forEach) {\n /** @private */\n Array.prototype.forEach = arrayForEach;\n }\n\n if (!Array.prototype.indexOf) {\n /** @private */\n Array.prototype.indexOf = arrayIndexOf;\n }\n}\n\n})();\n//@ sourceURL=ember-metal/array");minispade.register('ember-metal/binding', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core'); // Ember.Logger\nminispade.require('ember-metal/accessors'); // get, getPath, setPath, trySetPath\nminispade.require('ember-metal/utils'); // guidFor, isArray, meta\nminispade.require('ember-metal/observer'); // addObserver, removeObserver\nminispade.require('ember-metal/run_loop'); // Ember.run.schedule\n\n// ..........................................................\n// CONSTANTS\n//\n\n\n/**\n @static\n\n Debug parameter you can turn on. This will log all bindings that fire to\n the console. This should be disabled in production code. Note that you\n can also enable this from the console or temporarily.\n\n @type Boolean\n @default false\n*/\nEmber.LOG_BINDINGS = false || !!Ember.ENV.LOG_BINDINGS;\n\n/**\n @static\n\n Performance paramter. This will benchmark the time spent firing each\n binding.\n\n @type Boolean\n*/\nEmber.BENCHMARK_BINDING_NOTIFICATIONS = !!Ember.ENV.BENCHMARK_BINDING_NOTIFICATIONS;\n\n/**\n @static\n\n Performance parameter. This will benchmark the time spend configuring each\n binding.\n\n @type Boolean\n*/\nEmber.BENCHMARK_BINDING_SETUP = !!Ember.ENV.BENCHMARK_BINDING_SETUP;\n\n\n/**\n @static\n\n Default placeholder for multiple values in bindings.\n\n @type String\n @default '@@MULT@@'\n*/\nEmber.MULTIPLE_PLACEHOLDER = '@@MULT@@';\n\n/**\n @static\n\n Default placeholder for empty values in bindings. Used by notEmpty()\n helper unless you specify an alternative.\n\n @type String\n @default '@@EMPTY@@'\n*/\nEmber.EMPTY_PLACEHOLDER = '@@EMPTY@@';\n\n// ..........................................................\n// TYPE COERCION HELPERS\n//\n\n// Coerces a non-array value into an array.\n/** @private */\nfunction MULTIPLE(val) {\n if (val instanceof Array) return val;\n if (val === undefined || val === null) return [];\n return [val];\n}\n\n// Treats a single-element array as the element. Otherwise\n// returns a placeholder.\n/** @private */\nfunction SINGLE(val, placeholder) {\n if (val instanceof Array) {\n if (val.length>1) return placeholder;\n else return val[0];\n }\n return val;\n}\n\n// Coerces the binding value into a Boolean.\n\nvar BOOL = {\n to: function (val) {\n return !!val;\n }\n};\n\n// Returns the Boolean inverse of the value.\nvar NOT = {\n to: function NOT(val) {\n return !val;\n }\n};\n\nvar get = Ember.get,\n getPath = Ember.getPath,\n setPath = Ember.setPath,\n guidFor = Ember.guidFor,\n isGlobalPath = Ember.isGlobalPath;\n\n// Applies a binding's transformations against a value.\n/** @private */\nfunction getTransformedValue(binding, val, obj, dir) {\n\n // First run a type transform, if it exists, that changes the fundamental\n // type of the value. For example, some transforms convert an array to a\n // single object.\n\n var typeTransform = binding._typeTransform;\n if (typeTransform) { val = typeTransform(val, binding._placeholder); }\n\n // handle transforms\n var transforms = binding._transforms,\n len = transforms ? transforms.length : 0,\n idx;\n\n for(idx=0;idx<len;idx++) {\n var transform = transforms[idx][dir];\n if (transform) { val = transform.call(this, val, obj); }\n }\n return val;\n}\n\n/** @private */\nfunction empty(val) {\n return val===undefined || val===null || val==='' || (Ember.isArray(val) && get(val, 'length')===0) ;\n}\n\n/** @private */\nfunction getPathWithGlobals(obj, path) {\n return getPath(isGlobalPath(path) ? window : obj, path);\n}\n\n/** @private */\nfunction getTransformedFromValue(obj, binding) {\n var operation = binding._operation,\n fromValue;\n if (operation) {\n fromValue = operation(obj, binding._from, binding._operand);\n } else {\n fromValue = getPathWithGlobals(obj, binding._from);\n }\n return getTransformedValue(binding, fromValue, obj, 'to');\n}\n\n/** @private */\nfunction getTransformedToValue(obj, binding) {\n var toValue = getPath(obj, binding._to);\n return getTransformedValue(binding, toValue, obj, 'from');\n}\n\n/** @private */\nvar AND_OPERATION = function(obj, left, right) {\n return getPathWithGlobals(obj, left) && getPathWithGlobals(obj, right);\n};\n\n/** @private */\nvar OR_OPERATION = function(obj, left, right) {\n return getPathWithGlobals(obj, left) || getPathWithGlobals(obj, right);\n};\n\n// ..........................................................\n// BINDING\n//\n/** @private */\nvar K = function() {};\n\n/** @private */\nvar Binding = function(toPath, fromPath) {\n var self;\n\n if (this instanceof Binding) {\n self = this;\n } else {\n self = new K();\n }\n\n /** @private */\n self._direction = 'fwd';\n\n /** @private */\n self._from = fromPath;\n self._to = toPath;\n\n return self;\n};\n\nK.prototype = Binding.prototype;\n\nBinding.prototype = /** @scope Ember.Binding.prototype */ {\n /**\n This copies the Binding so it can be connected to another object.\n @returns {Ember.Binding}\n */\n copy: function () {\n var copy = new Binding(this._to, this._from);\n if (this._oneWay) {\n copy._oneWay = true;\n }\n if (this._transforms) {\n copy._transforms = this._transforms.slice(0);\n }\n if (this._typeTransform) {\n copy._typeTransform = this._typeTransform;\n copy._placeholder = this._placeholder;\n }\n if (this._operand) {\n copy._operand = this._operand;\n copy._operation = this._operation;\n }\n return copy;\n },\n\n // ..........................................................\n // CONFIG\n //\n\n /**\n This will set \"from\" property path to the specified value. It will not\n attempt to resolve this property path to an actual object until you\n connect the binding.\n\n The binding will search for the property path starting at the root object\n you pass when you connect() the binding. It follows the same rules as\n `getPath()` - see that method for more information.\n\n @param {String} propertyPath the property path to connect to\n @returns {Ember.Binding} receiver\n */\n from: function(path) {\n this._from = path;\n return this;\n },\n\n /**\n This will set the \"to\" property path to the specified value. It will not\n attempt to resolve this property path to an actual object until you\n connect the binding.\n\n The binding will search for the property path starting at the root object\n you pass when you connect() the binding. It follows the same rules as\n `getPath()` - see that method for more information.\n\n @param {String|Tuple} propertyPath A property path or tuple\n @param {Object} [root] Root object to use when resolving the path.\n @returns {Ember.Binding} this\n */\n to: function(path) {\n this._to = path;\n return this;\n },\n\n /**\n Configures the binding as one way. A one-way binding will relay changes\n on the \"from\" side to the \"to\" side, but not the other way around. This\n means that if you change the \"to\" side directly, the \"from\" side may have\n a different value.\n\n @param {Boolean} flag\n (Optional) passing nothing here will make the binding oneWay. You can\n instead pass false to disable oneWay, making the binding two way again.\n\n @returns {Ember.Binding} receiver\n */\n oneWay: function(flag) {\n this._oneWay = flag===undefined ? true : !!flag;\n return this;\n },\n\n /**\n Adds the specified transform to the array of transform functions.\n\n A transform is a hash with `to` and `from` properties. Each property\n should be a function that performs a transformation in either the\n forward or back direction.\n\n The functions you pass must have the following signature:\n\n function(value) {};\n\n They must also return the transformed value.\n\n Transforms are invoked in the order they were added. If you are\n extending a binding and want to reset the transforms, you can call\n `resetTransform()` first.\n\n @param {Function} transformFunc the transform function.\n @returns {Ember.Binding} this\n */\n transform: function(transform) {\n if ('function' === typeof transform) {\n transform = { to: transform };\n }\n\n if (!this._transforms) this._transforms = [];\n this._transforms.push(transform);\n return this;\n },\n\n /**\n Resets the transforms for the binding. After calling this method the\n binding will no longer transform values. You can then add new transforms\n as needed.\n\n @returns {Ember.Binding} this\n */\n resetTransforms: function() {\n this._transforms = null;\n return this;\n },\n\n /**\n Adds a transform to the chain that will allow only single values to pass.\n This will allow single values and nulls to pass through. If you pass an\n array, it will be mapped as so:\n\n - [] => null\n - [a] => a\n - [a,b,c] => Multiple Placeholder\n\n You can pass in an optional multiple placeholder or it will use the\n default.\n\n Note that this transform will only happen on forwarded valued. Reverse\n values are send unchanged.\n\n @param {String} fromPath from path or null\n @param {Object} [placeholder] Placeholder value.\n @returns {Ember.Binding} this\n */\n single: function(placeholder) {\n if (placeholder===undefined) placeholder = Ember.MULTIPLE_PLACEHOLDER;\n this._typeTransform = SINGLE;\n this._placeholder = placeholder;\n return this;\n },\n\n /**\n Adds a transform that will convert the passed value to an array. If\n the value is null or undefined, it will be converted to an empty array.\n\n @param {String} [fromPath]\n @returns {Ember.Binding} this\n */\n multiple: function() {\n this._typeTransform = MULTIPLE;\n this._placeholder = null;\n return this;\n },\n\n /**\n Adds a transform to convert the value to a bool value. If the value is\n an array it will return true if array is not empty. If the value is a\n string it will return true if the string is not empty.\n\n @returns {Ember.Binding} this\n */\n bool: function() {\n this.transform(BOOL);\n return this;\n },\n\n /**\n Adds a transform that will return the placeholder value if the value is\n null, undefined, an empty array or an empty string. See also notNull().\n\n @param {Object} [placeholder] Placeholder value.\n @returns {Ember.Binding} this\n */\n notEmpty: function(placeholder) {\n if (placeholder === null || placeholder === undefined) {\n placeholder = Ember.EMPTY_PLACEHOLDER;\n }\n\n this.transform({\n to: function(val) { return empty(val) ? placeholder : val; }\n });\n\n return this;\n },\n\n /**\n Adds a transform that will return the placeholder value if the value is\n null or undefined. Otherwise it will passthrough untouched. See also notEmpty().\n\n @param {String} fromPath from path or null\n @param {Object} [placeholder] Placeholder value.\n @returns {Ember.Binding} this\n */\n notNull: function(placeholder) {\n if (placeholder === null || placeholder === undefined) {\n placeholder = Ember.EMPTY_PLACEHOLDER;\n }\n\n this.transform({\n to: function(val) { return (val === null || val === undefined) ? placeholder : val; }\n });\n\n return this;\n },\n\n /**\n Adds a transform to convert the value to the inverse of a bool value. This\n uses the same transform as bool() but inverts it.\n\n @returns {Ember.Binding} this\n */\n not: function() {\n this.transform(NOT);\n return this;\n },\n\n /**\n Adds a transform that will return true if the value is null or undefined, false otherwise.\n\n @returns {Ember.Binding} this\n */\n isNull: function() {\n this.transform(function(val) { return val === null || val === undefined; });\n return this;\n },\n\n /** @private */\n toString: function() {\n var oneWay = this._oneWay ? '[oneWay]' : '';\n return \"Ember.Binding<\" + guidFor(this) + \">(\" + this._from + \" -> \" + this._to + \")\" + oneWay;\n },\n\n // ..........................................................\n // CONNECT AND SYNC\n //\n\n /**\n Attempts to connect this binding instance so that it can receive and relay\n changes. This method will raise an exception if you have not set the\n from/to properties yet.\n\n @param {Object} obj\n The root object for this binding.\n\n @param {Boolean} preferFromParam\n private: Normally, `connect` cannot take an object if `from` already set\n an object. Internally, we would like to be able to provide a default object\n to be used if no object was provided via `from`, so this parameter turns\n off the assertion.\n\n @returns {Ember.Binding} this\n */\n connect: function(obj) {\n Ember.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);\n\n var oneWay = this._oneWay, operand = this._operand;\n\n // add an observer on the object to be notified when the binding should be updated\n Ember.addObserver(obj, this._from, this, this.fromDidChange);\n\n // if there is an operand, add an observer onto it as well\n if (operand) { Ember.addObserver(obj, operand, this, this.fromDidChange); }\n\n // if the binding is a two-way binding, also set up an observer on the target\n // object.\n if (!oneWay) { Ember.addObserver(obj, this._to, this, this.toDidChange); }\n\n if (Ember.meta(obj,false).proto !== obj) { this._scheduleSync(obj, 'fwd'); }\n\n this._readyToSync = true;\n return this;\n },\n\n /**\n Disconnects the binding instance. Changes will no longer be relayed. You\n will not usually need to call this method.\n\n @param {Object} obj\n The root object you passed when connecting the binding.\n\n @returns {Ember.Binding} this\n */\n disconnect: function(obj) {\n Ember.assert('Must pass a valid object to Ember.Binding.disconnect()', !!obj);\n\n var oneWay = this._oneWay, operand = this._operand;\n\n // remove an observer on the object so we're no longer notified of\n // changes that should update bindings.\n Ember.removeObserver(obj, this._from, this, this.fromDidChange);\n\n // if there is an operand, remove the observer from it as well\n if (operand) Ember.removeObserver(obj, operand, this, this.fromDidChange);\n\n // if the binding is two-way, remove the observer from the target as well\n if (!oneWay) Ember.removeObserver(obj, this._to, this, this.toDidChange);\n\n this._readyToSync = false; // disable scheduled syncs...\n return this;\n },\n\n // ..........................................................\n // PRIVATE\n //\n\n /** @private - called when the from side changes */\n fromDidChange: function(target) {\n this._scheduleSync(target, 'fwd');\n },\n\n /** @private - called when the to side changes */\n toDidChange: function(target) {\n this._scheduleSync(target, 'back');\n },\n\n /** @private */\n _scheduleSync: function(obj, dir) {\n var guid = guidFor(obj), existingDir = this[guid];\n\n // if we haven't scheduled the binding yet, schedule it\n if (!existingDir) {\n Ember.run.schedule('sync', this, this._sync, obj);\n this[guid] = dir;\n }\n\n // If both a 'back' and 'fwd' sync have been scheduled on the same object,\n // default to a 'fwd' sync so that it remains deterministic.\n if (existingDir === 'back' && dir === 'fwd') {\n this[guid] = 'fwd';\n }\n },\n\n /** @private */\n _sync: function(obj) {\n var log = Ember.LOG_BINDINGS;\n\n // don't synchronize destroyed objects or disconnected bindings\n if (obj.isDestroyed || !this._readyToSync) { return; }\n\n // get the direction of the binding for the object we are\n // synchronizing from\n var guid = guidFor(obj), direction = this[guid];\n\n var fromPath = this._from, toPath = this._to;\n\n delete this[guid];\n\n // if we're synchronizing from the remote object...\n if (direction === 'fwd') {\n var fromValue = getTransformedFromValue(obj, this);\n if (log) {\n Ember.Logger.log(' ', this.toString(), '->', fromValue, obj);\n }\n if (this._oneWay) {\n Ember.trySetPath(Ember.isGlobalPath(toPath) ? window : obj, toPath, fromValue);\n } else {\n Ember._suspendObserver(obj, toPath, this, this.toDidChange, function () {\n Ember.trySetPath(Ember.isGlobalPath(toPath) ? window : obj, toPath, fromValue);\n });\n }\n // if we're synchronizing *to* the remote object\n } else if (direction === 'back') {// && !this._oneWay) {\n var toValue = getTransformedToValue(obj, this);\n if (log) {\n Ember.Logger.log(' ', this.toString(), '<-', toValue, obj);\n }\n Ember._suspendObserver(obj, fromPath, this, this.fromDidChange, function () {\n Ember.trySetPath(Ember.isGlobalPath(fromPath) ? window : obj, fromPath, toValue);\n });\n }\n }\n\n};\n\n/** @private */\nfunction mixinProperties(to, from) {\n for (var key in from) {\n if (from.hasOwnProperty(key)) {\n to[key] = from[key];\n }\n }\n}\n\nmixinProperties(Binding,\n/** @scope Ember.Binding */ {\n\n /**\n @see Ember.Binding.prototype.from\n */\n from: function() {\n var C = this, binding = new C();\n return binding.from.apply(binding, arguments);\n },\n\n /**\n @see Ember.Binding.prototype.to\n */\n to: function() {\n var C = this, binding = new C();\n return binding.to.apply(binding, arguments);\n },\n\n /**\n @see Ember.Binding.prototype.oneWay\n */\n oneWay: function(from, flag) {\n var C = this, binding = new C(null, from);\n return binding.oneWay(flag);\n },\n\n /**\n @see Ember.Binding.prototype.single\n */\n single: function(from, placeholder) {\n var C = this, binding = new C(null, from);\n return binding.single(placeholder);\n },\n\n /**\n @see Ember.Binding.prototype.multiple\n */\n multiple: function(from) {\n var C = this, binding = new C(null, from);\n return binding.multiple();\n },\n\n /**\n @see Ember.Binding.prototype.transform\n */\n transform: function(from, func) {\n if (!func) {\n func = from;\n from = null;\n }\n var C = this, binding = new C(null, from);\n return binding.transform(func);\n },\n\n /**\n @see Ember.Binding.prototype.notEmpty\n */\n notEmpty: function(from, placeholder) {\n var C = this, binding = new C(null, from);\n return binding.notEmpty(placeholder);\n },\n\n /**\n @see Ember.Binding.prototype.notNull\n */\n notNull: function(from, placeholder) {\n var C = this, binding = new C(null, from);\n return binding.notNull(placeholder);\n },\n\n\n /**\n @see Ember.Binding.prototype.bool\n */\n bool: function(from) {\n var C = this, binding = new C(null, from);\n return binding.bool();\n },\n\n /**\n @see Ember.Binding.prototype.not\n */\n not: function(from) {\n var C = this, binding = new C(null, from);\n return binding.not();\n },\n\n /**\n @see Ember.Binding.prototype.isNull\n */\n isNull: function(from) {\n var C = this, binding = new C(null, from);\n return binding.isNull();\n },\n\n /**\n Adds a transform that forwards the logical 'AND' of values at 'pathA' and\n 'pathB' whenever either source changes. Note that the transform acts\n strictly as a one-way binding, working only in the direction\n\n 'pathA' AND 'pathB' --> value (value returned is the result of ('pathA' && 'pathB'))\n\n Usage example where a delete button's `isEnabled` value is determined by\n whether something is selected in a list and whether the current user is\n allowed to delete:\n\n deleteButton: Ember.ButtonView.design({\n isEnabledBinding: Ember.Binding.and('MyApp.itemsController.hasSelection', 'MyApp.userController.canDelete')\n })\n\n @param {String} pathA The first part of the conditional\n @param {String} pathB The second part of the conditional\n */\n and: function(pathA, pathB) {\n var C = this, binding = new C(null, pathA).oneWay();\n binding._operand = pathB;\n binding._operation = AND_OPERATION;\n return binding;\n },\n\n /**\n Adds a transform that forwards the 'OR' of values at 'pathA' and\n 'pathB' whenever either source changes. Note that the transform acts\n strictly as a one-way binding, working only in the direction\n\n 'pathA' AND 'pathB' --> value (value returned is the result of ('pathA' || 'pathB'))\n\n @param {String} pathA The first part of the conditional\n @param {String} pathB The second part of the conditional\n */\n or: function(pathA, pathB) {\n var C = this, binding = new C(null, pathA).oneWay();\n binding._operand = pathB;\n binding._operation = OR_OPERATION;\n return binding;\n },\n\n /**\n Registers a custom transform for use in bindings.\n\n @param {String} name The name of the transform\n @param {Function} transform The transformation function\n */\n registerTransform: function(name, transform) {\n this.prototype[name] = transform;\n this[name] = function(from) {\n var C = this, binding = new C(null, from), args;\n args = Array.prototype.slice.call(arguments, 1);\n return binding[name].apply(binding, args);\n };\n }\n\n});\n\n/**\n @class\n\n A binding simply connects the properties of two objects so that whenever the\n value of one property changes, the other property will be changed also. You\n do not usually work with Binding objects directly but instead describe\n bindings in your class definition using something like:\n\n valueBinding: \"MyApp.someController.title\"\n\n This will create a binding from `MyApp.someController.title` to the `value`\n property of your object instance automatically. Now the two values will be\n kept in sync.\n\n ## Customizing Your Bindings\n\n In addition to synchronizing values, bindings can also perform some basic\n transforms on values. These transforms can help to make sure the data fed\n into one object always meets the expectations of that object regardless of\n what the other object outputs.\n\n To customize a binding, you can use one of the many helper methods defined\n on Ember.Binding like so:\n\n valueBinding: Ember.Binding.single(\"MyApp.someController.title\")\n\n This will create a binding just like the example above, except that now the\n binding will convert the value of `MyApp.someController.title` to a single\n object (removing any arrays) before applying it to the `value` property of\n your object.\n\n You can also chain helper methods to build custom bindings like so:\n\n valueBinding: Ember.Binding.single(\"MyApp.someController.title\").notEmpty(\"(EMPTY)\")\n\n This will force the value of MyApp.someController.title to be a single value\n and then check to see if the value is \"empty\" (null, undefined, empty array,\n or an empty string). If it is empty, the value will be set to the string\n \"(EMPTY)\".\n\n ## One Way Bindings\n\n One especially useful binding customization you can use is the `oneWay()`\n helper. This helper tells Ember that you are only interested in\n receiving changes on the object you are binding from. For example, if you\n are binding to a preference and you want to be notified if the preference\n has changed, but your object will not be changing the preference itself, you\n could do:\n\n bigTitlesBinding: Ember.Binding.oneWay(\"MyApp.preferencesController.bigTitles\")\n\n This way if the value of MyApp.preferencesController.bigTitles changes the\n \"bigTitles\" property of your object will change also. However, if you\n change the value of your \"bigTitles\" property, it will not update the\n preferencesController.\n\n One way bindings are almost twice as fast to setup and twice as fast to\n execute because the binding only has to worry about changes to one side.\n\n You should consider using one way bindings anytime you have an object that\n may be created frequently and you do not intend to change a property; only\n to monitor it for changes. (such as in the example above).\n\n ## Adding Custom Transforms\n\n In addition to using the standard helpers provided by Ember, you can\n also defined your own custom transform functions which will be used to\n convert the value. To do this, just define your transform function and add\n it to the binding with the transform() helper. The following example will\n not allow Integers less than ten. Note that it checks the value of the\n bindings and allows all other values to pass:\n\n valueBinding: Ember.Binding.transform(function(value, binding) {\n return ((Ember.typeOf(value) === 'number') && (value < 10)) ? 10 : value;\n }).from(\"MyApp.someController.value\")\n\n If you would like to instead use this transform on a number of bindings,\n you can also optionally add your own helper method to Ember.Binding. This\n method should simply return the value of `this.transform()`. The example\n below adds a new helper called `notLessThan()` which will limit the value to\n be not less than the passed minimum:\n\n Ember.Binding.registerTransform('notLessThan', function(minValue) {\n return this.transform(function(value, binding) {\n return ((Ember.typeOf(value) === 'number') && (value < minValue)) ? minValue : value;\n });\n });\n\n You could specify this in your core.js file, for example. Then anywhere in\n your application you can use it to define bindings like so:\n\n valueBinding: Ember.Binding.from(\"MyApp.someController.value\").notLessThan(10)\n\n Also, remember that helpers are chained so you can use your helper along\n with any other helpers. The example below will create a one way binding that\n does not allow empty values or values less than 10:\n\n valueBinding: Ember.Binding.oneWay(\"MyApp.someController.value\").notEmpty().notLessThan(10)\n\n Finally, it's also possible to specify bi-directional transforms. To do this,\n you can pass a hash to `transform` with `to` and `from`. In the following\n example, we are expecting a lowercase string that we want to transform to\n uppercase.\n\n valueBinding: Ember.Binding.transform({\n to: function(value, binding) { return value.toUpperCase(); },\n from: function(value, binding) { return value.toLowerCase(); }\n\n ## How to Manually Adding Binding\n\n All of the examples above show you how to configure a custom binding, but\n the result of these customizations will be a binding template, not a fully\n active binding. The binding will actually become active only when you\n instantiate the object the binding belongs to. It is useful however, to\n understand what actually happens when the binding is activated.\n\n For a binding to function it must have at least a \"from\" property and a \"to\"\n property. The from property path points to the object/key that you want to\n bind from while the to path points to the object/key you want to bind to.\n\n When you define a custom binding, you are usually describing the property\n you want to bind from (such as \"MyApp.someController.value\" in the examples\n above). When your object is created, it will automatically assign the value\n you want to bind \"to\" based on the name of your binding key. In the\n examples above, during init, Ember objects will effectively call\n something like this on your binding:\n\n binding = Ember.Binding.from(this.valueBinding).to(\"value\");\n\n This creates a new binding instance based on the template you provide, and\n sets the to path to the \"value\" property of the new object. Now that the\n binding is fully configured with a \"from\" and a \"to\", it simply needs to be\n connected to become active. This is done through the connect() method:\n\n binding.connect(this);\n\n Note that when you connect a binding you pass the object you want it to be\n connected to. This object will be used as the root for both the from and\n to side of the binding when inspecting relative paths. This allows the\n binding to be automatically inherited by subclassed objects as well.\n\n Now that the binding is connected, it will observe both the from and to side\n and relay changes.\n\n If you ever needed to do so (you almost never will, but it is useful to\n understand this anyway), you could manually create an active binding by\n using the Ember.bind() helper method. (This is the same method used by\n to setup your bindings on objects):\n\n Ember.bind(MyApp.anotherObject, \"value\", \"MyApp.someController.value\");\n\n Both of these code fragments have the same effect as doing the most friendly\n form of binding creation like so:\n\n MyApp.anotherObject = Ember.Object.create({\n valueBinding: \"MyApp.someController.value\",\n\n // OTHER CODE FOR THIS OBJECT...\n\n });\n\n Ember's built in binding creation method makes it easy to automatically\n create bindings for you. You should always use the highest-level APIs\n available, even if you understand how it works underneath.\n\n @since Ember 0.9\n*/\nEmber.Binding = Binding;\n\n/**\n Global helper method to create a new binding. Just pass the root object\n along with a to and from path to create and connect the binding. The new\n binding object will be returned which you can further configure with\n transforms and other conditions.\n\n @param {Object} obj\n The root object of the transform.\n\n @param {String} to\n The path to the 'to' side of the binding. Must be relative to obj.\n\n @param {String} from\n The path to the 'from' side of the binding. Must be relative to obj or\n a global path.\n\n @returns {Ember.Binding} binding instance\n*/\nEmber.bind = function(obj, to, from) {\n return new Ember.Binding(to, from).connect(obj);\n};\n\nEmber.oneWay = function(obj, to, from) {\n return new Ember.Binding(to, from).oneWay().connect(obj);\n};\n\n})();\n//@ sourceURL=ember-metal/binding");minispade.register('ember-metal/computed', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\nminispade.require('ember-metal/utils');\nminispade.require('ember-metal/properties');\n\n\nEmber.warn(\"Computed properties will soon be cacheable by default. To enable this in your app, set `ENV.CP_DEFAULT_CACHEABLE = true`.\", Ember.CP_DEFAULT_CACHEABLE);\n\n\nvar meta = Ember.meta;\nvar guidFor = Ember.guidFor;\nvar USE_ACCESSORS = Ember.USE_ACCESSORS;\nvar a_slice = Array.prototype.slice;\nvar o_create = Ember.platform.create;\nvar o_defineProperty = Ember.platform.defineProperty;\n\n// ..........................................................\n// DEPENDENT KEYS\n//\n\n// data structure:\n// meta.deps = {\n// 'depKey': {\n// 'keyName': count,\n// __emberproto__: SRC_OBJ [to detect clones]\n// },\n// __emberproto__: SRC_OBJ\n// }\n\n/** @private */\nfunction uniqDeps(obj, depKey) {\n var m = meta(obj), deps, ret;\n deps = m.deps;\n if (!deps) {\n deps = m.deps = { __emberproto__: obj };\n } else if (deps.__emberproto__ !== obj) {\n deps = m.deps = o_create(deps);\n deps.__emberproto__ = obj;\n }\n\n ret = deps[depKey];\n if (!ret) {\n ret = deps[depKey] = { __emberproto__: obj };\n } else if (ret.__emberproto__ !== obj) {\n ret = deps[depKey] = o_create(ret);\n ret.__emberproto__ = obj;\n }\n\n return ret;\n}\n\n/** @private */\nfunction addDependentKey(obj, keyName, depKey) {\n var deps = uniqDeps(obj, depKey);\n deps[keyName] = (deps[keyName] || 0) + 1;\n Ember.watch(obj, depKey);\n}\n\n/** @private */\nfunction removeDependentKey(obj, keyName, depKey) {\n var deps = uniqDeps(obj, depKey);\n deps[keyName] = (deps[keyName] || 0) - 1;\n Ember.unwatch(obj, depKey);\n}\n\n/** @private */\nfunction addDependentKeys(desc, obj, keyName) {\n var keys = desc._dependentKeys,\n len = keys ? keys.length : 0;\n for(var idx=0;idx<len;idx++) addDependentKey(obj, keyName, keys[idx]);\n}\n\n// ..........................................................\n// COMPUTED PROPERTY\n//\n\n/** @private */\nfunction ComputedProperty(func, opts) {\n this.func = func;\n this._cacheable = (opts && opts.cacheable !== undefined) ? opts.cacheable : Ember.CP_DEFAULT_CACHEABLE;\n this._dependentKeys = opts && opts.dependentKeys;\n}\n\n/**\n @constructor\n*/\nEmber.ComputedProperty = ComputedProperty;\nComputedProperty.prototype = new Ember.Descriptor();\n\nvar CP_DESC = {\n configurable: true,\n enumerable: true,\n get: function() { return undefined; }, // for when use_accessors is false.\n set: Ember.Descriptor.MUST_USE_SETTER // for when use_accessors is false\n};\n\n/** @private */\nfunction mkCpGetter(keyName, desc) {\n var cacheable = desc._cacheable,\n func = desc.func;\n\n if (cacheable) {\n return function() {\n var ret, cache = meta(this).cache;\n if (keyName in cache) return cache[keyName];\n ret = cache[keyName] = func.call(this, keyName);\n return ret ;\n };\n } else {\n return function() {\n return func.call(this, keyName);\n };\n }\n}\n\n/** @private */\nfunction mkCpSetter(keyName, desc) {\n var cacheable = desc._cacheable,\n func = desc.func;\n\n return function(value) {\n var m = meta(this, cacheable),\n watched = (m.source===this) && m.watching[keyName]>0,\n ret, oldSuspended, lastSetValues;\n\n oldSuspended = desc._suspended;\n desc._suspended = this;\n\n watched = watched && m.lastSetValues[keyName]!==guidFor(value);\n if (watched) {\n m.lastSetValues[keyName] = guidFor(value);\n Ember.propertyWillChange(this, keyName);\n }\n\n if (cacheable) delete m.cache[keyName];\n ret = func.call(this, keyName, value);\n if (cacheable) m.cache[keyName] = ret;\n if (watched) Ember.propertyDidChange(this, keyName);\n desc._suspended = oldSuspended;\n return ret;\n };\n}\n\n/**\n @extends Ember.ComputedProperty\n @private\n*/\nvar Cp = ComputedProperty.prototype;\n\n/**\n Call on a computed property to set it into cacheable mode. When in this\n mode the computed property will automatically cache the return value of\n your function until one of the dependent keys changes.\n\n MyApp.president = Ember.Object.create({\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // After calculating the value of this function, Ember.js will\n // return that value without re-executing this function until\n // one of the dependent properties change.\n }.property('firstName', 'lastName').cacheable()\n });\n\n Properties are cacheable by default.\n\n @name Ember.ComputedProperty.cacheable\n @param {Boolean} aFlag optional set to false to disable caching\n @returns {Ember.ComputedProperty} receiver\n*/\nCp.cacheable = function(aFlag) {\n this._cacheable = aFlag!==false;\n return this;\n};\n\n/**\n Call on a computed property to set it into non-cached mode. When in this\n mode the computed property will not automatically cache the return value.\n\n MyApp.outsideService = Ember.Object.create({\n value: function() {\n return OutsideService.getValue();\n }.property().volatile()\n });\n\n @name Ember.ComputedProperty.volatile\n @returns {Ember.ComputedProperty} receiver\n*/\nCp.volatile = function() {\n return this.cacheable(false);\n};\n\n/**\n Sets the dependent keys on this computed property. Pass any number of\n arguments containing key paths that this computed property depends on.\n\n MyApp.president = Ember.Object.create({\n fullName: Ember.computed(function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Tell Ember.js that this computed property depends on firstName\n // and lastName\n }).property('firstName', 'lastName')\n });\n\n @name Ember.ComputedProperty.property\n @param {String} path... zero or more property paths\n @returns {Ember.ComputedProperty} receiver\n*/\nCp.property = function() {\n this._dependentKeys = a_slice.call(arguments);\n return this;\n};\n\n/**\n In some cases, you may want to annotate computed properties with additional\n metadata about how they function or what values they operate on. For example,\n computed property functions may close over variables that are then no longer\n available for introspection.\n\n You can pass a hash of these values to a computed property like this:\n\n person: function() {\n var personId = this.get('personId');\n return App.Person.create({ id: personId });\n }.property().meta({ type: App.Person })\n\n The hash that you pass to the `meta()` function will be saved on the\n computed property descriptor under the `_meta` key. Ember runtime\n exposes a public API for retrieving these values from classes,\n via the `metaForProperty()` function.\n\n @name Ember.ComputedProperty.meta\n @param {Hash} metadata\n @returns {Ember.ComputedProperty} property descriptor instance\n*/\n\nCp.meta = function(meta) {\n this._meta = meta;\n return this;\n};\n\n/** @private - impl descriptor API */\nCp.setup = function(obj, keyName, value) {\n CP_DESC.get = mkCpGetter(keyName, this);\n CP_DESC.set = mkCpSetter(keyName, this);\n o_defineProperty(obj, keyName, CP_DESC);\n CP_DESC.get = CP_DESC.set = null;\n addDependentKeys(this, obj, keyName);\n};\n\n/** @private - impl descriptor API */\nCp.teardown = function(obj, keyName) {\n var keys = this._dependentKeys,\n len = keys ? keys.length : 0;\n for(var idx=0;idx<len;idx++) removeDependentKey(obj, keyName, keys[idx]);\n\n if (this._cacheable) delete meta(obj).cache[keyName];\n\n return null; // no value to restore\n};\n\n/** @private - impl descriptor API */\nCp.didChange = function(obj, keyName) {\n if (this._cacheable && (this._suspended !== obj)) {\n delete meta(obj).cache[keyName];\n }\n};\n\n/** @private - impl descriptor API */\nCp.get = function(obj, keyName) {\n var ret, cache;\n\n if (this._cacheable) {\n cache = meta(obj).cache;\n if (keyName in cache) return cache[keyName];\n ret = cache[keyName] = this.func.call(obj, keyName);\n } else {\n ret = this.func.call(obj, keyName);\n }\n return ret ;\n};\n\n/** @private - impl descriptor API */\nCp.set = function(obj, keyName, value) {\n var cacheable = this._cacheable;\n\n var m = meta(obj, cacheable),\n watched = (m.source===obj) && m.watching[keyName]>0,\n ret, oldSuspended, lastSetValues;\n\n oldSuspended = this._suspended;\n this._suspended = obj;\n\n watched = watched && m.lastSetValues[keyName]!==guidFor(value);\n if (watched) {\n m.lastSetValues[keyName] = guidFor(value);\n Ember.propertyWillChange(obj, keyName);\n }\n\n if (cacheable) delete m.cache[keyName];\n ret = this.func.call(obj, keyName, value);\n if (cacheable) m.cache[keyName] = ret;\n if (watched) Ember.propertyDidChange(obj, keyName);\n this._suspended = oldSuspended;\n return ret;\n};\n\nCp.val = function(obj, keyName) {\n return meta(obj, false).values[keyName];\n};\n\nif (!Ember.platform.hasPropertyAccessors) {\n Cp.setup = function(obj, keyName, value) {\n obj[keyName] = undefined; // so it shows up in key iteration\n addDependentKeys(this, obj, keyName);\n };\n\n} else if (!USE_ACCESSORS) {\n Cp.setup = function(obj, keyName) {\n // throw exception if not using Ember.get() and Ember.set() when supported\n o_defineProperty(obj, keyName, CP_DESC);\n addDependentKeys(this, obj, keyName);\n };\n}\n\n/**\n This helper returns a new property descriptor that wraps the passed\n computed property function. You can use this helper to define properties\n with mixins or via Ember.defineProperty().\n\n The function you pass will be used to both get and set property values.\n The function should accept two parameters, key and value. If value is not\n undefined you should set the value first. In either case return the\n current value of the property.\n\n @param {Function} func\n The computed property function.\n\n @returns {Ember.ComputedProperty} property descriptor instance\n*/\nEmber.computed = function(func) {\n var args;\n\n if (arguments.length > 1) {\n args = a_slice.call(arguments, 0, -1);\n func = a_slice.call(arguments, -1)[0];\n }\n\n var cp = new ComputedProperty(func);\n\n if (args) {\n cp.property.apply(cp, args);\n }\n\n return cp;\n};\n\n/**\n Returns the cached value for a property, if one exists.\n This can be useful for peeking at the value of a computed\n property that is generated lazily, without accidentally causing\n it to be created.\n\n @param {Object} obj the object whose property you want to check\n @param {String} key the name of the property whose cached value you want\n to return\n\n*/\nEmber.cacheFor = function(obj, key) {\n var cache = meta(obj, false).cache;\n\n if (cache && key in cache) {\n return cache[key];\n }\n};\n\n})();\n//@ sourceURL=ember-metal/computed");minispade.register('ember-metal/core', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Em:true ENV */\n\nif ('undefined' === typeof Ember) {\n/**\n @namespace\n @name Ember\n @version 0.9.8.1\n\n All Ember methods and functions are defined inside of this namespace.\n You generally should not add new properties to this namespace as it may be\n overwritten by future versions of Ember.\n\n You can also use the shorthand \"Em\" instead of \"Ember\".\n\n Ember-Runtime is a framework that provides core functions for\n Ember including cross-platform functions, support for property\n observing and objects. Its focus is on small size and performance. You can\n use this in place of or along-side other cross-platform libraries such as\n jQuery.\n\n The core Runtime framework is based on the jQuery API with a number of\n performance optimizations.\n*/\n\n// Create core object. Make it act like an instance of Ember.Namespace so that\n// objects assigned to it are given a sane string representation.\nEmber = {};\n\n// aliases needed to keep minifiers from removing the global context\nif ('undefined' !== typeof window) {\n window.Em = window.Ember = Em = Ember;\n}\n\n}\n\n// Make sure these are set whether Ember was already defined or not\n\nEmber.isNamespace = true;\n\nEmber.toString = function() { return \"Ember\"; };\n\n\n/**\n @static\n @type String\n @default '0.9.8.1'\n @constant\n*/\nEmber.VERSION = '0.9.8.1';\n\n/**\n @static\n @type Hash\n @constant\n\n Standard environmental variables. You can define these in a global `ENV`\n variable before loading Ember to control various configuration\n settings.\n*/\nEmber.ENV = 'undefined' === typeof ENV ? {} : ENV;\n\n\n// ..........................................................\n// BOOTSTRAP\n//\n\n/**\n @static\n @type Boolean\n @default true\n @constant\n\n Determines whether Ember should enhances some built-in object\n prototypes to provide a more friendly API. If enabled, a few methods\n will be added to Function, String, and Array. Object.prototype will not be\n enhanced, which is the one that causes most troubles for people.\n\n In general we recommend leaving this option set to true since it rarely\n conflicts with other code. If you need to turn it off however, you can\n define an ENV.EXTEND_PROTOTYPES config to disable it.\n*/\nEmber.EXTEND_PROTOTYPES = (Ember.ENV.EXTEND_PROTOTYPES !== false);\n\n\n/**\n @static\n @type Boolean\n @default Ember.EXTEND_PROTOTYPES\n @constant\n\n Determines whether Ember should add ECMAScript 5 shims to older browsers.\n*/\nEmber.SHIM_ES5 = (Ember.ENV.SHIM_ES5 === false) ? false : Ember.EXTEND_PROTOTYPES;\n\n\n/**\n @static\n @type Boolean\n @default false\n @constant\n\n Determines whether computed properties are cacheable by default.\n In future releases this will default to `true`. For the 1.0 release,\n the option to turn off caching by default will be removed entirely.\n\n When caching is enabled by default, you can use `volatile()` to disable\n caching on individual computed properties.\n*/\nEmber.CP_DEFAULT_CACHEABLE = !!Ember.ENV.CP_DEFAULT_CACHEABLE;\n\n/**\n @static\n @type Boolean\n @default false\n @constant\n\n Determines whether views render their templates using themselves\n as the context, or whether it is inherited from the parent. In\n future releases, this will default to `true`. For the 1.0 release,\n the option to have views change context by default will be removed entirely.\n\n If you need to update your application to use the new context rules, simply\n prefix property access with `view.`:\n\n // Before:\n {{#each App.photosController}}\n Photo Title: {{title}}\n {{#view App.InfoView contentBinding=\"this\"}}\n {{content.date}}\n {{content.cameraType}}\n {{otherViewProperty}}\n {{/view}}\n {{/each}}\n\n // After:\n {{#each App.photosController}}\n Photo Title: {{title}}\n {{#view App.InfoView}}\n {{date}}\n {{cameraType}}\n {{view.otherViewProperty}}\n {{/view}}\n {{/each}}\n*/\nEmber.VIEW_PRESERVES_CONTEXT = !!Ember.ENV.VIEW_PRESERVES_CONTEXT;\n\n/**\n Empty function. Useful for some operations.\n\n @returns {Object}\n @private\n*/\nEmber.K = function() { return this; };\n\n/**\n @namespace\n @name window\n @description The global window object\n*/\n\n\n// Stub out the methods defined by the ember-debug package in case it's not loaded\n\nif ('undefined' === typeof Ember.assert) { Ember.assert = Ember.K; }\nif ('undefined' === typeof Ember.warn) { Ember.warn = Ember.K; }\nif ('undefined' === typeof Ember.deprecate) { Ember.deprecate = Ember.K; }\nif ('undefined' === typeof Ember.deprecateFunc) {\n Ember.deprecateFunc = function(_, func) { return func; };\n}\n\n// These are deprecated but still supported\n\nif ('undefined' === typeof ember_assert) { window.ember_assert = Ember.K; }\nif ('undefined' === typeof ember_warn) { window.ember_warn = Ember.K; }\nif ('undefined' === typeof ember_deprecate) { window.ember_deprecate = Ember.K; }\nif ('undefined' === typeof ember_deprecateFunc) {\n /** @private */\n window.ember_deprecateFunc = function(_, func) { return func; };\n}\n\n\n// ..........................................................\n// LOGGER\n//\n\n/**\n @class\n\n Inside Ember-Metal, simply uses the window.console object.\n Override this to provide more robust logging functionality.\n*/\nEmber.Logger = window.console || { log: Ember.K, warn: Ember.K, error: Ember.K };\n\n})();\n//@ sourceURL=ember-metal/core");minispade.register('ember-metal/events', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\nminispade.require('ember-metal/utils');\n\nvar o_create = Ember.platform.create;\nvar meta = Ember.meta;\nvar guidFor = Ember.guidFor;\nvar a_slice = Array.prototype.slice;\n\n/**\n The event system uses a series of nested hashes to store listeners on an\n object. When a listener is registered, or when an event arrives, these\n hashes are consulted to determine which target and action pair to invoke.\n\n The hashes are stored in the object's meta hash, and look like this:\n\n // Object's meta hash\n {\n listeners: { // variable name: `listenerSet`\n \"foo:changed\": { // variable name: `targetSet`\n [targetGuid]: { // variable name: `actionSet`\n [methodGuid]: { // variable name: `action`\n target: [Object object],\n method: [Function function],\n xform: [Function function]\n }\n }\n }\n }\n }\n\n*/\n\n/** @private */\nvar metaPath = Ember.metaPath;\n\n// Gets the set of all actions, keyed on the guid of each action's\n// method property.\n/** @private */\nfunction actionSetFor(obj, eventName, target, writable) {\n var targetGuid = guidFor(target);\n return metaPath(obj, ['listeners', eventName, targetGuid], writable);\n}\n\n// Gets the set of all targets, keyed on the guid of each action's\n// target property.\n/** @private */\nfunction targetSetFor(obj, eventName) {\n var listenerSet = meta(obj, false).listeners;\n if (!listenerSet) { return false; }\n\n return listenerSet[eventName] || false;\n}\n\n// TODO: This knowledge should really be a part of the\n// meta system.\nvar SKIP_PROPERTIES = { __ember_source__: true };\n\n/** @private */\nfunction iterateSet(targetSet, callback, params) {\n if (!targetSet) { return false; }\n // Iterate through all elements of the target set\n for(var targetGuid in targetSet) {\n if (SKIP_PROPERTIES[targetGuid]) { continue; }\n\n var actionSet = targetSet[targetGuid];\n if (actionSet) {\n // Iterate through the elements of the action set\n for(var methodGuid in actionSet) {\n if (SKIP_PROPERTIES[methodGuid]) { continue; }\n\n var action = actionSet[methodGuid];\n if (action) {\n if (callback(action, params) === true) {\n return true;\n }\n }\n }\n }\n }\n return false;\n}\n\n/** @private */\nfunction invokeAction(action, params) {\n var method = action.method, target = action.target, xform = action.xform;\n // If there is no target, the target is the object\n // on which the event was fired.\n if (!target) { target = params[0]; }\n if ('string' === typeof method) { method = target[method]; }\n\n // Listeners can provide an `xform` function, which can perform\n // arbitrary transformations, such as changing the order of\n // parameters.\n //\n // This is primarily used by ember-runtime's observer system, which\n // provides a higher level abstraction on top of events, including\n // dynamically looking up current values and passing them into the\n // registered listener.\n if (xform) {\n xform(target, method, params);\n } else {\n method.apply(target, params);\n }\n}\n\n/**\n The parameters passed to an event listener are not exactly the\n parameters passed to an observer. if you pass an xform function, it will\n be invoked and is able to translate event listener parameters into the form\n that observers are expecting.\n\n @memberOf Ember\n*/\nfunction addListener(obj, eventName, target, method, xform) {\n Ember.assert(\"You must pass at least an object and event name to Ember.addListener\", !!obj && !!eventName);\n\n if (!method && 'function' === typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method);\n\n if (!actionSet[methodGuid]) {\n actionSet[methodGuid] = { target: target, method: method, xform: xform };\n } else {\n actionSet[methodGuid].xform = xform; // used by observers etc to map params\n }\n\n if ('function' === typeof obj.didAddListener) {\n obj.didAddListener(eventName, target, method);\n }\n}\n\n/** @memberOf Ember */\nfunction removeListener(obj, eventName, target, method) {\n if (!method && 'function'===typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method);\n\n // we can't simply delete this parameter, because if we do, we might\n // re-expose the property from the prototype chain.\n if (actionSet && actionSet[methodGuid]) { actionSet[methodGuid] = null; }\n\n if (obj && 'function'===typeof obj.didRemoveListener) {\n obj.didRemoveListener(eventName, target, method);\n }\n}\n\n// Suspend listener during callback.\n//\n// This should only be used by the target of the event listener\n// when it is taking an action that would cause the event, e.g.\n// an object might suspend its property change listener while it is\n// setting that property.\n/** @private */\nfunction suspendListener(obj, eventName, target, method, callback) {\n if (!method && 'function' === typeof target) {\n method = target;\n target = null;\n }\n\n var actionSet = actionSetFor(obj, eventName, target, true),\n methodGuid = guidFor(method),\n action = actionSet && actionSet[methodGuid];\n\n actionSet[methodGuid] = null;\n try {\n return callback.call(target);\n } finally {\n actionSet[methodGuid] = action;\n }\n}\n\n// returns a list of currently watched events\n/** @memberOf Ember */\nfunction watchedEvents(obj) {\n var listeners = meta(obj, false).listeners, ret = [];\n\n if (listeners) {\n for(var eventName in listeners) {\n if (!SKIP_PROPERTIES[eventName] && listeners[eventName]) {\n ret.push(eventName);\n }\n }\n }\n return ret;\n}\n\n/** @memberOf Ember */\nfunction sendEvent(obj, eventName) {\n\n // first give object a chance to handle it\n if (obj !== Ember && 'function' === typeof obj.sendEvent) {\n obj.sendEvent.apply(obj, a_slice.call(arguments, 1));\n }\n\n var targetSet = targetSetFor(obj, eventName);\n iterateSet(targetSet, invokeAction, arguments);\n\n return true;\n}\n\n/** @memberOf Ember */\nfunction deferEvent(obj, eventName) {\n var targetSet = targetSetFor(obj, eventName), actions = [], params = arguments;\n iterateSet(targetSet, function (action) {\n actions.push(action);\n });\n\n return function() {\n if (obj !== Ember && 'function' === typeof obj.sendEvent) {\n obj.sendEvent.apply(obj, a_slice.call(params, 1));\n }\n\n for (var i=0, len=actions.length; i < len; ++i) {\n invokeAction(actions[i], params);\n }\n };\n}\n\n/** @memberOf Ember */\nfunction hasListeners(obj, eventName) {\n var targetSet = targetSetFor(obj, eventName);\n if (iterateSet(targetSet, function () {return true;})) {\n return true;\n }\n\n // no listeners! might as well clean this up so it is faster later.\n var set = metaPath(obj, ['listeners'], true);\n set[eventName] = null;\n\n return false;\n}\n\n/** @memberOf Ember */\nfunction listenersFor(obj, eventName) {\n var targetSet = targetSetFor(obj, eventName), ret = [];\n iterateSet(targetSet, function (action) {\n ret.push([action.target, action.method]);\n });\n return ret;\n}\n\nEmber.addListener = addListener;\nEmber.removeListener = removeListener;\nEmber._suspendListener = suspendListener;\nEmber.sendEvent = sendEvent;\nEmber.hasListeners = hasListeners;\nEmber.watchedEvents = watchedEvents;\nEmber.listenersFor = listenersFor;\nEmber.deferEvent = deferEvent;\n})();\n//@ sourceURL=ember-metal/events");minispade.register('ember-metal', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\nminispade.require('ember-metal/utils');\nminispade.require('ember-metal/accessors');\nminispade.require('ember-metal/properties');\nminispade.require('ember-metal/computed');\nminispade.require('ember-metal/watching');\nminispade.require('ember-metal/events');\nminispade.require('ember-metal/observer');\nminispade.require('ember-metal/mixin');\nminispade.require('ember-metal/binding');\nminispade.require('ember-metal/run_loop');\n\n})();\n//@ sourceURL=ember-metal");minispade.register('ember-metal/mixin', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/accessors');\nminispade.require('ember-metal/computed');\nminispade.require('ember-metal/properties');\nminispade.require('ember-metal/observer');\nminispade.require('ember-metal/utils');\nminispade.require('ember-metal/array');\nminispade.require('ember-metal/binding');\n\nvar Mixin, MixinDelegate, REQUIRED, Alias;\nvar classToString, superClassString;\n\nvar a_map = Ember.ArrayUtils.map;\nvar a_indexOf = Ember.ArrayUtils.indexOf;\nvar a_forEach = Ember.ArrayUtils.forEach;\nvar a_slice = Array.prototype.slice;\nvar EMPTY_META = {}; // dummy for non-writable meta\nvar META_SKIP = { __emberproto__: true, __ember_count__: true };\n\nvar o_create = Ember.platform.create;\n\n/** @private */\nfunction meta(obj, writable) {\n var m = Ember.meta(obj, writable!==false), ret = m.mixins;\n if (writable===false) return ret || EMPTY_META;\n\n if (!ret) {\n ret = m.mixins = { __emberproto__: obj };\n } else if (ret.__emberproto__ !== obj) {\n ret = m.mixins = o_create(ret);\n ret.__emberproto__ = obj;\n }\n return ret;\n}\n\n/** @private */\nfunction initMixin(mixin, args) {\n if (args && args.length > 0) {\n mixin.mixins = a_map(args, function(x) {\n if (x instanceof Mixin) return x;\n\n // Note: Manually setup a primitive mixin here. This is the only\n // way to actually get a primitive mixin. This way normal creation\n // of mixins will give you combined mixins...\n var mixin = new Mixin();\n mixin.properties = x;\n return mixin;\n });\n }\n return mixin;\n}\n\nvar NATIVES = [Boolean, Object, Number, Array, Date, String];\n/** @private */\nfunction isMethod(obj) {\n if ('function' !== typeof obj || obj.isMethod===false) return false;\n return a_indexOf(NATIVES, obj)<0;\n}\n\n/** @private */\nfunction mergeMixins(mixins, m, descs, values, base) {\n var len = mixins.length, idx, mixin, guid, props, value, key, ovalue, concats;\n\n /** @private */\n function removeKeys(keyName) {\n delete descs[keyName];\n delete values[keyName];\n }\n\n for(idx=0;idx<len;idx++) {\n\n mixin = mixins[idx];\n if (!mixin) throw new Error('Null value found in Ember.mixin()');\n\n if (mixin instanceof Mixin) {\n guid = Ember.guidFor(mixin);\n if (m[guid]) continue;\n m[guid] = mixin;\n props = mixin.properties;\n } else {\n props = mixin; // apply anonymous mixin properties\n }\n\n if (props) {\n\n // reset before adding each new mixin to pickup concats from previous\n concats = values.concatenatedProperties || base.concatenatedProperties;\n if (props.concatenatedProperties) {\n concats = concats ? concats.concat(props.concatenatedProperties) : props.concatenatedProperties;\n }\n\n for (key in props) {\n if (!props.hasOwnProperty(key)) continue;\n value = props[key];\n if (value instanceof Ember.Descriptor) {\n if (value === REQUIRED && descs[key]) { continue; }\n\n descs[key] = value;\n values[key] = undefined;\n } else {\n\n // impl super if needed...\n if (isMethod(value)) {\n ovalue = (descs[key] === Ember.SIMPLE_PROPERTY) && values[key];\n if (!ovalue) ovalue = base[key];\n if ('function' !== typeof ovalue) ovalue = null;\n if (ovalue) {\n var o = value.__ember_observes__, ob = value.__ember_observesBefore__;\n value = Ember.wrap(value, ovalue);\n value.__ember_observes__ = o;\n value.__ember_observesBefore__ = ob;\n }\n } else if ((concats && a_indexOf(concats, key)>=0) || key === 'concatenatedProperties') {\n var baseValue = values[key] || base[key];\n value = baseValue ? baseValue.concat(value) : Ember.makeArray(value);\n }\n\n descs[key] = Ember.SIMPLE_PROPERTY;\n values[key] = value;\n }\n }\n\n // manually copy toString() because some JS engines do not enumerate it\n if (props.hasOwnProperty('toString')) {\n base.toString = props.toString;\n }\n\n } else if (mixin.mixins) {\n mergeMixins(mixin.mixins, m, descs, values, base);\n if (mixin._without) a_forEach(mixin._without, removeKeys);\n }\n }\n}\n\n/** @private */\nvar defineProperty = Ember.defineProperty;\n\n/** @private */\nfunction writableReq(obj) {\n var m = Ember.meta(obj), req = m.required;\n if (!req || (req.__emberproto__ !== obj)) {\n req = m.required = req ? o_create(req) : { __ember_count__: 0 };\n req.__emberproto__ = obj;\n }\n return req;\n}\n\n/** @private */\nfunction getObserverPaths(value) {\n return ('function' === typeof value) && value.__ember_observes__;\n}\n\n/** @private */\nfunction getBeforeObserverPaths(value) {\n return ('function' === typeof value) && value.__ember_observesBefore__;\n}\n\nvar IS_BINDING = Ember.IS_BINDING = /^.+Binding$/;\n\nfunction detectBinding(obj, key, m) {\n if (IS_BINDING.test(key)) {\n var bindings = m.bindings;\n if (!bindings) {\n bindings = m.bindings = { __emberproto__: obj };\n } else if (bindings.__emberproto__ !== obj) {\n bindings = m.bindings = o_create(m.bindings);\n bindings.__emberproto__ = obj;\n }\n bindings[key] = true;\n }\n}\n\nfunction connectBindings(obj, m) {\n if (m === undefined) {\n m = Ember.meta(obj);\n }\n var bindings = m.bindings, key, binding;\n if (bindings) {\n for (key in bindings) {\n binding = key !== '__emberproto__' && obj[key];\n if (binding) {\n if (binding instanceof Ember.Binding) {\n binding = binding.copy(); // copy prototypes' instance\n binding.to(key.slice(0, -7));\n } else {\n binding = new Ember.Binding(key.slice(0,-7), binding);\n }\n binding.connect(obj);\n obj[key] = binding;\n }\n }\n }\n}\n\n/** @private */\nfunction applyMixin(obj, mixins, partial) {\n var descs = {}, values = {}, m = Ember.meta(obj), req = m.required;\n var key, willApply, didApply, value, desc;\n\n // Go through all mixins and hashes passed in, and:\n //\n // * Handle concatenated properties\n // * Set up _super wrapping if necessary\n // * Set up descriptors (simple, watched or computed properties)\n // * Copying `toString` in broken browsers\n mergeMixins(mixins, meta(obj), descs, values, obj);\n\n if (MixinDelegate.detect(obj)) {\n willApply = values.willApplyProperty || obj.willApplyProperty;\n didApply = values.didApplyProperty || obj.didApplyProperty;\n }\n\n for(key in descs) {\n if (!descs.hasOwnProperty(key)) continue;\n\n desc = descs[key];\n value = values[key];\n\n if (desc === REQUIRED) {\n if (!(key in obj)) {\n if (!partial) throw new Error('Required property not defined: '+key);\n\n // for partial applies add to hash of required keys\n req = writableReq(obj);\n req.__ember_count__++;\n req[key] = true;\n }\n\n } else {\n\n while (desc instanceof Alias) {\n\n var altKey = desc.methodName;\n if (descs[altKey]) {\n value = values[altKey];\n desc = descs[altKey];\n } else if (m.descs[altKey]) {\n desc = m.descs[altKey];\n value = desc.val(obj, altKey);\n } else {\n value = obj[altKey];\n desc = Ember.SIMPLE_PROPERTY;\n }\n }\n\n if (willApply) willApply.call(obj, key);\n\n var observerPaths = getObserverPaths(value),\n curObserverPaths = observerPaths && getObserverPaths(obj[key]),\n beforeObserverPaths = getBeforeObserverPaths(value),\n curBeforeObserverPaths = beforeObserverPaths && getBeforeObserverPaths(obj[key]),\n len, idx;\n\n if (curObserverPaths) {\n len = curObserverPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.removeObserver(obj, curObserverPaths[idx], null, key);\n }\n }\n\n if (curBeforeObserverPaths) {\n len = curBeforeObserverPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.removeBeforeObserver(obj, curBeforeObserverPaths[idx], null,key);\n }\n }\n\n detectBinding(obj, key, m);\n\n defineProperty(obj, key, desc, value);\n\n if (observerPaths) {\n len = observerPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.addObserver(obj, observerPaths[idx], null, key);\n }\n }\n\n if (beforeObserverPaths) {\n len = beforeObserverPaths.length;\n for(idx=0;idx<len;idx++) {\n Ember.addBeforeObserver(obj, beforeObserverPaths[idx], null, key);\n }\n }\n\n if (req && req[key]) {\n req = writableReq(obj);\n req.__ember_count__--;\n req[key] = false;\n }\n\n if (didApply) didApply.call(obj, key);\n\n }\n }\n\n if (!partial) { // don't apply to prototype\n value = connectBindings(obj, m);\n }\n\n // Make sure no required attrs remain\n if (!partial && req && req.__ember_count__>0) {\n var keys = [];\n for(key in req) {\n if (META_SKIP[key]) continue;\n keys.push(key);\n }\n throw new Error('Required properties not defined: '+keys.join(','));\n }\n return obj;\n}\n\nEmber.mixin = function(obj) {\n var args = a_slice.call(arguments, 1);\n return applyMixin(obj, args, false);\n};\n\n\n/**\n @constructor\n*/\nEmber.Mixin = function() { return initMixin(this, arguments); };\n\n/** @private */\nMixin = Ember.Mixin;\n\n/** @private */\nMixin._apply = applyMixin;\n\nMixin.applyPartial = function(obj) {\n var args = a_slice.call(arguments, 1);\n return applyMixin(obj, args, true);\n};\n\nMixin.finishPartial = function(obj) {\n connectBindings(obj);\n return obj;\n};\n\nMixin.create = function() {\n classToString.processed = false;\n var M = this;\n return initMixin(new M(), arguments);\n};\n\nMixin.prototype.reopen = function() {\n\n var mixin, tmp;\n\n if (this.properties) {\n mixin = Mixin.create();\n mixin.properties = this.properties;\n delete this.properties;\n this.mixins = [mixin];\n }\n\n var len = arguments.length, mixins = this.mixins, idx;\n\n for(idx=0;idx<len;idx++) {\n mixin = arguments[idx];\n if (mixin instanceof Mixin) {\n mixins.push(mixin);\n } else {\n tmp = Mixin.create();\n tmp.properties = mixin;\n mixins.push(tmp);\n }\n }\n\n return this;\n};\n\nvar TMP_ARRAY = [];\nMixin.prototype.apply = function(obj) {\n TMP_ARRAY[0] = this;\n var ret = applyMixin(obj, TMP_ARRAY, false);\n TMP_ARRAY.length=0;\n return ret;\n};\n\nMixin.prototype.applyPartial = function(obj) {\n TMP_ARRAY[0] = this;\n var ret = applyMixin(obj, TMP_ARRAY, true);\n TMP_ARRAY.length=0;\n return ret;\n};\n\n/** @private */\nfunction _detect(curMixin, targetMixin, seen) {\n var guid = Ember.guidFor(curMixin);\n\n if (seen[guid]) return false;\n seen[guid] = true;\n\n if (curMixin === targetMixin) return true;\n var mixins = curMixin.mixins, loc = mixins ? mixins.length : 0;\n while(--loc >= 0) {\n if (_detect(mixins[loc], targetMixin, seen)) return true;\n }\n return false;\n}\n\nMixin.prototype.detect = function(obj) {\n if (!obj) return false;\n if (obj instanceof Mixin) return _detect(obj, this, {});\n return !!meta(obj, false)[Ember.guidFor(this)];\n};\n\nMixin.prototype.without = function() {\n var ret = new Mixin(this);\n ret._without = a_slice.call(arguments);\n return ret;\n};\n\n/** @private */\nfunction _keys(ret, mixin, seen) {\n if (seen[Ember.guidFor(mixin)]) return;\n seen[Ember.guidFor(mixin)] = true;\n\n if (mixin.properties) {\n var props = mixin.properties;\n for(var key in props) {\n if (props.hasOwnProperty(key)) ret[key] = true;\n }\n } else if (mixin.mixins) {\n a_forEach(mixin.mixins, function(x) { _keys(ret, x, seen); });\n }\n}\n\nMixin.prototype.keys = function() {\n var keys = {}, seen = {}, ret = [];\n _keys(keys, this, seen);\n for(var key in keys) {\n if (keys.hasOwnProperty(key)) ret.push(key);\n }\n return ret;\n};\n\n/** @private - make Mixin's have nice displayNames */\n\nvar NAME_KEY = Ember.GUID_KEY+'_name';\nvar get = Ember.get;\n\n/** @private */\nfunction processNames(paths, root, seen) {\n var idx = paths.length;\n for(var key in root) {\n if (!root.hasOwnProperty || !root.hasOwnProperty(key)) continue;\n var obj = root[key];\n paths[idx] = key;\n\n if (obj && obj.toString === classToString) {\n obj[NAME_KEY] = paths.join('.');\n } else if (obj && get(obj, 'isNamespace')) {\n if (seen[Ember.guidFor(obj)]) continue;\n seen[Ember.guidFor(obj)] = true;\n processNames(paths, obj, seen);\n }\n\n }\n paths.length = idx; // cut out last item\n}\n\n/** @private */\nfunction findNamespaces() {\n var Namespace = Ember.Namespace, obj, isNamespace;\n\n if (Namespace.PROCESSED) { return; }\n\n for (var prop in window) {\n // get(window.globalStorage, 'isNamespace') would try to read the storage for domain isNamespace and cause exception in Firefox.\n // globalStorage is a storage obsoleted by the WhatWG storage specification. See https://developer.mozilla.org/en/DOM/Storage#globalStorage\n if (prop === \"globalStorage\" && window.StorageList && window.globalStorage instanceof window.StorageList) { continue; }\n // Unfortunately, some versions of IE don't support window.hasOwnProperty\n if (window.hasOwnProperty && !window.hasOwnProperty(prop)) { continue; }\n\n // At times we are not allowed to access certain properties for security reasons.\n // There are also times where even if we can access them, we are not allowed to access their properties.\n try {\n obj = window[prop];\n isNamespace = obj && get(obj, 'isNamespace');\n } catch (e) {\n continue;\n }\n\n if (isNamespace) {\n Ember.deprecate(\"Namespaces should not begin with lowercase.\", /^[A-Z]/.test(prop));\n obj[NAME_KEY] = prop;\n }\n }\n}\n\nEmber.identifyNamespaces = findNamespaces;\n\n/** @private */\nsuperClassString = function(mixin) {\n var superclass = mixin.superclass;\n if (superclass) {\n if (superclass[NAME_KEY]) { return superclass[NAME_KEY]; }\n else { return superClassString(superclass); }\n } else {\n return;\n }\n};\n\n/** @private */\nclassToString = function() {\n var Namespace = Ember.Namespace, namespace;\n\n // TODO: Namespace should really be in Metal\n if (Namespace) {\n if (!this[NAME_KEY] && !classToString.processed) {\n if (!Namespace.PROCESSED) {\n findNamespaces();\n Namespace.PROCESSED = true;\n }\n\n classToString.processed = true;\n\n var namespaces = Namespace.NAMESPACES;\n for (var i=0, l=namespaces.length; i<l; i++) {\n namespace = namespaces[i];\n processNames([namespace.toString()], namespace, {});\n }\n }\n }\n\n if (this[NAME_KEY]) {\n return this[NAME_KEY];\n } else {\n var str = superClassString(this);\n if (str) {\n return \"(subclass of \" + str + \")\";\n } else {\n return \"(unknown mixin)\";\n }\n }\n};\n\nMixin.prototype.toString = classToString;\n\n// returns the mixins currently applied to the specified object\n// TODO: Make Ember.mixin\nMixin.mixins = function(obj) {\n var ret = [], mixins = meta(obj, false), key, mixin;\n for(key in mixins) {\n if (META_SKIP[key]) continue;\n mixin = mixins[key];\n\n // skip primitive mixins since these are always anonymous\n if (!mixin.properties) ret.push(mixins[key]);\n }\n return ret;\n};\n\nREQUIRED = new Ember.Descriptor();\nREQUIRED.toString = function() { return '(Required Property)'; };\n\nEmber.required = function() {\n return REQUIRED;\n};\n\n/** @private */\nAlias = function(methodName) {\n this.methodName = methodName;\n};\nAlias.prototype = new Ember.Descriptor();\n\nEmber.alias = function(methodName) {\n return new Alias(methodName);\n};\n\nEmber.MixinDelegate = Mixin.create({\n\n willApplyProperty: Ember.required(),\n didApplyProperty: Ember.required()\n\n});\n\n/** @private */\nMixinDelegate = Ember.MixinDelegate;\n\n\n// ..........................................................\n// OBSERVER HELPER\n//\n\nEmber.observer = function(func) {\n var paths = a_slice.call(arguments, 1);\n func.__ember_observes__ = paths;\n return func;\n};\n\nEmber.beforeObserver = function(func) {\n var paths = a_slice.call(arguments, 1);\n func.__ember_observesBefore__ = paths;\n return func;\n};\n\n\n\n\n\n\n\n})();\n//@ sourceURL=ember-metal/mixin");minispade.register('ember-metal/observer', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\nminispade.require('ember-metal/utils');\nminispade.require('ember-metal/accessors');\nminispade.require('ember-metal/array');\n\nvar AFTER_OBSERVERS = ':change';\nvar BEFORE_OBSERVERS = ':before';\nvar guidFor = Ember.guidFor;\nvar normalizePath = Ember.normalizePath;\n\nvar deferred = 0;\nvar array_Slice = Array.prototype.slice;\nvar array_ForEach = Ember.ArrayUtils.forEach;\n\n/** @private */\nvar ObserverSet = function () {\n this.targetSet = {};\n};\nObserverSet.prototype.add = function (target, path) {\n var targetSet = this.targetSet,\n targetGuid = Ember.guidFor(target),\n pathSet = targetSet[targetGuid];\n if (!pathSet) {\n targetSet[targetGuid] = pathSet = {};\n }\n if (pathSet[path]) {\n return false;\n } else {\n return pathSet[path] = true;\n }\n};\nObserverSet.prototype.clear = function () {\n this.targetSet = {};\n};\n\n/** @private */\nvar DeferredEventQueue = function() {\n this.targetSet = {};\n this.queue = [];\n};\n\nDeferredEventQueue.prototype.push = function(target, eventName) {\n var targetSet = this.targetSet,\n queue = this.queue,\n targetGuid = Ember.guidFor(target),\n eventNameSet = targetSet[targetGuid],\n index;\n\n if (!eventNameSet) {\n targetSet[targetGuid] = eventNameSet = {};\n }\n index = eventNameSet[eventName];\n if (index === undefined) {\n eventNameSet[eventName] = queue.push(Ember.deferEvent(target, eventName)) - 1;\n } else {\n queue[index] = Ember.deferEvent(target, eventName);\n }\n};\n\nDeferredEventQueue.prototype.flush = function() {\n var queue = this.queue;\n this.queue = [];\n this.targetSet = {};\n for (var i=0, len=queue.length; i < len; ++i) {\n queue[i]();\n }\n};\n\nvar queue = new DeferredEventQueue(), beforeObserverSet = new ObserverSet();\n\n/** @private */\nfunction notifyObservers(obj, eventName, forceNotification) {\n if (deferred && !forceNotification) {\n queue.push(obj, eventName);\n } else {\n Ember.sendEvent(obj, eventName);\n }\n}\n\n/** @private */\nfunction flushObserverQueue() {\n beforeObserverSet.clear();\n\n queue.flush();\n}\n\nEmber.beginPropertyChanges = function() {\n deferred++;\n return this;\n};\n\nEmber.endPropertyChanges = function() {\n deferred--;\n if (deferred<=0) flushObserverQueue();\n};\n\n/**\n Make a series of property changes together in an\n exception-safe way.\n\n Ember.changeProperties(function() {\n obj1.set('foo', mayBlowUpWhenSet);\n obj2.set('bar', baz);\n });\n*/\nEmber.changeProperties = function(cb, binding){\n Ember.beginPropertyChanges();\n try {\n cb.call(binding);\n } finally {\n Ember.endPropertyChanges();\n }\n};\n\n/**\n Set a list of properties on an object. These properties are set inside\n a single `beginPropertyChanges` and `endPropertyChanges` batch, so\n observers will be buffered.\n*/\nEmber.setProperties = function(self, hash) {\n Ember.changeProperties(function(){\n for(var prop in hash) {\n if (hash.hasOwnProperty(prop)) Ember.set(self, prop, hash[prop]);\n }\n });\n return self;\n};\n\n\n/** @private */\nfunction changeEvent(keyName) {\n return keyName+AFTER_OBSERVERS;\n}\n\n/** @private */\nfunction beforeEvent(keyName) {\n return keyName+BEFORE_OBSERVERS;\n}\n\n/** @private */\nfunction changeKey(eventName) {\n return eventName.slice(0, -7);\n}\n\n/** @private */\nfunction beforeKey(eventName) {\n return eventName.slice(0, -7);\n}\n\n/** @private */\nfunction xformForArgs(args) {\n return function (target, method, params) {\n var obj = params[0], keyName = changeKey(params[1]), val;\n var copy_args = args.slice();\n if (method.length>2) {\n val = Ember.getPath(Ember.isGlobalPath(keyName) ? window : obj, keyName);\n }\n copy_args.unshift(obj, keyName, val);\n method.apply(target, copy_args);\n };\n}\n\nvar xformChange = xformForArgs([]);\n\n/** @private */\nfunction xformBefore(target, method, params) {\n var obj = params[0], keyName = beforeKey(params[1]), val;\n if (method.length>2) val = Ember.getPath(obj, keyName);\n method.call(target, obj, keyName, val);\n}\n\nEmber.addObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n\n var xform;\n if (arguments.length > 4) {\n var args = array_Slice.call(arguments, 4);\n xform = xformForArgs(args);\n } else {\n xform = xformChange;\n }\n Ember.addListener(obj, changeEvent(path), target, method, xform);\n Ember.watch(obj, path);\n return this;\n};\n\n/** @private */\nEmber.observersFor = function(obj, path) {\n return Ember.listenersFor(obj, changeEvent(path));\n};\n\nEmber.removeObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n Ember.unwatch(obj, path);\n Ember.removeListener(obj, changeEvent(path), target, method);\n return this;\n};\n\nEmber.addBeforeObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n Ember.addListener(obj, beforeEvent(path), target, method, xformBefore);\n Ember.watch(obj, path);\n return this;\n};\n\n// Suspend observer during callback.\n//\n// This should only be used by the target of the observer\n// while it is setting the observed path.\n/** @private */\nEmber._suspendObserver = function(obj, path, target, method, callback) {\n return Ember._suspendListener(obj, changeEvent(path), target, method, callback);\n};\n\n/** @private */\nEmber.beforeObserversFor = function(obj, path) {\n return Ember.listenersFor(obj, beforeEvent(path));\n};\n\nEmber.removeBeforeObserver = function(obj, path, target, method) {\n path = normalizePath(path);\n Ember.unwatch(obj, path);\n Ember.removeListener(obj, beforeEvent(path), target, method);\n return this;\n};\n\n/** @private */\nEmber.notifyObservers = function(obj, keyName) {\n if (obj.isDestroying) { return; }\n\n notifyObservers(obj, changeEvent(keyName));\n};\n\n/** @private */\nEmber.notifyBeforeObservers = function(obj, keyName) {\n if (obj.isDestroying) { return; }\n\n var guid, set, forceNotification = false;\n\n if (deferred) {\n if (beforeObserverSet.add(obj, keyName)) {\n forceNotification = true;\n } else {\n return;\n }\n }\n\n notifyObservers(obj, beforeEvent(keyName), forceNotification);\n};\n\n\n})();\n//@ sourceURL=ember-metal/observer");minispade.register('ember-metal/platform', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals Node */\nminispade.require('ember-metal/core');\n\n/**\n @class\n\n Platform specific methods and feature detectors needed by the framework.\n\n @name Ember.platform\n*/\nvar platform = Ember.platform = {} ;\n\n/**\n Identical to Object.create(). Implements if not available natively.\n @memberOf Ember.platform\n @name create\n*/\nplatform.create = Object.create;\n\nif (!platform.create) {\n /** @private */\n var O_ctor = function() {},\n O_proto = O_ctor.prototype;\n\n platform.create = function(obj, descs) {\n O_ctor.prototype = obj;\n obj = new O_ctor();\n O_ctor.prototype = O_proto;\n\n if (descs !== undefined) {\n for(var key in descs) {\n if (!descs.hasOwnProperty(key)) continue;\n platform.defineProperty(obj, key, descs[key]);\n }\n }\n\n return obj;\n };\n\n platform.create.isSimulated = true;\n}\n\n/** @private */\nvar defineProperty = Object.defineProperty;\nvar canRedefineProperties, canDefinePropertyOnDOM;\n\n// Catch IE8 where Object.defineProperty exists but only works on DOM elements\nif (defineProperty) {\n try {\n defineProperty({}, 'a',{get:function(){}});\n } catch (e) {\n /** @private */\n defineProperty = null;\n }\n}\n\nif (defineProperty) {\n // Detects a bug in Android <3.2 where you cannot redefine a property using\n // Object.defineProperty once accessors have already been set.\n /** @private */\n canRedefineProperties = (function() {\n var obj = {};\n\n defineProperty(obj, 'a', {\n configurable: true,\n enumerable: true,\n get: function() { },\n set: function() { }\n });\n\n defineProperty(obj, 'a', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: true\n });\n\n return obj.a === true;\n })();\n\n // This is for Safari 5.0, which supports Object.defineProperty, but not\n // on DOM nodes.\n /** @private */\n canDefinePropertyOnDOM = (function(){\n try {\n defineProperty(document.createElement('div'), 'definePropertyOnDOM', {});\n return true;\n } catch(e) { }\n\n return false;\n })();\n\n if (!canRedefineProperties) {\n /** @private */\n defineProperty = null;\n } else if (!canDefinePropertyOnDOM) {\n /** @private */\n defineProperty = function(obj, keyName, desc){\n var isNode;\n\n if (typeof Node === \"object\") {\n isNode = obj instanceof Node;\n } else {\n isNode = typeof obj === \"object\" && typeof obj.nodeType === \"number\" && typeof obj.nodeName === \"string\";\n }\n\n if (isNode) {\n // TODO: Should we have a warning here?\n return (obj[keyName] = desc.value);\n } else {\n return Object.defineProperty(obj, keyName, desc);\n }\n };\n }\n}\n\n/**\n Identical to Object.defineProperty(). Implements as much functionality\n as possible if not available natively.\n\n @memberOf Ember.platform\n @name defineProperty\n @param {Object} obj The object to modify\n @param {String} keyName property name to modify\n @param {Object} desc descriptor hash\n @returns {void}\n*/\nplatform.defineProperty = defineProperty;\n\n/**\n Set to true if the platform supports native getters and setters.\n\n @memberOf Ember.platform\n @name hasPropertyAccessors\n*/\nplatform.hasPropertyAccessors = true;\n\nif (!platform.defineProperty) {\n platform.hasPropertyAccessors = false;\n\n platform.defineProperty = function(obj, keyName, desc) {\n Ember.assert(\"property descriptor cannot have `get` or `set` on this platform\", !desc.get && !desc.set);\n obj[keyName] = desc.value;\n };\n\n platform.defineProperty.isSimulated = true;\n}\n\n})();\n//@ sourceURL=ember-metal/platform");minispade.register('ember-metal/properties', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\nminispade.require('ember-metal/utils');\nminispade.require('ember-metal/accessors');\n\nvar USE_ACCESSORS = Ember.USE_ACCESSORS;\nvar GUID_KEY = Ember.GUID_KEY;\nvar META_KEY = Ember.META_KEY;\nvar meta = Ember.meta;\nvar o_create = Ember.platform.create;\nvar o_defineProperty = Ember.platform.defineProperty;\nvar SIMPLE_PROPERTY, WATCHED_PROPERTY;\n\n// ..........................................................\n// DESCRIPTOR\n//\n\nvar SIMPLE_DESC = {\n writable: true,\n configurable: true,\n enumerable: true,\n value: null\n};\n\n/**\n @private\n @constructor\n\n Objects of this type can implement an interface to responds requests to\n get and set. The default implementation handles simple properties.\n\n You generally won't need to create or subclass this directly.\n*/\nvar Dc = Ember.Descriptor = function() {};\n\nvar setup = Dc.setup = function(obj, keyName, value) {\n SIMPLE_DESC.value = value;\n o_defineProperty(obj, keyName, SIMPLE_DESC);\n SIMPLE_DESC.value = null;\n};\n\nvar Dp = Ember.Descriptor.prototype;\n\n/**\n Called whenever we want to set the property value. Should set the value\n and return the actual set value (which is usually the same but may be\n different in the case of computed properties.)\n\n @param {Object} obj\n The object to set the value on.\n\n @param {String} keyName\n The key to set.\n\n @param {Object} value\n The new value\n\n @returns {Object} value actual set value\n*/\nDp.set = function(obj, keyName, value) {\n obj[keyName] = value;\n return value;\n};\n\n/**\n Called whenever we want to get the property value. Should retrieve the\n current value.\n\n @param {Object} obj\n The object to get the value on.\n\n @param {String} keyName\n The key to retrieve\n\n @returns {Object} the current value\n*/\nDp.get = function(obj, keyName) {\n return w_get(obj, keyName, obj);\n};\n\n/**\n This is called on the descriptor to set it up on the object. The\n descriptor is responsible for actually defining the property on the object\n here.\n\n The passed `value` is the transferValue returned from any previous\n descriptor.\n\n @param {Object} obj\n The object to set the value on.\n\n @param {String} keyName\n The key to set.\n\n @param {Object} value\n The transfer value from any previous descriptor.\n\n @returns {void}\n*/\nDp.setup = setup;\n\n/**\n This is called on the descriptor just before another descriptor takes its\n place. This method should at least return the 'transfer value' of the\n property - which is the value you want to passed as the input to the new\n descriptor's setup() method.\n\n It is not generally necessary to actually 'undefine' the property as a new\n property descriptor will redefine it immediately after this method returns.\n\n @param {Object} obj\n The object to set the value on.\n\n @param {String} keyName\n The key to set.\n\n @returns {Object} transfer value\n*/\nDp.teardown = function(obj, keyName) {\n return obj[keyName];\n};\n\nDp.val = function(obj, keyName) {\n return obj[keyName];\n};\n\n// ..........................................................\n// SIMPLE AND WATCHED PROPERTIES\n//\n\n// if accessors are disabled for the app then this will act as a guard when\n// testing on browsers that do support accessors. It will throw an exception\n// if you do foo.bar instead of Ember.get(foo, 'bar')\n\n// The exception to this is that any objects managed by Ember but not a descendant\n// of Ember.Object will not throw an exception, instead failing silently. This\n// prevent errors with other libraries that may attempt to access special\n// properties on standard objects like Array. Usually this happens when copying\n// an object by looping over all properties.\n\nif (!USE_ACCESSORS) {\n Ember.Descriptor.MUST_USE_GETTER = function() {\n if (this instanceof Ember.Object) {\n Ember.assert('Must use Ember.get() to access this property', false);\n }\n };\n\n Ember.Descriptor.MUST_USE_SETTER = function() {\n if (this instanceof Ember.Object) {\n if (this.isDestroyed) {\n Ember.assert('You cannot set observed properties on destroyed objects', false);\n } else {\n Ember.assert('Must use Ember.set() to access this property', false);\n }\n }\n };\n}\n\nvar WATCHED_DESC = {\n configurable: true,\n enumerable: true,\n set: Ember.Descriptor.MUST_USE_SETTER\n};\n\n/** @private */\nfunction w_get(obj, keyName, values) {\n values = values || meta(obj, false).values;\n\n if (values) {\n var ret = values[keyName];\n if (ret !== undefined) { return ret; }\n if (obj.unknownProperty) { return obj.unknownProperty(keyName); }\n }\n\n}\n\n/** @private */\nfunction w_set(obj, keyName, value) {\n var m = meta(obj), watching;\n\n watching = m.watching[keyName]>0 && value!==m.values[keyName];\n if (watching) Ember.propertyWillChange(obj, keyName);\n m.values[keyName] = value;\n if (watching) Ember.propertyDidChange(obj, keyName);\n return value;\n}\n\nvar WATCHED_GETTERS = {};\n/** @private */\nfunction mkWatchedGetter(keyName) {\n var ret = WATCHED_GETTERS[keyName];\n if (!ret) {\n ret = WATCHED_GETTERS[keyName] = function() {\n return w_get(this, keyName);\n };\n }\n return ret;\n}\n\nvar WATCHED_SETTERS = {};\n/** @private */\nfunction mkWatchedSetter(keyName) {\n var ret = WATCHED_SETTERS[keyName];\n if (!ret) {\n ret = WATCHED_SETTERS[keyName] = function(value) {\n return w_set(this, keyName, value);\n };\n }\n return ret;\n}\n\n/**\n @private\n\n Private version of simple property that invokes property change callbacks.\n*/\nWATCHED_PROPERTY = new Ember.Descriptor();\n\nif (Ember.platform.hasPropertyAccessors) {\n WATCHED_PROPERTY.get = w_get ;\n WATCHED_PROPERTY.set = w_set ;\n\n if (USE_ACCESSORS) {\n WATCHED_PROPERTY.setup = function(obj, keyName, value) {\n WATCHED_DESC.get = mkWatchedGetter(keyName);\n WATCHED_DESC.set = mkWatchedSetter(keyName);\n o_defineProperty(obj, keyName, WATCHED_DESC);\n WATCHED_DESC.get = WATCHED_DESC.set = null;\n if (value !== undefined) meta(obj).values[keyName] = value;\n };\n\n } else {\n WATCHED_PROPERTY.setup = function(obj, keyName, value) {\n WATCHED_DESC.get = mkWatchedGetter(keyName);\n o_defineProperty(obj, keyName, WATCHED_DESC);\n WATCHED_DESC.get = null;\n if (value !== undefined) meta(obj).values[keyName] = value;\n };\n }\n\n WATCHED_PROPERTY.teardown = function(obj, keyName) {\n var ret = meta(obj).values[keyName];\n delete meta(obj).values[keyName];\n return ret;\n };\n\n// NOTE: if platform does not have property accessors then we just have to\n// set values and hope for the best. You just won't get any warnings...\n} else {\n\n WATCHED_PROPERTY.set = function(obj, keyName, value) {\n var m = meta(obj), watching;\n\n watching = m.watching[keyName]>0 && value!==obj[keyName];\n if (watching) Ember.propertyWillChange(obj, keyName);\n obj[keyName] = value;\n if (watching) Ember.propertyDidChange(obj, keyName);\n return value;\n };\n\n}\n\n/**\n The default descriptor for simple properties. Pass as the third argument\n to Ember.defineProperty() along with a value to set a simple value.\n\n @static\n @default Ember.Descriptor\n*/\nEmber.SIMPLE_PROPERTY = new Ember.Descriptor();\nSIMPLE_PROPERTY = Ember.SIMPLE_PROPERTY;\n\nSIMPLE_PROPERTY.unwatched = WATCHED_PROPERTY.unwatched = SIMPLE_PROPERTY;\nSIMPLE_PROPERTY.watched = WATCHED_PROPERTY.watched = WATCHED_PROPERTY;\n\n\n// ..........................................................\n// DEFINING PROPERTIES API\n//\n\n/** @private */\nfunction hasDesc(descs, keyName) {\n if (keyName === 'toString') return 'function' !== typeof descs.toString;\n else return !!descs[keyName];\n}\n\n/**\n @private\n\n NOTE: This is a low-level method used by other parts of the API. You almost\n never want to call this method directly. Instead you should use Ember.mixin()\n to define new properties.\n\n Defines a property on an object. This method works much like the ES5\n Object.defineProperty() method except that it can also accept computed\n properties and other special descriptors.\n\n Normally this method takes only three parameters. However if you pass an\n instance of Ember.Descriptor as the third param then you can pass an optional\n value as the fourth parameter. This is often more efficient than creating\n new descriptor hashes for each property.\n\n ## Examples\n\n // ES5 compatible mode\n Ember.defineProperty(contact, 'firstName', {\n writable: true,\n configurable: false,\n enumerable: true,\n value: 'Charles'\n });\n\n // define a simple property\n Ember.defineProperty(contact, 'lastName', Ember.SIMPLE_PROPERTY, 'Jolley');\n\n // define a computed property\n Ember.defineProperty(contact, 'fullName', Ember.computed(function() {\n return this.firstName+' '+this.lastName;\n }).property('firstName', 'lastName').cacheable());\n*/\nEmber.defineProperty = function(obj, keyName, desc, val) {\n var m = meta(obj, false), descs = m.descs, watching = m.watching[keyName]>0, override = true;\n\n if (val === undefined) {\n override = false;\n val = hasDesc(descs, keyName) ? descs[keyName].teardown(obj, keyName) : obj[keyName];\n } else if (hasDesc(descs, keyName)) {\n descs[keyName].teardown(obj, keyName);\n }\n\n if (!desc) desc = SIMPLE_PROPERTY;\n\n if (desc instanceof Ember.Descriptor) {\n m = meta(obj, true);\n descs = m.descs;\n\n desc = (watching ? desc.watched : desc.unwatched) || desc;\n descs[keyName] = desc;\n desc.setup(obj, keyName, val, watching);\n\n // compatibility with ES5\n } else {\n if (descs[keyName]) meta(obj).descs[keyName] = null;\n o_defineProperty(obj, keyName, desc);\n }\n\n // if key is being watched, override chains that\n // were initialized with the prototype\n if (override && watching) Ember.overrideChains(obj, keyName, m);\n\n return this;\n};\n\n/**\n Creates a new object using the passed object as its prototype. On browsers\n that support it, this uses the built in Object.create method. Else one is\n simulated for you.\n\n This method is a better choice than Object.create() because it will make\n sure that any observers, event listeners, and computed properties are\n inherited from the parent as well.\n\n @param {Object} obj\n The object you want to have as the prototype.\n\n @returns {Object} the newly created object\n*/\nEmber.create = function(obj, props) {\n var ret = o_create(obj, props);\n if (GUID_KEY in ret) Ember.generateGuid(ret, 'ember');\n if (META_KEY in ret) Ember.rewatch(ret); // setup watch chains if needed.\n return ret;\n};\n\n/**\n @private\n\n Creates a new object using the passed object as its prototype. This method\n acts like `Ember.create()` in every way except that bindings, observers, and\n computed properties will be activated on the object.\n\n The purpose of this method is to build an object for use in a prototype\n chain. (i.e. to be set as the `prototype` property on a constructor\n function). Prototype objects need to inherit bindings, observers and\n other configuration so they pass it on to their children. However since\n they are never 'live' objects themselves, they should not fire or make\n other changes when various properties around them change.\n\n You should use this method anytime you want to create a new object for use\n in a prototype chain.\n\n @param {Object} obj\n The base object.\n\n @param {Object} hash\n Optional hash of properties to define on the object.\n\n @returns {Object} new object\n*/\nEmber.createPrototype = function(obj, props) {\n var ret = o_create(obj, props);\n meta(ret, true).proto = ret;\n if (GUID_KEY in ret) Ember.generateGuid(ret, 'ember');\n if (META_KEY in ret) Ember.rewatch(ret); // setup watch chains if needed.\n return ret;\n};\n\n})();\n//@ sourceURL=ember-metal/properties");minispade.register('ember-metal/run_loop', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core'); // Ember.Logger\nminispade.require('ember-metal/watching'); // Ember.watch.flushPending\nminispade.require('ember-metal/observer'); // Ember.beginPropertyChanges, Ember.endPropertyChanges\nminispade.require('ember-metal/utils'); // Ember.guidFor\nminispade.require('ember-metal/array'); // Ember.ArrayUtils\n\n// ..........................................................\n// HELPERS\n//\n\nvar slice = Array.prototype.slice;\nvar forEach = Ember.ArrayUtils.forEach;\n\n// invokes passed params - normalizing so you can pass target/func,\n// target/string or just func\n/** @private */\nfunction invoke(target, method, args, ignore) {\n\n if (method===undefined) {\n method = target;\n target = undefined;\n }\n\n if ('string'===typeof method) method = target[method];\n if (args && ignore>0) {\n args = args.length>ignore ? slice.call(args, ignore) : null;\n }\n\n // Unfortunately in some browsers we lose the backtrace if we rethrow the existing error,\n // so in the event that we don't have an `onerror` handler we don't wrap in a try/catch\n if ('function' === typeof Ember.onerror) {\n try {\n // IE8's Function.prototype.apply doesn't accept undefined/null arguments.\n return method.apply(target || this, args || []);\n } catch (error) {\n Ember.onerror(error);\n }\n } else {\n // IE8's Function.prototype.apply doesn't accept undefined/null arguments.\n return method.apply(target || this, args || []);\n }\n}\n\n\n// ..........................................................\n// RUNLOOP\n//\n\nvar timerMark; // used by timers...\n\n/** @private */\nvar K = function() {};\n\n/** @private */\nvar RunLoop = function(prev) {\n var self;\n\n if (this instanceof RunLoop) {\n self = this;\n } else {\n self = new K();\n }\n\n self._prev = prev || null;\n self.onceTimers = {};\n\n return self;\n};\n\nK.prototype = RunLoop.prototype;\n\nRunLoop.prototype = {\n end: function() {\n this.flush();\n },\n\n prev: function() {\n return this._prev;\n },\n\n // ..........................................................\n // Delayed Actions\n //\n\n schedule: function(queueName, target, method) {\n var queues = this._queues, queue;\n if (!queues) queues = this._queues = {};\n queue = queues[queueName];\n if (!queue) queue = queues[queueName] = [];\n\n var args = arguments.length>3 ? slice.call(arguments, 3) : null;\n queue.push({ target: target, method: method, args: args });\n return this;\n },\n\n flush: function(queueName) {\n var queues = this._queues, queueNames, idx, len, queue, log;\n\n if (!queues) return this; // nothing to do\n\n function iter(item) {\n invoke(item.target, item.method, item.args);\n }\n\n Ember.watch.flushPending(); // make sure all chained watchers are setup\n\n if (queueName) {\n while (this._queues && (queue = this._queues[queueName])) {\n this._queues[queueName] = null;\n\n // the sync phase is to allow property changes to propagate. don't\n // invoke observers until that is finished.\n if (queueName === 'sync') {\n log = Ember.LOG_BINDINGS;\n if (log) Ember.Logger.log('Begin: Flush Sync Queue');\n\n Ember.beginPropertyChanges();\n try {\n forEach(queue, iter);\n } finally {\n Ember.endPropertyChanges();\n }\n\n if (log) Ember.Logger.log('End: Flush Sync Queue');\n\n } else {\n forEach(queue, iter);\n }\n }\n\n } else {\n queueNames = Ember.run.queues;\n len = queueNames.length;\n do {\n this._queues = null;\n for(idx=0;idx<len;idx++) {\n queueName = queueNames[idx];\n queue = queues[queueName];\n\n if (queue) {\n // the sync phase is to allow property changes to propagate. don't\n // invoke observers until that is finished.\n if (queueName === 'sync') {\n log = Ember.LOG_BINDINGS;\n if (log) Ember.Logger.log('Begin: Flush Sync Queue');\n\n Ember.beginPropertyChanges();\n try {\n forEach(queue, iter);\n } finally {\n Ember.endPropertyChanges();\n }\n\n if (log) Ember.Logger.log('End: Flush Sync Queue');\n } else {\n forEach(queue, iter);\n }\n }\n }\n } while (queues = this._queues); // go until queues stay clean\n }\n\n timerMark = null;\n\n return this;\n }\n\n};\n\nEmber.RunLoop = RunLoop;\n\n// ..........................................................\n// Ember.run - this is ideally the only public API the dev sees\n//\n/** \n* @namespace Ember.run is both a function and a namespace for\n* RunLoop-related functions.\n* @name Ember.run\n*/ \n\n/**\n Runs the passed target and method inside of a RunLoop, ensuring any\n deferred actions including bindings and views updates are flushed at the\n end.\n\n Normally you should not need to invoke this method yourself. However if\n you are implementing raw event handlers when interfacing with other\n libraries or plugins, you should probably wrap all of your code inside this\n call.\n\n Ember.run(function(){\n // code to be execute within a RunLoop \n });\n\n @name run^2\n @methodOf Ember.run\n @param {Object} target\n (Optional) target of method to call\n\n @param {Function|String} method\n Method to invoke. May be a function or a string. If you pass a string\n then it will be looked up on the passed target.\n\n @param {Object...} args\n Any additional arguments you wish to pass to the method.\n\n @returns {Object} return value from invoking the passed function.\n*/\nEmber.run = function(target, method) {\n\n var ret, loop;\n run.begin();\n try {\n if (target || method) ret = invoke(target, method, arguments, 2);\n } finally {\n run.end();\n }\n return ret;\n};\n\n/** @private */\nvar run = Ember.run;\n\n\n/**\n Begins a new RunLoop. Any deferred actions invoked after the begin will\n be buffered until you invoke a matching call to Ember.run.end(). This is\n an lower-level way to use a RunLoop instead of using Ember.run().\n\n Ember.run.begin();\n // code to be execute within a RunLoop \n Ember.run.end();\n\n\n @returns {void}\n*/\nEmber.run.begin = function() {\n run.currentRunLoop = new RunLoop(run.currentRunLoop);\n};\n\n/**\n Ends a RunLoop. This must be called sometime after you call Ember.run.begin()\n to flush any deferred actions. This is a lower-level way to use a RunLoop\n instead of using Ember.run().\n\n Ember.run.begin();\n // code to be execute within a RunLoop \n Ember.run.end();\n\n @returns {void}\n*/\nEmber.run.end = function() {\n Ember.assert('must have a current run loop', run.currentRunLoop);\n try {\n run.currentRunLoop.end();\n }\n finally {\n run.currentRunLoop = run.currentRunLoop.prev();\n }\n};\n\n/**\n Array of named queues. This array determines the order in which queues\n are flushed at the end of the RunLoop. You can define your own queues by\n simply adding the queue name to this array. Normally you should not need\n to inspect or modify this property.\n\n @property {String}\n @default ['sync', 'actions', 'destroy', 'timers']\n*/\nEmber.run.queues = ['sync', 'actions', 'destroy', 'timers'];\n\n/**\n Adds the passed target/method and any optional arguments to the named\n queue to be executed at the end of the RunLoop. If you have not already\n started a RunLoop when calling this method one will be started for you\n automatically.\n\n At the end of a RunLoop, any methods scheduled in this way will be invoked.\n Methods will be invoked in an order matching the named queues defined in\n the run.queues property.\n\n Ember.run.schedule('timers', this, function(){\n // this will be executed at the end of the RunLoop, when timers are run\n console.log(\"scheduled on timers queue\");\n });\n Ember.run.schedule('sync', this, function(){\n // this will be executed at the end of the RunLoop, when bindings are synced\n console.log(\"scheduled on sync queue\");\n });\n // Note the functions will be run in order based on the run queues order. Output would be:\n // scheduled on sync queue\n // scheduled on timers queue\n\n @param {String} queue\n The name of the queue to schedule against. Default queues are 'sync' and\n 'actions'\n\n @param {Object} target\n (Optional) target object to use as the context when invoking a method.\n\n @param {String|Function} method\n The method to invoke. If you pass a string it will be resolved on the\n target object at the time the scheduled item is invoked allowing you to\n change the target function.\n\n @param {Object} arguments...\n Optional arguments to be passed to the queued method.\n\n @returns {void}\n*/\nEmber.run.schedule = function(queue, target, method) {\n var loop = run.autorun();\n loop.schedule.apply(loop, arguments);\n};\n\nvar autorunTimer;\n\n/** @private */\nfunction autorun() {\n autorunTimer = null;\n if (run.currentRunLoop) run.end();\n}\n\n/**\n Begins a new RunLoop if necessary and schedules a timer to flush the\n RunLoop at a later time. This method is used by parts of Ember to\n ensure the RunLoop always finishes. You normally do not need to call this\n method directly. Instead use Ember.run().\n\n Ember.run.autorun();\n\n @returns {Ember.RunLoop} the new current RunLoop\n*/\nEmber.run.autorun = function() {\n\n if (!run.currentRunLoop) {\n run.begin();\n\n // TODO: throw during tests\n if (Ember.testing) {\n run.end();\n } else if (!autorunTimer) {\n autorunTimer = setTimeout(autorun, 1);\n }\n }\n\n return run.currentRunLoop;\n};\n\n/**\n Immediately flushes any events scheduled in the 'sync' queue. Bindings\n use this queue so this method is a useful way to immediately force all\n bindings in the application to sync.\n\n You should call this method anytime you need any changed state to propagate\n throughout the app immediately without repainting the UI.\n\n Ember.run.sync();\n\n @returns {void}\n*/\nEmber.run.sync = function() {\n run.autorun();\n run.currentRunLoop.flush('sync');\n};\n\n// ..........................................................\n// TIMERS\n//\n\nvar timers = {}; // active timers...\n\nvar laterScheduled = false;\n/** @private */\nfunction invokeLaterTimers() {\n var now = (+ new Date()), earliest = -1;\n for(var key in timers) {\n if (!timers.hasOwnProperty(key)) continue;\n var timer = timers[key];\n if (timer && timer.expires) {\n if (now >= timer.expires) {\n delete timers[key];\n invoke(timer.target, timer.method, timer.args, 2);\n } else {\n if (earliest<0 || (timer.expires < earliest)) earliest=timer.expires;\n }\n }\n }\n\n // schedule next timeout to fire...\n if (earliest>0) setTimeout(invokeLaterTimers, earliest-(+ new Date()));\n}\n\n/**\n Invokes the passed target/method and optional arguments after a specified\n period if time. The last parameter of this method must always be a number\n of milliseconds.\n\n You should use this method whenever you need to run some action after a\n period of time instead of using setTimeout(). This method will ensure that\n items that expire during the same script execution cycle all execute\n together, which is often more efficient than using a real setTimeout.\n\n Ember.run.later(myContext, function(){\n // code here will execute within a RunLoop in about 500ms with this == myContext\n }, 500);\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n @param {Number} wait\n Number of milliseconds to wait.\n\n @returns {Timer} an object you can use to cancel a timer at a later time.\n*/\nEmber.run.later = function(target, method) {\n var args, expires, timer, guid, wait;\n\n // setTimeout compatibility...\n if (arguments.length===2 && 'function' === typeof target) {\n wait = method;\n method = target;\n target = undefined;\n args = [target, method];\n\n } else {\n args = slice.call(arguments);\n wait = args.pop();\n }\n\n expires = (+ new Date())+wait;\n timer = { target: target, method: method, expires: expires, args: args };\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n run.once(timers, invokeLaterTimers);\n return guid;\n};\n\n/** @private */\nfunction invokeOnceTimer(guid, onceTimers) {\n if (onceTimers[this.tguid]) delete onceTimers[this.tguid][this.mguid];\n if (timers[guid]) invoke(this.target, this.method, this.args, 2);\n delete timers[guid];\n}\n\n/**\n Schedules an item to run one time during the current RunLoop. Calling\n this method with the same target/method combination will have no effect.\n\n Note that although you can pass optional arguments these will not be\n considered when looking for duplicates. New arguments will replace previous\n calls.\n\n Ember.run(function(){\n var doFoo = function() { foo(); }\n Ember.run.once(myContext, doFoo);\n Ember.run.once(myContext, doFoo);\n // doFoo will only be executed once at the end of the RunLoop\n });\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n\n @returns {Object} timer\n*/\nEmber.run.once = function(target, method) {\n var tguid = Ember.guidFor(target), mguid = Ember.guidFor(method), guid, timer;\n\n var onceTimers = run.autorun().onceTimers;\n guid = onceTimers[tguid] && onceTimers[tguid][mguid];\n if (guid && timers[guid]) {\n timers[guid].args = slice.call(arguments); // replace args\n\n } else {\n timer = {\n target: target,\n method: method,\n args: slice.call(arguments),\n tguid: tguid,\n mguid: mguid\n };\n\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n if (!onceTimers[tguid]) onceTimers[tguid] = {};\n onceTimers[tguid][mguid] = guid; // so it isn't scheduled more than once\n\n run.schedule('actions', timer, invokeOnceTimer, guid, onceTimers);\n }\n\n return guid;\n};\n\nvar scheduledNext = false;\n/** @private */\nfunction invokeNextTimers() {\n scheduledNext = null;\n for(var key in timers) {\n if (!timers.hasOwnProperty(key)) continue;\n var timer = timers[key];\n if (timer.next) {\n delete timers[key];\n invoke(timer.target, timer.method, timer.args, 2);\n }\n }\n}\n\n/**\n Schedules an item to run after control has been returned to the system.\n This is often equivalent to calling setTimeout(function...,1).\n\n Ember.run.next(myContext, function(){\n // code to be executed in the next RunLoop, which will be scheduled after the current one\n });\n\n @param {Object} target\n (optional) target of method to invoke\n\n @param {Function|String} method\n The method to invoke. If you pass a string it will be resolved on the\n target at the time the method is invoked.\n\n @param {Object...} args\n Optional arguments to pass to the timeout.\n\n @returns {Object} timer\n*/\nEmber.run.next = function(target, method) {\n var timer, guid;\n\n timer = {\n target: target,\n method: method,\n args: slice.call(arguments),\n next: true\n };\n\n guid = Ember.guidFor(timer);\n timers[guid] = timer;\n\n if (!scheduledNext) scheduledNext = setTimeout(invokeNextTimers, 1);\n return guid;\n};\n\n/**\n Cancels a scheduled item. Must be a value returned by `Ember.run.later()`,\n `Ember.run.once()`, or `Ember.run.next()`.\n\n var runNext = Ember.run.next(myContext, function(){\n // will not be executed\n });\n Ember.run.cancel(runNext);\n\n var runLater = Ember.run.next(myContext, function(){\n // will not be executed\n }, 500);\n Ember.run.cancel(runLater);\n\n var runOnce = Ember.run.once(myContext, function(){\n // will not be executed\n });\n Ember.run.cancel(runOnce);\n\n @param {Object} timer\n Timer object to cancel\n\n @returns {void}\n*/\nEmber.run.cancel = function(timer) {\n delete timers[timer];\n};\n\n})();\n//@ sourceURL=ember-metal/run_loop");minispade.register('ember-metal/utils', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\n\n// ..........................................................\n// GUIDS\n//\n\n// Used for guid generation...\nvar GUID_KEY = '__ember'+ (+ new Date());\nvar uuid, numberCache, stringCache;\n\nuuid = 0;\nnumberCache = [];\nstringCache = {};\n\nvar GUID_DESC = Ember.GUID_DESC = {\n configurable: true,\n writable: true,\n enumerable: false\n};\n\nvar o_defineProperty = Ember.platform.defineProperty;\nvar o_create = Ember.platform.create;\n\n/**\n @private\n @static\n @type String\n @constant\n\n A unique key used to assign guids and other private metadata to objects.\n If you inspect an object in your browser debugger you will often see these.\n They can be safely ignored.\n\n On browsers that support it, these properties are added with enumeration\n disabled so they won't show up when you iterate over your properties.\n*/\nEmber.GUID_KEY = GUID_KEY;\n\n/**\n @private\n\n Generates a new guid, optionally saving the guid to the object that you\n pass in. You will rarely need to use this method. Instead you should\n call Ember.guidFor(obj), which return an existing guid if available.\n\n @param {Object} obj\n Optional object the guid will be used for. If passed in, the guid will\n be saved on the object and reused whenever you pass the same object\n again.\n\n If no object is passed, just generate a new guid.\n\n @param {String} prefix\n Optional prefix to place in front of the guid. Useful when you want to\n separate the guid into separate namespaces.\n\n @returns {String} the guid\n*/\nEmber.generateGuid = function(obj, prefix) {\n if (!prefix) prefix = 'ember';\n var ret = (prefix + (uuid++));\n if (obj) {\n GUID_DESC.value = ret;\n o_defineProperty(obj, GUID_KEY, GUID_DESC);\n GUID_DESC.value = null;\n }\n\n return ret ;\n};\n\n/**\n @private\n\n Returns a unique id for the object. If the object does not yet have\n a guid, one will be assigned to it. You can call this on any object,\n Ember.Object-based or not, but be aware that it will add a _guid property.\n\n You can also use this method on DOM Element objects.\n\n @method\n @param obj {Object} any object, string, number, Element, or primitive\n @returns {String} the unique guid for this instance.\n*/\nEmber.guidFor = function(obj) {\n\n // special cases where we don't want to add a key to object\n if (obj === undefined) return \"(undefined)\";\n if (obj === null) return \"(null)\";\n\n var cache, ret;\n var type = typeof obj;\n\n // Don't allow prototype changes to String etc. to change the guidFor\n switch(type) {\n case 'number':\n ret = numberCache[obj];\n if (!ret) ret = numberCache[obj] = 'nu'+obj;\n return ret;\n\n case 'string':\n ret = stringCache[obj];\n if (!ret) ret = stringCache[obj] = 'st'+(uuid++);\n return ret;\n\n case 'boolean':\n return obj ? '(true)' : '(false)';\n\n default:\n if (obj[GUID_KEY]) return obj[GUID_KEY];\n if (obj === Object) return '(Object)';\n if (obj === Array) return '(Array)';\n return Ember.generateGuid(obj, 'ember');\n }\n};\n\n\n// ..........................................................\n// META\n//\n\nvar META_DESC = {\n writable: true,\n configurable: false,\n enumerable: false,\n value: null\n};\n\nvar META_KEY = Ember.GUID_KEY+'_meta';\n\n/**\n The key used to store meta information on object for property observing.\n\n @static\n @property\n*/\nEmber.META_KEY = META_KEY;\n\n// Placeholder for non-writable metas.\nvar EMPTY_META = {\n descs: {},\n watching: {}\n};\n\nif (Object.freeze) Object.freeze(EMPTY_META);\n\nvar createMeta = Ember.platform.defineProperty.isSimulated ? o_create : (function(meta) { return meta; });\n\n/**\n @private\n @function\n\n Retrieves the meta hash for an object. If 'writable' is true ensures the\n hash is writable for this object as well.\n\n The meta object contains information about computed property descriptors as\n well as any watched properties and other information. You generally will\n not access this information directly but instead work with higher level\n methods that manipulate this hash indirectly.\n\n @param {Object} obj\n The object to retrieve meta for\n\n @param {Boolean} writable\n Pass false if you do not intend to modify the meta hash, allowing the\n method to avoid making an unnecessary copy.\n\n @returns {Hash}\n*/\nEmber.meta = function meta(obj, writable) {\n\n var ret = obj[META_KEY];\n if (writable===false) return ret || EMPTY_META;\n\n if (!ret) {\n o_defineProperty(obj, META_KEY, META_DESC);\n ret = obj[META_KEY] = createMeta({\n descs: {},\n watching: {},\n values: {},\n lastSetValues: {},\n cache: {},\n source: obj\n });\n\n // make sure we don't accidentally try to create constructor like desc\n ret.descs.constructor = null;\n\n } else if (ret.source !== obj) {\n ret = o_create(ret);\n ret.descs = o_create(ret.descs);\n ret.values = o_create(ret.values);\n ret.watching = o_create(ret.watching);\n ret.lastSetValues = {};\n ret.cache = {};\n ret.source = obj;\n\n o_defineProperty(obj, META_KEY, META_DESC);\n ret = obj[META_KEY] = createMeta(ret);\n }\n return ret;\n};\n\nEmber.getMeta = function getMeta(obj, property) {\n var meta = Ember.meta(obj, false);\n return meta[property];\n};\n\nEmber.setMeta = function setMeta(obj, property, value) {\n var meta = Ember.meta(obj, true);\n meta[property] = value;\n return value;\n};\n\n/**\n @private\n\n In order to store defaults for a class, a prototype may need to create\n a default meta object, which will be inherited by any objects instantiated\n from the class's constructor.\n\n However, the properties of that meta object are only shallow-cloned,\n so if a property is a hash (like the event system's `listeners` hash),\n it will by default be shared across all instances of that class.\n\n This method allows extensions to deeply clone a series of nested hashes or\n other complex objects. For instance, the event system might pass\n ['listeners', 'foo:change', 'ember157'] to `prepareMetaPath`, which will\n walk down the keys provided.\n\n For each key, if the key does not exist, it is created. If it already\n exists and it was inherited from its constructor, the constructor's\n key is cloned.\n\n You can also pass false for `writable`, which will simply return\n undefined if `prepareMetaPath` discovers any part of the path that\n shared or undefined.\n\n @param {Object} obj The object whose meta we are examining\n @param {Array} path An array of keys to walk down\n @param {Boolean} writable whether or not to create a new meta\n (or meta property) if one does not already exist or if it's\n shared with its constructor\n*/\nEmber.metaPath = function(obj, path, writable) {\n var meta = Ember.meta(obj, writable), keyName, value;\n\n for (var i=0, l=path.length; i<l; i++) {\n keyName = path[i];\n value = meta[keyName];\n\n if (!value) {\n if (!writable) { return undefined; }\n value = meta[keyName] = { __ember_source__: obj };\n } else if (value.__ember_source__ !== obj) {\n if (!writable) { return undefined; }\n value = meta[keyName] = o_create(value);\n value.__ember_source__ = obj;\n }\n\n meta = value;\n }\n\n return value;\n};\n\n/**\n @private\n\n Wraps the passed function so that `this._super` will point to the superFunc\n when the function is invoked. This is the primitive we use to implement\n calls to super.\n\n @param {Function} func\n The function to call\n\n @param {Function} superFunc\n The super function.\n\n @returns {Function} wrapped function.\n*/\nEmber.wrap = function(func, superFunc) {\n\n function K() {}\n\n var newFunc = function() {\n var ret, sup = this._super;\n this._super = superFunc || K;\n ret = func.apply(this, arguments);\n this._super = sup;\n return ret;\n };\n\n newFunc.base = func;\n return newFunc;\n};\n\n/**\n Returns true if the passed object is an array or Array-like.\n\n Ember Array Protocol:\n\n - the object has an objectAt property\n - the object is a native Array\n - the object is an Object, and has a length property\n\n Unlike Ember.typeOf this method returns true even if the passed object is\n not formally array but appears to be array-like (i.e. implements Ember.Array)\n\n Ember.isArray(); // false\n Ember.isArray([]); // true\n Ember.isArray( Ember.ArrayProxy.create({ content: [] }) ); // true\n\n @param {Object} obj The object to test\n @returns {Boolean}\n*/\nEmber.isArray = function(obj) {\n if (!obj || obj.setInterval) { return false; }\n if (Array.isArray && Array.isArray(obj)) { return true; }\n if (Ember.Array && Ember.Array.detect(obj)) { return true; }\n if ((obj.length !== undefined) && 'object'===typeof obj) { return true; }\n return false;\n};\n\n/**\n Forces the passed object to be part of an array. If the object is already\n an array or array-like, returns the object. Otherwise adds the object to\n an array. If obj is null or undefined, returns an empty array.\n\n Ember.makeArray(); => []\n Ember.makeArray(null); => []\n Ember.makeArray(undefined); => []\n Ember.makeArray('lindsay'); => ['lindsay'] \n Ember.makeArray([1,2,42]); => [1,2,42]\n\n var controller = Ember.ArrayProxy.create({ content: [] });\n Ember.makeArray(controller) === controller; => true\n\n @param {Object} obj the object\n @returns {Array}\n*/\nEmber.makeArray = function(obj) {\n if (obj === null || obj === undefined) return [];\n return Ember.isArray(obj) ? obj : [obj];\n};\n\n\n\n})();\n//@ sourceURL=ember-metal/utils");minispade.register('ember-metal/watching', "(function() {// ==========================================================================\n// Project: Ember Metal\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal/core');\nminispade.require('ember-metal/platform');\nminispade.require('ember-metal/utils');\nminispade.require('ember-metal/accessors');\nminispade.require('ember-metal/properties');\nminispade.require('ember-metal/observer');\nminispade.require('ember-metal/array');\n\nvar guidFor = Ember.guidFor;\nvar meta = Ember.meta;\nvar get = Ember.get, set = Ember.set;\nvar normalizeTuple = Ember.normalizeTuple.primitive;\nvar normalizePath = Ember.normalizePath;\nvar SIMPLE_PROPERTY = Ember.SIMPLE_PROPERTY;\nvar GUID_KEY = Ember.GUID_KEY;\nvar META_KEY = Ember.META_KEY;\nvar notifyObservers = Ember.notifyObservers;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar FIRST_KEY = /^([^\\.\\*]+)/;\nvar IS_PATH = /[\\.\\*]/;\n\n/** @private */\nfunction firstKey(path) {\n return path.match(FIRST_KEY)[0];\n}\n\n// returns true if the passed path is just a keyName\n/** @private */\nfunction isKeyName(path) {\n return path==='*' || !IS_PATH.test(path);\n}\n\n// ..........................................................\n// DEPENDENT KEYS\n//\n\nvar DEP_SKIP = { __emberproto__: true }; // skip some keys and toString\n\n/** @private */\nfunction iterDeps(method, obj, depKey, seen, meta) {\n\n var guid = guidFor(obj);\n if (!seen[guid]) seen[guid] = {};\n if (seen[guid][depKey]) return ;\n seen[guid][depKey] = true;\n\n var deps = meta.deps;\n deps = deps && deps[depKey];\n if (deps) {\n for(var key in deps) {\n if (DEP_SKIP[key]) continue;\n method(obj, key);\n }\n }\n}\n\n\nvar WILL_SEEN, DID_SEEN;\n\n// called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...)\n/** @private */\nfunction dependentKeysWillChange(obj, depKey, meta) {\n if (obj.isDestroying) { return; }\n\n var seen = WILL_SEEN, top = !seen;\n if (top) seen = WILL_SEEN = {};\n iterDeps(propertyWillChange, obj, depKey, seen, meta);\n if (top) WILL_SEEN = null;\n}\n\n// called whenever a property has just changed to update dependent keys\n/** @private */\nfunction dependentKeysDidChange(obj, depKey, meta) {\n if (obj.isDestroying) { return; }\n\n var seen = DID_SEEN, top = !seen;\n if (top) seen = DID_SEEN = {};\n iterDeps(propertyDidChange, obj, depKey, seen, meta);\n if (top) DID_SEEN = null;\n}\n\n// ..........................................................\n// CHAIN\n//\n\n/** @private */\nfunction addChainWatcher(obj, keyName, node) {\n if (!obj || ('object' !== typeof obj)) return; // nothing to do\n var m = meta(obj);\n var nodes = m.chainWatchers;\n if (!nodes || nodes.__emberproto__ !== obj) {\n nodes = m.chainWatchers = { __emberproto__: obj };\n }\n\n if (!nodes[keyName]) nodes[keyName] = {};\n nodes[keyName][guidFor(node)] = node;\n Ember.watch(obj, keyName);\n}\n\n/** @private */\nfunction removeChainWatcher(obj, keyName, node) {\n if (!obj || ('object' !== typeof obj)) return; // nothing to do\n var m = meta(obj, false);\n var nodes = m.chainWatchers;\n if (!nodes || nodes.__emberproto__ !== obj) return; //nothing to do\n if (nodes[keyName]) delete nodes[keyName][guidFor(node)];\n Ember.unwatch(obj, keyName);\n}\n\nvar pendingQueue = [];\n\n// attempts to add the pendingQueue chains again. If some of them end up\n// back in the queue and reschedule is true, schedules a timeout to try\n// again.\n/** @private */\nfunction flushPendingChains() {\n if (pendingQueue.length===0) return ; // nothing to do\n\n var queue = pendingQueue;\n pendingQueue = [];\n\n forEach(queue, function(q) { q[0].add(q[1]); });\n\n Ember.warn('Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos', pendingQueue.length > 0);\n}\n\n/** @private */\nfunction isProto(pvalue) {\n return meta(pvalue, false).proto === pvalue;\n}\n\n// A ChainNode watches a single key on an object. If you provide a starting\n// value for the key then the node won't actually watch it. For a root node\n// pass null for parent and key and object for value.\n/** @private */\nvar ChainNode = function(parent, key, value, separator) {\n var obj;\n this._parent = parent;\n this._key = key;\n\n // _watching is true when calling get(this._parent, this._key) will\n // return the value of this node.\n //\n // It is false for the root of a chain (because we have no parent)\n // and for global paths (because the parent node is the object with\n // the observer on it)\n this._watching = value===undefined;\n\n this._value = value;\n this._separator = separator || '.';\n this._paths = {};\n if (this._watching) {\n this._object = parent.value();\n if (this._object) addChainWatcher(this._object, this._key, this);\n }\n\n // Special-case: the EachProxy relies on immediate evaluation to\n // establish its observers.\n //\n // TODO: Replace this with an efficient callback that the EachProxy\n // can implement.\n if (this._parent && this._parent._key === '@each') {\n this.value();\n }\n};\n\n\nvar Wp = ChainNode.prototype;\n\nWp.value = function() {\n if (this._value === undefined && this._watching){\n var obj = this._parent.value();\n this._value = (obj && !isProto(obj)) ? get(obj, this._key) : undefined;\n }\n return this._value;\n};\n\nWp.destroy = function() {\n if (this._watching) {\n var obj = this._object;\n if (obj) removeChainWatcher(obj, this._key, this);\n this._watching = false; // so future calls do nothing\n }\n};\n\n// copies a top level object only\nWp.copy = function(obj) {\n var ret = new ChainNode(null, null, obj, this._separator);\n var paths = this._paths, path;\n for(path in paths) {\n if (paths[path] <= 0) continue; // this check will also catch non-number vals.\n ret.add(path);\n }\n return ret;\n};\n\n// called on the root node of a chain to setup watchers on the specified\n// path.\nWp.add = function(path) {\n var obj, tuple, key, src, separator, paths;\n\n paths = this._paths;\n paths[path] = (paths[path] || 0) + 1 ;\n\n obj = this.value();\n tuple = normalizeTuple(obj, path);\n\n // the path was a local path\n if (tuple[0] && (tuple[0] === obj)) {\n path = tuple[1];\n key = firstKey(path);\n path = path.slice(key.length+1);\n\n // global path, but object does not exist yet.\n // put into a queue and try to connect later.\n } else if (!tuple[0]) {\n pendingQueue.push([this, path]);\n tuple.length = 0;\n return;\n\n // global path, and object already exists\n } else {\n src = tuple[0];\n key = path.slice(0, 0-(tuple[1].length+1));\n separator = path.slice(key.length, key.length+1);\n path = tuple[1];\n }\n\n tuple.length = 0;\n this.chain(key, path, src, separator);\n};\n\n// called on the root node of a chain to teardown watcher on the specified\n// path\nWp.remove = function(path) {\n var obj, tuple, key, src, paths;\n\n paths = this._paths;\n if (paths[path] > 0) paths[path]--;\n\n obj = this.value();\n tuple = normalizeTuple(obj, path);\n if (tuple[0] === obj) {\n path = tuple[1];\n key = firstKey(path);\n path = path.slice(key.length+1);\n\n } else {\n src = tuple[0];\n key = path.slice(0, 0-(tuple[1].length+1));\n path = tuple[1];\n }\n\n tuple.length = 0;\n this.unchain(key, path);\n};\n\nWp.count = 0;\n\nWp.chain = function(key, path, src, separator) {\n var chains = this._chains, node;\n if (!chains) chains = this._chains = {};\n\n node = chains[key];\n if (!node) node = chains[key] = new ChainNode(this, key, src, separator);\n node.count++; // count chains...\n\n // chain rest of path if there is one\n if (path && path.length>0) {\n key = firstKey(path);\n path = path.slice(key.length+1);\n node.chain(key, path); // NOTE: no src means it will observe changes...\n }\n};\n\nWp.unchain = function(key, path) {\n var chains = this._chains, node = chains[key];\n\n // unchain rest of path first...\n if (path && path.length>1) {\n key = firstKey(path);\n path = path.slice(key.length+1);\n node.unchain(key, path);\n }\n\n // delete node if needed.\n node.count--;\n if (node.count<=0) {\n delete chains[node._key];\n node.destroy();\n }\n\n};\n\nWp.willChange = function() {\n var chains = this._chains;\n if (chains) {\n for(var key in chains) {\n if (!chains.hasOwnProperty(key)) continue;\n chains[key].willChange();\n }\n }\n\n if (this._parent) this._parent.chainWillChange(this, this._key, 1);\n};\n\nWp.chainWillChange = function(chain, path, depth) {\n if (this._key) path = this._key+this._separator+path;\n\n if (this._parent) {\n this._parent.chainWillChange(this, path, depth+1);\n } else {\n if (depth>1) Ember.propertyWillChange(this.value(), path);\n path = 'this.'+path;\n if (this._paths[path]>0) Ember.propertyWillChange(this.value(), path);\n }\n};\n\nWp.chainDidChange = function(chain, path, depth) {\n if (this._key) path = this._key+this._separator+path;\n if (this._parent) {\n this._parent.chainDidChange(this, path, depth+1);\n } else {\n if (depth>1) Ember.propertyDidChange(this.value(), path);\n path = 'this.'+path;\n if (this._paths[path]>0) Ember.propertyDidChange(this.value(), path);\n }\n};\n\nWp.didChange = function(suppressEvent) {\n // invalidate my own value first.\n if (this._watching) {\n var obj = this._parent.value();\n if (obj !== this._object) {\n removeChainWatcher(this._object, this._key, this);\n this._object = obj;\n addChainWatcher(obj, this._key, this);\n }\n this._value = undefined;\n\n // Special-case: the EachProxy relies on immediate evaluation to\n // establish its observers.\n if (this._parent && this._parent._key === '@each')\n this.value();\n }\n\n // then notify chains...\n var chains = this._chains;\n if (chains) {\n for(var key in chains) {\n if (!chains.hasOwnProperty(key)) continue;\n chains[key].didChange(suppressEvent);\n }\n }\n\n if (suppressEvent) return;\n\n // and finally tell parent about my path changing...\n if (this._parent) this._parent.chainDidChange(this, this._key, 1);\n};\n\n// get the chains for the current object. If the current object has\n// chains inherited from the proto they will be cloned and reconfigured for\n// the current object.\n/** @private */\nfunction chainsFor(obj) {\n var m = meta(obj), ret = m.chains;\n if (!ret) {\n ret = m.chains = new ChainNode(null, null, obj);\n } else if (ret.value() !== obj) {\n ret = m.chains = ret.copy(obj);\n }\n return ret ;\n}\n\n\n/** @private */\nfunction notifyChains(obj, m, keyName, methodName, arg) {\n var nodes = m.chainWatchers;\n\n if (!nodes || nodes.__emberproto__ !== obj) return; // nothing to do\n\n nodes = nodes[keyName];\n if (!nodes) return;\n\n for(var key in nodes) {\n if (!nodes.hasOwnProperty(key)) continue;\n nodes[key][methodName](arg);\n }\n}\n\nEmber.overrideChains = function(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'didChange', true);\n};\n\n/** @private */\nfunction chainsWillChange(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'willChange');\n}\n\n/** @private */\nfunction chainsDidChange(obj, keyName, m) {\n notifyChains(obj, m, keyName, 'didChange');\n}\n\n// ..........................................................\n// WATCH\n//\n\nvar WATCHED_PROPERTY = Ember.SIMPLE_PROPERTY.watched;\n\n/**\n @private\n\n Starts watching a property on an object. Whenever the property changes,\n invokes Ember.propertyWillChange and Ember.propertyDidChange. This is the\n primitive used by observers and dependent keys; usually you will never call\n this method directly but instead use higher level methods like\n Ember.addObserver().\n*/\nEmber.watch = function(obj, keyName) {\n\n // can't watch length on Array - it is special...\n if (keyName === 'length' && Ember.typeOf(obj)==='array') return this;\n\n var m = meta(obj), watching = m.watching, desc;\n keyName = normalizePath(keyName);\n\n // activate watching first time\n if (!watching[keyName]) {\n watching[keyName] = 1;\n if (isKeyName(keyName)) {\n desc = m.descs[keyName];\n desc = desc ? desc.watched : WATCHED_PROPERTY;\n if (desc) Ember.defineProperty(obj, keyName, desc);\n } else {\n chainsFor(obj).add(keyName);\n }\n\n } else {\n watching[keyName] = (watching[keyName]||0)+1;\n }\n return this;\n};\n\nEmber.isWatching = function(obj, keyName) {\n return !!meta(obj).watching[keyName];\n};\n\nEmber.watch.flushPending = flushPendingChains;\n\n/** @private */\nEmber.unwatch = function(obj, keyName) {\n // can't watch length on Array - it is special...\n if (keyName === 'length' && Ember.typeOf(obj)==='array') return this;\n\n var watching = meta(obj).watching, desc, descs;\n keyName = normalizePath(keyName);\n if (watching[keyName] === 1) {\n watching[keyName] = 0;\n if (isKeyName(keyName)) {\n desc = meta(obj).descs[keyName];\n desc = desc ? desc.unwatched : SIMPLE_PROPERTY;\n if (desc) Ember.defineProperty(obj, keyName, desc);\n } else {\n chainsFor(obj).remove(keyName);\n }\n\n } else if (watching[keyName]>1) {\n watching[keyName]--;\n }\n\n return this;\n};\n\n/**\n @private\n\n Call on an object when you first beget it from another object. This will\n setup any chained watchers on the object instance as needed. This method is\n safe to call multiple times.\n*/\nEmber.rewatch = function(obj) {\n var m = meta(obj, false), chains = m.chains, bindings = m.bindings, key, b;\n\n // make sure the object has its own guid.\n if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) {\n Ember.generateGuid(obj, 'ember');\n }\n\n // make sure any chained watchers update.\n if (chains && chains.value() !== obj) chainsFor(obj);\n\n return this;\n};\n\n// ..........................................................\n// PROPERTY CHANGES\n//\n\n/**\n This function is called just before an object property is about to change.\n It will notify any before observers and prepare caches among other things.\n\n Normally you will not need to call this method directly but if for some\n reason you can't directly watch a property you can invoke this method\n manually along with `Ember.propertyDidChange()` which you should call just\n after the property value changes.\n\n @memberOf Ember\n\n @param {Object} obj\n The object with the property that will change\n\n @param {String} keyName\n The property key (or path) that will change.\n\n @returns {void}\n*/\nfunction propertyWillChange(obj, keyName) {\n var m = meta(obj, false), proto = m.proto, desc = m.descs[keyName];\n if (proto === obj) return ;\n if (desc && desc.willChange) desc.willChange(obj, keyName);\n dependentKeysWillChange(obj, keyName, m);\n chainsWillChange(obj, keyName, m);\n Ember.notifyBeforeObservers(obj, keyName);\n}\n\nEmber.propertyWillChange = propertyWillChange;\n\n/**\n This function is called just after an object property has changed.\n It will notify any observers and clear caches among other things.\n\n Normally you will not need to call this method directly but if for some\n reason you can't directly watch a property you can invoke this method\n manually along with `Ember.propertyWilLChange()` which you should call just\n before the property value changes.\n\n @memberOf Ember\n\n @param {Object} obj\n The object with the property that will change\n\n @param {String} keyName\n The property key (or path) that will change.\n\n @returns {void}\n*/\nfunction propertyDidChange(obj, keyName) {\n var m = meta(obj, false), proto = m.proto, desc = m.descs[keyName];\n if (proto === obj) return ;\n if (desc && desc.didChange) desc.didChange(obj, keyName);\n dependentKeysDidChange(obj, keyName, m);\n chainsDidChange(obj, keyName, m);\n Ember.notifyObservers(obj, keyName);\n}\n\nEmber.propertyDidChange = propertyDidChange;\n\nvar NODE_STACK = [];\n\n/**\n Tears down the meta on an object so that it can be garbage collected.\n Multiple calls will have no effect.\n\n @param {Object} obj the object to destroy\n @returns {void}\n*/\nEmber.destroy = function (obj) {\n var meta = obj[META_KEY], node, nodes, key, nodeObject;\n if (meta) {\n obj[META_KEY] = null;\n // remove chainWatchers to remove circular references that would prevent GC\n node = meta.chains;\n if (node) {\n NODE_STACK.push(node);\n // process tree\n while (NODE_STACK.length > 0) {\n node = NODE_STACK.pop();\n // push children\n nodes = node._chains;\n if (nodes) {\n for (key in nodes) {\n if (nodes.hasOwnProperty(key)) {\n NODE_STACK.push(nodes[key]);\n }\n }\n }\n // remove chainWatcher in node object\n if (node._watching) {\n nodeObject = node._object;\n if (nodeObject) {\n removeChainWatcher(nodeObject, node._key, node);\n }\n }\n }\n }\n }\n};\n\n})();\n//@ sourceURL=ember-metal/watching");minispade.register('ember-runtime/controllers', "(function() {minispade.require('ember-runtime/controllers/array_controller');\n\n})();\n//@ sourceURL=ember-runtime/controllers");minispade.register('ember-runtime/controllers/array_controller', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/system/array_proxy');\n\n/**\n @class\n\n Ember.ArrayController provides a way for you to publish a collection of objects\n so that you can easily bind to the collection from a Handlebars #each helper,\n an Ember.CollectionView, or other controllers.\n\n The advantage of using an ArrayController is that you only have to set up\n your view bindings once; to change what's displayed, simply swap out the\n `content` property on the controller.\n\n For example, imagine you wanted to display a list of items fetched via an XHR\n request. Create an Ember.ArrayController and set its `content` property:\n\n MyApp.listController = Ember.ArrayController.create();\n\n $.get('people.json', function(data) {\n MyApp.listController.set('content', data);\n });\n\n Then, create a view that binds to your new controller:\n\n {{#each MyApp.listController}}\n {{firstName}} {{lastName}}\n {{/each}}\n\n Although you are binding to the controller, the behavior of this controller\n is to pass through any methods or properties to the underlying array. This\n capability comes from `Ember.ArrayProxy`, which this class inherits from.\n\n Note: As of this writing, `ArrayController` does not add any functionality\n to its superclass, `ArrayProxy`. The Ember team plans to add additional\n controller-specific functionality in the future, e.g. single or multiple\n selection support. If you are creating something that is conceptually a\n controller, use this class.\n\n @extends Ember.ArrayProxy\n*/\n\nEmber.ArrayController = Ember.ArrayProxy.extend();\n\n})();\n//@ sourceURL=ember-runtime/controllers/array_controller");minispade.register('ember-runtime/core', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n/*globals ENV */\nminispade.require('ember-metal');\n\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n// ........................................\n// TYPING & ARRAY MESSAGING\n//\n\nvar TYPE_MAP = {};\nvar t =\"Boolean Number String Function Array Date RegExp Object\".split(\" \");\nEmber.ArrayUtils.forEach(t, function(name) {\n\tTYPE_MAP[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\nvar toString = Object.prototype.toString;\n\n/**\n Returns a consistent type for the passed item.\n\n Use this instead of the built-in Ember.typeOf() to get the type of an item.\n It will return the same result across all browsers and includes a bit\n more detail. Here is what will be returned:\n\n | Return Value | Meaning |\n |---------------|------------------------------------------------------|\n | 'string' | String primitive |\n | 'number' | Number primitive |\n | 'boolean' | Boolean primitive |\n | 'null' | Null value |\n | 'undefined' | Undefined value |\n | 'function' | A function |\n | 'array' | An instance of Array |\n | 'class' | A Ember class (created using Ember.Object.extend()) |\n | 'instance' | A Ember object instance |\n | 'error' | An instance of the Error object |\n | 'object' | A JavaScript object not inheriting from Ember.Object |\n\n Examples:\n\n Ember.typeOf(); => 'undefined'\n Ember.typeOf(null); => 'null'\n Ember.typeOf(undefined); => 'undefined'\n Ember.typeOf('michael'); => 'string'\n Ember.typeOf(101); => 'number'\n Ember.typeOf(true); => 'boolean'\n Ember.typeOf(Ember.makeArray); => 'function'\n Ember.typeOf([1,2,90]); => 'array'\n Ember.typeOf(Ember.Object.extend()); => 'class'\n Ember.typeOf(Ember.Object.create()); => 'instance'\n Ember.typeOf(new Error('teamocil')); => 'error'\n\n // \"normal\" JavaScript object\n Ember.typeOf({a: 'b'}); => 'object'\n\n @param item {Object} the item to check\n @returns {String} the type\n*/\nEmber.typeOf = function(item) {\n var ret;\n\n ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';\n\n if (ret === 'function') {\n if (Ember.Object && Ember.Object.detect(item)) ret = 'class';\n } else if (ret === 'object') {\n if (item instanceof Error) ret = 'error';\n else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';\n else ret = 'object';\n }\n\n return ret;\n};\n\n/**\n Returns true if the passed value is null or undefined. This avoids errors\n from JSLint complaining about use of ==, which can be technically\n confusing.\n\n Ember.none(); => true\n Ember.none(null); => true\n Ember.none(undefined); => true\n Ember.none(''); => false\n Ember.none([]); => false\n Ember.none(function(){}); => false\n\n @param {Object} obj Value to test\n @returns {Boolean}\n*/\nEmber.none = function(obj) {\n return obj === null || obj === undefined;\n};\n\n/**\n Verifies that a value is null or an empty string | array | function.\n\n Constrains the rules on `Ember.none` by returning false for empty\n string and empty arrays.\n\n Ember.empty(); => true\n Ember.empty(null); => true\n Ember.empty(undefined); => true\n Ember.empty(''); => true\n Ember.empty([]); => true\n Ember.empty('tobias fünke'); => false\n Ember.empty([0,1,2]); => false\n\n @param {Object} obj Value to test\n @returns {Boolean}\n*/\nEmber.empty = function(obj) {\n return obj === null || obj === undefined || (obj.length === 0 && typeof obj !== 'function');\n};\n\n/**\n This will compare two javascript values of possibly different types.\n It will tell you which one is greater than the other by returning:\n\n - -1 if the first is smaller than the second,\n - 0 if both are equal,\n - 1 if the first is greater than the second.\n\n The order is calculated based on Ember.ORDER_DEFINITION, if types are different.\n In case they have the same type an appropriate comparison for this type is made.\n\n Ember.compare('hello', 'hello'); => 0\n Ember.compare('abc', 'dfg'); => -1\n Ember.compare(2, 1); => 1\n\n @param {Object} v First value to compare\n @param {Object} w Second value to compare\n @returns {Number} -1 if v < w, 0 if v = w and 1 if v > w.\n*/\nEmber.compare = function compare(v, w) {\n if (v === w) { return 0; }\n\n var type1 = Ember.typeOf(v);\n var type2 = Ember.typeOf(w);\n\n var Comparable = Ember.Comparable;\n if (Comparable) {\n if (type1==='instance' && Comparable.detect(v.constructor)) {\n return v.constructor.compare(v, w);\n }\n\n if (type2 === 'instance' && Comparable.detect(w.constructor)) {\n return 1-w.constructor.compare(w, v);\n }\n }\n\n // If we haven't yet generated a reverse-mapping of Ember.ORDER_DEFINITION,\n // do so now.\n var mapping = Ember.ORDER_DEFINITION_MAPPING;\n if (!mapping) {\n var order = Ember.ORDER_DEFINITION;\n mapping = Ember.ORDER_DEFINITION_MAPPING = {};\n var idx, len;\n for (idx = 0, len = order.length; idx < len; ++idx) {\n mapping[order[idx]] = idx;\n }\n\n // We no longer need Ember.ORDER_DEFINITION.\n delete Ember.ORDER_DEFINITION;\n }\n\n var type1Index = mapping[type1];\n var type2Index = mapping[type2];\n\n if (type1Index < type2Index) { return -1; }\n if (type1Index > type2Index) { return 1; }\n\n // types are equal - so we have to check values now\n switch (type1) {\n case 'boolean':\n case 'number':\n if (v < w) { return -1; }\n if (v > w) { return 1; }\n return 0;\n\n case 'string':\n var comp = v.localeCompare(w);\n if (comp < 0) { return -1; }\n if (comp > 0) { return 1; }\n return 0;\n\n case 'array':\n var vLen = v.length;\n var wLen = w.length;\n var l = Math.min(vLen, wLen);\n var r = 0;\n var i = 0;\n while (r === 0 && i < l) {\n r = compare(v[i],w[i]);\n i++;\n }\n if (r !== 0) { return r; }\n\n // all elements are equal now\n // shorter array should be ordered first\n if (vLen < wLen) { return -1; }\n if (vLen > wLen) { return 1; }\n // arrays are equal now\n return 0;\n\n case 'instance':\n if (Ember.Comparable && Ember.Comparable.detect(v)) {\n return v.compare(v, w);\n }\n return 0;\n\n default:\n return 0;\n }\n};\n\n/** @private */\nfunction _copy(obj, deep, seen, copies) {\n var ret, loc, key;\n\n // primitive data types are immutable, just return them.\n if ('object' !== typeof obj || obj===null) return obj;\n\n // avoid cyclical loops\n if (deep && (loc=indexOf(seen, obj))>=0) return copies[loc];\n\n Ember.assert('Cannot clone an Ember.Object that does not implement Ember.Copyable', !(obj instanceof Ember.Object) || (Ember.Copyable && Ember.Copyable.detect(obj)));\n\n // IMPORTANT: this specific test will detect a native array only. Any other\n // object will need to implement Copyable.\n if (Ember.typeOf(obj) === 'array') {\n ret = obj.slice();\n if (deep) {\n loc = ret.length;\n while(--loc>=0) ret[loc] = _copy(ret[loc], deep, seen, copies);\n }\n } else if (Ember.Copyable && Ember.Copyable.detect(obj)) {\n ret = obj.copy(deep, seen, copies);\n } else {\n ret = {};\n for(key in obj) {\n if (!obj.hasOwnProperty(key)) continue;\n ret[key] = deep ? _copy(obj[key], deep, seen, copies) : obj[key];\n }\n }\n\n if (deep) {\n seen.push(obj);\n copies.push(ret);\n }\n\n return ret;\n}\n\n/**\n Creates a clone of the passed object. This function can take just about\n any type of object and create a clone of it, including primitive values\n (which are not actually cloned because they are immutable).\n\n If the passed object implements the clone() method, then this function\n will simply call that method and return the result.\n\n @param {Object} object The object to clone\n @param {Boolean} deep If true, a deep copy of the object is made\n @returns {Object} The cloned object\n*/\nEmber.copy = function(obj, deep) {\n // fast paths\n if ('object' !== typeof obj || obj===null) return obj; // can't copy primitives\n if (Ember.Copyable && Ember.Copyable.detect(obj)) return obj.copy(deep);\n return _copy(obj, deep, deep ? [] : null, deep ? [] : null);\n};\n\n/**\n Convenience method to inspect an object. This method will attempt to\n convert the object into a useful string description.\n\n @param {Object} obj The object you want to inspect.\n @returns {String} A description of the object\n*/\nEmber.inspect = function(obj) {\n var v, ret = [];\n for(var key in obj) {\n if (obj.hasOwnProperty(key)) {\n v = obj[key];\n if (v === 'toString') { continue; } // ignore useless items\n if (Ember.typeOf(v) === 'function') { v = \"function() { ... }\"; }\n ret.push(key + \": \" + v);\n }\n }\n return \"{\" + ret.join(\" , \") + \"}\";\n};\n\n/**\n Compares two objects, returning true if they are logically equal. This is\n a deeper comparison than a simple triple equal. For sets it will compare the\n internal objects. For any other object that implements `isEqual()` it will \n respect that method.\n\n Ember.isEqual('hello', 'hello'); => true\n Ember.isEqual(1, 2); => false\n Ember.isEqual([4,2], [4,2]); => false\n\n @param {Object} a first object to compare\n @param {Object} b second object to compare\n @returns {Boolean}\n*/\nEmber.isEqual = function(a, b) {\n if (a && 'function'===typeof a.isEqual) return a.isEqual(b);\n return a === b;\n};\n\n/**\n @private\n Used by Ember.compare\n*/\nEmber.ORDER_DEFINITION = Ember.ENV.ORDER_DEFINITION || [\n 'undefined',\n 'null',\n 'boolean',\n 'number',\n 'string',\n 'array',\n 'object',\n 'instance',\n 'function',\n 'class'\n];\n\n/**\n Returns all of the keys defined on an object or hash. This is useful\n when inspecting objects for debugging. On browsers that support it, this\n uses the native Object.keys implementation.\n\n @function\n @param {Object} obj\n @returns {Array} Array containing keys of obj\n*/\nEmber.keys = Object.keys;\n\nif (!Ember.keys) {\n Ember.keys = function(obj) {\n var ret = [];\n for(var key in obj) {\n if (obj.hasOwnProperty(key)) { ret.push(key); }\n }\n return ret;\n };\n}\n\n// ..........................................................\n// ERROR\n//\n\n/**\n @class\n\n A subclass of the JavaScript Error object for use in Ember.\n*/\nEmber.Error = function() {\n var tmp = Error.prototype.constructor.apply(this, arguments);\n\n for (var p in tmp) {\n if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }\n }\n this.message = tmp.message;\n};\n\nEmber.Error.prototype = Ember.create(Error.prototype);\n\n})();\n//@ sourceURL=ember-runtime/core");minispade.register('ember-runtime/ext', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/ext/string');\nminispade.require('ember-runtime/ext/function');\n\n})();\n//@ sourceURL=ember-runtime/ext");minispade.register('ember-runtime/ext/function', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/core');\n\nvar a_slice = Array.prototype.slice;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n The `property` extension of Javascript's Function prototype is available\n when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n Computed properties allow you to treat a function like a property:\n\n MyApp.president = Ember.Object.create({\n firstName: \"Barack\",\n lastName: \"Obama\",\n\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Call this flag to mark the function as a property\n }.property()\n });\n\n MyApp.president.get('fullName'); => \"Barack Obama\"\n\n Treating a function like a property is useful because they can work with\n bindings, just like any other property.\n\n Many computed properties have dependencies on other properties. For\n example, in the above example, the `fullName` property depends on\n `firstName` and `lastName` to determine its value. You can tell Ember.js\n about these dependencies like this:\n\n MyApp.president = Ember.Object.create({\n firstName: \"Barack\",\n lastName: \"Obama\",\n\n fullName: function() {\n return this.get('firstName') + ' ' + this.get('lastName');\n\n // Tell Ember.js that this computed property depends on firstName\n // and lastName\n }.property('firstName', 'lastName')\n });\n\n Make sure you list these dependencies so Ember.js knows when to update\n bindings that connect to a computed property. Changing a dependency\n will not immediately trigger an update of the computed property, but\n will instead clear the cache so that it is updated when the next `get`\n is called on the property.\n\n Note: you will usually want to use `property(...)` with `cacheable()`.\n\n @see Ember.ComputedProperty\n @see Ember.computed\n */\n Function.prototype.property = function() {\n var ret = Ember.computed(this);\n return ret.property.apply(ret, arguments);\n };\n\n /**\n The `observes` extension of Javascript's Function prototype is available\n when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n You can observe property changes simply by adding the `observes`\n call to the end of your method declarations in classes that you write.\n For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property changes\n }.observes('value')\n });\n \n @see Ember.Observable\n */\n Function.prototype.observes = function() {\n this.__ember_observes__ = a_slice.call(arguments);\n return this;\n };\n\n /**\n The `observesBefore` extension of Javascript's Function prototype is\n available when Ember.EXTEND_PROTOTYPES is true, which is the default. \n\n You can get notified when a property changes is about to happen by\n by adding the `observesBefore` call to the end of your method\n declarations in classes that you write. For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property is about to change\n }.observesBefore('value')\n });\n \n @see Ember.Observable\n */\n Function.prototype.observesBefore = function() {\n this.__ember_observesBefore__ = a_slice.call(arguments);\n return this;\n };\n\n}\n\n\n})();\n//@ sourceURL=ember-runtime/ext/function");minispade.register('ember-runtime/ext/string', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/core');\nminispade.require('ember-runtime/system/string');\n\n\n\nvar fmt = Ember.String.fmt,\n w = Ember.String.w,\n loc = Ember.String.loc,\n camelize = Ember.String.camelize,\n decamelize = Ember.String.decamelize,\n dasherize = Ember.String.dasherize,\n underscore = Ember.String.underscore;\n\nif (Ember.EXTEND_PROTOTYPES) {\n\n /**\n @see Ember.String.fmt\n */\n String.prototype.fmt = function() {\n return fmt(this, arguments);\n };\n\n /**\n @see Ember.String.w\n */\n String.prototype.w = function() {\n return w(this);\n };\n\n /**\n @see Ember.String.loc\n */\n String.prototype.loc = function() {\n return loc(this, arguments);\n };\n\n /**\n @see Ember.String.camelize\n */\n String.prototype.camelize = function() {\n return camelize(this);\n };\n\n /**\n @see Ember.String.decamelize\n */\n String.prototype.decamelize = function() {\n return decamelize(this);\n };\n\n /**\n @see Ember.String.dasherize\n */\n String.prototype.dasherize = function() {\n return dasherize(this);\n };\n\n /**\n @see Ember.String.underscore\n */\n String.prototype.underscore = function() {\n return underscore(this);\n };\n\n}\n\n\n})();\n//@ sourceURL=ember-runtime/ext/string");minispade.register('ember-runtime/license', "(function() {/**\n * @license\n * ==========================================================================\n * Ember\n * Copyright ©2006-2011, Strobe Inc. and contributors.\n * Portions copyright ©2008-2011 Apple Inc. All rights reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n *\n * For more information about Ember, visit http://www.emberjs.com\n *\n * ==========================================================================\n */\n\n})();\n//@ sourceURL=ember-runtime/license");minispade.register('ember-runtime', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/license');\nminispade.require('ember-metal');\nminispade.require('ember-runtime/core');\nminispade.require('ember-runtime/ext');\nminispade.require('ember-runtime/mixins');\nminispade.require('ember-runtime/system');\nminispade.require('ember-runtime/controllers');\n\n})();\n//@ sourceURL=ember-runtime");minispade.register('ember-runtime/mixins', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/array');\nminispade.require('ember-runtime/mixins/comparable');\nminispade.require('ember-runtime/mixins/copyable');\nminispade.require('ember-runtime/mixins/enumerable');\nminispade.require('ember-runtime/mixins/freezable');\nminispade.require('ember-runtime/mixins/mutable_array');\nminispade.require('ember-runtime/mixins/mutable_enumerable');\nminispade.require('ember-runtime/mixins/observable');\nminispade.require('ember-runtime/mixins/target_action_support');\nminispade.require('ember-runtime/mixins/evented');\n\n})();\n//@ sourceURL=ember-runtime/mixins");minispade.register('ember-runtime/mixins/array', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/enumerable');\n\n\n\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set, meta = Ember.meta, map = Ember.ArrayUtils.map, cacheFor = Ember.cacheFor;\n\n/** @private */\nfunction none(obj) { return obj===null || obj===undefined; }\n\n/** @private */\nfunction xform(target, method, params) {\n method.call(target, params[0], params[2], params[3], params[4]);\n}\n\n// ..........................................................\n// ARRAY\n//\n/**\n @namespace\n\n This module implements Observer-friendly Array-like behavior. This mixin is\n picked up by the Array class as well as other controllers, etc. that want to\n appear to be arrays.\n\n Unlike Ember.Enumerable, this mixin defines methods specifically for\n collections that provide index-ordered access to their contents. When you\n are designing code that needs to accept any kind of Array-like object, you\n should use these methods instead of Array primitives because these will\n properly notify observers of changes to the array.\n\n Although these methods are efficient, they do add a layer of indirection to\n your application so it is a good idea to use them only when you need the\n flexibility of using both true JavaScript arrays and \"virtual\" arrays such\n as controllers and collections.\n\n You can use the methods defined in this module to access and modify array\n contents in a KVO-friendly way. You can also be notified whenever the\n membership if an array changes by changing the syntax of the property to\n .observes('*myProperty.[]') .\n\n To support Ember.Array in your own class, you must override two\n primitives to use it: replace() and objectAt().\n\n Note that the Ember.Array mixin also incorporates the Ember.Enumerable mixin. All\n Ember.Array-like objects are also enumerable.\n\n @extends Ember.Enumerable\n @since Ember 0.9.0\n*/\nEmber.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.prototype */ {\n\n /** @private - compatibility */\n isSCArray: true,\n\n /**\n @field {Number} length\n\n Your array must support the length property. Your replace methods should\n set this property whenever it changes.\n */\n length: Ember.required(),\n\n /**\n This is one of the primitives you must implement to support Ember.Array.\n Returns the object at the named index. If your object supports retrieving\n the value of an array item using get() (i.e. myArray.get(0)), then you do\n not need to implement this method yourself.\n\n @param {Number} idx\n The index of the item to return. If idx exceeds the current length,\n return null.\n */\n objectAt: function(idx) {\n if ((idx < 0) || (idx>=get(this, 'length'))) return undefined ;\n return get(this, idx);\n },\n\n /**\n This returns the objects at the specified indexes, using objectAt.\n\n @param {Array} indexes\n An array of indexes of items to return.\n */\n objectsAt: function(indexes) {\n var self = this;\n return map(indexes, function(idx){ return self.objectAt(idx); });\n },\n\n /** @private (nodoc) - overrides Ember.Enumerable version */\n nextObject: function(idx) {\n return this.objectAt(idx);\n },\n\n /**\n @field []\n\n This is the handler for the special array content property. If you get\n this property, it will return this. If you set this property it a new\n array, it will replace the current content.\n\n This property overrides the default property defined in Ember.Enumerable.\n */\n '[]': Ember.computed(function(key, value) {\n if (value !== undefined) this.replace(0, get(this, 'length'), value) ;\n return this ;\n }).property().cacheable(),\n\n firstObject: Ember.computed(function() {\n return this.objectAt(0);\n }).property().cacheable(),\n\n lastObject: Ember.computed(function() {\n return this.objectAt(get(this, 'length')-1);\n }).property().cacheable(),\n\n /** @private (nodoc) - optimized version from Enumerable */\n contains: function(obj){\n return this.indexOf(obj) >= 0;\n },\n\n // Add any extra methods to Ember.Array that are native to the built-in Array.\n /**\n Returns a new array that is a slice of the receiver. This implementation\n uses the observable array methods to retrieve the objects for the new\n slice.\n\n var arr = ['red', 'green', 'blue'];\n arr.slice(0); => ['red', 'green', 'blue']\n arr.slice(0, 2); => ['red', 'green']\n arr.slice(1, 100); => ['green', 'blue']\n\n @param beginIndex {Integer} (Optional) index to begin slicing from.\n @param endIndex {Integer} (Optional) index to end the slice at.\n @returns {Array} New array with specified slice\n */\n slice: function(beginIndex, endIndex) {\n var ret = [];\n var length = get(this, 'length') ;\n if (none(beginIndex)) beginIndex = 0 ;\n if (none(endIndex) || (endIndex > length)) endIndex = length ;\n while(beginIndex < endIndex) {\n ret[ret.length] = this.objectAt(beginIndex++) ;\n }\n return ret ;\n },\n\n /**\n Returns the index of the given object's first occurrence.\n If no startAt argument is given, the starting location to\n search is 0. If it's negative, will count backward from\n the end of the array. Returns -1 if no match is found.\n\n var arr = [\"a\", \"b\", \"c\", \"d\", \"a\"];\n arr.indexOf(\"a\"); => 0\n arr.indexOf(\"z\"); => -1\n arr.indexOf(\"a\", 2); => 4\n arr.indexOf(\"a\", -1); => 4\n arr.indexOf(\"b\", 3); => -1\n arr.indexOf(\"a\", 100); => -1\n\n @param {Object} object the item to search for\n @param {Number} startAt optional starting location to search, default 0\n @returns {Number} index or -1 if not found\n */\n indexOf: function(object, startAt) {\n var idx, len = get(this, 'length');\n\n if (startAt === undefined) startAt = 0;\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx<len;idx++) {\n if (this.objectAt(idx, true) === object) return idx ;\n }\n return -1;\n },\n\n /**\n Returns the index of the given object's last occurrence.\n If no startAt argument is given, the search starts from\n the last position. If it's negative, will count backward\n from the end of the array. Returns -1 if no match is found.\n\n var arr = [\"a\", \"b\", \"c\", \"d\", \"a\"];\n arr.lastIndexOf(\"a\"); => 4\n arr.lastIndexOf(\"z\"); => -1\n arr.lastIndexOf(\"a\", 2); => 0\n arr.lastIndexOf(\"a\", -1); => 4\n arr.lastIndexOf(\"b\", 3); => 1\n arr.lastIndexOf(\"a\", 100); => 4\n\n @param {Object} object the item to search for\n @param {Number} startAt optional starting location to search, default 0\n @returns {Number} index or -1 if not found\n */\n lastIndexOf: function(object, startAt) {\n var idx, len = get(this, 'length');\n\n if (startAt === undefined || startAt >= len) startAt = len-1;\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx>=0;idx--) {\n if (this.objectAt(idx) === object) return idx ;\n }\n return -1;\n },\n\n // ..........................................................\n // ARRAY OBSERVERS\n //\n\n /**\n Adds an array observer to the receiving array. The array observer object\n normally must implement two methods:\n\n * `arrayWillChange(start, removeCount, addCount)` - This method will be\n called just before the array is modified.\n * `arrayDidChange(start, removeCount, addCount)` - This method will be\n called just after the array is modified.\n\n Both callbacks will be passed the starting index of the change as well a\n a count of the items to be removed and added. You can use these callbacks\n to optionally inspect the array during the change, clear caches, or do\n any other bookkeeping necessary.\n\n In addition to passing a target, you can also include an options hash\n which you can use to override the method names that will be invoked on the\n target.\n\n @param {Object} target\n The observer object.\n\n @param {Hash} opts\n Optional hash of configuration options including willChange, didChange,\n and a context option.\n\n @returns {Ember.Array} receiver\n */\n addArrayObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'arrayWillChange',\n didChange = (opts && opts.didChange) || 'arrayDidChange';\n\n var hasObservers = get(this, 'hasArrayObservers');\n if (!hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');\n Ember.addListener(this, '@array:before', target, willChange, xform);\n Ember.addListener(this, '@array:change', target, didChange, xform);\n if (!hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');\n return this;\n },\n\n /**\n Removes an array observer from the object if the observer is current\n registered. Calling this method multiple times with the same object will\n have no effect.\n\n @param {Object} target\n The object observing the array.\n\n @returns {Ember.Array} receiver\n */\n removeArrayObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'arrayWillChange',\n didChange = (opts && opts.didChange) || 'arrayDidChange';\n\n var hasObservers = get(this, 'hasArrayObservers');\n if (hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');\n Ember.removeListener(this, '@array:before', target, willChange, xform);\n Ember.removeListener(this, '@array:change', target, didChange, xform);\n if (hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');\n return this;\n },\n\n /**\n Becomes true whenever the array currently has observers watching changes\n on the array.\n\n @property {Boolean}\n */\n hasArrayObservers: Ember.computed(function() {\n return Ember.hasListeners(this, '@array:change') || Ember.hasListeners(this, '@array:before');\n }).property().cacheable(),\n\n /**\n If you are implementing an object that supports Ember.Array, call this\n method just before the array content changes to notify any observers and\n invalidate any related properties. Pass the starting index of the change\n as well as a delta of the amounts to change.\n\n @param {Number} startIdx\n The starting index in the array that will change.\n\n @param {Number} removeAmt\n The number of items that will be removed. If you pass null assumes 0\n\n @param {Number} addAmt\n The number of items that will be added. If you pass null assumes 0.\n\n @returns {Ember.Array} receiver\n */\n arrayContentWillChange: function(startIdx, removeAmt, addAmt) {\n\n // if no args are passed assume everything changes\n if (startIdx===undefined) {\n startIdx = 0;\n removeAmt = addAmt = -1;\n } else {\n if (removeAmt === undefined) removeAmt=-1;\n if (addAmt === undefined) addAmt=-1;\n }\n\n Ember.sendEvent(this, '@array:before', startIdx, removeAmt, addAmt);\n\n var removing, lim;\n if (startIdx>=0 && removeAmt>=0 && get(this, 'hasEnumerableObservers')) {\n removing = [];\n lim = startIdx+removeAmt;\n for(var idx=startIdx;idx<lim;idx++) removing.push(this.objectAt(idx));\n } else {\n removing = removeAmt;\n }\n\n this.enumerableContentWillChange(removing, addAmt);\n\n // Make sure the @each proxy is set up if anyone is observing @each\n if (Ember.isWatching(this, '@each')) { get(this, '@each'); }\n\n return this;\n },\n\n arrayContentDidChange: function(startIdx, removeAmt, addAmt) {\n\n // if no args are passed assume everything changes\n if (startIdx===undefined) {\n startIdx = 0;\n removeAmt = addAmt = -1;\n } else {\n if (removeAmt === undefined) removeAmt=-1;\n if (addAmt === undefined) addAmt=-1;\n }\n\n var adding, lim;\n if (startIdx>=0 && addAmt>=0 && get(this, 'hasEnumerableObservers')) {\n adding = [];\n lim = startIdx+addAmt;\n for(var idx=startIdx;idx<lim;idx++) adding.push(this.objectAt(idx));\n } else {\n adding = addAmt;\n }\n\n this.enumerableContentDidChange(removeAmt, adding);\n Ember.sendEvent(this, '@array:change', startIdx, removeAmt, addAmt);\n\n var length = get(this, 'length'),\n cachedFirst = cacheFor(this, 'firstObject'),\n cachedLast = cacheFor(this, 'lastObject');\n if (this.objectAt(0) !== cachedFirst) {\n Ember.propertyWillChange(this, 'firstObject');\n Ember.propertyDidChange(this, 'firstObject');\n }\n if (this.objectAt(length-1) !== cachedLast) {\n Ember.propertyWillChange(this, 'lastObject');\n Ember.propertyDidChange(this, 'lastObject');\n }\n\n return this;\n },\n\n // ..........................................................\n // ENUMERATED PROPERTIES\n //\n\n /**\n Returns a special object that can be used to observe individual properties\n on the array. Just get an equivalent property on this object and it will\n return an enumerable that maps automatically to the named key on the\n member objects.\n */\n '@each': Ember.computed(function() {\n if (!this.__each) this.__each = new Ember.EachProxy(this);\n return this.__each;\n }).property().cacheable()\n\n\n\n}) ;\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/mixins/array");minispade.register('ember-runtime/mixins/comparable', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/core');\n\n\n/**\n @namespace\n\n Implements some standard methods for comparing objects. Add this mixin to\n any class you create that can compare its instances.\n\n You should implement the compare() method.\n\n @since Ember 0.9\n*/\nEmber.Comparable = Ember.Mixin.create( /** @scope Ember.Comparable.prototype */{\n\n /**\n walk like a duck. Indicates that the object can be compared.\n\n @type Boolean\n @default true\n @constant\n */\n isComparable: true,\n\n /**\n Override to return the result of the comparison of the two parameters. The\n compare method should return:\n\n - `-1` if `a < b`\n - `0` if `a == b`\n - `1` if `a > b`\n\n Default implementation raises an exception.\n\n @param a {Object} the first object to compare\n @param b {Object} the second object to compare\n @returns {Integer} the result of the comparison\n */\n compare: Ember.required(Function)\n\n});\n\n\n})();\n//@ sourceURL=ember-runtime/mixins/comparable");minispade.register('ember-runtime/mixins/copyable', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/system/string');\n\n\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @namespace\n\n Implements some standard methods for copying an object. Add this mixin to\n any object you create that can create a copy of itself. This mixin is\n added automatically to the built-in array.\n\n You should generally implement the copy() method to return a copy of the\n receiver.\n\n Note that frozenCopy() will only work if you also implement Ember.Freezable.\n\n @since Ember 0.9\n*/\nEmber.Copyable = Ember.Mixin.create(\n/** @scope Ember.Copyable.prototype */ {\n\n /**\n Override to return a copy of the receiver. Default implementation raises\n an exception.\n\n @param deep {Boolean} if true, a deep copy of the object should be made\n @returns {Object} copy of receiver\n */\n copy: Ember.required(Function),\n\n /**\n If the object implements Ember.Freezable, then this will return a new copy\n if the object is not frozen and the receiver if the object is frozen.\n\n Raises an exception if you try to call this method on a object that does\n not support freezing.\n\n You should use this method whenever you want a copy of a freezable object\n since a freezable object can simply return itself without actually\n consuming more memory.\n\n @returns {Object} copy of receiver or receiver\n */\n frozenCopy: function() {\n if (Ember.Freezable && Ember.Freezable.detect(this)) {\n return get(this, 'isFrozen') ? this : this.copy().freeze();\n } else {\n throw new Error(Ember.String.fmt(\"%@ does not support freezing\", [this]));\n }\n }\n});\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/mixins/copyable");minispade.register('ember-runtime/mixins/enumerable', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n\n\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set;\nvar a_slice = Array.prototype.slice;\nvar a_indexOf = Ember.ArrayUtils.indexOf;\n\nvar contexts = [];\n/** @private */\nfunction popCtx() {\n return contexts.length===0 ? {} : contexts.pop();\n}\n\n/** @private */\nfunction pushCtx(ctx) {\n contexts.push(ctx);\n return null;\n}\n\n/** @private */\nfunction iter(key, value) {\n var valueProvided = arguments.length === 2;\n\n function i(item) {\n var cur = get(item, key);\n return valueProvided ? value===cur : !!cur;\n }\n return i ;\n}\n\n/** @private */\nfunction xform(target, method, params) {\n method.call(target, params[0], params[2], params[3]);\n}\n\n/**\n @class\n\n This mixin defines the common interface implemented by enumerable objects\n in Ember. Most of these methods follow the standard Array iteration\n API defined up to JavaScript 1.8 (excluding language-specific features that\n cannot be emulated in older versions of JavaScript).\n\n This mixin is applied automatically to the Array class on page load, so you\n can use any of these methods on simple arrays. If Array already implements\n one of these methods, the mixin will not override them.\n\n h3. Writing Your Own Enumerable\n\n To make your own custom class enumerable, you need two items:\n\n 1. You must have a length property. This property should change whenever\n the number of items in your enumerable object changes. If you using this\n with an Ember.Object subclass, you should be sure to change the length\n property using set().\n\n 2. If you must implement nextObject(). See documentation.\n\n Once you have these two methods implement, apply the Ember.Enumerable mixin\n to your class and you will be able to enumerate the contents of your object\n like any other collection.\n\n h3. Using Ember Enumeration with Other Libraries\n\n Many other libraries provide some kind of iterator or enumeration like\n facility. This is often where the most common API conflicts occur.\n Ember's API is designed to be as friendly as possible with other\n libraries by implementing only methods that mostly correspond to the\n JavaScript 1.8 API.\n\n @since Ember 0.9\n*/\nEmber.Enumerable = Ember.Mixin.create( /** @lends Ember.Enumerable */ {\n\n /** @private - compatibility */\n isEnumerable: true,\n\n /**\n Implement this method to make your class enumerable.\n\n This method will be call repeatedly during enumeration. The index value\n will always begin with 0 and increment monotonically. You don't have to\n rely on the index value to determine what object to return, but you should\n always check the value and start from the beginning when you see the\n requested index is 0.\n\n The previousObject is the object that was returned from the last call\n to nextObject for the current iteration. This is a useful way to\n manage iteration if you are tracing a linked list, for example.\n\n Finally the context parameter will always contain a hash you can use as\n a \"scratchpad\" to maintain any other state you need in order to iterate\n properly. The context object is reused and is not reset between\n iterations so make sure you setup the context with a fresh state whenever\n the index parameter is 0.\n\n Generally iterators will continue to call nextObject until the index\n reaches the your current length-1. If you run out of data before this\n time for some reason, you should simply return undefined.\n\n The default implementation of this method simply looks up the index.\n This works great on any Array-like objects.\n\n @param index {Number} the current index of the iteration\n @param previousObject {Object} the value returned by the last call to nextObject.\n @param context {Object} a context object you can use to maintain state.\n @returns {Object} the next object in the iteration or undefined\n */\n nextObject: Ember.required(Function),\n\n /**\n Helper method returns the first object from a collection. This is usually\n used by bindings and other parts of the framework to extract a single\n object if the enumerable contains only one item.\n\n If you override this method, you should implement it so that it will\n always return the same value each time it is called. If your enumerable\n contains only one object, this method should always return that object.\n If your enumerable is empty, this method should return undefined.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.firstObject(); => \"a\"\n\n var arr = [];\n arr.firstObject(); => undefined\n\n @returns {Object} the object or undefined\n */\n firstObject: Ember.computed(function() {\n if (get(this, 'length')===0) return undefined ;\n\n // handle generic enumerables\n var context = popCtx(), ret;\n ret = this.nextObject(0, null, context);\n pushCtx(context);\n return ret ;\n }).property('[]').cacheable(),\n\n /**\n Helper method returns the last object from a collection. If your enumerable\n contains only one object, this method should always return that object.\n If your enumerable is empty, this method should return undefined.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.lastObject(); => \"c\"\n\n var arr = [];\n arr.lastObject(); => undefined\n\n @returns {Object} the last object or undefined\n */\n lastObject: Ember.computed(function() {\n var len = get(this, 'length');\n if (len===0) return undefined ;\n var context = popCtx(), idx=0, cur, last = null;\n do {\n last = cur;\n cur = this.nextObject(idx++, last, context);\n } while (cur !== undefined);\n pushCtx(context);\n return last;\n }).property('[]').cacheable(),\n\n /**\n Returns true if the passed object can be found in the receiver. The\n default version will iterate through the enumerable until the object\n is found. You may want to override this with a more efficient version.\n\n var arr = [\"a\", \"b\", \"c\"];\n arr.contains(\"a\"); => true\n arr.contains(\"z\"); => false\n\n @param {Object} obj\n The object to search for.\n\n @returns {Boolean} true if object is found in enumerable.\n */\n contains: function(obj) {\n return this.find(function(item) { return item===obj; }) !== undefined;\n },\n\n /**\n Iterates through the enumerable, calling the passed function on each\n item. This method corresponds to the forEach() method defined in\n JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Object} receiver\n */\n forEach: function(callback, target) {\n if (typeof callback !== \"function\") throw new TypeError() ;\n var len = get(this, 'length'), last = null, context = popCtx();\n\n if (target === undefined) target = null;\n\n for(var idx=0;idx<len;idx++) {\n var next = this.nextObject(idx, last, context) ;\n callback.call(target, next, idx, this);\n last = next ;\n }\n last = null ;\n context = pushCtx(context);\n return this ;\n },\n\n /**\n Alias for mapProperty\n\n @params key {String} name of the property\n @returns {Array} The mapped array.\n */\n getEach: function(key) {\n return this.mapProperty(key);\n },\n\n /**\n Sets the value on the named property for each member. This is more\n efficient than using other methods defined on this helper. If the object\n implements Ember.Observable, the value will be changed to set(), otherwise\n it will be set directly. null objects are skipped.\n\n @param {String} key The key to set\n @param {Object} value The object to set\n @returns {Object} receiver\n */\n setEach: function(key, value) {\n return this.forEach(function(item) {\n set(item, key, value);\n });\n },\n\n /**\n Maps all of the items in the enumeration to another value, returning\n a new array. This method corresponds to map() defined in JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the mapped value.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Array} The mapped array.\n */\n map: function(callback, target) {\n var ret = [];\n this.forEach(function(x, idx, i) {\n ret[idx] = callback.call(target, x, idx,i);\n });\n return ret ;\n },\n\n /**\n Similar to map, this specialized function returns the value of the named\n property on all items in the enumeration.\n\n @params key {String} name of the property\n @returns {Array} The mapped array.\n */\n mapProperty: function(key) {\n return this.map(function(next) {\n return get(next, key);\n });\n },\n\n /**\n Returns an array with all of the items in the enumeration that the passed\n function returns true for. This method corresponds to filter() defined in\n JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true to include the item in the results, false otherwise.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Array} A filtered array.\n */\n filter: function(callback, target) {\n var ret = [];\n this.forEach(function(x, idx, i) {\n if (callback.call(target, x, idx, i)) ret.push(x);\n });\n return ret ;\n },\n\n /**\n Returns an array with just the items with the matched property. You\n can pass an optional second argument with the target value. Otherwise\n this will match any property that evaluates to true.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Array} filtered array\n */\n filterProperty: function(key, value) {\n return this.filter(iter.apply(this, arguments));\n },\n\n /**\n Returns the first item in the array for which the callback returns true.\n This method works similar to the filter() method defined in JavaScript 1.6\n except that it will stop working on the array once a match is found.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true to include the item in the results, false otherwise.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Object} Found item or null.\n */\n find: function(callback, target) {\n var len = get(this, 'length') ;\n if (target === undefined) target = null;\n\n var last = null, next, found = false, ret ;\n var context = popCtx();\n for(var idx=0;idx<len && !found;idx++) {\n next = this.nextObject(idx, last, context) ;\n if (found = callback.call(target, next, idx, this)) ret = next ;\n last = next ;\n }\n next = last = null ;\n context = pushCtx(context);\n return ret ;\n },\n\n /**\n Returns an the first item with a property matching the passed value. You\n can pass an optional second argument with the target value. Otherwise\n this will match any property that evaluates to true.\n\n This method works much like the more generic find() method.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Object} found item or null\n */\n findProperty: function(key, value) {\n return this.find(iter.apply(this, arguments));\n },\n\n /**\n Returns true if the passed function returns true for every item in the\n enumeration. This corresponds with the every() method in JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true or false.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n Example Usage:\n\n if (people.every(isEngineer)) { Paychecks.addBigBonus(); }\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Boolean}\n */\n every: function(callback, target) {\n return !this.find(function(x, idx, i) {\n return !callback.call(target, x, idx, i);\n });\n },\n\n /**\n Returns true if the passed property resolves to true for all items in the\n enumerable. This method is often simpler/faster than using a callback.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Array} filtered array\n */\n everyProperty: function(key, value) {\n return this.every(iter.apply(this, arguments));\n },\n\n\n /**\n Returns true if the passed function returns true for any item in the\n enumeration. This corresponds with the every() method in JavaScript 1.6.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(item, index, enumerable);\n\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n It should return the true to include the item in the results, false otherwise.\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as \"this\" on the context. This is a good way\n to give your iterator function access to the current object.\n\n Usage Example:\n\n if (people.some(isManager)) { Paychecks.addBiggerBonus(); }\n\n @param {Function} callback The callback to execute\n @param {Object} target The target object to use\n @returns {Array} A filtered array.\n */\n some: function(callback, target) {\n return !!this.find(function(x, idx, i) {\n return !!callback.call(target, x, idx, i);\n });\n },\n\n /**\n Returns true if the passed property resolves to true for any item in the\n enumerable. This method is often simpler/faster than using a callback.\n\n @params key {String} the property to test\n @param value {String} optional value to test against.\n @returns {Boolean} true\n */\n someProperty: function(key, value) {\n return this.some(iter.apply(this, arguments));\n },\n\n /**\n This will combine the values of the enumerator into a single value. It\n is a useful way to collect a summary value from an enumeration. This\n corresponds to the reduce() method defined in JavaScript 1.8.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n function(previousValue, item, index, enumerable);\n\n - *previousValue* is the value returned by the last call to the iterator.\n - *item* is the current item in the iteration.\n - *index* is the current index in the iteration\n - *enumerable* is the enumerable object itself.\n\n Return the new cumulative value.\n\n In addition to the callback you can also pass an initialValue. An error\n will be raised if you do not pass an initial value and the enumerator is\n empty.\n\n Note that unlike the other methods, this method does not allow you to\n pass a target object to set as this for the callback. It's part of the\n spec. Sorry.\n\n @param {Function} callback The callback to execute\n @param {Object} initialValue Initial value for the reduce\n @param {String} reducerProperty internal use only.\n @returns {Object} The reduced value.\n */\n reduce: function(callback, initialValue, reducerProperty) {\n if (typeof callback !== \"function\") { throw new TypeError(); }\n\n var ret = initialValue;\n\n this.forEach(function(item, i) {\n ret = callback.call(null, ret, item, i, this, reducerProperty);\n }, this);\n\n return ret;\n },\n\n /**\n Invokes the named method on every object in the receiver that\n implements it. This method corresponds to the implementation in\n Prototype 1.6.\n\n @param methodName {String} the name of the method\n @param args {Object...} optional arguments to pass as well.\n @returns {Array} return values from calling invoke.\n */\n invoke: function(methodName) {\n var args, ret = [];\n if (arguments.length>1) args = a_slice.call(arguments, 1);\n\n this.forEach(function(x, idx) {\n var method = x && x[methodName];\n if ('function' === typeof method) {\n ret[idx] = args ? method.apply(x, args) : method.call(x);\n }\n }, this);\n\n return ret;\n },\n\n /**\n Simply converts the enumerable into a genuine array. The order is not\n guaranteed. Corresponds to the method implemented by Prototype.\n\n @returns {Array} the enumerable as an array.\n */\n toArray: function() {\n var ret = [];\n this.forEach(function(o, idx) { ret[idx] = o; });\n return ret ;\n },\n\n /**\n Returns a copy of the array with all null elements removed.\n \n var arr = [\"a\", null, \"c\", null];\n arr.compact(); => [\"a\", \"c\"] \n\n @returns {Array} the array without null elements.\n */\n compact: function() { return this.without(null); },\n\n /**\n Returns a new enumerable that excludes the passed value. The default\n implementation returns an array regardless of the receiver type unless\n the receiver does not contain the value.\n\n var arr = [\"a\", \"b\", \"a\", \"c\"];\n arr.without(\"a\"); => [\"b\", \"c\"]\n\n @param {Object} value\n @returns {Ember.Enumerable}\n */\n without: function(value) {\n if (!this.contains(value)) return this; // nothing to do\n var ret = [] ;\n this.forEach(function(k) {\n if (k !== value) ret[ret.length] = k;\n }) ;\n return ret ;\n },\n\n /**\n Returns a new enumerable that contains only unique values. The default\n implementation returns an array regardless of the receiver type.\n\n var arr = [\"a\", \"a\", \"b\", \"b\"];\n arr.uniq(); => [\"a\", \"b\"]\n\n @returns {Ember.Enumerable}\n */\n uniq: function() {\n var ret = [];\n this.forEach(function(k){\n if (a_indexOf(ret, k)<0) ret.push(k);\n });\n return ret;\n },\n\n /**\n This property will trigger anytime the enumerable's content changes.\n You can observe this property to be notified of changes to the enumerables\n content.\n\n For plain enumerables, this property is read only. Ember.Array overrides\n this method.\n\n @property {Ember.Array}\n */\n '[]': Ember.computed(function(key, value) {\n return this;\n }).property().cacheable(),\n\n // ..........................................................\n // ENUMERABLE OBSERVERS\n //\n\n /**\n Registers an enumerable observer. Must implement Ember.EnumerableObserver\n mixin.\n */\n addEnumerableObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'enumerableWillChange',\n didChange = (opts && opts.didChange) || 'enumerableDidChange';\n\n var hasObservers = get(this, 'hasEnumerableObservers');\n if (!hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');\n Ember.addListener(this, '@enumerable:before', target, willChange, xform);\n Ember.addListener(this, '@enumerable:change', target, didChange, xform);\n if (!hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');\n return this;\n },\n\n /**\n Removes a registered enumerable observer.\n */\n removeEnumerableObserver: function(target, opts) {\n var willChange = (opts && opts.willChange) || 'enumerableWillChange',\n didChange = (opts && opts.didChange) || 'enumerableDidChange';\n\n var hasObservers = get(this, 'hasEnumerableObservers');\n if (hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');\n Ember.removeListener(this, '@enumerable:before', target, willChange);\n Ember.removeListener(this, '@enumerable:change', target, didChange);\n if (hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');\n return this;\n },\n\n /**\n Becomes true whenever the array currently has observers watching changes\n on the array.\n\n @property {Boolean}\n */\n hasEnumerableObservers: Ember.computed(function() {\n return Ember.hasListeners(this, '@enumerable:change') || Ember.hasListeners(this, '@enumerable:before');\n }).property().cacheable(),\n\n\n /**\n Invoke this method just before the contents of your enumerable will\n change. You can either omit the parameters completely or pass the objects\n to be removed or added if available or just a count.\n\n @param {Ember.Enumerable|Number} removing\n An enumerable of the objects to be removed or the number of items to\n be removed.\n\n @param {Ember.Enumerable|Number} adding\n An enumerable of the objects to be added or the number of items to be\n added.\n\n @returns {Ember.Enumerable} receiver\n */\n enumerableContentWillChange: function(removing, adding) {\n\n var removeCnt, addCnt, hasDelta;\n\n if ('number' === typeof removing) removeCnt = removing;\n else if (removing) removeCnt = get(removing, 'length');\n else removeCnt = removing = -1;\n\n if ('number' === typeof adding) addCnt = adding;\n else if (adding) addCnt = get(adding,'length');\n else addCnt = adding = -1;\n\n hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;\n\n if (removing === -1) removing = null;\n if (adding === -1) adding = null;\n\n Ember.propertyWillChange(this, '[]');\n if (hasDelta) Ember.propertyWillChange(this, 'length');\n Ember.sendEvent(this, '@enumerable:before', removing, adding);\n\n return this;\n },\n\n /**\n Invoke this method when the contents of your enumerable has changed.\n This will notify any observers watching for content changes. If your are\n implementing an ordered enumerable (such as an array), also pass the\n start and end values where the content changed so that it can be used to\n notify range observers.\n\n @param {Number} start\n optional start offset for the content change. For unordered\n enumerables, you should always pass -1.\n\n @param {Ember.Enumerable|Number} removing\n An enumerable of the objects to be removed or the number of items to\n be removed.\n\n @param {Ember.Enumerable|Numbe} adding\n An enumerable of the objects to be added or the number of items to be\n added.\n\n @returns {Object} receiver\n */\n enumerableContentDidChange: function(removing, adding) {\n var notify = this.propertyDidChange, removeCnt, addCnt, hasDelta;\n\n if ('number' === typeof removing) removeCnt = removing;\n else if (removing) removeCnt = get(removing, 'length');\n else removeCnt = removing = -1;\n\n if ('number' === typeof adding) addCnt = adding;\n else if (adding) addCnt = get(adding, 'length');\n else addCnt = adding = -1;\n\n hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;\n\n if (removing === -1) removing = null;\n if (adding === -1) adding = null;\n\n Ember.sendEvent(this, '@enumerable:change', removing, adding);\n if (hasDelta) Ember.propertyDidChange(this, 'length');\n Ember.propertyDidChange(this, '[]');\n\n return this ;\n }\n\n}) ;\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/mixins/enumerable");minispade.register('ember-runtime/mixins/evented', "(function() {var get = Ember.get, set = Ember.set, a_slice = Array.prototype.slice;\n\n/** @private */\nfunction xform(target, method, params) {\n var args = a_slice.call(params, 2);\n method.apply(target, args);\n}\n\nEmber.Evented = Ember.Mixin.create({\n on: function(name, target, method) {\n if (!method) {\n method = target;\n target = null;\n }\n\n Ember.addListener(this, name, target, method, xform);\n },\n\n fire: function(name) {\n Ember.sendEvent.apply(null, [this, name].concat(a_slice.call(arguments, 1)));\n },\n\n off: function(name, target, method) {\n Ember.removeListener(this, name, target, method);\n }\n});\n\n})();\n//@ sourceURL=ember-runtime/mixins/evented");minispade.register('ember-runtime/mixins/freezable', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2010 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @namespace\n\n The Ember.Freezable mixin implements some basic methods for marking an object\n as frozen. Once an object is frozen it should be read only. No changes\n may be made the internal state of the object.\n\n ## Enforcement\n\n To fully support freezing in your subclass, you must include this mixin and\n override any method that might alter any property on the object to instead\n raise an exception. You can check the state of an object by checking the\n isFrozen property.\n\n Although future versions of JavaScript may support language-level freezing\n object objects, that is not the case today. Even if an object is freezable,\n it is still technically possible to modify the object, even though it could\n break other parts of your application that do not expect a frozen object to\n change. It is, therefore, very important that you always respect the\n isFrozen property on all freezable objects.\n\n ## Example Usage\n\n The example below shows a simple object that implement the Ember.Freezable\n protocol.\n\n Contact = Ember.Object.extend(Ember.Freezable, {\n\n firstName: null,\n\n lastName: null,\n\n // swaps the names\n swapNames: function() {\n if (this.get('isFrozen')) throw Ember.FROZEN_ERROR;\n var tmp = this.get('firstName');\n this.set('firstName', this.get('lastName'));\n this.set('lastName', tmp);\n return this;\n }\n\n });\n\n c = Context.create({ firstName: \"John\", lastName: \"Doe\" });\n c.swapNames(); => returns c\n c.freeze();\n c.swapNames(); => EXCEPTION\n\n ## Copying\n\n Usually the Ember.Freezable protocol is implemented in cooperation with the\n Ember.Copyable protocol, which defines a frozenCopy() method that will return\n a frozen object, if the object implements this method as well.\n\n @since Ember 0.9\n*/\nEmber.Freezable = Ember.Mixin.create(\n/** @scope Ember.Freezable.prototype */ {\n\n /**\n Set to true when the object is frozen. Use this property to detect whether\n your object is frozen or not.\n\n @property {Boolean}\n */\n isFrozen: false,\n\n /**\n Freezes the object. Once this method has been called the object should\n no longer allow any properties to be edited.\n\n @returns {Object} receiver\n */\n freeze: function() {\n if (get(this, 'isFrozen')) return this;\n set(this, 'isFrozen', true);\n return this;\n }\n\n});\n\nEmber.FROZEN_ERROR = \"Frozen object cannot be modified.\";\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/mixins/freezable");minispade.register('ember-runtime/mixins/mutable_array', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/array');\nminispade.require('ember-runtime/mixins/mutable_enumerable');\n\n// ..........................................................\n// CONSTANTS\n//\n\nvar OUT_OF_RANGE_EXCEPTION = \"Index out of range\" ;\nvar EMPTY = [];\n\n// ..........................................................\n// HELPERS\n//\n\nvar get = Ember.get, set = Ember.set, forEach = Ember.ArrayUtils.forEach;\n\n/**\n @class\n\n This mixin defines the API for modifying array-like objects. These methods\n can be applied only to a collection that keeps its items in an ordered set.\n\n Note that an Array can change even if it does not implement this mixin.\n For example, one might implement a SparseArray that cannot be directly\n modified, but if its underlying enumerable changes, it will change also.\n\n @extends Ember.Mixin\n @extends Ember.Array\n @extends Ember.MutableEnumerable\n*/\nEmber.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,\n /** @scope Ember.MutableArray.prototype */ {\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n This is one of the primitives you must implement to support Ember.Array. You\n should replace amt objects started at idx with the objects in the passed\n array. You should also call this.enumerableContentDidChange() ;\n\n @param {Number} idx\n Starting index in the array to replace. If idx >= length, then append\n to the end of the array.\n\n @param {Number} amt\n Number of elements that should be removed from the array, starting at\n *idx*.\n\n @param {Array} objects\n An array of zero or more objects that should be inserted into the array\n at *idx*\n */\n replace: Ember.required(),\n\n /**\n Remove all elements from self. This is useful if you\n want to reuse an existing array without having to recreate it.\n\n var colors = [\"red\", \"green\", \"blue\"];\n color.length(); => 3\n colors.clear(); => []\n colors.length(); => 0\n\n @returns {Ember.Array} An empty Array. \n */\n clear: function () {\n var len = get(this, 'length');\n if (len === 0) return this;\n this.replace(0, len, EMPTY);\n return this;\n },\n\n /**\n This will use the primitive replace() method to insert an object at the\n specified index.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.insertAt(2, \"yellow\"); => [\"red\", \"green\", \"yellow\", \"blue\"]\n colors.insertAt(5, \"orange\"); => Error: Index out of range\n\n @param {Number} idx index of insert the object at.\n @param {Object} object object to insert\n */\n insertAt: function(idx, object) {\n if (idx > get(this, 'length')) throw new Error(OUT_OF_RANGE_EXCEPTION) ;\n this.replace(idx, 0, [object]) ;\n return this ;\n },\n\n /**\n Remove an object at the specified index using the replace() primitive\n method. You can pass either a single index, or a start and a length.\n\n If you pass a start and length that is beyond the\n length this method will throw an Ember.OUT_OF_RANGE_EXCEPTION\n\n var colors = [\"red\", \"green\", \"blue\", \"yellow\", \"orange\"];\n colors.removeAt(0); => [\"green\", \"blue\", \"yellow\", \"orange\"]\n colors.removeAt(2, 2); => [\"green\", \"blue\"]\n colors.removeAt(4, 2); => Error: Index out of range\n\n @param {Number} start index, start of range\n @param {Number} len length of passing range\n @returns {Object} receiver\n */\n removeAt: function(start, len) {\n\n var delta = 0;\n\n if ('number' === typeof start) {\n\n if ((start < 0) || (start >= get(this, 'length'))) {\n throw new Error(OUT_OF_RANGE_EXCEPTION);\n }\n\n // fast case\n if (len === undefined) len = 1;\n this.replace(start, len, EMPTY);\n }\n\n return this ;\n },\n\n /**\n Push the object onto the end of the array. Works just like push() but it\n is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.pushObject(\"black\"); => [\"red\", \"green\", \"blue\", \"black\"]\n colors.pushObject([\"yellow\", \"orange\"]); => [\"red\", \"green\", \"blue\", \"black\", [\"yellow\", \"orange\"]]\n\n */\n pushObject: function(obj) {\n this.insertAt(get(this, 'length'), obj) ;\n return obj ;\n },\n\n /**\n Add the objects in the passed numerable to the end of the array. Defers\n notifying observers of the change until all objects are added.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.pushObjects(\"black\"); => [\"red\", \"green\", \"blue\", \"black\"]\n colors.pushObjects([\"yellow\", \"orange\"]); => [\"red\", \"green\", \"blue\", \"black\", \"yellow\", \"orange\"]\n\n @param {Ember.Enumerable} objects the objects to add\n @returns {Ember.Array} receiver\n */\n pushObjects: function(objects) {\n this.replace(get(this, 'length'), 0, objects);\n return this;\n },\n\n /**\n Pop object from array or nil if none are left. Works just like pop() but\n it is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.popObject(); => \"blue\"\n console.log(colors); => [\"red\", \"green\"]\n\n */\n popObject: function() {\n var len = get(this, 'length') ;\n if (len === 0) return null ;\n\n var ret = this.objectAt(len-1) ;\n this.removeAt(len-1, 1) ;\n return ret ;\n },\n\n /**\n Shift an object from start of array or nil if none are left. Works just\n like shift() but it is KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.shiftObject(); => \"red\"\n console.log(colors); => [\"green\", \"blue\"]\n\n */\n shiftObject: function() {\n if (get(this, 'length') === 0) return null ;\n var ret = this.objectAt(0) ;\n this.removeAt(0) ;\n return ret ;\n },\n\n /**\n Unshift an object to start of array. Works just like unshift() but it is\n KVO-compliant.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.unshiftObject(\"yellow\"); => [\"yellow\", \"red\", \"green\", \"blue\"]\n colors.unshiftObject([\"black\", \"white\"]); => [[\"black\", \"white\"], \"yellow\", \"red\", \"green\", \"blue\"]\n\n */\n unshiftObject: function(obj) {\n this.insertAt(0, obj) ;\n return obj ;\n },\n\n /**\n Adds the named objects to the beginning of the array. Defers notifying\n observers until all objects have been added.\n\n var colors = [\"red\", \"green\", \"blue\"];\n colors.unshiftObjects([\"black\", \"white\"]); => [\"black\", \"white\", \"red\", \"green\", \"blue\"]\n colors.unshiftObjects(\"yellow\"); => Type Error: 'undefined' is not a function\n\n @param {Ember.Enumerable} objects the objects to add\n @returns {Ember.Array} receiver\n */\n unshiftObjects: function(objects) {\n this.replace(0, 0, objects);\n return this;\n },\n\n // ..........................................................\n // IMPLEMENT Ember.MutableEnumerable\n //\n\n /** @private (nodoc) */\n removeObject: function(obj) {\n var loc = get(this, 'length') || 0;\n while(--loc >= 0) {\n var curObject = this.objectAt(loc) ;\n if (curObject === obj) this.removeAt(loc) ;\n }\n return this ;\n },\n\n /** @private (nodoc) */\n addObject: function(obj) {\n if (!this.contains(obj)) this.pushObject(obj);\n return this ;\n }\n\n});\n\n\n})();\n//@ sourceURL=ember-runtime/mixins/mutable_array");minispade.register('ember-runtime/mixins/mutable_enumerable', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/enumerable');\n\nvar forEach = Ember.ArrayUtils.forEach;\n\n/**\n @class\n\n This mixin defines the API for modifying generic enumerables. These methods\n can be applied to an object regardless of whether it is ordered or\n unordered.\n\n Note that an Enumerable can change even if it does not implement this mixin.\n For example, a MappedEnumerable cannot be directly modified but if its\n underlying enumerable changes, it will change also.\n\n ## Adding Objects\n\n To add an object to an enumerable, use the addObject() method. This\n method will only add the object to the enumerable if the object is not\n already present and the object if of a type supported by the enumerable.\n\n set.addObject(contact);\n\n ## Removing Objects\n\n To remove an object form an enumerable, use the removeObject() method. This\n will only remove the object if it is already in the enumerable, otherwise\n this method has no effect.\n\n set.removeObject(contact);\n\n ## Implementing In Your Own Code\n\n If you are implementing an object and want to support this API, just include\n this mixin in your class and implement the required methods. In your unit\n tests, be sure to apply the Ember.MutableEnumerableTests to your object.\n\n @extends Ember.Mixin\n @extends Ember.Enumerable\n*/\nEmber.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,\n /** @scope Ember.MutableEnumerable.prototype */ {\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n Attempts to add the passed object to the receiver if the object is not\n already present in the collection. If the object is present, this method\n has no effect.\n\n If the passed object is of a type not supported by the receiver\n then this method should raise an exception.\n\n @param {Object} object\n The object to add to the enumerable.\n\n @returns {Object} the passed object\n */\n addObject: Ember.required(Function),\n\n /**\n Adds each object in the passed enumerable to the receiver.\n\n @param {Ember.Enumerable} objects the objects to add.\n @returns {Object} receiver\n */\n addObjects: function(objects) {\n Ember.beginPropertyChanges(this);\n forEach(objects, function(obj) { this.addObject(obj); }, this);\n Ember.endPropertyChanges(this);\n return this;\n },\n\n /**\n __Required.__ You must implement this method to apply this mixin.\n\n Attempts to remove the passed object from the receiver collection if the\n object is in present in the collection. If the object is not present,\n this method has no effect.\n\n If the passed object is of a type not supported by the receiver\n then this method should raise an exception.\n\n @param {Object} object\n The object to remove from the enumerable.\n\n @returns {Object} the passed object\n */\n removeObject: Ember.required(Function),\n\n\n /**\n Removes each objects in the passed enumerable from the receiver.\n\n @param {Ember.Enumerable} objects the objects to remove\n @returns {Object} receiver\n */\n removeObjects: function(objects) {\n Ember.beginPropertyChanges(this);\n forEach(objects, function(obj) { this.removeObject(obj); }, this);\n Ember.endPropertyChanges(this);\n return this;\n }\n\n});\n\n})();\n//@ sourceURL=ember-runtime/mixins/mutable_enumerable");minispade.register('ember-runtime/mixins/observable', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n ## Overview\n \n This mixin provides properties and property observing functionality, core\n features of the Ember object model.\n \n Properties and observers allow one object to observe changes to a\n property on another object. This is one of the fundamental ways that\n models, controllers and views communicate with each other in an Ember\n application.\n \n Any object that has this mixin applied can be used in observer\n operations. That includes Ember.Object and most objects you will\n interact with as you write your Ember application.\n\n Note that you will not generally apply this mixin to classes yourself,\n but you will use the features provided by this module frequently, so it\n is important to understand how to use it.\n \n ## Using get() and set()\n \n Because of Ember's support for bindings and observers, you will always\n access properties using the get method, and set properties using the\n set method. This allows the observing objects to be notified and\n computed properties to be handled properly.\n \n More documentation about `get` and `set` are below.\n \n ## Observing Property Changes\n\n You typically observe property changes simply by adding the `observes`\n call to the end of your method declarations in classes that you write.\n For example:\n\n Ember.Object.create({\n valueObserver: function() {\n // Executes whenever the \"value\" property changes\n }.observes('value')\n });\n \n Although this is the most common way to add an observer, this capability\n is actually built into the Ember.Object class on top of two methods\n defined in this mixin: `addObserver` and `removeObserver`. You can use\n these two methods to add and remove observers yourself if you need to\n do so at runtime.\n\n To add an observer for a property, call:\n\n object.addObserver('propertyKey', targetObject, targetAction)\n\n This will call the `targetAction` method on the `targetObject` to be called\n whenever the value of the `propertyKey` changes.\n \n Note that if `propertyKey` is a computed property, the observer will be \n called when any of the property dependencies are changed, even if the \n resulting value of the computed property is unchanged. This is necessary\n because computed properties are not computed until `get` is called.\n \n @extends Ember.Mixin\n*/\nEmber.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {\n\n /** @private - compatibility */\n isObserverable: true,\n\n /**\n Retrieves the value of a property from the object.\n\n This method is usually similar to using object[keyName] or object.keyName,\n however it supports both computed properties and the unknownProperty\n handler.\n \n Because `get` unifies the syntax for accessing all these kinds\n of properties, it can make many refactorings easier, such as replacing a\n simple property with a computed property, or vice versa.\n\n ### Computed Properties\n\n Computed properties are methods defined with the `property` modifier\n declared at the end, such as:\n\n fullName: function() {\n return this.getEach('firstName', 'lastName').compact().join(' ');\n }.property('firstName', 'lastName')\n\n When you call `get` on a computed property, the function will be\n called and the return value will be returned instead of the function\n itself.\n\n ### Unknown Properties\n\n Likewise, if you try to call `get` on a property whose value is\n undefined, the unknownProperty() method will be called on the object.\n If this method returns any value other than undefined, it will be returned\n instead. This allows you to implement \"virtual\" properties that are\n not defined upfront.\n\n @param {String} key The property to retrieve\n @returns {Object} The property value or undefined.\n */\n get: function(keyName) {\n return get(this, keyName);\n },\n\n /**\n To get multiple properties at once, call getProperties\n with a list of strings or an array:\n\n record.getProperties('firstName', 'lastName', 'zipCode'); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }\n\n is equivalent to:\n\n record.getProperties(['firstName', 'lastName', 'zipCode']); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }\n\n @param {String...|Array} list of keys to get\n @returns {Hash}\n */\n getProperties: function() {\n var ret = {};\n var propertyNames = arguments;\n if (arguments.length === 1 && Ember.typeOf(arguments[0]) === 'array') {\n propertyNames = arguments[0];\n }\n for(var i = 0; i < propertyNames.length; i++) {\n ret[propertyNames[i]] = get(this, propertyNames[i]);\n }\n return ret;\n },\n\n /**\n Sets the key equal to value.\n\n This method is generally very similar to calling object[key] = value or\n object.key = value, except that it provides support for computed\n properties, the unknownProperty() method and property observers.\n\n ### Computed Properties\n\n If you try to set a value on a key that has a computed property handler\n defined (see the get() method for an example), then set() will call\n that method, passing both the value and key instead of simply changing\n the value itself. This is useful for those times when you need to\n implement a property that is composed of one or more member\n properties.\n\n ### Unknown Properties\n\n If you try to set a value on a key that is undefined in the target\n object, then the unknownProperty() handler will be called instead. This\n gives you an opportunity to implement complex \"virtual\" properties that\n are not predefined on the object. If unknownProperty() returns\n undefined, then set() will simply set the value on the object.\n\n ### Property Observers\n\n In addition to changing the property, set() will also register a\n property change with the object. Unless you have placed this call\n inside of a beginPropertyChanges() and endPropertyChanges(), any \"local\"\n observers (i.e. observer methods declared on the same object), will be\n called immediately. Any \"remote\" observers (i.e. observer methods\n declared on another object) will be placed in a queue and called at a\n later time in a coalesced manner.\n\n ### Chaining\n\n In addition to property changes, set() returns the value of the object\n itself so you can do chaining like this:\n\n record.set('firstName', 'Charles').set('lastName', 'Jolley');\n\n @param {String} key The property to set\n @param {Object} value The value to set or null.\n @returns {Ember.Observable}\n */\n set: function(keyName, value) {\n set(this, keyName, value);\n return this;\n },\n\n /**\n To set multiple properties at once, call setProperties\n with a Hash:\n\n record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });\n\n @param {Hash} hash the hash of keys and values to set\n @returns {Ember.Observable}\n */\n setProperties: function(hash) {\n return Ember.setProperties(this, hash);\n },\n\n /**\n Begins a grouping of property changes.\n\n You can use this method to group property changes so that notifications\n will not be sent until the changes are finished. If you plan to make a\n large number of changes to an object at one time, you should call this\n method at the beginning of the changes to begin deferring change\n notifications. When you are done making changes, call endPropertyChanges()\n to deliver the deferred change notifications and end deferring.\n\n @returns {Ember.Observable}\n */\n beginPropertyChanges: function() {\n Ember.beginPropertyChanges();\n return this;\n },\n\n /**\n Ends a grouping of property changes.\n\n You can use this method to group property changes so that notifications\n will not be sent until the changes are finished. If you plan to make a\n large number of changes to an object at one time, you should call\n beginPropertyChanges() at the beginning of the changes to defer change\n notifications. When you are done making changes, call this method to\n deliver the deferred change notifications and end deferring.\n\n @returns {Ember.Observable}\n */\n endPropertyChanges: function() {\n Ember.endPropertyChanges();\n return this;\n },\n\n /**\n Notify the observer system that a property is about to change.\n\n Sometimes you need to change a value directly or indirectly without\n actually calling get() or set() on it. In this case, you can use this\n method and propertyDidChange() instead. Calling these two methods\n together will notify all observers that the property has potentially\n changed value.\n\n Note that you must always call propertyWillChange and propertyDidChange as\n a pair. If you do not, it may get the property change groups out of order\n and cause notifications to be delivered more often than you would like.\n\n @param {String} key The property key that is about to change.\n @returns {Ember.Observable}\n */\n propertyWillChange: function(keyName){\n Ember.propertyWillChange(this, keyName);\n return this;\n },\n\n /**\n Notify the observer system that a property has just changed.\n\n Sometimes you need to change a value directly or indirectly without\n actually calling get() or set() on it. In this case, you can use this\n method and propertyWillChange() instead. Calling these two methods\n together will notify all observers that the property has potentially\n changed value.\n\n Note that you must always call propertyWillChange and propertyDidChange as\n a pair. If you do not, it may get the property change groups out of order\n and cause notifications to be delivered more often than you would like.\n\n @param {String} keyName The property key that has just changed.\n @returns {Ember.Observable}\n */\n propertyDidChange: function(keyName) {\n Ember.propertyDidChange(this, keyName);\n return this;\n },\n \n /**\n Convenience method to call `propertyWillChange` and `propertyDidChange` in\n succession.\n \n @param {String} keyName The property key to be notified about.\n @returns {Ember.Observable}\n */\n notifyPropertyChange: function(keyName) {\n this.propertyWillChange(keyName);\n this.propertyDidChange(keyName);\n return this;\n },\n\n /**\n Adds an observer on a property.\n\n This is the core method used to register an observer for a property.\n\n Once you call this method, anytime the key's value is set, your observer\n will be notified. Note that the observers are triggered anytime the\n value is set, regardless of whether it has actually changed. Your\n observer should be prepared to handle that.\n\n You can also pass an optional context parameter to this method. The\n context will be passed to your observer method whenever it is triggered.\n Note that if you add the same target/method pair on a key multiple times\n with different context parameters, your observer will only be called once\n with the last context you passed.\n\n ### Observer Methods\n\n Observer methods you pass should generally have the following signature if\n you do not pass a \"context\" parameter:\n\n fooDidChange: function(sender, key, value, rev);\n\n The sender is the object that changed. The key is the property that\n changes. The value property is currently reserved and unused. The rev\n is the last property revision of the object when it changed, which you can\n use to detect if the key value has really changed or not.\n\n If you pass a \"context\" parameter, the context will be passed before the\n revision like so:\n\n fooDidChange: function(sender, key, value, context, rev);\n\n Usually you will not need the value, context or revision parameters at\n the end. In this case, it is common to write observer methods that take\n only a sender and key value as parameters or, if you aren't interested in\n any of these values, to write an observer that has no parameters at all.\n\n @param {String} key The key to observer\n @param {Object} target The target object to invoke\n @param {String|Function} method The method to invoke.\n @returns {Ember.Object} self\n */\n addObserver: function(key, target, method) {\n Ember.addObserver(this, key, target, method);\n },\n\n /**\n Remove an observer you have previously registered on this object. Pass\n the same key, target, and method you passed to addObserver() and your\n target will no longer receive notifications.\n\n @param {String} key The key to observer\n @param {Object} target The target object to invoke\n @param {String|Function} method The method to invoke.\n @returns {Ember.Observable} receiver\n */\n removeObserver: function(key, target, method) {\n Ember.removeObserver(this, key, target, method);\n },\n\n /**\n Returns true if the object currently has observers registered for a\n particular key. You can use this method to potentially defer performing\n an expensive action until someone begins observing a particular property\n on the object.\n\n @param {String} key Key to check\n @returns {Boolean}\n */\n hasObserverFor: function(key) {\n return Ember.hasListeners(this, key+':change');\n },\n\n /**\n This method will be called when a client attempts to get the value of a\n property that has not been defined in one of the typical ways. Override\n this method to create \"virtual\" properties.\n \n @param {String} key The name of the unknown property that was requested.\n @returns {Object} The property value or undefined. Default is undefined.\n */\n unknownProperty: function(key) {\n return undefined;\n },\n\n /**\n This method will be called when a client attempts to set the value of a\n property that has not been defined in one of the typical ways. Override\n this method to create \"virtual\" properties.\n \n @param {String} key The name of the unknown property to be set.\n @param {Object} value The value the unknown property is to be set to.\n */\n setUnknownProperty: function(key, value) {\n this[key] = value;\n },\n\n /**\n This is like `get`, but allows you to pass in a dot-separated property\n path.\n \n person.getPath('address.zip'); // return the zip\n person.getPath('children.firstObject.age'); // return the first kid's age\n\n This reads much better than chained `get` calls.\n\n @param {String} path The property path to retrieve\n @returns {Object} The property value or undefined.\n */\n getPath: function(path) {\n return Ember.getPath(this, path);\n },\n\n /**\n This is like `set`, but allows you to specify the property you want to\n set as a dot-separated property path.\n \n person.setPath('address.zip', 10011); // set the zip to 10011\n person.setPath('children.firstObject.age', 6); // set the first kid's age to 6\n\n This is not as commonly used as `getPath`, but it can be useful.\n\n @param {String} path The path to the property that will be set\n @param {Object} value The value to set or null.\n @returns {Ember.Observable}\n */\n setPath: function(path, value) {\n Ember.setPath(this, path, value);\n return this;\n },\n\n /**\n Retrieves the value of a property, or a default value in the case that the property\n returns undefined.\n \n person.getWithDefault('lastName', 'Doe');\n \n @param {String} keyName The name of the property to retrieve\n @param {Object} defaultValue The value to return if the property value is undefined\n @returns {Object} The property value or the defaultValue.\n */\n getWithDefault: function(keyName, defaultValue) {\n return Ember.getWithDefault(this, keyName, defaultValue);\n },\n\n /**\n Set the value of a property to the current value plus some amount.\n \n person.incrementProperty('age');\n team.incrementProperty('score', 2);\n \n @param {String} keyName The name of the property to increment\n @param {Object} increment The amount to increment by. Defaults to 1\n @returns {Object} The new property value\n */\n incrementProperty: function(keyName, increment) {\n if (!increment) { increment = 1; }\n set(this, keyName, (get(this, keyName) || 0)+increment);\n return get(this, keyName);\n },\n \n /**\n Set the value of a property to the current value minus some amount.\n \n player.decrementProperty('lives');\n orc.decrementProperty('health', 5);\n \n @param {String} keyName The name of the property to decrement\n @param {Object} increment The amount to decrement by. Defaults to 1\n @returns {Object} The new property value\n */\n decrementProperty: function(keyName, increment) {\n if (!increment) { increment = 1; }\n set(this, keyName, (get(this, keyName) || 0)-increment);\n return get(this, keyName);\n },\n\n /**\n Set the value of a boolean property to the opposite of it's\n current value.\n \n starship.toggleProperty('warpDriveEnaged');\n \n @param {String} keyName The name of the property to toggle\n @returns {Object} The new property value\n */\n toggleProperty: function(keyName) {\n set(this, keyName, !get(this, keyName));\n return get(this, keyName);\n },\n\n /**\n Returns the cached value of a computed property, if it exists.\n This allows you to inspect the value of a computed property\n without accidentally invoking it if it is intended to be\n generated lazily.\n\n @param {String} keyName\n @returns {Object} The cached value of the computed property, if any\n */\n cacheFor: function(keyName) {\n return Ember.cacheFor(this, keyName);\n },\n\n /** @private - intended for debugging purposes */\n observersForKey: function(keyName) {\n return Ember.observersFor(this, keyName);\n }\n});\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/mixins/observable");minispade.register('ember-runtime/mixins/target_action_support', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath;\n\nEmber.TargetActionSupport = Ember.Mixin.create({\n target: null,\n action: null,\n\n targetObject: Ember.computed(function() {\n var target = get(this, 'target');\n\n if (Ember.typeOf(target) === \"string\") {\n var value = getPath(this, target);\n if (value === undefined) { value = getPath(window, target); }\n return value;\n } else {\n return target;\n }\n }).property('target').cacheable(),\n\n triggerAction: function() {\n var action = get(this, 'action'),\n target = get(this, 'targetObject');\n\n if (target && action) {\n var ret;\n\n if (typeof target.send === 'function') {\n ret = target.send(action, this);\n } else {\n if (typeof action === 'string') {\n action = target[action];\n }\n ret = action.call(target, this);\n }\n if (ret !== false) ret = true;\n\n return ret;\n } else {\n return false;\n }\n }\n});\n\n})();\n//@ sourceURL=ember-runtime/mixins/target_action_support");minispade.register('ember-runtime/system', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/system/application');\nminispade.require('ember-runtime/system/array_proxy');\nminispade.require('ember-runtime/system/core_object');\nminispade.require('ember-runtime/system/each_proxy');\nminispade.require('ember-runtime/system/namespace');\nminispade.require('ember-runtime/system/native_array');\nminispade.require('ember-runtime/system/object');\nminispade.require('ember-runtime/system/set');\nminispade.require('ember-runtime/system/string');\nminispade.require('ember-runtime/system/map');\nminispade.require('ember-runtime/system/lazy_load');\n\n})();\n//@ sourceURL=ember-runtime/system");minispade.register('ember-runtime/system/application', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/system/namespace');\n\n/**\n @private\n\n Defines a namespace that will contain an executable application. This is\n very similar to a normal namespace except that it is expected to include at\n least a 'ready' function which can be run to initialize the application.\n\n Currently Ember.Application is very similar to Ember.Namespace. However, this\n class may be augmented by additional frameworks so it is important to use\n this instance when building new applications.\n\n # Example Usage\n\n MyApp = Ember.Application.create({\n VERSION: '1.0.0',\n store: Ember.Store.create().from(Ember.fixtures)\n });\n\n MyApp.ready = function() {\n //..init code goes here...\n }\n\n*/\nEmber.Application = Ember.Namespace.extend();\n\n\n})();\n//@ sourceURL=ember-runtime/system/application");minispade.register('ember-runtime/system/array_proxy', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/mutable_array');\nminispade.require('ember-runtime/system/object');\n\n\n\nvar get = Ember.get, set = Ember.set;\n\n/**\n @class\n\n An ArrayProxy wraps any other object that implements Ember.Array and/or\n Ember.MutableArray, forwarding all requests. This makes it very useful for\n a number of binding use cases or other cases where being able to swap\n out the underlying array is useful.\n\n A simple example of usage:\n\n var pets = ['dog', 'cat', 'fish'];\n var ap = Ember.ArrayProxy.create({ content: Ember.A(pets) });\n ap.get('firstObject'); // => 'dog'\n ap.set('content', ['amoeba', 'paramecium']);\n ap.get('firstObject'); // => 'amoeba'\n\n This class can also be useful as a layer to transform the contents of\n an array, as they are accessed. This can be done by overriding\n `objectAtContent`:\n\n var pets = ['dog', 'cat', 'fish'];\n var ap = Ember.ArrayProxy.create({\n content: Ember.A(pets),\n objectAtContent: function(idx) {\n return this.get('content').objectAt(idx).toUpperCase();\n }\n });\n ap.get('firstObject'); // => 'DOG'\n\n\n @extends Ember.Object\n @extends Ember.Array\n @extends Ember.MutableArray\n*/\nEmber.ArrayProxy = Ember.Object.extend(Ember.MutableArray,\n/** @scope Ember.ArrayProxy.prototype */ {\n\n /**\n The content array. Must be an object that implements Ember.Array and/or\n Ember.MutableArray.\n\n @property {Ember.Array}\n */\n content: null,\n\n /**\n Should actually retrieve the object at the specified index from the\n content. You can override this method in subclasses to transform the\n content item to something new.\n\n This method will only be called if content is non-null.\n\n @param {Number} idx\n The index to retrieve.\n\n @returns {Object} the value or undefined if none found\n */\n objectAtContent: function(idx) {\n return get(this, 'content').objectAt(idx);\n },\n\n /**\n Should actually replace the specified objects on the content array.\n You can override this method in subclasses to transform the content item\n into something new.\n\n This method will only be called if content is non-null.\n\n @param {Number} idx\n The starting index\n\n @param {Number} amt\n The number of items to remove from the content.\n\n @param {Array} objects\n Optional array of objects to insert or null if no objects.\n\n @returns {void}\n */\n replaceContent: function(idx, amt, objects) {\n get(this, 'content').replace(idx, amt, objects);\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 contentWillChange: Ember.beforeObserver(function() {\n var content = get(this, 'content'),\n len = content ? get(content, 'length') : 0;\n this.arrayWillChange(content, 0, len, undefined);\n if (content) content.removeArrayObserver(this);\n }, 'content'),\n\n /**\n Invoked when the content property changes. Notifies observers that the\n entire array content has changed.\n */\n contentDidChange: Ember.observer(function() {\n var content = get(this, 'content'),\n len = content ? get(content, 'length') : 0;\n if (content) content.addArrayObserver(this);\n this.arrayDidChange(content, 0, undefined, len);\n }, 'content'),\n\n /** @private (nodoc) */\n objectAt: function(idx) {\n return get(this, 'content') && this.objectAtContent(idx);\n },\n\n /** @private (nodoc) */\n length: Ember.computed(function() {\n var content = get(this, 'content');\n return content ? get(content, 'length') : 0;\n // No dependencies since Enumerable notifies length of change\n }).property().cacheable(),\n\n /** @private (nodoc) */\n replace: function(idx, amt, objects) {\n if (get(this, 'content')) this.replaceContent(idx, amt, objects);\n return this;\n },\n\n /** @private (nodoc) */\n arrayWillChange: function(item, idx, removedCnt, addedCnt) {\n this.arrayContentWillChange(idx, removedCnt, addedCnt);\n },\n\n /** @private (nodoc) */\n arrayDidChange: function(item, idx, removedCnt, addedCnt) {\n this.arrayContentDidChange(idx, removedCnt, addedCnt);\n },\n\n /** @private (nodoc) */\n init: function() {\n this._super();\n this.contentWillChange();\n this.contentDidChange();\n }\n\n});\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/system/array_proxy");minispade.register('ember-runtime/system/core_object', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n\n\n// NOTE: this object should never be included directly. Instead use Ember.\n// Ember.Object. We only define this separately so that Ember.Set can depend on it\n\n\n\nvar rewatch = Ember.rewatch;\nvar classToString = Ember.Mixin.prototype.toString;\nvar set = Ember.set, get = Ember.get;\nvar o_create = Ember.platform.create,\n o_defineProperty = Ember.platform.defineProperty,\n a_slice = Array.prototype.slice,\n meta = Ember.meta;\n\n/** @private */\nfunction makeCtor() {\n\n // Note: avoid accessing any properties on the object since it makes the\n // method a lot faster. This is glue code so we want it to be as fast as\n // possible.\n\n var wasApplied = false, initMixins, init = false, hasChains = false;\n\n var Class = function() {\n if (!wasApplied) { Class.proto(); } // prepare prototype...\n if (initMixins) {\n this.reopen.apply(this, initMixins);\n initMixins = null;\n rewatch(this); // always rewatch just in case\n Ember.Mixin.finishPartial(this);\n this.init.apply(this, arguments);\n } else {\n if (hasChains) {\n rewatch(this);\n } else {\n Ember.GUID_DESC.value = undefined;\n o_defineProperty(this, Ember.GUID_KEY, Ember.GUID_DESC);\n }\n if (init===false) { init = this.init; } // cache for later instantiations\n Ember.GUID_DESC.value = undefined;\n o_defineProperty(this, '_super', Ember.GUID_DESC);\n Ember.Mixin.finishPartial(this);\n init.apply(this, arguments);\n }\n };\n\n Class.toString = classToString;\n Class.willReopen = function() {\n if (wasApplied) {\n Class.PrototypeMixin = Ember.Mixin.create(Class.PrototypeMixin);\n }\n\n wasApplied = false;\n };\n Class._initMixins = function(args) { initMixins = args; };\n\n Class.proto = function() {\n var superclass = Class.superclass;\n if (superclass) { superclass.proto(); }\n\n if (!wasApplied) {\n wasApplied = true;\n Class.PrototypeMixin.applyPartial(Class.prototype);\n Ember.rewatch(Class.prototype); // setup watch chains if needed.\n hasChains = !!meta(Class.prototype, false).chains; // avoid rewatch\n }\n\n return this.prototype;\n };\n\n return Class;\n\n}\n\nvar CoreObject = makeCtor();\n\nCoreObject.PrototypeMixin = Ember.Mixin.create(\n/** @scope Ember.CoreObject */ {\n\n reopen: function() {\n Ember.Mixin._apply(this, arguments, true);\n return this;\n },\n\n isInstance: true,\n\n /** @private */\n init: function() {},\n\n /** @field */\n isDestroyed: false,\n\n /** @field */\n isDestroying: false,\n\n /**\n Destroys an object by setting the isDestroyed flag and removing its\n metadata, which effectively destroys observers and bindings.\n\n If you try to set a property on a destroyed object, an exception will be\n raised.\n\n Note that destruction is scheduled for the end of the run loop and does not\n happen immediately.\n\n @returns {Ember.Object} receiver\n */\n destroy: function() {\n if (this.isDestroying) { return; }\n\n this.isDestroying = true;\n\n if (this.willDestroy) { this.willDestroy(); }\n\n set(this, 'isDestroyed', true);\n Ember.run.schedule('destroy', this, this._scheduledDestroy);\n return this;\n },\n\n /**\n Invoked by the run loop to actually destroy the object. This is\n scheduled for execution by the `destroy` method.\n\n @private\n */\n _scheduledDestroy: function() {\n Ember.destroy(this);\n if (this.didDestroy) { this.didDestroy(); }\n },\n\n bind: function(to, from) {\n if (!(from instanceof Ember.Binding)) { from = Ember.Binding.from(from); }\n from.to(to).connect(this);\n return from;\n },\n\n toString: function() {\n return '<'+this.constructor.toString()+':'+Ember.guidFor(this)+'>';\n }\n});\n\nCoreObject.__super__ = null;\n\nvar ClassMixin = Ember.Mixin.create({\n\n ClassMixin: Ember.required(),\n\n PrototypeMixin: Ember.required(),\n\n isClass: true,\n\n isMethod: false,\n\n extend: function() {\n var Class = makeCtor(), proto;\n Class.ClassMixin = Ember.Mixin.create(this.ClassMixin);\n Class.PrototypeMixin = Ember.Mixin.create(this.PrototypeMixin);\n\n Class.ClassMixin.ownerConstructor = Class;\n Class.PrototypeMixin.ownerConstructor = Class;\n\n var PrototypeMixin = Class.PrototypeMixin;\n PrototypeMixin.reopen.apply(PrototypeMixin, arguments);\n\n Class.superclass = this;\n Class.__super__ = this.prototype;\n\n proto = Class.prototype = o_create(this.prototype);\n proto.constructor = Class;\n Ember.generateGuid(proto, 'ember');\n meta(proto).proto = proto; // this will disable observers on prototype\n\n\n Class.subclasses = Ember.Set ? new Ember.Set() : null;\n if (this.subclasses) { this.subclasses.add(Class); }\n\n Class.ClassMixin.apply(Class);\n return Class;\n },\n\n create: function() {\n var C = this;\n if (arguments.length>0) { this._initMixins(arguments); }\n return new C();\n },\n\n reopen: function() {\n this.willReopen();\n var PrototypeMixin = this.PrototypeMixin;\n PrototypeMixin.reopen.apply(PrototypeMixin, arguments);\n return this;\n },\n\n reopenClass: function() {\n var ClassMixin = this.ClassMixin;\n ClassMixin.reopen.apply(ClassMixin, arguments);\n Ember.Mixin._apply(this, arguments, false);\n return this;\n },\n\n detect: function(obj) {\n if ('function' !== typeof obj) { return false; }\n while(obj) {\n if (obj===this) { return true; }\n obj = obj.superclass;\n }\n return false;\n },\n\n detectInstance: function(obj) {\n return obj instanceof this;\n },\n\n /**\n In some cases, you may want to annotate computed properties with additional\n metadata about how they function or what values they operate on. For example,\n computed property functions may close over variables that are then no longer\n available for introspection.\n\n You can pass a hash of these values to a computed property like this:\n\n person: function() {\n var personId = this.get('personId');\n return App.Person.create({ id: personId });\n }.property().meta({ type: App.Person })\n\n Once you've done this, you can retrieve the values saved to the computed\n property from your class like this:\n\n MyClass.metaForProperty('person');\n\n This will return the original hash that was passed to `meta()`.\n */\n metaForProperty: function(key) {\n var desc = meta(this.proto(), false).descs[key];\n\n Ember.assert(\"metaForProperty() could not find a computed property with key '\"+key+\"'.\", !!desc && desc instanceof Ember.ComputedProperty);\n return desc._meta || {};\n },\n\n /**\n Iterate over each computed property for the class, passing its name\n and any associated metadata (see `metaForProperty`) to the callback.\n */\n eachComputedProperty: function(callback, binding) {\n var proto = this.proto(),\n descs = meta(proto).descs,\n empty = {},\n property;\n\n for (var name in descs) {\n property = descs[name];\n\n if (property instanceof Ember.ComputedProperty) {\n callback.call(binding || this, name, property._meta || empty);\n }\n }\n }\n\n});\n\nCoreObject.ClassMixin = ClassMixin;\nClassMixin.apply(CoreObject);\n\n/**\n @class\n*/\nEmber.CoreObject = CoreObject;\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/system/core_object");minispade.register('ember-runtime/system/each_proxy', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/system/object');\nminispade.require('ember-runtime/mixins/array');\n\n\n\nvar set = Ember.set, get = Ember.get, guidFor = Ember.guidFor;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar EachArray = Ember.Object.extend(Ember.Array, {\n\n init: function(content, keyName, owner) {\n this._super();\n this._keyName = keyName;\n this._owner = owner;\n this._content = content;\n },\n\n objectAt: function(idx) {\n var item = this._content.objectAt(idx);\n return item && get(item, this._keyName);\n },\n\n length: Ember.computed(function() {\n var content = this._content;\n return content ? get(content, 'length') : 0;\n }).property().cacheable()\n\n});\n\nvar IS_OBSERVER = /^.+:(before|change)$/;\n\n/** @private */\nfunction addObserverForContentKey(content, keyName, proxy, idx, loc) {\n var objects = proxy._objects, guid;\n if (!objects) objects = proxy._objects = {};\n\n while(--loc>=idx) {\n var item = content.objectAt(loc);\n if (item) {\n Ember.addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');\n Ember.addObserver(item, keyName, proxy, 'contentKeyDidChange');\n\n // keep track of the indicies each item was found at so we can map\n // it back when the obj changes.\n guid = guidFor(item);\n if (!objects[guid]) objects[guid] = [];\n objects[guid].push(loc);\n }\n }\n}\n\n/** @private */\nfunction removeObserverForContentKey(content, keyName, proxy, idx, loc) {\n var objects = proxy._objects;\n if (!objects) objects = proxy._objects = {};\n var indicies, guid;\n\n while(--loc>=idx) {\n var item = content.objectAt(loc);\n if (item) {\n Ember.removeBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');\n Ember.removeObserver(item, keyName, proxy, 'contentKeyDidChange');\n\n guid = guidFor(item);\n indicies = objects[guid];\n indicies[indicies.indexOf(loc)] = null;\n }\n }\n}\n\n/**\n @private\n @class\n\n This is the object instance returned when you get the @each property on an\n array. It uses the unknownProperty handler to automatically create\n EachArray instances for property names.\n\n @extends Ember.Object\n*/\nEmber.EachProxy = Ember.Object.extend({\n\n init: function(content) {\n this._super();\n this._content = content;\n content.addArrayObserver(this);\n\n // in case someone is already observing some keys make sure they are\n // added\n forEach(Ember.watchedEvents(this), function(eventName) {\n this.didAddListener(eventName);\n }, this);\n },\n\n /**\n You can directly access mapped properties by simply requesting them.\n The unknownProperty handler will generate an EachArray of each item.\n */\n unknownProperty: function(keyName, value) {\n var ret;\n ret = new EachArray(this._content, keyName, this);\n new Ember.Descriptor().setup(this, keyName, ret);\n this.beginObservingContentKey(keyName);\n return ret;\n },\n\n // ..........................................................\n // ARRAY CHANGES\n // Invokes whenever the content array itself changes.\n\n arrayWillChange: function(content, idx, removedCnt, addedCnt) {\n var keys = this._keys, key, array, lim;\n\n lim = removedCnt>0 ? idx+removedCnt : -1;\n Ember.beginPropertyChanges(this);\n\n for(key in keys) {\n if (!keys.hasOwnProperty(key)) { continue; }\n\n if (lim>0) removeObserverForContentKey(content, key, this, idx, lim);\n\n Ember.propertyWillChange(this, key);\n }\n\n Ember.propertyWillChange(this._content, '@each');\n Ember.endPropertyChanges(this);\n },\n\n arrayDidChange: function(content, idx, removedCnt, addedCnt) {\n var keys = this._keys, key, array, lim;\n\n lim = addedCnt>0 ? idx+addedCnt : -1;\n Ember.beginPropertyChanges(this);\n\n for(key in keys) {\n if (!keys.hasOwnProperty(key)) { continue; }\n\n if (lim>0) addObserverForContentKey(content, key, this, idx, lim);\n\n Ember.propertyDidChange(this, key);\n }\n\n Ember.propertyDidChange(this._content, '@each');\n Ember.endPropertyChanges(this);\n },\n\n // ..........................................................\n // LISTEN FOR NEW OBSERVERS AND OTHER EVENT LISTENERS\n // Start monitoring keys based on who is listening...\n\n didAddListener: function(eventName) {\n if (IS_OBSERVER.test(eventName)) {\n this.beginObservingContentKey(eventName.slice(0, -7));\n }\n },\n\n didRemoveListener: function(eventName) {\n if (IS_OBSERVER.test(eventName)) {\n this.stopObservingContentKey(eventName.slice(0, -7));\n }\n },\n\n // ..........................................................\n // CONTENT KEY OBSERVING\n // Actual watch keys on the source content.\n\n beginObservingContentKey: function(keyName) {\n var keys = this._keys;\n if (!keys) keys = this._keys = {};\n if (!keys[keyName]) {\n keys[keyName] = 1;\n var content = this._content,\n len = get(content, 'length');\n addObserverForContentKey(content, keyName, this, 0, len);\n } else {\n keys[keyName]++;\n }\n },\n\n stopObservingContentKey: function(keyName) {\n var keys = this._keys;\n if (keys && (keys[keyName]>0) && (--keys[keyName]<=0)) {\n var content = this._content,\n len = get(content, 'length');\n removeObserverForContentKey(content, keyName, this, 0, len);\n }\n },\n\n contentKeyWillChange: function(obj, keyName) {\n Ember.propertyWillChange(this, keyName);\n },\n\n contentKeyDidChange: function(obj, keyName) {\n Ember.propertyDidChange(this, keyName);\n }\n\n});\n\n\n\n})();\n//@ sourceURL=ember-runtime/system/each_proxy");minispade.register('ember-runtime/system/lazy_load', "(function() {var loadHooks = {};\nvar loaded = {};\n\nEmber.onLoad = function(name, callback) {\n var object;\n\n loadHooks[name] = loadHooks[name] || Ember.A();\n loadHooks[name].pushObject(callback);\n\n if (object = loaded[name]) {\n callback(object);\n }\n};\n\nEmber.runLoadHooks = function(name, object) {\n var hooks;\n\n loaded[name] = object;\n\n if (hooks = loadHooks[name]) {\n loadHooks[name].forEach(function(callback) {\n callback(object);\n });\n }\n};\n\n})();\n//@ sourceURL=ember-runtime/system/lazy_load");minispade.register('ember-runtime/system/map', "(function() {/**\n JavaScript (before ES6) does not have a Map implementation. Objects,\n which are often used as dictionaries, may only have Strings as keys.\n\n Because Ember has a way to get a unique identifier for every object\n via `Ember.guidFor`, we can implement a performant Map with arbitrary\n keys. Because it is commonly used in low-level bookkeeping, Map is\n implemented as a pure JavaScript object for performance.\n\n This implementation follows the current iteration of the ES6 proposal\n for maps (http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets),\n with two exceptions. First, because we need our implementation to be\n pleasant on older browsers, we do not use the `delete` name (using\n `remove` instead). Second, as we do not have the luxury of in-VM\n iteration, we implement a forEach method for iteration.\n\n Map is mocked out to look like an Ember object, so you can do\n `Ember.Map.create()` for symmetry with other Ember classes.\n*/\n\n/** @private */\nvar guidFor = Ember.guidFor;\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n// This class is used internally by Ember.js and Ember Data.\n// Please do not use it at this time. We plan to clean it up\n// and add many tests soon.\nvar OrderedSet = Ember.OrderedSet = function() {\n this.clear();\n};\n\nOrderedSet.create = function() {\n return new OrderedSet();\n};\n\nOrderedSet.prototype = {\n clear: function() {\n this.presenceSet = {};\n this.list = [];\n },\n\n add: function(obj) {\n var guid = guidFor(obj),\n presenceSet = this.presenceSet,\n list = this.list;\n\n if (guid in presenceSet) { return; }\n\n presenceSet[guid] = true;\n list.push(obj);\n },\n\n remove: function(obj) {\n var guid = guidFor(obj),\n presenceSet = this.presenceSet,\n list = this.list;\n\n delete presenceSet[guid];\n\n var index = indexOf(list, obj);\n if (index > -1) {\n list.splice(index, 1);\n }\n },\n\n isEmpty: function() {\n return this.list.length === 0;\n },\n\n forEach: function(fn, self) {\n // allow mutation during iteration\n var list = this.list.slice();\n\n for (var i = 0, j = list.length; i < j; i++) {\n fn.call(self, list[i]);\n }\n },\n\n toArray: function() {\n return this.list.slice();\n }\n};\n\n/**\n A Map stores values indexed by keys. Unlike JavaScript's\n default Objects, the keys of a Map can be any JavaScript\n object.\n\n Internally, a Map has two data structures:\n\n `keys`: an OrderedSet of all of the existing keys\n `values`: a JavaScript Object indexed by the\n Ember.guidFor(key)\n\n When a key/value pair is added for the first time, we\n add the key to the `keys` OrderedSet, and create or\n replace an entry in `values`. When an entry is deleted,\n we delete its entry in `keys` and `values`.\n*/\n\n/** @private */\nvar Map = Ember.Map = function() {\n this.keys = Ember.OrderedSet.create();\n this.values = {};\n};\n\nMap.create = function() {\n return new Map();\n};\n\nMap.prototype = {\n /**\n Retrieve the value associated with a given key.\n\n @param {anything} key\n @return {anything} the value associated with the key, or undefined\n */\n get: function(key) {\n var values = this.values,\n guid = guidFor(key);\n\n return values[guid];\n },\n\n /**\n Adds a value to the map. If a value for the given key has already been\n provided, the new value will replace the old value.\n\n @param {anything} key\n @param {anything} value\n */\n set: function(key, value) {\n var keys = this.keys,\n values = this.values,\n guid = guidFor(key);\n\n keys.add(key);\n values[guid] = value;\n },\n\n /**\n Removes a value from the map for an associated key.\n\n @param {anything} key\n @returns {Boolean} true if an item was removed, false otherwise\n */\n remove: function(key) {\n // don't use ES6 \"delete\" because it will be annoying\n // to use in browsers that are not ES6 friendly;\n var keys = this.keys,\n values = this.values,\n guid = guidFor(key),\n value;\n\n if (values.hasOwnProperty(guid)) {\n keys.remove(key);\n value = values[guid];\n delete values[guid];\n return true;\n } else {\n return false;\n }\n },\n\n /**\n Check whether a key is present.\n\n @param {anything} key\n @returns {Boolean} true if the item was present, false otherwise\n */\n has: function(key) {\n var values = this.values,\n guid = guidFor(key);\n\n return values.hasOwnProperty(guid);\n },\n\n /**\n Iterate over all the keys and values. Calls the function once\n for each key, passing in the key and value, in that order.\n\n The keys are guaranteed to be iterated over in insertion order.\n\n @param {Function} callback\n @param {anything} self if passed, the `this` value inside the\n callback. By default, `this` is the map.\n */\n forEach: function(callback, self) {\n var keys = this.keys,\n values = this.values;\n\n keys.forEach(function(key) {\n var guid = guidFor(key);\n callback.call(self, key, values[guid]);\n });\n }\n};\n\n})();\n//@ sourceURL=ember-runtime/system/map");minispade.register('ember-runtime/system/namespace', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/system/object');\n\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n/**\n @private\n A Namespace is an object usually used to contain other objects or methods\n such as an application or framework. Create a namespace anytime you want\n to define one of these new containers.\n\n # Example Usage\n\n MyFramework = Ember.Namespace.create({\n VERSION: '1.0.0'\n });\n\n*/\nEmber.Namespace = Ember.Object.extend({\n isNamespace: true,\n\n init: function() {\n Ember.Namespace.NAMESPACES.push(this);\n Ember.Namespace.PROCESSED = false;\n },\n\n toString: function() {\n Ember.identifyNamespaces();\n return this[Ember.GUID_KEY+'_name'];\n },\n\n destroy: function() {\n var namespaces = Ember.Namespace.NAMESPACES;\n window[this.toString()] = undefined;\n namespaces.splice(indexOf(namespaces, this), 1);\n this._super();\n }\n});\n\nEmber.Namespace.NAMESPACES = [Ember];\nEmber.Namespace.PROCESSED = false;\n\n})();\n//@ sourceURL=ember-runtime/system/namespace");minispade.register('ember-runtime/system/native_array', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/observable');\nminispade.require('ember-runtime/mixins/mutable_array');\nminispade.require('ember-runtime/mixins/copyable');\n\n\n\nvar get = Ember.get, set = Ember.set;\n\n// Add Ember.Array to Array.prototype. Remove methods with native\n// implementations and supply some more optimized versions of generic methods\n// because they are so common.\nvar NativeArray = Ember.Mixin.create(Ember.MutableArray, Ember.Observable, Ember.Copyable, {\n\n // because length is a built-in property we need to know to just get the\n // original property.\n get: function(key) {\n if (key==='length') return this.length;\n else if ('number' === typeof key) return this[key];\n else return this._super(key);\n },\n\n objectAt: function(idx) {\n return this[idx];\n },\n\n // primitive for array support.\n replace: function(idx, amt, objects) {\n\n if (this.isFrozen) throw Ember.FROZEN_ERROR ;\n\n // if we replaced exactly the same number of items, then pass only the\n // replaced range. Otherwise, pass the full remaining array length\n // since everything has shifted\n var len = objects ? get(objects, 'length') : 0;\n this.arrayContentWillChange(idx, amt, len);\n\n if (!objects || objects.length === 0) {\n this.splice(idx, amt) ;\n } else {\n var args = [idx, amt].concat(objects) ;\n this.splice.apply(this,args) ;\n }\n\n this.arrayContentDidChange(idx, amt, len);\n return this ;\n },\n\n // If you ask for an unknown property, then try to collect the value\n // from member items.\n unknownProperty: function(key, value) {\n var ret;// = this.reducedProperty(key, value) ;\n if ((value !== undefined) && ret === undefined) {\n ret = this[key] = value;\n }\n return ret ;\n },\n\n // If browser did not implement indexOf natively, then override with\n // specialized version\n indexOf: function(object, startAt) {\n var idx, len = this.length;\n\n if (startAt === undefined) startAt = 0;\n else startAt = (startAt < 0) ? Math.ceil(startAt) : Math.floor(startAt);\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx<len;idx++) {\n if (this[idx] === object) return idx ;\n }\n return -1;\n },\n\n lastIndexOf: function(object, startAt) {\n var idx, len = this.length;\n\n if (startAt === undefined) startAt = len-1;\n else startAt = (startAt < 0) ? Math.ceil(startAt) : Math.floor(startAt);\n if (startAt < 0) startAt += len;\n\n for(idx=startAt;idx>=0;idx--) {\n if (this[idx] === object) return idx ;\n }\n return -1;\n },\n\n copy: function() {\n return this.slice();\n }\n});\n\n// Remove any methods implemented natively so we don't override them\nvar ignore = ['length'];\nEmber.ArrayUtils.forEach(NativeArray.keys(), function(methodName) {\n if (Array.prototype[methodName]) ignore.push(methodName);\n});\n\nif (ignore.length>0) {\n NativeArray = NativeArray.without.apply(NativeArray, ignore);\n}\n\n/**\n The NativeArray mixin contains the properties needed to to make the native\n Array support Ember.MutableArray and all of its dependent APIs. Unless you\n have Ember.EXTEND_PROTOTYPES set to false, this will be applied automatically.\n Otherwise you can apply the mixin at anytime by calling\n `Ember.NativeArray.activate`.\n\n @namespace\n @extends Ember.MutableArray\n @extends Ember.Array\n @extends Ember.Enumerable\n @extends Ember.MutableEnumerable\n @extends Ember.Copyable\n @extends Ember.Freezable\n*/\nEmber.NativeArray = NativeArray;\n\n/**\n Creates an Ember.NativeArray from an Array like object.\n Does not modify the original object.\n\n @returns {Ember.NativeArray}\n*/\nEmber.A = function(arr){\n if (arr === undefined) { arr = []; }\n return Ember.NativeArray.apply(arr);\n};\n\n/**\n Activates the mixin on the Array.prototype if not already applied. Calling\n this method more than once is safe.\n\n @returns {void}\n*/\nEmber.NativeArray.activate = function() {\n NativeArray.apply(Array.prototype);\n\n Ember.A = function(arr) { return arr || []; };\n};\n\nif (Ember.EXTEND_PROTOTYPES) Ember.NativeArray.activate();\n\n\n\n})();\n//@ sourceURL=ember-runtime/system/native_array");minispade.register('ember-runtime/system/object', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/mixins/observable');\nminispade.require('ember-runtime/system/core_object');\nminispade.require('ember-runtime/system/set');\n\nEmber.CoreObject.subclasses = new Ember.Set();\n\n/**\n @class\n @extends Ember.CoreObject\n @extends Ember.Observable\n*/\nEmber.Object = Ember.CoreObject.extend(Ember.Observable);\n\n\n\n\n})();\n//@ sourceURL=ember-runtime/system/object");minispade.register('ember-runtime/system/set', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime/core');\nminispade.require('ember-runtime/system/core_object');\nminispade.require('ember-runtime/mixins/mutable_enumerable');\nminispade.require('ember-runtime/mixins/copyable');\nminispade.require('ember-runtime/mixins/freezable');\n\nvar get = Ember.get, set = Ember.set, guidFor = Ember.guidFor, none = Ember.none;\n\n/**\n @class\n\n An unordered collection of objects.\n\n A Set works a bit like an array except that its items are not ordered.\n You can create a set to efficiently test for membership for an object. You\n can also iterate through a set just like an array, even accessing objects\n by index, however there is no guarantee as to their order.\n\n All Sets are observable via the Enumerable Observer API - which works\n on any enumerable object including both Sets and Arrays.\n\n ## Creating a Set\n\n You can create a set like you would most objects using\n `new Ember.Set()`. Most new sets you create will be empty, but you can\n also initialize the set with some content by passing an array or other\n enumerable of objects to the constructor.\n\n Finally, you can pass in an existing set and the set will be copied. You\n can also create a copy of a set by calling `Ember.Set#copy()`.\n\n #js\n // creates a new empty set\n var foundNames = new Ember.Set();\n\n // creates a set with four names in it.\n var names = new Ember.Set([\"Charles\", \"Tom\", \"Juan\", \"Alex\"]); // :P\n\n // creates a copy of the names set.\n var namesCopy = new Ember.Set(names);\n\n // same as above.\n var anotherNamesCopy = names.copy();\n\n ## Adding/Removing Objects\n\n You generally add or remove objects from a set using `add()` or\n `remove()`. You can add any type of object including primitives such as\n numbers, strings, and booleans.\n\n Unlike arrays, objects can only exist one time in a set. If you call `add()`\n on a set with the same object multiple times, the object will only be added\n once. Likewise, calling `remove()` with the same object multiple times will\n remove the object the first time and have no effect on future calls until\n you add the object to the set again.\n\n NOTE: You cannot add/remove null or undefined to a set. Any attempt to do so\n will be ignored.\n\n In addition to add/remove you can also call `push()`/`pop()`. Push behaves\n just like `add()` but `pop()`, unlike `remove()` will pick an arbitrary\n object, remove it and return it. This is a good way to use a set as a job\n queue when you don't care which order the jobs are executed in.\n\n ## Testing for an Object\n\n To test for an object's presence in a set you simply call\n `Ember.Set#contains()`.\n\n ## Observing changes\n\n When using `Ember.Set`, you can observe the `\"[]\"` property to be\n alerted whenever the content changes. You can also add an enumerable\n observer to the set to be notified of specific objects that are added and\n removed from the set. See `Ember.Enumerable` for more information on\n enumerables.\n\n This is often unhelpful. If you are filtering sets of objects, for instance,\n it is very inefficient to re-filter all of the items each time the set\n changes. It would be better if you could just adjust the filtered set based\n on what was changed on the original set. The same issue applies to merging\n sets, as well.\n\n ## Other Methods\n\n `Ember.Set` primary implements other mixin APIs. For a complete reference\n on the methods you will use with `Ember.Set`, please consult these mixins.\n The most useful ones will be `Ember.Enumerable` and\n `Ember.MutableEnumerable` which implement most of the common iterator\n methods you are used to on Array.\n\n Note that you can also use the `Ember.Copyable` and `Ember.Freezable`\n APIs on `Ember.Set` as well. Once a set is frozen it can no longer be\n modified. The benefit of this is that when you call frozenCopy() on it,\n Ember will avoid making copies of the set. This allows you to write\n code that can know with certainty when the underlying set data will or\n will not be modified.\n\n @extends Ember.Enumerable\n @extends Ember.MutableEnumerable\n @extends Ember.Copyable\n @extends Ember.Freezable\n\n @since Ember 0.9\n*/\nEmber.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Ember.Freezable,\n /** @scope Ember.Set.prototype */ {\n\n // ..........................................................\n // IMPLEMENT ENUMERABLE APIS\n //\n\n /**\n This property will change as the number of objects in the set changes.\n\n @property Number\n @default 0\n */\n length: 0,\n\n /**\n Clears the set. This is useful if you want to reuse an existing set\n without having to recreate it.\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.length; => 3\n colors.clear();\n colors.length; => 0\n\n @returns {Ember.Set} An empty Set\n */\n clear: function() {\n if (this.isFrozen) { throw new Error(Ember.FROZEN_ERROR); }\n\n var len = get(this, 'length');\n if (len === 0) { return this; }\n\n var guid;\n\n this.enumerableContentWillChange(len, 0);\n Ember.propertyWillChange(this, 'firstObject');\n Ember.propertyWillChange(this, 'lastObject');\n\n for (var i=0; i < len; i++){\n guid = guidFor(this[i]);\n delete this[guid];\n delete this[i];\n }\n\n set(this, 'length', 0);\n\n Ember.propertyDidChange(this, 'firstObject');\n Ember.propertyDidChange(this, 'lastObject');\n this.enumerableContentDidChange(len, 0);\n\n return this;\n },\n\n /**\n Returns true if the passed object is also an enumerable that contains the\n same objects as the receiver.\n\n var colors = [\"red\", \"green\", \"blue\"],\n same_colors = new Ember.Set(colors);\n same_colors.isEqual(colors); => true\n same_colors.isEqual([\"purple\", \"brown\"]); => false\n\n @param {Ember.Set} obj the other object.\n @returns {Boolean}\n */\n isEqual: function(obj) {\n // fail fast\n if (!Ember.Enumerable.detect(obj)) return false;\n\n var loc = get(this, 'length');\n if (get(obj, 'length') !== loc) return false;\n\n while(--loc >= 0) {\n if (!obj.contains(this[loc])) return false;\n }\n\n return true;\n },\n\n /**\n Adds an object to the set. Only non-null objects can be added to a set\n and those can only be added once. If the object is already in the set or\n the passed value is null this method will have no effect.\n\n This is an alias for `Ember.MutableEnumerable.addObject()`.\n\n var colors = new Ember.Set();\n colors.add(\"blue\"); => [\"blue\"]\n colors.add(\"blue\"); => [\"blue\"]\n colors.add(\"red\"); => [\"blue\", \"red\"]\n colors.add(null); => [\"blue\", \"red\"]\n colors.add(undefined); => [\"blue\", \"red\"]\n\n @function\n @param {Object} obj The object to add.\n @returns {Ember.Set} The set itself.\n */\n add: Ember.alias('addObject'),\n\n /**\n Removes the object from the set if it is found. If you pass a null value\n or an object that is already not in the set, this method will have no\n effect. This is an alias for `Ember.MutableEnumerable.removeObject()`.\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.remove(\"red\"); => [\"blue\", \"green\"]\n colors.remove(\"purple\"); => [\"blue\", \"green\"]\n colors.remove(null); => [\"blue\", \"green\"]\n\n @function\n @param {Object} obj The object to remove\n @returns {Ember.Set} The set itself.\n */\n remove: Ember.alias('removeObject'),\n\n /**\n Removes the last element from the set and returns it, or null if it's empty.\n\n var colors = new Ember.Set([\"green\", \"blue\"]);\n colors.pop(); => \"blue\"\n colors.pop(); => \"green\"\n colors.pop(); => null\n\n @returns {Object} The removed object from the set or null.\n */\n pop: function() {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n var obj = this.length > 0 ? this[this.length-1] : null;\n this.remove(obj);\n return obj;\n },\n\n /**\n Inserts the given object on to the end of the set. It returns\n the set itself.\n\n This is an alias for `Ember.MutableEnumerable.addObject()`.\n\n var colors = new Ember.Set();\n colors.push(\"red\"); => [\"red\"]\n colors.push(\"green\"); => [\"red\", \"green\"]\n colors.push(\"blue\"); => [\"red\", \"green\", \"blue\"]\n\n @function\n @returns {Ember.Set} The set itself.\n */\n push: Ember.alias('addObject'),\n\n /**\n Removes the last element from the set and returns it, or null if it's empty.\n\n This is an alias for `Ember.Set.pop()`.\n\n var colors = new Ember.Set([\"green\", \"blue\"]);\n colors.shift(); => \"blue\"\n colors.shift(); => \"green\"\n colors.shift(); => null\n\n @function\n @returns {Object} The removed object from the set or null.\n */\n shift: Ember.alias('pop'),\n\n /**\n Inserts the given object on to the end of the set. It returns\n the set itself.\n\n This is an alias of `Ember.Set.push()`\n\n var colors = new Ember.Set();\n colors.unshift(\"red\"); => [\"red\"]\n colors.unshift(\"green\"); => [\"red\", \"green\"]\n colors.unshift(\"blue\"); => [\"red\", \"green\", \"blue\"]\n\n @function\n @returns {Ember.Set} The set itself.\n */\n unshift: Ember.alias('push'),\n\n /**\n Adds each object in the passed enumerable to the set.\n\n This is an alias of `Ember.MutableEnumerable.addObjects()`\n\n var colors = new Ember.Set();\n colors.addEach([\"red\", \"green\", \"blue\"]); => [\"red\", \"green\", \"blue\"]\n\n @function\n @param {Ember.Enumerable} objects the objects to add.\n @returns {Ember.Set} The set itself.\n */\n addEach: Ember.alias('addObjects'),\n\n /**\n Removes each object in the passed enumerable to the set.\n\n This is an alias of `Ember.MutableEnumerable.removeObjects()`\n\n var colors = new Ember.Set([\"red\", \"green\", \"blue\"]);\n colors.removeEach([\"red\", \"blue\"]); => [\"green\"]\n\n @function\n @param {Ember.Enumerable} objects the objects to remove.\n @returns {Ember.Set} The set itself.\n */\n removeEach: Ember.alias('removeObjects'),\n\n // ..........................................................\n // PRIVATE ENUMERABLE SUPPORT\n //\n\n /** @private */\n init: function(items) {\n this._super();\n if (items) this.addObjects(items);\n },\n\n /** @private (nodoc) - implement Ember.Enumerable */\n nextObject: function(idx) {\n return this[idx];\n },\n\n /** @private - more optimized version */\n firstObject: Ember.computed(function() {\n return this.length > 0 ? this[0] : undefined;\n }).property().cacheable(),\n\n /** @private - more optimized version */\n lastObject: Ember.computed(function() {\n return this.length > 0 ? this[this.length-1] : undefined;\n }).property().cacheable(),\n\n /** @private (nodoc) - implements Ember.MutableEnumerable */\n addObject: function(obj) {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n if (none(obj)) return this; // nothing to do\n\n var guid = guidFor(obj),\n idx = this[guid],\n len = get(this, 'length'),\n added ;\n\n if (idx>=0 && idx<len && (this[idx] === obj)) return this; // added\n\n added = [obj];\n\n this.enumerableContentWillChange(null, added);\n Ember.propertyWillChange(this, 'lastObject');\n\n len = get(this, 'length');\n this[guid] = len;\n this[len] = obj;\n set(this, 'length', len+1);\n\n Ember.propertyDidChange(this, 'lastObject');\n this.enumerableContentDidChange(null, added);\n\n return this;\n },\n\n /** @private (nodoc) - implements Ember.MutableEnumerable */\n removeObject: function(obj) {\n if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);\n if (none(obj)) return this; // nothing to do\n\n var guid = guidFor(obj),\n idx = this[guid],\n len = get(this, 'length'),\n isFirst = idx === 0,\n isLast = idx === len-1,\n last, removed;\n\n\n if (idx>=0 && idx<len && (this[idx] === obj)) {\n removed = [obj];\n\n this.enumerableContentWillChange(removed, null);\n if (isFirst) { Ember.propertyWillChange(this, 'firstObject'); }\n if (isLast) { Ember.propertyWillChange(this, 'lastObject'); }\n\n // swap items - basically move the item to the end so it can be removed\n if (idx < len-1) {\n last = this[len-1];\n this[idx] = last;\n this[guidFor(last)] = idx;\n }\n\n delete this[guid];\n delete this[len-1];\n set(this, 'length', len-1);\n\n if (isFirst) { Ember.propertyDidChange(this, 'firstObject'); }\n if (isLast) { Ember.propertyDidChange(this, 'lastObject'); }\n this.enumerableContentDidChange(removed, null);\n }\n\n return this;\n },\n\n /** @private (nodoc) - optimized version */\n contains: function(obj) {\n return this[guidFor(obj)]>=0;\n },\n\n /** @private (nodoc) */\n copy: function() {\n var C = this.constructor, ret = new C(), loc = get(this, 'length');\n set(ret, 'length', loc);\n while(--loc>=0) {\n ret[loc] = this[loc];\n ret[guidFor(this[loc])] = loc;\n }\n return ret;\n },\n\n /** @private */\n toString: function() {\n var len = this.length, idx, array = [];\n for(idx = 0; idx < len; idx++) {\n array[idx] = this[idx];\n }\n return \"Ember.Set<%@>\".fmt(array.join(','));\n }\n\n});\n\n})();\n//@ sourceURL=ember-runtime/system/set");minispade.register('ember-runtime/system/string', "(function() {// ==========================================================================\n// Project: Ember Runtime\n// Copyright: ©2011 Strobe Inc.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/** @private **/\nvar STRING_DASHERIZE_REGEXP = (/[ _]/g);\nvar STRING_DASHERIZE_CACHE = {};\nvar STRING_DECAMELIZE_REGEXP = (/([a-z])([A-Z])/g);\nvar STRING_CAMELIZE_REGEXP = (/(\\-|_|\\s)+(.)?/g);\nvar STRING_UNDERSCORE_REGEXP_1 = (/([a-z\\d])([A-Z]+)/g);\nvar STRING_UNDERSCORE_REGEXP_2 = (/\\-|\\s+/g);\n\n/**\n Defines the hash of localized strings for the current language. Used by\n the `Ember.String.loc()` helper. To localize, add string values to this\n hash.\n\n @property {String}\n*/\nEmber.STRINGS = {};\n\n/**\n Defines string helper methods including string formatting and localization.\n Unless Ember.EXTEND_PROTOTYPES = false these methods will also be added to the\n String.prototype as well.\n\n @namespace\n*/\nEmber.String = {\n\n /**\n Apply formatting options to the string. This will look for occurrences\n of %@ in your string and substitute them with the arguments you pass into\n this method. If you want to control the specific order of replacement,\n you can add a number after the key as well to indicate which argument\n you want to insert.\n\n Ordered insertions are most useful when building loc strings where values\n you need to insert may appear in different orders.\n\n \"Hello %@ %@\".fmt('John', 'Doe') => \"Hello John Doe\"\n \"Hello %@2, %@1\".fmt('John', 'Doe') => \"Hello Doe, John\"\n\n @param {Object...} [args]\n @returns {String} formatted string\n */\n fmt: function(str, formats) {\n // first, replace any ORDERED replacements.\n var idx = 0; // the current index for non-numerical replacements\n return str.replace(/%@([0-9]+)?/g, function(s, argIndex) {\n argIndex = (argIndex) ? parseInt(argIndex,0) - 1 : idx++ ;\n s = formats[argIndex];\n return ((s === null) ? '(null)' : (s === undefined) ? '' : s).toString();\n }) ;\n },\n\n /**\n Formats the passed string, but first looks up the string in the localized\n strings hash. This is a convenient way to localize text. See\n `Ember.String.fmt()` for more information on formatting.\n\n Note that it is traditional but not required to prefix localized string\n keys with an underscore or other character so you can easily identify\n localized strings.\n\n Ember.STRINGS = {\n '_Hello World': 'Bonjour le monde',\n '_Hello %@ %@': 'Bonjour %@ %@'\n };\n\n Ember.String.loc(\"_Hello World\");\n => 'Bonjour le monde';\n\n Ember.String.loc(\"_Hello %@ %@\", [\"John\", \"Smith\"]);\n => \"Bonjour John Smith\";\n\n @param {String} str\n The string to format\n\n @param {Array} formats\n Optional array of parameters to interpolate into string.\n\n @returns {String} formatted string\n */\n loc: function(str, formats) {\n str = Ember.STRINGS[str] || str;\n return Ember.String.fmt(str, formats) ;\n },\n\n /**\n Splits a string into separate units separated by spaces, eliminating any\n empty strings in the process. This is a convenience method for split that\n is mostly useful when applied to the String.prototype.\n\n Ember.String.w(\"alpha beta gamma\").forEach(function(key) {\n console.log(key);\n });\n > alpha\n > beta\n > gamma\n\n @param {String} str \n The string to split\n\n @returns {String} split string\n */\n w: function(str) { return str.split(/\\s+/); },\n\n /**\n Converts a camelized string into all lower case separated by underscores.\n \n 'innerHTML'.decamelize() => 'inner_html'\n 'action_name'.decamelize() => 'action_name'\n 'css-class-name'.decamelize() => 'css-class-name'\n 'my favorite items'.decamelize() => 'my favorite items'\n\n @param {String} str\n The string to decamelize.\n\n @returns {String} the decamelized string.\n */\n decamelize: function(str) {\n return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();\n },\n\n /**\n Replaces underscores or spaces with dashes.\n \n 'innerHTML'.dasherize() => 'inner-html'\n 'action_name'.dasherize() => 'action-name'\n 'css-class-name'.dasherize() => 'css-class-name'\n 'my favorite items'.dasherize() => 'my-favorite-items'\n\n @param {String} str\n The string to dasherize.\n\n @returns {String} the dasherized string.\n */\n dasherize: function(str) {\n var cache = STRING_DASHERIZE_CACHE,\n ret = cache[str];\n\n if (ret) {\n return ret;\n } else {\n ret = Ember.String.decamelize(str).replace(STRING_DASHERIZE_REGEXP,'-');\n cache[str] = ret;\n }\n\n return ret;\n },\n\n /**\n Returns the lowerCaseCamel form of a string.\n \n 'innerHTML'.camelize() => 'innerHTML'\n 'action_name'.camelize() => 'actionName'\n 'css-class-name'.camelize() => 'cssClassName'\n 'my favorite items'.camelize() => 'myFavoriteItems'\n\n @param {String} str\n The string to camelize.\n\n @returns {String} the camelized string.\n */\n camelize: function(str) {\n return str.replace(STRING_CAMELIZE_REGEXP, function(match, separator, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n /**\n More general than decamelize. Returns the lower_case_and_underscored\n form of a string.\n\n 'innerHTML'.underscore() => 'inner_html'\n 'action_name'.underscore() => 'action_name'\n 'css-class-name'.underscore() => 'css_class_name'\n 'my favorite items'.underscore() => 'my_favorite_items'\n\n @param {String} str\n The string to underscore.\n\n @returns {String} the underscored string.\n */\n underscore: function(str) {\n return str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').\n replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase();\n }\n};\n})();\n//@ sourceURL=ember-runtime/system/string");minispade.register('ember-states', "(function() {// ==========================================================================\n// Project: Ember Statecharts\n// Copyright: ©2011 Living Social Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-runtime');\nminispade.require('ember-states/state_manager');\nminispade.require('ember-states/state');\nminispade.require('ember-states/router');\n\n})();\n//@ sourceURL=ember-states");minispade.register('ember-states/routable', "(function() {var get = Ember.get, getPath = Ember.getPath;\n\n// The Ember Routable mixin assumes the existance of a simple\n// routing shim that supports the following three behaviors:\n//\n// * .getURL() - this is called when the page loads\n// * .setURL(newURL) - this is called from within the state\n// manager when the state changes to a routable state\n// * .onURLChange(callback) - this happens when the user presses\n// the back or forward button\n\nEmber.Routable = Ember.Mixin.create({\n init: function() {\n this.on('setupControllers', this, this.stashContext);\n\n this._super();\n },\n\n stashContext: function(manager, context) {\n var meta = get(manager, 'stateMeta'),\n serialized = this.serialize(manager, context);\n\n meta.set(this, serialized);\n\n if (get(this, 'isRoutable')) {\n this.updateRoute(manager, get(manager, 'location'));\n }\n },\n\n updateRoute: function(manager, location) {\n if (location && get(this, 'isLeaf')) {\n var path = this.absoluteRoute(manager);\n location.setURL(path);\n }\n },\n\n absoluteRoute: function(manager) {\n var parentState = get(this, 'parentState');\n var path = '';\n\n if (get(parentState, 'isRoutable')) {\n path = parentState.absoluteRoute(manager);\n }\n\n var matcher = get(this, 'routeMatcher'),\n hash = get(manager, 'stateMeta').get(this);\n\n var generated = matcher.generate(hash);\n\n if (generated !== \"\") {\n return path + '/' + matcher.generate(hash);\n } else {\n return path;\n }\n },\n\n isRoutable: Ember.computed(function() {\n return typeof this.route === \"string\";\n }).cacheable(),\n\n routeMatcher: Ember.computed(function() {\n return Ember._RouteMatcher.create({ route: get(this, 'route') });\n }).cacheable(),\n\n deserialize: function(manager, context) {\n return context;\n },\n\n serialize: function(manager, context) {\n return context;\n },\n\n routePath: function(manager, path) {\n if (get(this, 'isLeaf')) { return; }\n\n var childStates = get(this, 'childStates'), match;\n\n childStates = childStates.sort(function(a, b) {\n return getPath(b, 'route.length') - getPath(a, 'route.length');\n });\n\n var state = childStates.find(function(state) {\n var matcher = get(state, 'routeMatcher');\n if (match = matcher.match(path)) { return true; }\n });\n\n Ember.assert(\"Could not find state for path \" + path, !!state);\n\n var object = state.deserialize(manager, match.hash) || {};\n manager.transitionTo(get(state, 'path'), object);\n manager.send('routePath', match.remaining);\n }\n});\n\nEmber.State.reopen(Ember.Routable);\n\n})();\n//@ sourceURL=ember-states/routable");minispade.register('ember-states/route_matcher', "(function() {var escapeForRegex = function(text) {\n return text.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^\\$|#\\s]/g, \"\\\\$&\");\n};\n\nEmber._RouteMatcher = Ember.Object.extend({\n state: null,\n\n init: function() {\n var route = this.route,\n identifiers = [],\n count = 1,\n escaped;\n\n // Strip off leading slash if present\n if (route.charAt(0) === '/') {\n route = this.route = route.substr(1);\n }\n\n escaped = escapeForRegex(route);\n\n var regex = escaped.replace(/:([a-z_]+)(?=$|\\/)/gi, function(match, id) {\n identifiers[count++] = id;\n return \"([^/]+)\";\n });\n\n this.identifiers = identifiers;\n this.regex = new RegExp(\"^/?\" + regex);\n },\n\n match: function(path) {\n var match = path.match(this.regex);\n\n if (match) {\n var identifiers = this.identifiers,\n hash = {};\n\n for (var i=1, l=identifiers.length; i<l; i++) {\n hash[identifiers[i]] = match[i];\n }\n\n return {\n remaining: path.substr(match[0].length),\n hash: hash\n };\n }\n },\n\n generate: function(hash) {\n var identifiers = this.identifiers, route = this.route, id;\n for (var i=1, l=identifiers.length; i<l; i++) {\n id = identifiers[i];\n route = route.replace(new RegExp(\":\" + id), hash[id]);\n }\n return route;\n }\n});\n\n})();\n//@ sourceURL=ember-states/route_matcher");minispade.register('ember-states/router', "(function() {minispade.require('ember-states/state');\nminispade.require('ember-states/route_matcher');\nminispade.require('ember-states/routable');\n\nEmber.Router = Ember.StateManager.extend({\n route: function(path) {\n if (path.charAt(0) === '/') {\n path = path.substr(1);\n }\n\n this.send('routePath', path);\n }\n});\n\n})();\n//@ sourceURL=ember-states/router");minispade.register('ember-states/state', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath;\n\nEmber.State = Ember.Object.extend(Ember.Evented, {\n isState: true,\n parentState: null,\n start: null,\n name: null,\n path: Ember.computed(function() {\n var parentPath = getPath(this, 'parentState.path'),\n path = get(this, 'name');\n\n if (parentPath) {\n path = parentPath + '.' + path;\n }\n\n return path;\n }).property().cacheable(),\n\n /**\n @private\n\n Override the default event firing from Ember.Evented to\n also call methods with the given name.\n */\n fire: function(name) {\n if (this[name]) {\n this[name].apply(this, [].slice.call(arguments, 1));\n }\n this._super.apply(this, arguments);\n },\n\n init: function() {\n var states = get(this, 'states'), foundStates;\n set(this, 'childStates', Ember.A());\n\n var name;\n\n // As a convenience, loop over the properties\n // of this state and look for any that are other\n // Ember.State instances or classes, and move them\n // to the `states` hash. This avoids having to\n // create an explicit separate hash.\n\n if (!states) {\n states = {};\n\n for (name in this) {\n if (name === \"constructor\") { continue; }\n this.setupChild(states, name, this[name]);\n }\n\n set(this, 'states', states);\n } else {\n for (name in states) {\n this.setupChild(states, name, states[name]);\n }\n }\n\n set(this, 'routes', {});\n },\n\n setupChild: function(states, name, value) {\n if (!value) { return false; }\n\n if (Ember.State.detect(value)) {\n value = value.create({\n name: name\n });\n } else if (value.isState) {\n set(value, 'name', name);\n }\n\n if (value.isState) {\n set(value, 'parentState', this);\n get(this, 'childStates').pushObject(value);\n states[name] = value;\n }\n },\n\n /**\n A Boolean value indicating whether the state is a leaf state\n in the state hierarchy. This is false if the state has child\n states; otherwise it is true.\n\n @property {Boolean}\n */\n isLeaf: Ember.computed(function() {\n return !get(this, 'childStates').length;\n }).cacheable(),\n\n setupControllers: Ember.K,\n enter: Ember.K,\n exit: Ember.K\n});\n\n})();\n//@ sourceURL=ember-states/state");minispade.register('ember-states/state_manager', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt;\nminispade.require('ember-states/state');\n\n/**\n @class\n \n StateManager is part of Ember's implementation of a finite state machine. A StateManager\n instance manages a number of properties that are instances of `Ember.State`,\n tracks the current active state, and triggers callbacks when states have changed.\n\n ## Defining States\n\n The states of StateManager can be declared in one of two ways. First, you can define\n a `states` property that contains all the states:\n\n managerA = Ember.StateManager.create({\n states: {\n stateOne: Ember.State.create(),\n stateTwo: Ember.State.create()\n }\n })\n\n managerA.get('states')\n // {\n // stateOne: Ember.State.create(),\n // stateTwo: Ember.State.create()\n // }\n\n You can also add instances of `Ember.State` (or an `Ember.State` subclass) directly as properties\n of a StateManager. These states will be collected into the `states` property for you.\n\n managerA = Ember.StateManager.create({\n stateOne: Ember.State.create(),\n stateTwo: Ember.State.create()\n })\n\n managerA.get('states')\n // {\n // stateOne: Ember.State.create(),\n // stateTwo: Ember.State.create()\n // }\n\n ## The Initial State\n When created a StateManager instance will immediately enter into the state\n defined as its `start` property or the state referenced by name in its \n `initialState` property:\n\n managerA = Ember.StateManager.create({\n start: Ember.State.create({})\n })\n\n managerA.getPath('currentState.name') // 'start'\n\n managerB = Ember.StateManager.create({\n initialState: 'beginHere',\n beginHere: Ember.State.create({})\n })\n\n managerB.getPath('currentState.name') // 'beginHere'\n\n Because it is a property you may also provided a computed function if you wish to derive\n an `initialState` programmatically:\n\n managerC = Ember.StateManager.create({\n initialState: function(){\n if (someLogic) {\n return 'active';\n } else {\n return 'passive';\n }\n }.property(),\n active: Ember.State.create({}),\n passive: Ember.State.create({})\n })\n\n ## Moving Between States\n A StateManager can have any number of Ember.State objects as properties\n and can have a single one of these states as its current state.\n\n Calling `goToState` transitions between states:\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({}),\n poweredUp: Ember.State.create({})\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n robotManager.goToState('poweredUp')\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n Before transitioning into a new state the existing `currentState` will have its\n `exit` method called with the StateManager instance as its first argument and \n an object representing the transition as its second argument.\n\n After transitioning into a new state the new `currentState` will have its\n `enter` method called with the StateManager instance as its first argument and \n an object representing the transition as its second argument.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n exit: function(stateManager, transition){\n console.log(\"exiting the poweredDown state\")\n }\n }),\n poweredUp: Ember.State.create({\n enter: function(stateManager, transition){\n console.log(\"entering the poweredUp state. Destroy all humans.\")\n }\n })\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n robotManager.goToState('poweredUp')\n // will log\n // 'exiting the poweredDown state'\n // 'entering the poweredUp state. Destroy all humans.'\n\n\n Once a StateManager is already in a state, subsequent attempts to enter that state will\n not trigger enter or exit method calls. Attempts to transition into a state that the \n manager does not have will result in no changes in the StateManager's current state:\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n exit: function(stateManager, transition){\n console.log(\"exiting the poweredDown state\")\n }\n }),\n poweredUp: Ember.State.create({\n enter: function(stateManager, transition){\n console.log(\"entering the poweredUp state. Destroy all humans.\")\n }\n })\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n robotManager.goToState('poweredUp')\n // will log\n // 'exiting the poweredDown state'\n // 'entering the poweredUp state. Destroy all humans.'\n robotManager.goToState('poweredUp') // no logging, no state change\n\n robotManager.goToState('someUnknownState') // silently fails\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n\n Each state property may itself contain properties that are instances of Ember.State. \n The StateManager can transition to specific sub-states in a series of goToState method calls or\n via a single goToState with the full path to the specific state. The StateManager will also \n keep track of the full path to its currentState\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n charging: Ember.State.create(),\n charged: Ember.State.create()\n }),\n poweredUp: Ember.State.create({\n mobile: Ember.State.create(),\n stationary: Ember.State.create()\n })\n })\n\n robotManager.getPath('currentState.name') // 'poweredDown'\n\n robotManager.goToState('poweredUp')\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n robotManager.goToState('mobile')\n robotManager.getPath('currentState.name') // 'mobile'\n\n // transition via a state path\n robotManager.goToState('poweredDown.charging')\n robotManager.getPath('currentState.name') // 'charging'\n\n robotManager.getPath('currentState.get.path') // 'poweredDown.charging'\n\n Enter transition methods will be called for each state and nested child state in their\n hierarchical order. Exit methods will be called for each state and its nested states in\n reverse hierarchical order.\n\n Exit transitions for a parent state are not called when entering into one of its child states,\n only when transitioning to a new section of possible states in the hierarchy.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown',\n poweredDown: Ember.State.create({\n enter: function(){},\n exit: function(){\n console.log(\"exited poweredDown state\")\n },\n charging: Ember.State.create({\n enter: function(){},\n exit: function(){}\n }),\n charged: Ember.State.create({\n enter: function(){\n console.log(\"entered charged state\")\n },\n exit: function(){\n console.log(\"exited charged state\")\n }\n })\n }),\n poweredUp: Ember.State.create({\n enter: function(){\n console.log(\"entered poweredUp state\")\n },\n exit: function(){},\n mobile: Ember.State.create({\n enter: function(){\n console.log(\"entered mobile state\")\n },\n exit: function(){}\n }),\n stationary: Ember.State.create({\n enter: function(){},\n exit: function(){}\n })\n })\n })\n\n\n robotManager.get('currentState.get.path') // 'poweredDown'\n robotManager.goToState('charged')\n // logs 'entered charged state'\n // but does *not* log 'exited poweredDown state'\n robotManager.getPath('currentState.name') // 'charged\n\n robotManager.goToState('poweredUp.mobile')\n // logs\n // 'exited charged state'\n // 'exited poweredDown state'\n // 'entered poweredUp state'\n // 'entered mobile state'\n\n During development you can set a StateManager's `enableLogging` property to `true` to\n receive console messages of state transitions.\n\n robotManager = Ember.StateManager.create({\n enableLogging: true\n })\n\n ## Managing currentState with Actions\n To control which transitions between states are possible for a given state, StateManager\n can receive and route action messages to its states via the `send` method. Calling to `send` with\n an action name will begin searching for a method with the same name starting at the current state\n and moving up through the parent states in a state hierarchy until an appropriate method is found\n or the StateManager instance itself is reached. \n\n If an appropriately named method is found it will be called with the state manager as the first\n argument and an optional `context` object as the second argument.\n\n managerA = Ember.StateManager.create({\n initialState: 'stateOne.substateOne.subsubstateOne',\n stateOne: Ember.State.create({\n substateOne: Ember.State.create({\n anAction: function(manager, context){\n console.log(\"an action was called\")\n },\n subsubstateOne: Ember.State.create({})\n })\n })\n })\n\n managerA.getPath('currentState.name') // 'subsubstateOne'\n managerA.send('anAction')\n // 'stateOne.substateOne.subsubstateOne' has no anAction method\n // so the 'anAction' method of 'stateOne.substateOne' is called\n // and logs \"an action was called\"\n // with managerA as the first argument\n // and no second argument\n\n someObject = {}\n managerA.send('anAction', someObject)\n // the 'anAction' method of 'stateOne.substateOne' is called again\n // with managerA as the first argument and\n // someObject as the second argument.\n\n\n If the StateManager attempts to send an action but does not find an appropriately named\n method in the current state or while moving upwards through the state hierarchy\n it will throw a new Ember.Error. Action detection only moves upwards through the state hierarchy\n from the current state. It does not search in other portions of the hierarchy.\n\n managerB = Ember.StateManager.create({\n initialState: 'stateOne.substateOne.subsubstateOne',\n stateOne: Ember.State.create({\n substateOne: Ember.State.create({\n subsubstateOne: Ember.State.create({})\n })\n }),\n stateTwo: Ember.State.create({\n anAction: function(manager, context){\n // will not be called below because it is\n // not a parent of the current state\n }\n })\n })\n\n managerB.getPath('currentState.name') // 'subsubstateOne'\n managerB.send('anAction')\n // Error: <Ember.StateManager:ember132> could not\n // respond to event anAction in state stateOne.substateOne.subsubstateOne.\n\n Inside of an action method the given state should delegate `goToState` calls on its\n StateManager.\n\n robotManager = Ember.StateManager.create({\n initialState: 'poweredDown.charging',\n poweredDown: Ember.State.create({\n charging: Ember.State.create({\n chargeComplete: function(manager, context){\n manager.goToState('charged')\n }\n }),\n charged: Ember.State.create({\n boot: function(manager, context){\n manager.goToState('poweredUp')\n }\n })\n }),\n poweredUp: Ember.State.create({\n beginExtermination: function(manager, context){\n manager.goToState('rampaging')\n },\n rampaging: Ember.State.create()\n })\n })\n\n robotManager.getPath('currentState.name') // 'charging'\n robotManager.send('boot') // throws error, no boot action\n // in current hierarchy\n robotManager.getPath('currentState.name') // remains 'charging'\n\n robotManager.send('beginExtermination') // throws error, no beginExtermination\n // action in current hierarchy\n robotManager.getPath('currentState.name') // remains 'charging'\n\n robotManager.send('chargeComplete')\n robotManager.getPath('currentState.name') // 'charged'\n\n robotManager.send('boot')\n robotManager.getPath('currentState.name') // 'poweredUp'\n\n robotManager.send('beginExtermination', allHumans)\n robotManager.getPath('currentState.name') // 'rampaging'\n\n**/\nEmber.StateManager = Ember.State.extend(\n/** @scope Ember.StateManager.prototype */ {\n\n /**\n When creating a new statemanager, look for a default state to transition\n into. This state can either be named `start`, or can be specified using the\n `initialState` property.\n */\n init: function() {\n this._super();\n\n set(this, 'stateMeta', Ember.Map.create());\n\n var initialState = get(this, 'initialState');\n\n if (!initialState && getPath(this, 'states.start')) {\n initialState = 'start';\n }\n\n if (initialState) {\n this.goToState(initialState);\n }\n },\n\n currentState: null,\n\n /**\n If set to true, `errorOnUnhandledEvents` will cause an exception to be\n raised if you attempt to send an event to a state manager that is not\n handled by the current state or any of its parent states.\n\n @property {Boolean}\n */\n errorOnUnhandledEvent: true,\n\n send: function(event, context) {\n this.sendRecursively(event, get(this, 'currentState'), context);\n },\n\n sendRecursively: function(event, currentState, context) {\n var log = this.enableLogging;\n\n var action = currentState[event];\n\n // Test to see if the action is a method that\n // can be invoked. Don't blindly check just for\n // existence, because it is possible the state\n // manager has a child state of the given name,\n // and we should still raise an exception in that\n // case.\n if (typeof action === 'function') {\n if (log) { Ember.Logger.log(fmt(\"STATEMANAGER: Sending event '%@' to state %@.\", [event, get(currentState, 'path')])); }\n action.call(currentState, this, context);\n } else {\n var parentState = get(currentState, 'parentState');\n if (parentState) {\n this.sendRecursively(event, parentState, context);\n } else if (get(this, 'errorOnUnhandledEvent')) {\n throw new Ember.Error(this.toString() + \" could not respond to event \" + event + \" in state \" + getPath(this, 'currentState.path') + \".\");\n }\n }\n },\n\n findStatesByRoute: function(state, route) {\n if (!route || route === \"\") { return undefined; }\n var r = route.split('.'), ret = [];\n\n for (var i=0, len = r.length; i < len; i += 1) {\n var states = get(state, 'states') ;\n\n if (!states) { return undefined; }\n\n var s = get(states, r[i]);\n if (s) { state = s; ret.push(s); }\n else { return undefined; }\n }\n\n return ret;\n },\n\n goToState: function() {\n // not deprecating this yet so people don't constantly need to\n // make trivial changes for little reason.\n return this.transitionTo.apply(this, arguments);\n },\n\n pathForSegments: function(array) {\n return Ember.ArrayUtils.map(array, function(tuple) {\n Ember.assert(\"A segment passed to transitionTo must be an Array\", Ember.typeOf(tuple) === \"array\");\n return tuple[0];\n }).join(\".\");\n },\n\n transitionTo: function(name, context) {\n // 1. Normalize arguments\n // 2. Ensure that we are in the correct state\n // 3. Map provided path to context objects and send\n // appropriate setupControllers events\n\n if (Ember.empty(name)) { return; }\n\n var segments;\n\n if (Ember.typeOf(name) === \"array\") {\n segments = Array.prototype.slice.call(arguments);\n } else {\n segments = [[name, context]];\n }\n\n var path = this.pathForSegments(segments);\n\n var currentState = get(this, 'currentState') || this, state, newState;\n\n var exitStates = [], enterStates, resolveState;\n\n state = currentState;\n\n if (state.routes[path]) {\n // cache hit\n\n var route = state.routes[path];\n exitStates = route.exitStates;\n enterStates = route.enterStates;\n state = route.futureState;\n resolveState = route.resolveState;\n } else {\n // cache miss\n\n newState = this.findStatesByRoute(currentState, path);\n\n while (state && !newState) {\n exitStates.unshift(state);\n\n state = get(state, 'parentState');\n if (!state) {\n newState = this.findStatesByRoute(this, path);\n if (!newState) { return; }\n }\n newState = this.findStatesByRoute(state, path);\n }\n\n resolveState = state;\n\n enterStates = newState.slice(0);\n exitStates = exitStates.slice(0);\n\n if (enterStates.length > 0) {\n state = enterStates[enterStates.length - 1];\n\n while (enterStates.length > 0 && enterStates[0] === exitStates[0]) {\n enterStates.shift();\n exitStates.shift();\n }\n }\n\n currentState.routes[path] = {\n exitStates: exitStates,\n enterStates: enterStates,\n futureState: state,\n resolveState: resolveState\n };\n }\n\n this.enterState(exitStates, enterStates, state);\n this.triggerSetupContext(resolveState, segments);\n },\n\n triggerSetupContext: function(root, segments) {\n var state = root;\n\n Ember.ArrayUtils.forEach(segments, function(tuple) {\n var path = tuple[0], context = tuple[1];\n\n state = this.findStatesByRoute(state, path);\n state = state[state.length-1];\n\n state.fire('setupControllers', this, context);\n }, this);\n //getPath(root, path).setupControllers(this, context);\n },\n\n getState: function(name) {\n var state = get(this, name),\n parentState = get(this, 'parentState');\n\n if (state) {\n return state;\n } else if (parentState) {\n return parentState.getState(name);\n }\n },\n\n asyncEach: function(list, callback, doneCallback) {\n var async = false, self = this;\n\n if (!list.length) {\n if (doneCallback) { doneCallback.call(this); }\n return;\n }\n\n var head = list[0];\n var tail = list.slice(1);\n\n var transition = {\n async: function() { async = true; },\n resume: function() {\n self.asyncEach(tail, callback, doneCallback);\n }\n };\n\n callback.call(this, head, transition);\n\n if (!async) { transition.resume(); }\n },\n\n enterState: function(exitStates, enterStates, state) {\n var log = this.enableLogging;\n\n var stateManager = this;\n\n exitStates = exitStates.slice(0).reverse();\n this.asyncEach(exitStates, function(state, transition) {\n state.fire('exit', stateManager, transition);\n }, function() {\n this.asyncEach(enterStates, function(state, transition) {\n if (log) { Ember.Logger.log(\"STATEMANAGER: Entering \" + get(state, 'path')); }\n state.fire('enter', stateManager, transition);\n }, function() {\n var startState = state, enteredState, initialState;\n\n initialState = get(startState, 'initialState');\n\n if (!initialState) {\n initialState = 'start';\n }\n\n // right now, start states cannot be entered asynchronously\n while (startState = get(get(startState, 'states'), initialState)) {\n enteredState = startState;\n\n if (log) { Ember.Logger.log(\"STATEMANAGER: Entering \" + get(startState, 'path')); }\n startState.fire('enter', stateManager);\n\n initialState = get(startState, 'initialState');\n\n if (!initialState) {\n initialState = 'start';\n }\n }\n\n set(this, 'currentState', enteredState || state);\n });\n });\n }\n});\n\n})();\n//@ sourceURL=ember-states/state_manager");minispade.register('ember-views/core', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nEmber.assert(\"Ember Views require jQuery 1.6 or 1.7\", window.jQuery && window.jQuery().jquery.match(/^1\\.[67](\\.\\d+)?(pre|rc\\d?)?/));\nEmber.$ = window.jQuery;\n\n})();\n//@ sourceURL=ember-views/core");minispade.register('ember-views', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n/*globals jQuery*/\nminispade.require(\"ember-runtime\");\nminispade.require(\"ember-views/core\");\nminispade.require(\"ember-views/system\");\nminispade.require(\"ember-views/views\");\n\n})();\n//@ sourceURL=ember-views");minispade.register('ember-views/system', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-views/system/render_buffer\");\nminispade.require(\"ember-views/system/event_dispatcher\");\nminispade.require(\"ember-views/system/ext\");\n\n})();\n//@ sourceURL=ember-views/system");minispade.register('ember-views/system/event_dispatcher', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\n\n/**\n @ignore\n\n Ember.EventDispatcher handles delegating browser events to their corresponding\n Ember.Views. For example, when you click on a view, Ember.EventDispatcher ensures\n that that view's `mouseDown` method gets called.\n*/\nEmber.EventDispatcher = Ember.Object.extend(\n/** @scope Ember.EventDispatcher.prototype */{\n\n /**\n @private\n\n The root DOM element to which event listeners should be attached. Event\n listeners will be attached to the document unless this is overridden.\n\n Can be specified as a DOMElement or a selector string.\n\n The default body is a string since this may be evaluated before document.body\n exists in the DOM.\n\n @type DOMElement\n @default 'body'\n */\n rootElement: 'body',\n\n /**\n @private\n\n Sets up event listeners for standard browser events.\n\n This will be called after the browser sends a DOMContentReady event. By\n default, it will set up all of the listeners on the document body. If you\n would like to register the listeners on a different element, set the event\n dispatcher's `root` property.\n */\n setup: function(addedEvents) {\n var event, events = {\n touchstart : 'touchStart',\n touchmove : 'touchMove',\n touchend : 'touchEnd',\n touchcancel : 'touchCancel',\n keydown : 'keyDown',\n keyup : 'keyUp',\n keypress : 'keyPress',\n mousedown : 'mouseDown',\n mouseup : 'mouseUp',\n contextmenu : 'contextMenu',\n click : 'click',\n dblclick : 'doubleClick',\n mousemove : 'mouseMove',\n focusin : 'focusIn',\n focusout : 'focusOut',\n mouseenter : 'mouseEnter',\n mouseleave : 'mouseLeave',\n submit : 'submit',\n input : 'input',\n change : 'change',\n dragstart : 'dragStart',\n drag : 'drag',\n dragenter : 'dragEnter',\n dragleave : 'dragLeave',\n dragover : 'dragOver',\n drop : 'drop',\n dragend : 'dragEnd'\n };\n\n Ember.$.extend(events, addedEvents || {});\n\n var rootElement = Ember.$(get(this, 'rootElement'));\n\n Ember.assert(fmt('You cannot use the same root element (%@) multiple times in an Ember.Application', [rootElement.selector || rootElement[0].tagName]), !rootElement.is('.ember-application'));\n Ember.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest('.ember-application').length);\n Ember.assert('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find('.ember-application').length);\n\n rootElement.addClass('ember-application');\n\n Ember.assert('Unable to add \"ember-application\" class to rootElement. Make sure you set rootElement to the body or an element in the body.', rootElement.is('.ember-application'));\n\n for (event in events) {\n if (events.hasOwnProperty(event)) {\n this.setupHandler(rootElement, event, events[event]);\n }\n }\n },\n\n /**\n @private\n\n Registers an event listener on the document. If the given event is\n triggered, the provided event handler will be triggered on the target\n view.\n\n If the target view does not implement the event handler, or if the handler\n returns false, the parent view will be called. The event will continue to\n bubble to each successive parent view until it reaches the top.\n\n For example, to have the `mouseDown` method called on the target view when\n a `mousedown` event is received from the browser, do the following:\n\n setupHandler('mousedown', 'mouseDown');\n\n @param {String} event the browser-originated event to listen to\n @param {String} eventName the name of the method to call on the view\n */\n setupHandler: function(rootElement, event, eventName) {\n var self = this;\n\n rootElement.delegate('.ember-view', event + '.ember', function(evt, triggeringManager) {\n\n var view = Ember.View.views[this.id],\n result = true, manager = null;\n\n manager = self._findNearestEventManager(view,eventName);\n\n if (manager && manager !== triggeringManager) {\n result = self._dispatchEvent(manager, evt, eventName, view);\n } else if (view) {\n result = self._bubbleEvent(view,evt,eventName);\n } else {\n evt.stopPropagation();\n }\n\n return result;\n });\n\n rootElement.delegate('[data-ember-action]', event + '.ember', function(evt) {\n var actionId = Ember.$(evt.currentTarget).attr('data-ember-action'),\n action = Ember.Handlebars.ActionHelper.registeredActions[actionId],\n handler = action.handler;\n\n if (action.eventName === eventName) {\n return handler(evt);\n }\n });\n },\n\n /** @private */\n _findNearestEventManager: function(view, eventName) {\n var manager = null;\n\n while (view) {\n manager = get(view, 'eventManager');\n if (manager && manager[eventName]) { break; }\n\n view = get(view, 'parentView');\n }\n\n return manager;\n },\n\n /** @private */\n _dispatchEvent: function(object, evt, eventName, view) {\n var result = true;\n\n var handler = object[eventName];\n if (Ember.typeOf(handler) === 'function') {\n result = handler.call(object, evt, view);\n evt.stopPropagation();\n }\n else {\n result = this._bubbleEvent(view, evt, eventName);\n }\n\n return result;\n },\n\n /** @private */\n _bubbleEvent: function(view, evt, eventName) {\n return Ember.run(function() {\n return view.handleEvent(eventName, evt);\n });\n },\n\n /** @private */\n destroy: function() {\n var rootElement = get(this, 'rootElement');\n Ember.$(rootElement).undelegate('.ember').removeClass('ember-application');\n return this._super();\n }\n});\n\n})();\n//@ sourceURL=ember-views/system/event_dispatcher");minispade.register('ember-views/system/ext', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\n// Add a new named queue for rendering views that happens\n// after bindings have synced.\nvar queues = Ember.run.queues;\nqueues.splice(Ember.$.inArray('actions', queues)+1, 0, 'render');\n\n})();\n//@ sourceURL=ember-views/system/ext");minispade.register('ember-views/system/render_buffer', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\n\nvar get = Ember.get, set = Ember.set;\nvar forEach = Ember.ArrayUtils.forEach;\nvar indexOf = Ember.ArrayUtils.indexOf;\n\n/** @private */\nvar ClassSet = function() {\n this.seen = {};\n this.list = [];\n};\n\nClassSet.prototype = {\n add: function(string) {\n if (string in this.seen) { return; }\n this.seen[string] = true;\n\n this.list.push(string);\n },\n\n toDOM: function() {\n return this.list.join(\" \");\n }\n};\n\n/**\n @class\n\n Ember.RenderBuffer gathers information regarding the a view and generates the\n final representation. Ember.RenderBuffer will generate HTML which can be pushed\n to the DOM.\n\n @extends Ember.Object\n*/\nEmber.RenderBuffer = function(tagName) {\n return new Ember._RenderBuffer(tagName);\n};\n\nEmber._RenderBuffer = function(tagName) {\n this.elementTag = tagName;\n this.childBuffers = [];\n};\n\nEmber._RenderBuffer.prototype =\n/** @scope Ember.RenderBuffer.prototype */ {\n\n /**\n Array of class-names which will be applied in the class=\"\" attribute\n\n You should not maintain this array yourself, rather, you should use\n the addClass() method of Ember.RenderBuffer.\n\n @type Array\n @default []\n */\n elementClasses: null,\n\n /**\n The id in of the element, to be applied in the id=\"\" attribute\n\n You should not set this property yourself, rather, you should use\n the id() method of Ember.RenderBuffer.\n\n @type String\n @default null\n */\n elementId: null,\n\n /**\n A hash keyed on the name of the attribute and whose value will be\n applied to that attribute. For example, if you wanted to apply a\n data-view=\"Foo.bar\" property to an element, you would set the\n elementAttributes hash to {'data-view':'Foo.bar'}\n\n You should not maintain this hash yourself, rather, you should use\n the attr() method of Ember.RenderBuffer.\n\n @type Hash\n @default {}\n */\n elementAttributes: null,\n\n /**\n The tagname of the element an instance of Ember.RenderBuffer represents.\n\n Usually, this gets set as the first parameter to Ember.RenderBuffer. For\n example, if you wanted to create a `p` tag, then you would call\n\n Ember.RenderBuffer('p')\n\n @type String\n @default null\n */\n elementTag: null,\n\n /**\n A hash keyed on the name of the style attribute and whose value will\n be applied to that attribute. For example, if you wanted to apply a\n background-color:black;\" style to an element, you would set the\n elementStyle hash to {'background-color':'black'}\n\n You should not maintain this hash yourself, rather, you should use\n the style() method of Ember.RenderBuffer.\n\n @type Hash\n @default {}\n */\n elementStyle: null,\n\n /**\n Nested RenderBuffers will set this to their parent RenderBuffer\n instance.\n\n @type Ember._RenderBuffer\n */\n parentBuffer: null,\n\n /**\n Adds a string of HTML to the RenderBuffer.\n\n @param {String} string HTML to push into the buffer\n @returns {Ember.RenderBuffer} this\n */\n push: function(string) {\n this.childBuffers.push(String(string));\n return this;\n },\n\n /**\n Adds a class to the buffer, which will be rendered to the class attribute.\n\n @param {String} className Class name to add to the buffer\n @returns {Ember.RenderBuffer} this\n */\n addClass: function(className) {\n // lazily create elementClasses\n var elementClasses = this.elementClasses = (this.elementClasses || new ClassSet());\n this.elementClasses.add(className);\n\n return this;\n },\n\n /**\n Sets the elementID to be used for the element.\n\n @param {String} id\n @returns {Ember.RenderBuffer} this\n */\n id: function(id) {\n this.elementId = id;\n return this;\n },\n\n // duck type attribute functionality like jQuery so a render buffer\n // can be used like a jQuery object in attribute binding scenarios.\n\n /**\n Adds an attribute which will be rendered to the element.\n\n @param {String} name The name of the attribute\n @param {String} value The value to add to the attribute\n @returns {Ember.RenderBuffer|String} this or the current attribute value\n */\n attr: function(name, value) {\n var attributes = this.elementAttributes = (this.elementAttributes || {});\n\n if (arguments.length === 1) {\n return attributes[name];\n } else {\n attributes[name] = value;\n }\n\n return this;\n },\n\n /**\n Remove an attribute from the list of attributes to render.\n\n @param {String} name The name of the attribute\n @returns {Ember.RenderBuffer} this\n */\n removeAttr: function(name) {\n var attributes = this.elementAttributes;\n if (attributes) { delete attributes[name]; }\n\n return this;\n },\n\n /**\n Adds a style to the style attribute which will be rendered to the element.\n\n @param {String} name Name of the style\n @param {String} value\n @returns {Ember.RenderBuffer} this\n */\n style: function(name, value) {\n var style = this.elementStyle = (this.elementStyle || {});\n\n this.elementStyle[name] = value;\n return this;\n },\n\n /**\n Create a new child render buffer from a parent buffer. Optionally set\n additional properties on the buffer. Optionally invoke a callback\n with the newly created buffer.\n\n This is a primitive method used by other public methods: `begin`,\n `prepend`, `replaceWith`, `insertAfter`.\n\n @private\n @param {String} tagName Tag name to use for the child buffer's element\n @param {Ember._RenderBuffer} parent The parent render buffer that this\n buffer should be appended to.\n @param {Function} fn A callback to invoke with the newly created buffer.\n @param {Object} other Additional properties to add to the newly created\n buffer.\n */\n newBuffer: function(tagName, parent, fn, other) {\n var buffer = new Ember._RenderBuffer(tagName);\n buffer.parentBuffer = parent;\n\n if (other) { buffer.setProperties(other); }\n if (fn) { fn.call(this, buffer); }\n\n return buffer;\n },\n\n /**\n Replace the current buffer with a new buffer. This is a primitive\n used by `remove`, which passes `null` for `newBuffer`, and `replaceWith`,\n which passes the new buffer it created.\n\n @private\n @param {Ember._RenderBuffer} buffer The buffer to insert in place of\n the existing buffer.\n */\n replaceWithBuffer: function(newBuffer) {\n var parent = this.parentBuffer;\n if (!parent) { return; }\n\n var childBuffers = parent.childBuffers;\n\n var index = indexOf(childBuffers, this);\n\n if (newBuffer) {\n childBuffers.splice(index, 1, newBuffer);\n } else {\n childBuffers.splice(index, 1);\n }\n },\n\n /**\n Creates a new Ember.RenderBuffer object with the provided tagName as\n the element tag and with its parentBuffer property set to the current\n Ember.RenderBuffer.\n\n @param {String} tagName Tag name to use for the child buffer's element\n @returns {Ember.RenderBuffer} A new RenderBuffer object\n */\n begin: function(tagName) {\n return this.newBuffer(tagName, this, function(buffer) {\n this.childBuffers.push(buffer);\n });\n },\n\n /**\n Prepend a new child buffer to the current render buffer.\n\n @param {String} tagName Tag name to use for the child buffer's element\n */\n prepend: function(tagName) {\n return this.newBuffer(tagName, this, function(buffer) {\n this.childBuffers.splice(0, 0, buffer);\n });\n },\n\n /**\n Replace the current buffer with a new render buffer.\n\n @param {String} tagName Tag name to use for the new buffer's element\n */\n replaceWith: function(tagName) {\n var parentBuffer = this.parentBuffer;\n\n return this.newBuffer(tagName, parentBuffer, function(buffer) {\n this.replaceWithBuffer(buffer);\n });\n },\n\n /**\n Insert a new render buffer after the current render buffer.\n\n @param {String} tagName Tag name to use for the new buffer's element\n */\n insertAfter: function(tagName) {\n var parentBuffer = get(this, 'parentBuffer');\n\n return this.newBuffer(tagName, parentBuffer, function(buffer) {\n var siblings = parentBuffer.childBuffers;\n var index = indexOf(siblings, this);\n siblings.splice(index + 1, 0, buffer);\n });\n },\n\n /**\n Closes the current buffer and adds its content to the parentBuffer.\n\n @returns {Ember.RenderBuffer} The parentBuffer, if one exists. Otherwise, this\n */\n end: function() {\n var parent = this.parentBuffer;\n return parent || this;\n },\n\n remove: function() {\n this.replaceWithBuffer(null);\n },\n\n /**\n @returns {DOMElement} The element corresponding to the generated HTML\n of this buffer\n */\n element: function() {\n return Ember.$(this.string())[0];\n },\n\n /**\n Generates the HTML content for this buffer.\n\n @returns {String} The generated HTMl\n */\n string: function() {\n var content = '', tag = this.elementTag, openTag;\n\n if (tag) {\n var id = this.elementId,\n classes = this.elementClasses,\n attrs = this.elementAttributes,\n style = this.elementStyle,\n styleBuffer = '', prop;\n\n openTag = [\"<\" + tag];\n\n if (id) { openTag.push('id=\"' + this._escapeAttribute(id) + '\"'); }\n if (classes) { openTag.push('class=\"' + this._escapeAttribute(classes.toDOM()) + '\"'); }\n\n if (style) {\n for (prop in style) {\n if (style.hasOwnProperty(prop)) {\n styleBuffer += (prop + ':' + this._escapeAttribute(style[prop]) + ';');\n }\n }\n\n openTag.push('style=\"' + styleBuffer + '\"');\n }\n\n if (attrs) {\n for (prop in attrs) {\n if (attrs.hasOwnProperty(prop)) {\n openTag.push(prop + '=\"' + this._escapeAttribute(attrs[prop]) + '\"');\n }\n }\n }\n\n openTag = openTag.join(\" \") + '>';\n }\n\n var childBuffers = this.childBuffers;\n\n forEach(childBuffers, function(buffer) {\n var stringy = typeof buffer === 'string';\n content += (stringy ? buffer : buffer.string());\n });\n\n if (tag) {\n return openTag + content + \"</\" + tag + \">\";\n } else {\n return content;\n }\n },\n\n _escapeAttribute: function(value) {\n // Stolen shamelessly from Handlebars\n\n var escape = {\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n '\"': \"&quot;\",\n \"'\": \"&#x27;\",\n \"`\": \"&#x60;\"\n };\n\n var badChars = /&(?!\\w+;)|[<>\"'`]/g;\n var possible = /[&<>\"'`]/;\n\n var escapeChar = function(chr) {\n return escape[chr] || \"&amp;\";\n };\n\n var string = value.toString();\n\n if(!possible.test(string)) { return string; }\n return string.replace(badChars, escapeChar);\n }\n\n};\n\n})();\n//@ sourceURL=ember-views/system/render_buffer");minispade.register('ember-views/views', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-views/views/view\");\nminispade.require(\"ember-views/views/states\");\nminispade.require(\"ember-views/views/container_view\");\nminispade.require(\"ember-views/views/collection_view\");\n\n})();\n//@ sourceURL=ember-views/views");minispade.register('ember-views/views/collection_view', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views/views/container_view');\nminispade.require('ember-runtime/system/string');\n\nvar get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;\n\n/**\n @class\n\n `Ember.CollectionView` is an `Ember.View` descendent responsible for managing a\n collection (an array or array-like object) by maintaing a child view object and \n associated DOM representation for each item in the array and ensuring that child\n views and their associated rendered HTML are updated when items in the array\n are added, removed, or replaced.\n\n ## Setting content\n The managed collection of objects is referenced as the `Ember.CollectionView` instance's\n `content` property.\n\n someItemsView = Ember.CollectionView.create({\n content: ['A', 'B','C']\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 By default the view class for each item in the managed collection will be an instance\n of `Ember.View`. You can supply a different class by setting the `CollectionView`'s\n `itemViewClass` property.\n\n Given an empty `<body>` and the following code:\n\n\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: {{content}}\")\n })\n })\n\n someItemsView.appendTo('body')\n\n Will result in the following HTML structure\n\n <div class=\"ember-view a-collection\">\n <div class=\"ember-view\">the letter: A</div>\n <div class=\"ember-view\">the letter: B</div>\n <div class=\"ember-view\">the letter: C</div>\n </div>\n\n\n ## Automatic matching of parent/child tagNames\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\n Given an empty `<body>` and the following code:\n\n anUndorderedListView = Ember.CollectionView.create({\n tagName: 'ul',\n content: ['A','B','C'],\n itemViewClass: Ember.View.extend({\n template: Ember.Handlebars.compile(\"the letter: {{content}}\")\n })\n })\n\n anUndorderedListView.appendTo('body')\n\n Will result in the following HTML structure\n\n <ul class=\"ember-view a-collection\">\n <li class=\"ember-view\">the letter: A</li>\n <li class=\"ember-view\">the letter: B</li>\n <li class=\"ember-view\">the letter: C</li>\n </ul>\n\n Additional tagName pairs can be provided by adding to `Ember.CollectionView.CONTAINER_MAP `\n\n Ember.CollectionView.CONTAINER_MAP['article'] = 'section'\n\n\n ## Empty View\n You can provide an `Ember.View` subclass to the `Ember.CollectionView` instance as its\n `emptyView` property. If the `content` property of a `CollectionView` is set to `null`\n or an empty array, an instance of this view will be the `CollectionView`s only child.\n\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 Will result in the following HTML structure\n\n <div class=\"ember-view nothing\">\n <div class=\"ember-view\">\n The collection is empty\n </div>\n </div>\n\n ## Adding and Removing items\n The `childViews` property of a `CollectionView` should not be directly manipulated. Instead,\n add, remove, replace items from its `content` property. This will trigger\n appropriate changes to its rendered HTML.\n\n ## Use in templates via the `{{collection}}` Ember.Handlebars helper\n Ember.Handlebars provides a helper specifically for adding `CollectionView`s to templates.\n See `Ember.Handlebars.collection` for more details\n\n @since Ember 0.9\n @extends Ember.ContainerView\n*/\nEmber.CollectionView = Ember.ContainerView.extend(\n/** @scope Ember.CollectionView.prototype */ {\n\n /**\n A list of items to be displayed by the Ember.CollectionView.\n\n @type Ember.Array\n @default null\n */\n content: null,\n\n /**\n @private\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 emptyViewClass: Ember.View,\n\n /**\n An optional view to display if content is set to an empty array.\n\n @type Ember.View\n @default null\n */\n emptyView: null,\n\n /**\n @type Ember.View\n @default Ember.View\n */\n itemViewClass: Ember.View,\n\n /** @private */\n init: function() {\n var ret = this._super();\n this._contentDidChange();\n return ret;\n },\n\n _contentWillChange: Ember.beforeObserver(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 }, 'content'),\n\n /**\n @private\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 _contentDidChange: Ember.observer(function() {\n var content = get(this, 'content');\n\n if (content) {\n Ember.assert(fmt(\"an Ember.CollectionView's content must implement Ember.Array. You passed %@\", [content]), Ember.Array.detect(content));\n content.addArrayObserver(this);\n }\n\n var len = content ? get(content, 'length') : 0;\n this.arrayDidChange(content, 0, null, len);\n }, 'content'),\n\n willDestroy: function() {\n var content = get(this, 'content');\n if (content) { content.removeArrayObserver(this); }\n\n this._super();\n },\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 Ember.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 = get(this, 'childViews'), childView, idx, len;\n\n len = get(childViews, 'length');\n\n var removingAll = removedCount === len;\n\n if (removingAll) {\n this.invokeForState('empty');\n }\n\n for (idx = start + removedCount - 1; idx >= start; idx--) {\n childView = childViews[idx];\n if (removingAll) { childView.removedFromDOM = true; }\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 @param {Array} addedObjects\n the objects that were added to the content\n\n @param {Array} removedObjects\n the objects that were removed from the content\n\n @param {Number} changeIndex\n the index at which the changes occurred\n */\n arrayDidChange: function(content, start, removed, added) {\n var itemViewClass = get(this, 'itemViewClass'),\n childViews = get(this, 'childViews'),\n addedViews = [], view, item, idx, len, itemTagName;\n\n if ('string' === typeof itemViewClass) {\n itemViewClass = Ember.getPath(itemViewClass);\n }\n\n Ember.assert(fmt(\"itemViewClass must be a subclass of Ember.View, not %@\", [itemViewClass]), Ember.View.detect(itemViewClass));\n\n len = content ? get(content, 'length') : 0;\n if (len) {\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 var emptyView = get(this, 'emptyView');\n if (!emptyView) { return; }\n\n emptyView = this.createChildView(emptyView);\n addedViews.push(emptyView);\n set(this, 'emptyView', emptyView);\n }\n childViews.replace(start, 0, addedViews);\n },\n\n createChildView: function(view, attrs) {\n view = this._super(view, attrs);\n\n var itemTagName = get(view, 'tagName');\n var tagName = (itemTagName === null || itemTagName === undefined) ? Ember.CollectionView.CONTAINER_MAP[get(this, 'tagName')] : itemTagName;\n\n set(view, 'tagName', tagName);\n\n return view;\n }\n});\n\n/**\n @static\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 @type Hash\n @constant\n*/\nEmber.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})();\n//@ sourceURL=ember-views/views/collection_view");minispade.register('ember-views/views/container_view', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views/views/view');\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\nvar forEach = Ember.ArrayUtils.forEach;\n\nvar childViewsProperty = Ember.computed(function() {\n return get(this, '_childViews');\n}).property('_childViews').cacheable();\n\n/**\n @class\n\n A `ContainerView` is an `Ember.View` subclass that allows for manual or programatic\n management of a view's `childViews` array that will correctly update the `ContainerView`\n instance's rendered DOM representation.\n\n ## Setting Initial Child Views\n The initial array of child views can be set in one of two ways. You can provide\n a `childViews` property at creation time that contains instance of `Ember.View`:\n\n\n aContainer = Ember.ContainerView.create({\n childViews: [Ember.View.create(), Ember.View.create()]\n })\n\n You can also provide a list of property names whose values are instances of `Ember.View`:\n\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 The two strategies can be combined:\n\n aContainer = Ember.ContainerView.create({\n childViews: ['aView', Ember.View.create()],\n aView: Ember.View.create()\n })\n\n Each child view's rendering will be inserted into the container's rendered HTML in the same\n order as its position in the `childViews` property.\n\n ## Adding and Removing Child Views\n The views in a container's `childViews` array should be added and removed by manipulating\n the `childViews` property directly.\n\n To remove a view pass that view into a `removeObject` call on the container's `childViews` property. \n\n Given an empty `<body>` the following code\n\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 Results in the HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">B</div>\n </div>\n\n Removing a view\n\n aContainer.get('childViews') // [aContainer.aView, aContainer.bView]\n aContainer.get('childViews').removeObject(aContainer.get('bView'))\n aContainer.get('childViews') // [aContainer.aView]\n\n Will result in the following HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n </div>\n\n\n Similarly, adding a child view is accomplished by adding `Ember.View` instances to the \n container's `childViews` property.\n\n Given an empty `<body>` the following code\n\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 Results in the HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">B</div>\n </div>\n\n Adding a view\n\n AnotherViewClass = Ember.View.extend({\n template: Ember.Handlebars.compile(\"Another view\")\n })\n\n aContainer.get('childViews') // [aContainer.aView, aContainer.bView]\n aContainer.get('childViews').pushObject(AnotherViewClass.create())\n aContainer.get('childViews') // [aContainer.aView, <AnotherViewClass instance>]\n\n Will result in the following HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">Another view</div>\n </div>\n\n\n Direct manipulation of childViews presence or absence in the DOM via calls to \n `remove` or `removeFromParent` or calls to a container's `removeChild` may not behave\n correctly.\n\n Calling `remove()` on a child view will remove the view's HTML, but it will remain as part of its\n container's `childView`s property.\n\n Calling `removeChild()` on the container will remove the passed view instance from the container's\n `childView`s but keep its HTML within the container's rendered view.\n\n Calling `removeFromParent()` behaves as expected but should be avoided in favor of direct\n manipulation of a container's `childViews` property.\n\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 Results in the HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">A</div>\n <div class=\"ember-view\">B</div>\n </div>\n\n Calling `aContainer.get('aView').removeFromParent()` will result in the following HTML\n\n <div class=\"ember-view the-container\">\n <div class=\"ember-view\">B</div>\n </div>\n\n And the `Ember.View` instance stored in `aContainer.aView` will be removed from `aContainer`'s\n `childViews` array.\n\n ## Templates and Layout\n A `template`, `templateName`, `defaultTemplate`, `layout`, `layoutName` or `defaultLayout`\n property on a container view will not result in the template or layout being rendered. \n The HTML contents of a `Ember.ContainerView`'s DOM representation will only be the rendered HTML\n of its child views.\n\n ## Binding a View to Display\n\n If you would like to display a single view in your ContainerView, you can set its `currentView`\n property. When the `currentView` property is set to a view instance, it will be added to the\n ContainerView's `childViews` array. If the `currentView` property is later changed to a\n different view, the new view will replace the old view. If `currentView` is set to `null`, the\n last `currentView` will be removed.\n\n This functionality is useful for cases where you want to bind the display of a ContainerView to\n a controller or state manager. For example, you can bind the `currentView` of a container to\n a controller like this:\n\n // Controller\n App.appController = Ember.Object.create({\n view: Ember.View.create({\n templateName: 'person_template'\n })\n });\n\n // Handlebars template\n {{view Ember.ContainerView currentViewBinding=\"App.appController.view\"}}\n\n @extends Ember.View\n*/\n\nEmber.ContainerView = Ember.View.extend({\n\n init: function() {\n var childViews = get(this, 'childViews');\n Ember.defineProperty(this, 'childViews', childViewsProperty);\n\n this._super();\n\n var _childViews = get(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 // Make the _childViews array observable\n Ember.A(_childViews);\n\n // Sets up an array observer on the child views array. This\n // observer will detect when child views are added or removed\n // and update the DOM to reflect the mutation.\n get(this, 'childViews').addArrayObserver(this, {\n willChange: 'childViewsWillChange',\n didChange: 'childViewsDidChange'\n });\n },\n\n /**\n Instructs each child view to render to the passed render buffer.\n\n @param {Ember.RenderBuffer} buffer the buffer to render to\n @private\n */\n render: function(buffer) {\n this.forEachChildView(function(view) {\n view.renderToBuffer(buffer);\n });\n },\n\n /**\n When the container view is destroyed, tear down the child views\n array observer.\n\n @private\n */\n willDestroy: function() {\n get(this, 'childViews').removeArrayObserver(this, {\n willChange: 'childViewsWillChange',\n didChange: 'childViewsDidChange'\n });\n\n this._super();\n },\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 @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 if (removed === 0) { return; }\n\n var changedViews = views.slice(start, start+removed);\n this.initializeViews(changedViews, null, null);\n\n this.invokeForState('childViewsWillChange', views, start, removed);\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 view\n has already written to a buffer, but not yet converted that buffer into an\n element, we insert the string representation of the child into the appropriate\n place in the buffer.\n\n @private\n @param {Ember.Array} views the array of child views afte 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} the number of child views added\n */\n childViewsDidChange: function(views, start, removed, added) {\n var len = get(views, 'length');\n\n // No new child views were added; bail out.\n if (added === 0) return;\n\n var changedViews = views.slice(start, start+added);\n this.initializeViews(changedViews, this, get(this, 'templateData'));\n\n // Let the current state handle the changes\n this.invokeForState('childViewsDidChange', views, start, added);\n },\n\n initializeViews: function(views, parentView, templateData) {\n forEach(views, function(view) {\n set(view, '_parentView', parentView);\n\n if (!get(view, 'templateData')) {\n set(view, 'templateData', templateData);\n }\n });\n },\n\n /**\n Schedules a child view to be inserted into the DOM after bindings have\n finished syncing for this run loop.\n\n @param {Ember.View} view the child view to insert\n @param {Ember.View} prev the child view after which the specified view should\n be inserted\n @private\n */\n _scheduleInsertion: function(view, prev) {\n if (prev) {\n prev.domManager.after(prev, view);\n } else {\n this.domManager.prepend(this, view);\n }\n },\n\n currentView: null,\n\n _currentViewWillChange: Ember.beforeObserver(function() {\n var childViews = get(this, 'childViews'),\n currentView = get(this, 'currentView');\n\n if (currentView) {\n childViews.removeObject(currentView);\n }\n }, 'currentView'),\n\n _currentViewDidChange: Ember.observer(function() {\n var childViews = get(this, 'childViews'),\n currentView = get(this, 'currentView');\n\n if (currentView) {\n childViews.pushObject(currentView);\n }\n }, 'currentView')\n});\n\n// Ember.ContainerView extends the default view states to provide different\n// behavior for childViewsWillChange and childViewsDidChange.\nEmber.ContainerView.states = {\n parent: Ember.View.states,\n\n inBuffer: {\n childViewsDidChange: function(parentView, views, start, added) {\n var buffer = parentView.buffer,\n startWith, prev, prevBuffer, view;\n\n // Determine where to begin inserting the child view(s) in the\n // render buffer.\n if (start === 0) {\n // If views were inserted at the beginning, prepend the first\n // view to the render buffer, then begin inserting any\n // additional views at the beginning.\n view = views[start];\n startWith = start + 1;\n view.renderToBuffer(buffer, 'prepend');\n } else {\n // Otherwise, just insert them at the same place as the child\n // views mutation.\n view = views[start - 1];\n startWith = start;\n }\n\n for (var i=startWith; i<start+added; i++) {\n prev = view;\n view = views[i];\n prevBuffer = prev.buffer;\n view.renderToBuffer(prevBuffer, 'insertAfter');\n }\n }\n },\n\n hasElement: {\n childViewsWillChange: function(view, views, start, removed) {\n for (var i=start; i<start+removed; i++) {\n views[i].remove();\n }\n },\n\n childViewsDidChange: function(view, views, start, added) {\n // If the DOM element for this container view already exists,\n // schedule each child view to insert its DOM representation after\n // bindings have finished syncing.\n var prev = start === 0 ? null : views[start-1];\n\n for (var i=start; i<start+added; i++) {\n view = views[i];\n this._scheduleInsertion(view, prev);\n prev = view;\n }\n }\n }\n};\n\nEmber.ContainerView.states.inDOM = {\n parentState: Ember.ContainerView.states.hasElement\n};\n\nEmber.ContainerView.reopen({\n states: Ember.ContainerView.states\n});\n\n})();\n//@ sourceURL=ember-views/views/container_view");minispade.register('ember-views/views/states', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-views/views/states/default\");\nminispade.require(\"ember-views/views/states/pre_render\");\nminispade.require(\"ember-views/views/states/in_buffer\");\nminispade.require(\"ember-views/views/states/in_dom\");\nminispade.require(\"ember-views/views/states/destroyed\");\n\n})();\n//@ sourceURL=ember-views/views/states");minispade.register('ember-views/views/states/default', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views/views/view');\n\nvar get = Ember.get, set = Ember.set;\n\nEmber.View.states = {\n _default: {\n // appendChild is only legal while rendering the buffer.\n appendChild: function() {\n throw \"You can't use appendChild outside of the rendering process\";\n },\n\n $: function() {\n return Ember.$();\n },\n\n getElement: function() {\n return null;\n },\n\n // Handle events from `Ember.EventDispatcher`\n handleEvent: function() {\n return true; // continue event propagation\n },\n\n destroyElement: function(view) {\n set(view, 'element', null);\n view._lastInsert = null;\n return view;\n }\n }\n};\n\nEmber.View.reopen({\n states: Ember.View.states\n});\n\n})();\n//@ sourceURL=ember-views/views/states/default");minispade.register('ember-views/views/states/destroyed', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views/views/states/default');\n\nvar destroyedError = \"You can't call %@ on a destroyed view\", fmt = Ember.String.fmt;\n\nEmber.View.states.destroyed = {\n parentState: Ember.View.states._default,\n\n appendChild: function() {\n throw fmt(destroyedError, ['appendChild']);\n },\n rerender: function() {\n throw fmt(destroyedError, ['rerender']);\n },\n destroyElement: function() {\n throw fmt(destroyedError, ['destroyElement']);\n },\n empty: function() {\n throw fmt(destroyedError, ['empty']);\n },\n\n setElement: function() {\n throw fmt(destroyedError, [\"set('element', ...)\"]);\n },\n\n // Since element insertion is scheduled, don't do anything if\n // the view has been destroyed between scheduling and execution\n insertElement: Ember.K\n};\n\n\n})();\n//@ sourceURL=ember-views/views/states/destroyed");minispade.register('ember-views/views/states/in_buffer', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views/views/states/default');\n\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\n\nEmber.View.states.inBuffer = {\n parentState: Ember.View.states._default,\n\n $: function(view, sel) {\n // if we don't have an element yet, someone calling this.$() is\n // trying to update an element that isn't in the DOM. Instead,\n // rerender the view to allow the render method to reflect the\n // changes.\n view.rerender();\n return Ember.$();\n },\n\n // when a view is rendered in a buffer, rerendering it simply\n // replaces the existing buffer with a new one\n rerender: function(view) {\n Ember.deprecate(\"Something you did caused a view to re-render after it rendered but before it was inserted into the DOM. Because this is avoidable and the cause of significant performance issues in applications, this behavior is deprecated. If you want to use the debugger to find out what caused this, you can set ENV.RAISE_ON_DEPRECATION to true.\");\n\n view._notifyWillRerender();\n\n view.clearRenderedChildren();\n view.renderToBuffer(view.buffer, 'replaceWith');\n },\n\n // when a view is rendered in a buffer, appending a child\n // view will render that view and append the resulting\n // buffer into its buffer.\n appendChild: function(view, childView, options) {\n var buffer = view.buffer;\n\n childView = this.createChildView(childView, options);\n get(view, '_childViews').push(childView);\n\n childView.renderToBuffer(buffer);\n\n view.propertyDidChange('childViews');\n\n return childView;\n },\n\n // when a view is rendered in a buffer, destroying the\n // element will simply destroy the buffer and put the\n // state back into the preRender state.\n destroyElement: function(view) {\n view.clearBuffer();\n view._notifyWillDestroyElement();\n view.transitionTo('preRender');\n\n return view;\n },\n\n empty: function() {\n Ember.assert(\"Emptying a view in the inBuffer state is not allowed and should not happen under normal circumstances. Most likely there is a bug in your application. This may be due to excessive property change notifications.\");\n },\n\n // It should be impossible for a rendered view to be scheduled for\n // insertion.\n insertElement: function() {\n throw \"You can't insert an element that has already been rendered\";\n },\n\n setElement: function(view, value) {\n view.invalidateRecursively('element');\n\n if (value === null) {\n view.transitionTo('preRender');\n } else {\n view.clearBuffer();\n view.transitionTo('hasElement');\n }\n\n return value;\n }\n};\n\n\n})();\n//@ sourceURL=ember-views/views/states/in_buffer");minispade.register('ember-views/views/states/in_dom', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views/views/states/default');\n\nvar get = Ember.get, set = Ember.set, meta = Ember.meta;\n\nEmber.View.states.hasElement = {\n parentState: Ember.View.states._default,\n\n $: function(view, sel) {\n var elem = get(view, 'element');\n return sel ? Ember.$(sel, elem) : Ember.$(elem);\n },\n\n getElement: function(view) {\n var parent = get(view, 'parentView');\n if (parent) { parent = get(parent, 'element'); }\n if (parent) { return view.findElementInParentElement(parent); }\n return Ember.$(\"#\" + get(view, 'elementId'))[0];\n },\n\n setElement: function(view, value) {\n if (value === null) {\n view.invalidateRecursively('element');\n\n view.transitionTo('preRender');\n } else {\n throw \"You cannot set an element to a non-null value when the element is already in the DOM.\";\n }\n\n return value;\n },\n\n // once the view has been inserted into the DOM, rerendering is\n // deferred to allow bindings to synchronize.\n rerender: function(view) {\n view._notifyWillRerender();\n\n view.clearRenderedChildren();\n\n view.domManager.replace(view);\n return view;\n },\n\n // once the view is already in the DOM, destroying it removes it\n // from the DOM, nukes its element, and puts it back into the\n // preRender state if inDOM.\n\n destroyElement: function(view) {\n view._notifyWillDestroyElement();\n view.domManager.remove(view);\n return view;\n },\n\n empty: function(view) {\n var _childViews = get(view, '_childViews'), len, idx;\n if (_childViews) {\n len = get(_childViews, 'length');\n for (idx = 0; idx < len; idx++) {\n _childViews[idx]._notifyWillDestroyElement();\n }\n }\n view.domManager.empty(view);\n },\n\n // Handle events from `Ember.EventDispatcher`\n handleEvent: function(view, eventName, evt) {\n var handler = view[eventName];\n if (Ember.typeOf(handler) === 'function') {\n return handler.call(view, evt);\n } else {\n return true; // continue event propagation\n }\n }\n};\n\nEmber.View.states.inDOM = {\n parentState: Ember.View.states.hasElement,\n\n insertElement: function(view, fn) {\n if (view._lastInsert !== Ember.guidFor(fn)){\n return;\n }\n throw \"You can't insert an element into the DOM that has already been inserted\";\n }\n};\n\n})();\n//@ sourceURL=ember-views/views/states/in_dom");minispade.register('ember-views/views/states/pre_render', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views/views/states/default');\n\nEmber.View.states.preRender = {\n parentState: Ember.View.states._default,\n\n // a view leaves the preRender state once its element has been\n // created (createElement).\n insertElement: function(view, fn) {\n if (view._lastInsert !== Ember.guidFor(fn)){\n return;\n }\n view.createElement();\n view._notifyWillInsertElement();\n // after createElement, the view will be in the hasElement state.\n fn.call(view);\n view.transitionTo('inDOM');\n view._notifyDidInsertElement();\n },\n\n empty: Ember.K,\n\n setElement: function(view, value) {\n view.beginPropertyChanges();\n view.invalidateRecursively('element');\n\n if (value !== null) {\n view.transitionTo('hasElement');\n }\n\n view.endPropertyChanges();\n\n return value;\n }\n};\n\n})();\n//@ sourceURL=ember-views/views/states/pre_render");minispade.register('ember-views/views/view', "(function() {// ==========================================================================\n// Project: Ember - JavaScript Application Framework\n// Copyright: ©2006-2011 Strobe Inc. and contributors.\n// Portions ©2008-2011 Apple Inc. All rights reserved.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require(\"ember-views/system/render_buffer\");\nvar get = Ember.get, set = Ember.set, addObserver = Ember.addObserver;\nvar getPath = Ember.getPath, meta = Ember.meta, fmt = Ember.String.fmt;\nvar a_slice = Array.prototype.slice;\nvar a_forEach = Ember.ArrayUtils.forEach;\n\nvar childViewsProperty = Ember.computed(function() {\n var childViews = get(this, '_childViews');\n\n var ret = Ember.A();\n\n a_forEach(childViews, function(view) {\n if (view.isVirtual) {\n ret.pushObjects(get(view, 'childViews'));\n } else {\n ret.push(view);\n }\n });\n\n return ret;\n}).property().cacheable();\n\nvar VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;\nEmber.warn(\"The way that the {{view}} helper affects templates is about to change. Previously, templates inside child views would use the new view as the context. Soon, views will preserve their parent context when rendering their template. You can opt-in early to the new behavior by setting `ENV.VIEW_PRESERVES_CONTEXT = true`. For more information, see https://gist.github.com/2494968. You should update your templates as soon as possible; this default will change soon, and the option will be eliminated entirely before the 1.0 release.\", VIEW_PRESERVES_CONTEXT);\n\n/**\n @static\n\n Global hash of shared templates. This will automatically be populated\n by the build tools so that you can store your Handlebars templates in\n separate files that get loaded into JavaScript at buildtime.\n\n @type Hash\n*/\nEmber.TEMPLATES = {};\n\nvar invokeForState = {\n preRender: {},\n inBuffer: {},\n hasElement: {},\n inDOM: {},\n destroyed: {}\n};\n\n/**\n @class\n\n `Ember.View` is the class in Ember responsible for encapsulating templates of HTML\n content, combining templates with data to render as sections of a page's DOM, and\n registering and responding to user-initiated events.\n \n ## HTML Tag\n The default HTML tag name used for a view's DOM representation is `div`. This can be\n customized by setting the `tagName` property. The following view class:\n\n ParagraphView = Ember.View.extend({\n tagName: 'em'\n })\n\n Would result in instances with the following HTML:\n\n <em id=\"ember1\" class=\"ember-view\"></em>\n\n ## HTML `class` Attribute\n The HTML `class` attribute of a view's tag can be set by providing a `classNames` property\n that is set to an array of strings:\n\n MyView = Ember.View.extend({\n classNames: ['my-class', 'my-other-class']\n })\n\n Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view my-class my-other-class\"></div>\n\n `class` attribute values can also be set by providing a `classNameBindings` property\n set to an array of properties names for the view. The return value of these properties \n will be added as part of the value for the view's `class` attribute. These properties\n can be computed properties:\n\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 Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view from-a from-b\"></div>\n\n If the value of a class name binding returns a boolean the property name itself\n will be used as the class name if the property is true. The class name will\n not be added if the value is `false` or `undefined`.\n\n MyView = Ember.View.extend({\n classNameBindings: ['hovered'],\n hovered: true\n })\n\n Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view hovered\"></div>\n\n When using boolean class name bindings you can supply a string value other than the \n property name for use as the `class` HTML attribute by appending the preferred value after\n a \":\" character when defining the binding:\n\n MyView = Ember.View.extend({\n classNameBindings: ['awesome:so-very-cool'],\n awesome: true\n })\n\n Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view so-very-cool\"></div>\n\n\n Boolean value class name bindings whose property names are in a camelCase-style\n format will be converted to a dasherized format:\n\n MyView = Ember.View.extend({\n classNameBindings: ['isUrgent'],\n isUrgent: true\n })\n\n Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view is-urgent\"></div>\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 MyView = Ember.View.extend({\n classNameBindings: ['messages.empty']\n messages: Ember.Object.create({\n empty: true\n })\n })\n\n Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view empty\"></div>\n\n Updates to the the value of a class name binding will result in automatic update \n of the HTML `class` attribute in the view's rendered HTML representation.\n If the value becomes `false` or `undefined` the class name will be removed.\n\n Both `classNames` and `classNameBindings` are concatenated properties. \n See `Ember.Object` documentation for more information about concatenated properties.\n\n ## HTML Attributes\n The HTML attribute section of a view's tag can be set by providing an `attributeBindings`\n property set to an array of property names on the view. The return value of these properties\n will be used as the value of the view's HTML associated attribute:\n\n AnchorView = Ember.View.extend({\n tagName: 'a',\n attributeBindings: ['href'],\n href: 'http://google.com'\n })\n\n Will result in view instances with an HTML representation of:\n\n <a id=\"ember1\" class=\"ember-view\" href=\"http://google.com\"></a>\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 MyTextInput = Ember.View.extend({\n tagName: 'input',\n attributeBindings: ['disabled'],\n disabled: true\n })\n\n Will result in view instances with an HTML representation of:\n\n <input id=\"ember1\" class=\"ember-view\" disabled=\"disabled\" />\n\n `attributeBindings` can refer to computed properties:\n\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 Updates to the the property of an attribute binding will result in automatic update \n of the HTML attribute in the view's rendered HTML representation.\n\n `attributeBindings` is a concatenated property. See `Ember.Object` documentation\n for more information about concatenated properties.\n\n ## Templates\n The HTML contents of a view's rendered representation are determined by its template.\n Templates can be any function that accepts an optional context parameter and returns\n a string of HTML that will be inserted within the view's tag. Most\n typically in Ember this function will be a compiled Ember.Handlebars template.\n\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('I am the template')\n })\n\n Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">I am the template</div>\n\n The default context of the compiled template will be the view instance itself:\n\n AView = Ember.View.extend({\n template: Ember.Handlebars.compile('Hello {{excitedGreeting}}')\n })\n\n aView = AView.create({\n content: Ember.Object.create({\n firstName: 'Barry'\n })\n excitedGreeting: function(){\n return this.getPath(\"content.firstName\") + \"!!!\"\n }\n })\n\n Will result in an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">Hello Barry!!!</div>\n\n Within an Ember application is more common to define a Handlebars templates as\n part of a page:\n\n <script type='text/x-handlebars' data-template-name='some-template'>\n Hello\n </script>\n\n And associate it by name using a view's `templateName` property:\n\n AView = Ember.View.extend({\n templateName: 'some-template'\n })\n\n Using a value for `templateName` that does not have a Handlebars template with a\n matching `data-template-name` attribute will throw an error.\n\n Assigning a value to both `template` and `templateName` properties will throw an error.\n\n For views classes that may have a template later defined (e.g. as the block portion of a `{{view}}`\n Handlebars helper call in another template or in a subclass), you can provide a `defaultTemplate`\n property set to compiled template function. If a template is not later provided for the view\n instance the `defaultTemplate` value will be used:\n\n AView = Ember.View.extend({\n defaultTemplate: Ember.Handlebars.compile('I was the default'),\n template: null,\n templateName: null\n })\n\n Will result in instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">I was the default</div>\n\n If a `template` or `templateName` is provided it will take precedence over `defaultTemplate`:\n\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 Will result in the following HTML representation when rendered:\n\n <div id=\"ember1\" class=\"ember-view\">I was the template, not default</div>\n\n ## Layouts\n Views can have a secondary outer template that wraps their main template. Like\n primary templates, layouts can be any function that accepts an optional context\n parameter and returns a string of HTML that will be inserted a view's tag.\n Most typically in Ember this function will be a compiled Ember.Handlebars template.\n\n A view's layout can be set directly with the `layout` property or reference an\n 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 `{{yield}}`\n helper. The HTML contents of a view's rendered `template` will be inserted at this location:\n\n AViewWithLayout = Ember.View.extend({\n layout: Ember.Handlebars.compile(\"<div class='my-decorative-class'>{{yield}}</div>\")\n template: Ember.Handlebars.compile(\"I got wrapped\"),\n })\n\n Will result in view instances with an HTML representation of:\n\n <div id=\"ember1\" class=\"ember-view\">\n <div class=\"my-decorative-class\">\n I got wrapped\n </div>\n </div>\n\n See `Handlebars.helpers.yield` for more information.\n\n ## Responding to Browser Events\n Views can respond to user-initiated events in one of three ways: method implementation, \n through an event manager, and through `{{action}}` helper use in their template or layout.\n\n ### Method Implementation\n Views can respond to user-initiated events by implementing a method that matches the\n event name. A `jQuery.Event` object will be passed as the argument to this method.\n\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 ### Event Managers\n Views can define an object as their `eventManager` property. This object can then\n implement methods that match the desired event names. Matching events that occur\n on the view's rendered HTML or the rendered HTML of any of its DOM descendants \n will trigger this method. A `jQuery.Event` object will be passed as the first \n argument to the method and an `Ember.View` object as the second. The `Ember.View`\n will be the view whose rendered HTML was interacted with. This may be the view with\n the `eventManager` property or one of its descendent views.\n\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 same\n name handled through methods on the view.\n\n\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 presedence over AView#mouseEnter\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 be called\n if the view instance was rendered inside the HTML representation of a view that has \n an `eventManager` property defined that handles events of the name. Events not handled\n by the event manager will still trigger method calls on the descendent.\n\n OuterView = Ember.View.extend({\n eventManager: Ember.Object.create({\n template: Ember.Handlebars.compile(\"outer {{#view InnerView}}inner{{/view}} outer\"),\n mouseEnter: function(event, view){\n // view might be instance of either\n // OutsideView 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 ### Handlebars `{{action}}` Helper\n See `Handlebars.helpers.action`.\n\n ### Event Names\n Possible events names for any of the responding approaches described above are:\n\n Touch events: 'touchStart', 'touchMove', 'touchEnd', 'touchCancel'\n\n Keyboard events: 'keyDown', 'keyUp', 'keyPress'\n\n Mouse events: 'mouseDown', 'mouseUp', 'contextMenu', 'click', 'doubleClick', 'mouseMove',\n 'focusIn', 'focusOut', 'mouseEnter', 'mouseLeave'\n\n Form events: 'submit', 'change', 'focusIn', 'focusOut', 'input'\n\n HTML5 drag and drop events: 'dragStart', 'drag', 'dragEnter', 'dragLeave', 'drop', 'dragEnd'\n \n ## Handlebars `{{view}}` Helper\n Other `Ember.View` instances can be included as part of a view's template by using the `{{view}}`\n Handlebars helper. See `Handlebars.helpers.view` for additional information.\n\n @extends Ember.Object\n*/\nEmber.View = Ember.Object.extend(Ember.Evented,\n/** @scope Ember.View.prototype */ {\n\n /** @private */\n concatenatedProperties: ['classNames', 'classNameBindings', 'attributeBindings'],\n\n /**\n @type Boolean\n @default true\n @constant\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 Ember.View will look for a template with this name in this view's\n `templates` object. By default, this will be a global object\n shared in `Ember.TEMPLATES`.\n\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 Ember.View will look for a template with this name in this view's\n `templates` object. By default, this will be a global object\n shared in `Ember.TEMPLATES`.\n\n @type String\n @default null\n */\n layoutName: null,\n\n /**\n The hash in which to look for `templateName`.\n\n @type Ember.Object\n @default Ember.TEMPLATES\n */\n templates: Ember.TEMPLATES,\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 @field\n @type Function\n */\n template: Ember.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 return template || get(this, 'defaultTemplate');\n }).property('templateName').cacheable(),\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 @type Object\n */\n controller: null,\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 and 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 @field\n @type Function\n */\n layout: Ember.computed(function(key, value) {\n if (arguments.length === 2) { return value; }\n\n var layoutName = get(this, 'layoutName'),\n layout = this.templateForName(layoutName, 'layout');\n\n return layout || get(this, 'defaultLayout');\n }).property('layoutName').cacheable(),\n\n templateForName: function(name, type) {\n if (!name) { return; }\n\n var templates = get(this, 'templates'),\n template = get(templates, name);\n\n if (!template) {\n throw new Ember.Error(fmt('%@ - Unable to find %@ \"%@\".', [this, type, name]));\n }\n\n return template;\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 itself.\n\n @type Object\n */\n templateContext: Ember.computed(function(key, value) {\n if (arguments.length === 2) {\n set(this, '_templateContext', value);\n return value;\n } else {\n return get(this, '_templateContext');\n }\n }).cacheable(),\n\n /**\n @private\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 _templateContext: Ember.computed(function(key, value) {\n var parentView;\n\n if (arguments.length === 2) {\n return value;\n }\n\n if (VIEW_PRESERVES_CONTEXT) {\n parentView = get(this, '_parentView');\n if (parentView) {\n return get(parentView, '_templateContext');\n }\n }\n\n return this;\n }).cacheable(),\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 @private\n */\n _displayPropertyDidChange: Ember.observer(function() {\n this.rerender();\n }, 'templateContext', 'controller'),\n\n /**\n If the view is currently inserted into the DOM of a parent view, this\n property will point to the parent of the view.\n\n @type Ember.View\n @default null\n */\n parentView: Ember.computed(function() {\n var parent = get(this, '_parentView');\n\n if (parent && parent.isVirtual) {\n return get(parent, 'parentView');\n } else {\n return parent;\n }\n }).property('_parentView').volatile(),\n\n _parentView: null,\n\n // return the current view, not including virtual views\n concreteView: Ember.computed(function() {\n if (!this.isVirtual) { return this; }\n else { return get(this, 'parentView'); }\n }).property('_parentView').volatile(),\n\n /**\n If false, the view will appear hidden in DOM.\n\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 @private\n @type Array\n @default []\n */\n childViews: childViewsProperty,\n\n _childViews: [],\n\n /**\n When it's a virtual view, we need to notify the parent that their\n childViews will change.\n */\n _childViewsWillChange: Ember.beforeObserver(function() {\n if (this.isVirtual) {\n var parentView = get(this, 'parentView');\n if (parentView) { Ember.propertyWillChange(parentView, 'childViews'); }\n }\n }, 'childViews'),\n\n /**\n When it's a virtual view, we need to notify the parent that their\n childViews did change.\n */\n _childViewsDidChange: Ember.observer(function() {\n if (this.isVirtual) {\n var parentView = get(this, 'parentView');\n if (parentView) { Ember.propertyDidChange(parentView, 'childViews'); }\n }\n }, 'childViews'),\n\n /**\n Return the nearest ancestor that is an instance of the provided\n class.\n\n @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @returns Ember.View\n */\n nearestInstanceOf: function(klass) {\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 has a given property.\n\n @param {String} property A property name\n @returns 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 @param {Class} klass Subclass of Ember.View (or Ember.View itself)\n @returns 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 Return the nearest ancestor that is an Ember.CollectionView\n\n @returns Ember.CollectionView\n */\n collectionView: Ember.computed(function() {\n return this.nearestInstanceOf(Ember.CollectionView);\n }).cacheable(),\n\n /**\n Return the nearest ancestor that is a direct child of\n an Ember.CollectionView\n\n @returns Ember.View\n */\n itemView: Ember.computed(function() {\n return this.nearestChildOf(Ember.CollectionView);\n }).cacheable(),\n\n /**\n Return the nearest ancestor that has the property\n `content`.\n\n @returns Ember.View\n */\n contentView: Ember.computed(function() {\n return this.nearestWithProperty('content');\n }).cacheable(),\n\n /**\n @private\n\n When the parent view changes, recursively invalidate\n collectionView, itemView, and contentView\n */\n _parentViewDidChange: Ember.observer(function() {\n if (this.isDestroying) { return; }\n\n this.invokeRecursively(function(view) {\n view.propertyDidChange('collectionView');\n view.propertyDidChange('itemView');\n view.propertyDidChange('contentView');\n });\n }, '_parentView'),\n\n cloneKeywords: function() {\n var templateData = get(this, 'templateData'),\n controller = get(this, 'controller');\n\n var keywords = templateData ? Ember.copy(templateData.keywords) : {};\n keywords.view = get(this, 'concreteView');\n\n // If the view has a controller specified, make it available to the\n // template. If not, pass along the parent template's controller,\n // if it exists.\n if (controller) {\n keywords.controller = controller;\n }\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 `templateContext`. The value of\n `templateContext` will be the view itself unless you override it.\n\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, '_templateContext');\n var keywords = this.cloneKeywords();\n\n var data = {\n view: this,\n buffer: buffer,\n isRenderData: true,\n keywords: keywords\n };\n\n // Invoke the template with the provided template context, which\n // is the view 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 specify templateName instead?', typeof template === 'function');\n // The template should write directly to the render buffer instead\n // of returning a string.\n var 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 invokeForState: function(name) {\n var stateName = this.state, args;\n\n // try to find the function for the state in the cache\n if (fn = invokeForState[stateName][name]) {\n args = a_slice.call(arguments);\n args[0] = this;\n\n return fn.apply(this, args);\n }\n\n // otherwise, find and cache the function for this state\n var parent = this, states = parent.states, state;\n\n while (states) {\n state = states[stateName];\n\n while (state) {\n var fn = state[name];\n\n if (fn) {\n invokeForState[stateName][name] = fn;\n\n args = a_slice.call(arguments, 1);\n args.unshift(this);\n\n return fn.apply(this, args);\n }\n\n state = state.parentState;\n }\n\n states = states.parent;\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 rerender: function() {\n return this.invokeForState('rerender');\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 = get(this, '_childViews');\n for (var i=lengthAfter-1; i>=lengthBefore; i--) {\n if (childViews[i]) { childViews[i].destroy(); }\n }\n },\n\n /**\n @private\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 _applyClassNameBindings: function() {\n var classBindings = get(this, 'classNameBindings'),\n classNames = get(this, 'classNames'),\n elem, newClass, dasherizedClass;\n\n if (!classBindings) { return; }\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 // 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, property;\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 classNames.push(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 // Extract just the property name from bindings like 'foo:bar'\n property = binding.split(':')[0];\n addObserver(this, property, observer);\n }, this);\n },\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 @param {Ember.RenderBuffer} buffer\n */\n _applyAttributeBindings: function(buffer) {\n var attributeBindings = get(this, 'attributeBindings'),\n attributeValue, elem, type;\n\n if (!attributeBindings) { return; }\n\n a_forEach(attributeBindings, function(binding) {\n var split = binding.split(':'),\n property = split[0],\n attributeName = split[1] || property;\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 attributeValue = get(this, property);\n\n Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);\n };\n\n addObserver(this, property, observer);\n\n // Determine the current value and add it to the render buffer\n // if necessary.\n attributeValue = get(this, property);\n Ember.View.applyAttributeBindings(buffer, attributeName, attributeValue);\n }, this);\n },\n\n /**\n @private\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 _classStringForProperty: function(property) {\n var split = property.split(':'),\n className = split[1];\n\n property = split[0];\n\n // TODO: Remove this `false` when the `getPath` globals support is removed\n var val = Ember.getPath(this, property, false);\n if (val === undefined && Ember.isGlobalPath(property)) {\n val = Ember.getPath(window, property);\n }\n\n // If the value is truthy and we're using the colon syntax,\n // we should return the className directly\n if (!!val && className) {\n return className;\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 = property.split('.');\n return Ember.String.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 !== undefined && 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 // ELEMENT SUPPORT\n //\n\n /**\n Returns the current DOM element for the view.\n\n @field\n @type DOMElement\n */\n element: Ember.computed(function(key, value) {\n if (value !== undefined) {\n return this.invokeForState('setElement', value);\n } else {\n return this.invokeForState('getElement');\n }\n }).property('_parentView').cacheable(),\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 @param {String} [selector] a jQuery-compatible selector string\n @returns {Ember.CoreQuery} the CoreQuery object for the DOM node\n */\n $: function(sel) {\n return this.invokeForState('$', sel);\n },\n\n /** @private */\n mutateChildViews: function(callback) {\n var childViews = get(this, '_childViews'),\n idx = get(childViews, 'length'),\n view;\n\n while(--idx >= 0) {\n view = childViews[idx];\n callback.call(this, view, idx);\n }\n\n return this;\n },\n\n /** @private */\n forEachChildView: function(callback) {\n var childViews = get(this, '_childViews');\n\n if (!childViews) { return this; }\n\n var len = get(childViews, 'length'),\n view, idx;\n\n for(idx = 0; idx < len; idx++) {\n view = childViews[idx];\n callback.call(this, 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\n when building your application. You might consider using Ember.ContainerView\n instead. If you do need to use appendTo, be sure that the target element you\n are providing is associated with an Ember.Application and does not have an\n ancestor element that is associated with an Ember view.\n\n @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object\n @returns {Ember.View} receiver\n */\n appendTo: function(target) {\n Ember.assert(\"You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.\", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));\n\n // Schedule the DOM element to be created and appended to the given\n // element after bindings have synchronized.\n this._insertElementLater(function() {\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 element.\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 @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object\n @returns {Ember.View} received\n */\n replaceIn: function(target) {\n Ember.assert(\"You cannot replace an existing Ember.View. Consider using Ember.ContainerView instead.\", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));\n\n this._insertElementLater(function() {\n Ember.$(target).empty();\n this.$().appendTo(target);\n });\n\n return this;\n },\n\n /**\n @private\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 view._insertElementLater(function() {\n this.createElement();\n this.$().appendTo('body');\n });\n\n @param {Function} fn the function that inserts the element into the DOM\n */\n _insertElementLater: function(fn) {\n this._lastInsert = Ember.guidFor(fn);\n Ember.run.schedule('render', this, this.invokeForState, 'insertElement', 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 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 @returns {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 @returns {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 this.destroyElement();\n this.invokeRecursively(function(view) {\n view.clearRenderedChildren();\n });\n },\n\n /**\n The ID to use when trying to locate the element in the DOM. If you do not\n set the elementId explicitly, then the view's GUID will be used instead.\n This ID must be set at the time the view is created.\n\n @type String\n @readOnly\n */\n elementId: Ember.computed(function(key, value) {\n return value !== undefined ? value : Ember.guidFor(this);\n }).cacheable(),\n\n /**\n @private\n\n TODO: Perhaps this should be removed from the production build somehow.\n */\n _elementIdDidChange: Ember.beforeObserver(function() {\n throw \"Changing a view's elementId after creation is not allowed.\";\n }, 'elementId'),\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 view's\n guid if elementId is null). You can override this method to provide your\n own form of lookup. For example, if you want to discover your element\n using a CSS class name instead of an ID.\n\n @param {DOMElement} parentElement The parent's DOM element\n @returns {DOMElement} The discovered element\n */\n findElementInParentElement: function(parentElem) {\n var id = \"#\" + get(this, 'elementId');\n return Ember.$(id)[0] || Ember.$(id, parentElem)[0];\n },\n\n /**\n Creates a new renderBuffer with the passed tagName. You can override this\n method to provide further customization to the buffer if needed. Normally\n you will not need to call or override this method.\n\n @returns {Ember.RenderBuffer}\n */\n renderBuffer: function(tagName) {\n tagName = tagName || get(this, 'tagName');\n\n // Explicitly check for null or undefined, as tagName\n // may be an empty string, which would evaluate to false.\n if (tagName === null || tagName === undefined) {\n tagName = 'div';\n }\n\n return Ember.RenderBuffer(tagName);\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 @returns {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 willInsertElement: Ember.K,\n\n /**\n Called when the element of the view has been inserted into the DOM.\n Override this function to do any set up that requires an element in the\n document body.\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 willRerender: Ember.K,\n\n /**\n Run this callback on the current view and recursively on child views.\n\n @private\n */\n invokeRecursively: function(fn) {\n fn.call(this, this);\n\n this.forEachChildView(function(view) {\n view.invokeRecursively(fn);\n });\n },\n\n /**\n Invalidates the cache for a property on all child views.\n */\n invalidateRecursively: function(key) {\n this.forEachChildView(function(view) {\n view.propertyDidChange(key);\n });\n },\n\n /**\n @private\n\n Invokes the receiver's willInsertElement() method if it exists and then\n invokes the same on all child views.\n\n NOTE: In some cases this was called when the element existed. This no longer\n works so we let people know. We can remove this warning code later.\n */\n _notifyWillInsertElement: function() {\n this.invokeRecursively(function(view) {\n view.fire('willInsertElement');\n });\n },\n\n /**\n @private\n\n Invokes the receiver's didInsertElement() method if it exists and then\n invokes the same on all child views.\n */\n _notifyDidInsertElement: function() {\n this.invokeRecursively(function(view) {\n view.fire('didInsertElement');\n });\n },\n\n /**\n @private\n\n Invokes the receiver's willRerender() method if it exists and then\n invokes the same on all child views.\n */\n _notifyWillRerender: function() {\n this.invokeRecursively(function(view) {\n view.fire('willRerender');\n });\n },\n\n /**\n Destroys any existing element along with the element for any child views\n as well. If the view does not currently have a element, then this method\n will do nothing.\n\n If you implement willDestroyElement() on your view, then this method will\n be invoked on your view before your element is destroyed to give you a\n chance to clean up any event handlers, etc.\n\n If you write a willDestroyElement() handler, you can assume that your\n didInsertElement() handler was called earlier for the same element.\n\n Normally you will not call or override this method yourself, but you may\n want to implement the above callbacks when it is run.\n\n @returns {Ember.View} receiver\n */\n destroyElement: function() {\n return this.invokeForState('destroyElement');\n },\n\n /**\n Called when the element of the view is going to be destroyed. Override\n this function to do any teardown that requires an element, like removing\n event listeners.\n */\n willDestroyElement: function() {},\n\n /**\n @private\n\n Invokes the `willDestroyElement` callback on the view and child views.\n */\n _notifyWillDestroyElement: function() {\n this.invokeRecursively(function(view) {\n view.fire('willDestroyElement');\n });\n },\n\n /** @private (nodoc) */\n _elementWillChange: Ember.beforeObserver(function() {\n this.forEachChildView(function(view) {\n Ember.propertyWillChange(view, 'element');\n });\n }, 'element'),\n\n /**\n @private\n\n If this view's element changes, we need to invalidate the caches of our\n child views so that we do not retain references to DOM elements that are\n no longer needed.\n\n @observes element\n */\n _elementDidChange: Ember.observer(function() {\n this.forEachChildView(function(view) {\n Ember.propertyDidChange(view, 'element');\n });\n }, 'element'),\n\n /**\n Called when the parentView property has changed.\n\n @function\n */\n parentViewDidChange: Ember.K,\n\n /**\n @private\n\n Invoked by the view system when this view needs to produce an HTML\n representation. This method will create a new render buffer, if needed,\n then apply any default attributes, such as class names and visibility.\n Finally, the `render()` method is invoked, which is responsible for\n doing the bulk of the rendering.\n\n You should not need to override this method; instead, implement the\n `template` property, or if you need more control, override the `render`\n method.\n\n @param {Ember.RenderBuffer} buffer the render buffer. If no buffer is\n passed, a default buffer, using the current view's `tagName`, will\n be used.\n */\n renderToBuffer: function(parentBuffer, bufferOperation) {\n var buffer;\n\n Ember.run.sync();\n\n // Determine where in the parent buffer to start the new buffer.\n // By default, a new buffer will be appended to the parent buffer.\n // The buffer operation may be changed if the child views array is\n // mutated by Ember.ContainerView.\n bufferOperation = bufferOperation || 'begin';\n\n // If this is the top-most view, start a new buffer. Otherwise,\n // create a new buffer relative to the original using the\n // provided buffer operation (for example, `insertAfter` will\n // insert a new buffer after the \"parent buffer\").\n if (parentBuffer) {\n var tagName = get(this, 'tagName');\n if (tagName === null || tagName === undefined) {\n tagName = 'div';\n }\n\n buffer = parentBuffer[bufferOperation](tagName);\n } else {\n buffer = this.renderBuffer();\n }\n\n this.buffer = buffer;\n this.transitionTo('inBuffer', false);\n\n this.lengthBeforeRender = get(get(this, '_childViews'), 'length');\n\n this.beforeRender(buffer);\n this.render(buffer);\n this.afterRender(buffer);\n\n this.lengthAfterRender = get(get(this, '_childViews'), 'length');\n\n return buffer;\n },\n\n beforeRender: function(buffer) {\n this.applyAttributesToBuffer(buffer);\n },\n\n afterRender: Ember.K,\n\n /**\n @private\n */\n applyAttributesToBuffer: function(buffer) {\n // Creates observers for all registered class name and attribute bindings,\n // then adds them to the element.\n this._applyClassNameBindings();\n\n // Pass the render buffer so the method can apply attributes directly.\n // This isn't needed for class name bindings because they use the\n // existing classNames infrastructure.\n this._applyAttributeBindings(buffer);\n\n\n a_forEach(get(this, 'classNames'), function(name){ buffer.addClass(name); });\n buffer.id(get(this, 'elementId'));\n\n var role = get(this, 'ariaRole');\n if (role) {\n buffer.attr('role', role);\n }\n\n if (get(this, 'isVisible') === false) {\n buffer.style('display', 'none');\n }\n },\n\n // ..........................................................\n // STANDARD RENDER PROPERTIES\n //\n\n /**\n Tag name for the view's outer element. The tag name is only used when\n an element is first created. If you change the tagName for an element, you\n must destroy and recreate the view element.\n\n By default, the render buffer will use a `<div>` tag for views.\n\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\n\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 @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 // Applies the 'high' class to the view element\n Ember.View.create({\n classNameBindings: ['priority']\n priority: 'high'\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 // Applies the 'is-urgent' class to the view element\n Ember.View.create({\n classNameBindings: ['isUrgent']\n isUrgent: true\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 // Applies the 'urgent' class to the view element\n Ember.View.create({\n classNameBindings: ['isUrgent:urgent']\n isUrgent: true\n });\n\n This list of properties is inherited from the view's superclasses as well.\n\n @type Array\n @default []\n */\n classNameBindings: [],\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 // Applies the type attribute to the element\n // with the value \"button\", like <div type=\"button\">\n Ember.View.create({\n attributeBindings: ['type'],\n type: 'button'\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 // Renders something like <div enabled=\"enabled\">\n Ember.View.create({\n attributeBindings: ['enabled'],\n enabled: true\n });\n */\n attributeBindings: [],\n\n state: 'preRender',\n\n // .......................................................\n // CORE DISPLAY METHODS\n //\n\n /**\n @private\n\n Setup a view, but do not finish waking it up.\n - configure childViews\n - register the view with the global views hash, which is used for event\n dispatch\n */\n init: function() {\n this._super();\n\n // Register the view for event handling. This hash is used by\n // Ember.RootResponder to dispatch incoming events.\n Ember.View.views[get(this, 'elementId')] = this;\n\n var childViews = get(this, '_childViews').slice();\n\n // setup child views. be sure to clone the child views array first\n set(this, '_childViews', childViews);\n\n Ember.assert(\"Only arrays are allowed for 'classNameBindings'\", Ember.typeOf(this.classNameBindings) === 'array');\n this.classNameBindings = Ember.A(this.classNameBindings.slice());\n\n Ember.assert(\"Only arrays are allowed for 'classNames'\", Ember.typeOf(this.classNames) === 'array');\n this.classNames = Ember.A(this.classNames.slice());\n\n var viewController = get(this, 'viewController');\n if (viewController) {\n viewController = Ember.getPath(viewController);\n if (viewController) {\n set(viewController, 'view', this);\n }\n }\n },\n\n appendChild: function(view, options) {\n return this.invokeForState('appendChild', view, options);\n },\n\n /**\n Removes the child view from the parent view.\n\n @param {Ember.View} view\n @returns {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 = get(this, '_childViews');\n Ember.ArrayUtils.removeObject(childViews, view);\n\n this.propertyDidChange('childViews');\n\n return this;\n },\n\n /**\n Removes all children from the parentView.\n\n @returns {Ember.View} receiver\n */\n removeAllChildren: function() {\n return this.mutateChildViews(function(view) {\n this.removeChild(view);\n });\n },\n\n destroyAllChildren: function() {\n return this.mutateChildViews(function(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 @returns {Ember.View} receiver\n */\n removeFromParent: function() {\n var parent = get(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 willDestroy: function() {\n // calling this._super() will nuke computed properties and observers,\n // so collect any information we need before calling super.\n var childViews = get(this, '_childViews'),\n parent = get(this, '_parentView'),\n elementId = get(this, 'elementId'),\n childLen;\n\n // destroy the element -- this will avoid each child view destroying\n // the element over and over again...\n if (!this.removedFromDOM) { this.destroyElement(); }\n\n // remove from non-virtual parent view if viewName was specified\n if (this.viewName) {\n var nonVirtualParentView = get(this, 'parentView');\n if (nonVirtualParentView) {\n set(nonVirtualParentView, this.viewName, null);\n }\n }\n\n // remove from parent if found. Don't call removeFromParent,\n // as removeFromParent will try to remove the element from\n // the DOM again.\n if (parent) { parent.removeChild(this); }\n\n this.state = 'destroyed';\n\n childLen = get(childViews, 'length');\n for (var i=childLen-1; i>=0; i--) {\n childViews[i].removedFromDOM = true;\n childViews[i].destroy();\n }\n\n // next remove view from global hash\n delete Ember.View.views[get(this, 'elementId')];\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 @param {Class} viewClass\n @param {Hash} [attrs] Attributes to add\n @returns {Ember.View} new instance\n @test in createChildViews\n */\n createChildView: function(view, attrs) {\n var coreAttrs, templateData;\n\n if (Ember.View.detect(view)) {\n coreAttrs = { _parentView: this, templateData: get(this, 'templateData') };\n\n if (attrs) {\n view = view.create(coreAttrs, attrs);\n } else {\n view = view.create(coreAttrs);\n }\n\n var viewName = view.viewName;\n\n // don't set the property on a virtual view, as they are invisible to\n // consumers of the view API\n if (viewName) { set(get(this, 'concreteView'), viewName, view); }\n } else {\n Ember.assert('You must pass instance or subclass of View', view instanceof Ember.View);\n Ember.assert(\"You can only pass attributes when a class is provided\", !attrs);\n\n if (!get(view, 'templateData')) {\n set(view, 'templateData', get(this, 'templateData'));\n }\n\n set(view, '_parentView', this);\n }\n\n return view;\n },\n\n becameVisible: Ember.K,\n becameHidden: Ember.K,\n\n /**\n @private\n\n When the view's `isVisible` property changes, toggle the visibility\n element of the actual DOM element.\n */\n _isVisibleDidChange: Ember.observer(function() {\n var isVisible = get(this, 'isVisible');\n\n this.$().toggle(isVisible);\n\n if (this._isAncestorHidden()) { return; }\n\n if (isVisible) {\n this._notifyBecameVisible();\n } else {\n this._notifyBecameHidden();\n }\n }, 'isVisible'),\n\n _notifyBecameVisible: function() {\n this.fire('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.fire('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(function(view) {\n this.buffer = null;\n });\n },\n\n transitionTo: function(state, children) {\n this.state = state;\n\n if (children !== false) {\n this.forEachChildView(function(view) {\n view.transitionTo(state);\n });\n }\n },\n\n /**\n @private\n\n Override the default event firing from Ember.Evented to\n also call methods with the given name.\n */\n fire: function(name) {\n if (this[name]) {\n this[name].apply(this, [].slice.call(arguments, 1));\n }\n this._super.apply(this, arguments);\n },\n\n // .......................................................\n // EVENT HANDLING\n //\n\n /**\n @private\n\n Handle events from `Ember.EventDispatcher`\n */\n handleEvent: function(eventName, evt) {\n return this.invokeForState('handleEvent', eventName, evt);\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 * 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/** @private */\nvar DOMManager = {\n prepend: function(view, childView) {\n childView._insertElementLater(function() {\n var element = view.$();\n element.prepend(childView.$());\n });\n },\n\n after: function(view, nextView) {\n nextView._insertElementLater(function() {\n var element = view.$();\n element.after(nextView.$());\n });\n },\n\n replace: function(view) {\n var element = get(view, 'element');\n\n set(view, 'element', null);\n\n view._insertElementLater(function() {\n Ember.$(element).replaceWith(get(view, 'element'));\n });\n },\n\n remove: function(view) {\n var elem = get(view, 'element');\n\n set(view, 'element', null);\n view._lastInsert = null;\n\n Ember.$(elem).remove();\n },\n\n empty: function(view) {\n view.$().empty();\n }\n};\n\nEmber.View.reopen({\n states: Ember.View.states,\n domManager: DOMManager\n});\n\n// Create a global view hash.\nEmber.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.\nEmber.View.childViewsProperty = childViewsProperty;\n\nEmber.View.applyAttributeBindings = function(elem, name, value) {\n var type = Ember.typeOf(value);\n var currentValue = elem.attr(name);\n\n // if this changes, also change the logic in ember-handlebars/lib/helpers/binding.js\n if ((type === 'string' || (type === 'number' && !isNaN(value))) && value !== currentValue) {\n elem.attr(name, value);\n } else if (value && type === 'boolean') {\n elem.attr(name, name);\n } else if (!value) {\n elem.removeAttr(name);\n }\n};\n\n})();\n//@ sourceURL=ember-views/views/view");minispade.register('ember-viewstates', "(function() {// ==========================================================================\n// Project: Ember Statecharts\n// Copyright: ©2011 Living Social Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-views');\nminispade.require('ember-states');\nminispade.require('ember-viewstates/state_manager')\nminispade.require('ember-viewstates/view_state');\n\n})();\n//@ sourceURL=ember-viewstates");minispade.register('ember-viewstates/state_manager', "(function() {var get = Ember.get, set = Ember.set, getPath = Ember.getPath, fmt = Ember.String.fmt;\n\n/**\n @class\n \n ## Interactions with Ember's View System.\n When combined with instances of `Ember.ViewState`, StateManager is designed to \n interact with Ember's view system to control which views are added to \n and removed from the DOM based on the manager's current state.\n\n By default, a StateManager will manage views inside the 'body' element. This can be\n customized by setting the `rootElement` property to a CSS selector of an existing \n HTML element you would prefer to receive view rendering.\n\n\n viewStates = Ember.StateManager.create({\n rootElement: '#some-other-element'\n })\n\n You can also specify a particular instance of `Ember.ContainerView` you would like to receive\n view rendering by setting the `rootView` property. You will be responsible for placing\n this element into the DOM yourself.\n\n aLayoutView = Ember.ContainerView.create()\n\n // make sure this view instance is added to the browser\n aLayoutView.appendTo('body') \n\n App.viewStates = Ember.StateManager.create({\n rootView: aLayoutView\n })\n\n\n Once you have an instance of StateManager controlling a view, you can provide states\n that are instances of `Ember.ViewState`. When the StateManager enters a state\n that is an instance of `Ember.ViewState` that `ViewState`'s `view` property will be\n instantiated and inserted into the StateManager's `rootView` or `rootElement`.\n When a state is exited, the `ViewState`'s view will be removed from the StateManager's\n view.\n\n ContactListView = Ember.View.extend({\n classNames: ['my-contacts-css-class'],\n template: Ember.Handlebars.compile('<h2>People</h2>')\n })\n\n PhotoListView = Ember.View.extend({\n classNames: ['my-photos-css-class'],\n template: Ember.Handlebars.compile('<h2>Photos</h2>')\n })\n\n viewStates = Ember.StateManager.create({\n showingPeople: Ember.ViewState.create({\n view: ContactListView\n }),\n showingPhotos: Ember.ViewState.create({\n view: PhotoListView\n })\n })\n\n viewStates.goToState('showingPeople')\n\n The above code will change the rendered HTML from\n\n <body></body>\n\n to\n\n <body>\n <div id=\"ember1\" class=\"ember-view my-contacts-css-class\">\n <h2>People</h2>\n </div>\n </body>\n\n Changing the current state via `goToState` from `showingPeople` to\n `showingPhotos` will remove the `showingPeople` view and add the `showingPhotos` view:\n\n viewStates.goToState('showingPhotos')\n\n will change the rendered HTML to\n\n <body>\n <div id=\"ember2\" class=\"ember-view my-photos-css-class\">\n <h2>Photos</h2>\n </div>\n </body>\n\n\n When entering nested `ViewState`s, each state's view will be draw into the the StateManager's\n `rootView` or `rootElement` as siblings.\n\n\n ContactListView = Ember.View.extend({\n classNames: ['my-contacts-css-class'],\n template: Ember.Handlebars.compile('<h2>People</h2>')\n })\n\n EditAContactView = Ember.View.extend({\n classNames: ['editing-a-contact-css-class'],\n template: Ember.Handlebars.compile('Editing...')\n })\n\n viewStates = Ember.StateManager.create({\n showingPeople: Ember.ViewState.create({\n view: ContactListView,\n\n withEditingPanel: Ember.ViewState.create({\n view: EditAContactView\n })\n })\n })\n\n\n viewStates.goToState('showingPeople.withEditingPanel')\n\n\n Will result in the following rendered HTML:\n\n <body>\n <div id=\"ember2\" class=\"ember-view my-contacts-css-class\">\n <h2>People</h2>\n </div>\n\n <div id=\"ember2\" class=\"ember-view editing-a-contact-css-class\">\n Editing...\n </div>\n </body>\n\n\n ViewState views are added and removed from their StateManager's view via their\n `enter` and `exit` methods. If you need to override these methods, be sure to call\n `_super` to maintain the adding and removing behavior:\n\n viewStates = Ember.StateManager.create({\n aState: Ember.ViewState.create({\n view: Ember.View.extend({}),\n enter: function(manager, transition){\n // calling _super ensures this view will be\n // properly inserted\n this._super(manager, transition);\n\n // now you can do other things\n }\n })\n })\n\n ## Managing Multiple Sections of A Page With States\n Multiple StateManagers can be combined to control multiple areas of an application's rendered views.\n Given the following HTML body:\n\n <body>\n <div id='sidebar-nav'>\n </div>\n <div id='content-area'>\n </div>\n </body>\n\n You could separately manage view state for each section with two StateManagers\n\n navigationStates = Ember.StateManager.create({\n rootElement: '#sidebar-nav',\n userAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n userNotAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n contentStates = Ember.StateManager.create({\n rootElement: '#content-area',\n books: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n music: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n\n If you prefer to start with an empty body and manage state programmatically you\n can also take advantage of StateManager's `rootView` property and the ability of \n `Ember.ContainerView`s to manually manage their child views. \n\n\n dashboard = Ember.ContainerView.create({\n childViews: ['navigationAreaView', 'contentAreaView'],\n navigationAreaView: Ember.ContainerView.create({}),\n contentAreaView: Ember.ContainerView.create({})\n })\n\n navigationStates = Ember.StateManager.create({\n rootView: dashboard.get('navigationAreaView'),\n userAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n userNotAuthenticated: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n contentStates = Ember.StateManager.create({\n rootView: dashboard.get('contentAreaView'),\n books: Em.ViewState.create({\n view: Ember.View.extend({})\n }),\n music: Em.ViewState.create({\n view: Ember.View.extend({})\n })\n })\n\n dashboard.appendTo('body')\n\n ## User Manipulation of State via `{{action}}` Helpers\n The Handlebars `{{action}}` helper is StateManager-aware and will use StateManager action sending \n to connect user interaction to action-based state transitions.\n\n Given the following body and handlebars template\n\n <body>\n <script type='text/x-handlebars'>\n <a href=\"#\" {{action \"anAction\" target=\"App.appStates\"}}> Go </a>\n </script>\n </body>\n\n And application code\n\n App = Ember.Application.create()\n App.appStates = Ember.StateManager.create({\n initialState: 'aState',\n aState: Ember.State.create({\n anAction: function(manager, context){}\n }),\n bState: Ember.State.create({})\n })\n\n A user initiated click or touch event on \"Go\" will trigger the 'anAction' method of\n `App.appStates.aState` with `App.appStates` as the first argument and a\n `jQuery.Event` object as the second object. The `jQuery.Event` will include a property\n `view` that references the `Ember.View` object that was interacted with.\n \n**/\nEmber.StateManager.reopen(\n/** @scope Ember.StateManager.prototype */ {\n\n /**\n If the current state is a view state or the descendent of a view state,\n this property will be the view associated with it. If there is no\n view state active in this state manager, this value will be null.\n\n @property\n */\n currentView: Ember.computed(function() {\n var currentState = get(this, 'currentState'),\n view;\n\n while (currentState) {\n if (get(currentState, 'isViewState')) {\n view = get(currentState, 'view');\n if (view) { return view; }\n }\n\n currentState = get(currentState, 'parentState');\n }\n\n return null;\n }).property('currentState').cacheable()\n\n});\n\n})();\n//@ sourceURL=ember-viewstates/state_manager");minispade.register('ember-viewstates/view_state', "(function() {minispade.require('ember-states/state');\n\nvar get = Ember.get, set = Ember.set;\n\nEmber.ViewState = Ember.State.extend({\n isViewState: true,\n\n enter: function(stateManager) {\n var view = get(this, 'view'), root, childViews;\n\n if (view) {\n if (Ember.View.detect(view)) {\n view = view.create();\n set(this, 'view', view);\n }\n\n Ember.assert('view must be an Ember.View', view instanceof Ember.View);\n\n root = stateManager.get('rootView');\n\n if (root) {\n childViews = get(root, 'childViews');\n childViews.pushObject(view);\n } else {\n root = stateManager.get('rootElement') || 'body';\n view.appendTo(root);\n }\n }\n },\n\n exit: function(stateManager) {\n var view = get(this, 'view');\n\n if (view) {\n // If the view has a parent view, then it is\n // part of a view hierarchy and should be removed\n // from its parent.\n if (get(view, 'parentView')) {\n view.removeFromParent();\n } else {\n\n // Otherwise, the view is a \"root view\" and\n // was appended directly to the DOM.\n view.remove();\n }\n }\n }\n});\n\n})();\n//@ sourceURL=ember-viewstates/view_state");minispade.register('ember', "(function() {// ==========================================================================\n// Project: Ember\n// Copyright: ©2011 Strobe Inc. and contributors.\n// License: Licensed under MIT license (see license.js)\n// ==========================================================================\nminispade.require('ember-metal');\nminispade.require('ember-views');\nminispade.require('ember-handlebars');\n\n})();\n//@ sourceURL=ember");minispade.register('handlebars', "(function() {// lib/handlebars/base.js\nvar Handlebars = {};\n\nwindow.Handlebars = Handlebars;\n\nHandlebars.VERSION = \"1.0.beta.6\";\n\nHandlebars.helpers = {};\nHandlebars.partials = {};\n\nHandlebars.registerHelper = function(name, fn, inverse) {\n if(inverse) { fn.not = inverse; }\n this.helpers[name] = fn;\n};\n\nHandlebars.registerPartial = function(name, str) {\n this.partials[name] = str;\n};\n\nHandlebars.registerHelper('helperMissing', function(arg) {\n if(arguments.length === 2) {\n return undefined;\n } else {\n throw new Error(\"Could not find property '\" + arg + \"'\");\n }\n});\n\nvar toString = Object.prototype.toString, functionType = \"[object Function]\";\n\nHandlebars.registerHelper('blockHelperMissing', function(context, options) {\n var inverse = options.inverse || function() {}, fn = options.fn;\n\n\n var ret = \"\";\n var type = toString.call(context);\n\n if(type === functionType) { context = context.call(this); }\n\n if(context === true) {\n return fn(this);\n } else if(context === false || context == null) {\n return inverse(this);\n } else if(type === \"[object Array]\") {\n if(context.length > 0) {\n for(var i=0, j=context.length; i<j; i++) {\n ret = ret + fn(context[i]);\n }\n } else {\n ret = inverse(this);\n }\n return ret;\n } else {\n return fn(context);\n }\n});\n\nHandlebars.registerHelper('each', function(context, options) {\n var fn = options.fn, inverse = options.inverse;\n var ret = \"\";\n\n if(context && context.length > 0) {\n for(var i=0, j=context.length; i<j; i++) {\n ret = ret + fn(context[i]);\n }\n } else {\n ret = inverse(this);\n }\n return ret;\n});\n\nHandlebars.registerHelper('if', function(context, options) {\n var type = toString.call(context);\n if(type === functionType) { context = context.call(this); }\n\n if(!context || Handlebars.Utils.isEmpty(context)) {\n return options.inverse(this);\n } else {\n return options.fn(this);\n }\n});\n\nHandlebars.registerHelper('unless', function(context, options) {\n var fn = options.fn, inverse = options.inverse;\n options.fn = inverse;\n options.inverse = fn;\n\n return Handlebars.helpers['if'].call(this, context, options);\n});\n\nHandlebars.registerHelper('with', function(context, options) {\n return options.fn(context);\n});\n\nHandlebars.registerHelper('log', function(context) {\n Handlebars.log(context);\n});\n;\n// lib/handlebars/compiler/parser.js\n/* Jison generated parser */\nvar handlebars = (function(){\n\nvar parser = {trace: function trace() { },\nyy: {},\nsymbols_: {\"error\":2,\"root\":3,\"program\":4,\"EOF\":5,\"statements\":6,\"simpleInverse\":7,\"statement\":8,\"openInverse\":9,\"closeBlock\":10,\"openBlock\":11,\"mustache\":12,\"partial\":13,\"CONTENT\":14,\"COMMENT\":15,\"OPEN_BLOCK\":16,\"inMustache\":17,\"CLOSE\":18,\"OPEN_INVERSE\":19,\"OPEN_ENDBLOCK\":20,\"path\":21,\"OPEN\":22,\"OPEN_UNESCAPED\":23,\"OPEN_PARTIAL\":24,\"params\":25,\"hash\":26,\"param\":27,\"STRING\":28,\"INTEGER\":29,\"BOOLEAN\":30,\"hashSegments\":31,\"hashSegment\":32,\"ID\":33,\"EQUALS\":34,\"pathSegments\":35,\"SEP\":36,\"$accept\":0,\"$end\":1},\nterminals_: {2:\"error\",5:\"EOF\",14:\"CONTENT\",15:\"COMMENT\",16:\"OPEN_BLOCK\",18:\"CLOSE\",19:\"OPEN_INVERSE\",20:\"OPEN_ENDBLOCK\",22:\"OPEN\",23:\"OPEN_UNESCAPED\",24:\"OPEN_PARTIAL\",28:\"STRING\",29:\"INTEGER\",30:\"BOOLEAN\",33:\"ID\",34:\"EQUALS\",36:\"SEP\"},\nproductions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],\nperformAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {\n\nvar $0 = $$.length - 1;\nswitch (yystate) {\ncase 1: return $$[$0-1]\nbreak;\ncase 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0])\nbreak;\ncase 3: this.$ = new yy.ProgramNode($$[$0])\nbreak;\ncase 4: this.$ = new yy.ProgramNode([])\nbreak;\ncase 5: this.$ = [$$[$0]]\nbreak;\ncase 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]\nbreak;\ncase 7: this.$ = new yy.InverseNode($$[$0-2], $$[$0-1], $$[$0])\nbreak;\ncase 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0])\nbreak;\ncase 9: this.$ = $$[$0]\nbreak;\ncase 10: this.$ = $$[$0]\nbreak;\ncase 11: this.$ = new yy.ContentNode($$[$0])\nbreak;\ncase 12: this.$ = new yy.CommentNode($$[$0])\nbreak;\ncase 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])\nbreak;\ncase 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])\nbreak;\ncase 15: this.$ = $$[$0-1]\nbreak;\ncase 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])\nbreak;\ncase 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true)\nbreak;\ncase 18: this.$ = new yy.PartialNode($$[$0-1])\nbreak;\ncase 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1])\nbreak;\ncase 20:\nbreak;\ncase 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]\nbreak;\ncase 22: this.$ = [[$$[$0-1]].concat($$[$0]), null]\nbreak;\ncase 23: this.$ = [[$$[$0-1]], $$[$0]]\nbreak;\ncase 24: this.$ = [[$$[$0]], null]\nbreak;\ncase 25: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];\nbreak;\ncase 26: this.$ = [$$[$0]]\nbreak;\ncase 27: this.$ = $$[$0]\nbreak;\ncase 28: this.$ = new yy.StringNode($$[$0])\nbreak;\ncase 29: this.$ = new yy.IntegerNode($$[$0])\nbreak;\ncase 30: this.$ = new yy.BooleanNode($$[$0])\nbreak;\ncase 31: this.$ = new yy.HashNode($$[$0])\nbreak;\ncase 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]\nbreak;\ncase 33: this.$ = [$$[$0]]\nbreak;\ncase 34: this.$ = [$$[$0-2], $$[$0]]\nbreak;\ncase 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]\nbreak;\ncase 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]\nbreak;\ncase 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]\nbreak;\ncase 38: this.$ = new yy.IdNode($$[$0])\nbreak;\ncase 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];\nbreak;\ncase 40: this.$ = [$$[$0]]\nbreak;\n}\n},\ntable: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],\ndefaultActions: {16:[2,1],37:[2,23],53:[2,21]},\nparseError: function parseError(str, hash) {\n throw new Error(str);\n},\nparse: function parse(input) {\n var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = \"\", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;\n this.lexer.setInput(input);\n this.lexer.yy = this.yy;\n this.yy.lexer = this.lexer;\n if (typeof this.lexer.yylloc == \"undefined\")\n this.lexer.yylloc = {};\n var yyloc = this.lexer.yylloc;\n lstack.push(yyloc);\n if (typeof this.yy.parseError === \"function\")\n this.parseError = this.yy.parseError;\n function popStack(n) {\n stack.length = stack.length - 2 * n;\n vstack.length = vstack.length - n;\n lstack.length = lstack.length - n;\n }\n function lex() {\n var token;\n token = self.lexer.lex() || 1;\n if (typeof token !== \"number\") {\n token = self.symbols_[token] || token;\n }\n return token;\n }\n var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;\n while (true) {\n state = stack[stack.length - 1];\n if (this.defaultActions[state]) {\n action = this.defaultActions[state];\n } else {\n if (symbol == null)\n symbol = lex();\n action = table[state] && table[state][symbol];\n }\n if (typeof action === \"undefined\" || !action.length || !action[0]) {\n if (!recovering) {\n expected = [];\n for (p in table[state])\n if (this.terminals_[p] && p > 2) {\n expected.push(\"'\" + this.terminals_[p] + \"'\");\n }\n var errStr = \"\";\n if (this.lexer.showPosition) {\n errStr = \"Parse error on line \" + (yylineno + 1) + \":\\n\" + this.lexer.showPosition() + \"\\nExpecting \" + expected.join(\", \") + \", got '\" + this.terminals_[symbol] + \"'\";\n } else {\n errStr = \"Parse error on line \" + (yylineno + 1) + \": Unexpected \" + (symbol == 1?\"end of input\":\"'\" + (this.terminals_[symbol] || symbol) + \"'\");\n }\n this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});\n }\n }\n if (action[0] instanceof Array && action.length > 1) {\n throw new Error(\"Parse Error: multiple actions possible at state: \" + state + \", token: \" + symbol);\n }\n switch (action[0]) {\n case 1:\n stack.push(symbol);\n vstack.push(this.lexer.yytext);\n lstack.push(this.lexer.yylloc);\n stack.push(action[1]);\n symbol = null;\n if (!preErrorSymbol) {\n yyleng = this.lexer.yyleng;\n yytext = this.lexer.yytext;\n yylineno = this.lexer.yylineno;\n yyloc = this.lexer.yylloc;\n if (recovering > 0)\n recovering--;\n } else {\n symbol = preErrorSymbol;\n preErrorSymbol = null;\n }\n break;\n case 2:\n len = this.productions_[action[1]][1];\n yyval.$ = vstack[vstack.length - len];\n yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};\n r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);\n if (typeof r !== \"undefined\") {\n return r;\n }\n if (len) {\n stack = stack.slice(0, -1 * len * 2);\n vstack = vstack.slice(0, -1 * len);\n lstack = lstack.slice(0, -1 * len);\n }\n stack.push(this.productions_[action[1]][0]);\n vstack.push(yyval.$);\n lstack.push(yyval._$);\n newState = table[stack[stack.length - 2]][stack[stack.length - 1]];\n stack.push(newState);\n break;\n case 3:\n return true;\n }\n }\n return true;\n}\n};/* Jison generated lexer */\nvar lexer = (function(){\n\nvar lexer = ({EOF:1,\nparseError:function parseError(str, hash) {\n if (this.yy.parseError) {\n this.yy.parseError(str, hash);\n } else {\n throw new Error(str);\n }\n },\nsetInput:function (input) {\n this._input = input;\n this._more = this._less = this.done = false;\n this.yylineno = this.yyleng = 0;\n this.yytext = this.matched = this.match = '';\n this.conditionStack = ['INITIAL'];\n this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};\n return this;\n },\ninput:function () {\n var ch = this._input[0];\n this.yytext+=ch;\n this.yyleng++;\n this.match+=ch;\n this.matched+=ch;\n var lines = ch.match(/\\n/);\n if (lines) this.yylineno++;\n this._input = this._input.slice(1);\n return ch;\n },\nunput:function (ch) {\n this._input = ch + this._input;\n return this;\n },\nmore:function () {\n this._more = true;\n return this;\n },\npastInput:function () {\n var past = this.matched.substr(0, this.matched.length - this.match.length);\n return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\\n/g, \"\");\n },\nupcomingInput:function () {\n var next = this.match;\n if (next.length < 20) {\n next += this._input.substr(0, 20-next.length);\n }\n return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\\n/g, \"\");\n },\nshowPosition:function () {\n var pre = this.pastInput();\n var c = new Array(pre.length + 1).join(\"-\");\n return pre + this.upcomingInput() + \"\\n\" + c+\"^\";\n },\nnext:function () {\n if (this.done) {\n return this.EOF;\n }\n if (!this._input) this.done = true;\n\n var token,\n match,\n col,\n lines;\n if (!this._more) {\n this.yytext = '';\n this.match = '';\n }\n var rules = this._currentRules();\n for (var i=0;i < rules.length; i++) {\n match = this._input.match(this.rules[rules[i]]);\n if (match) {\n lines = match[0].match(/\\n.*/g);\n if (lines) this.yylineno += lines.length;\n this.yylloc = {first_line: this.yylloc.last_line,\n last_line: this.yylineno+1,\n first_column: this.yylloc.last_column,\n last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}\n this.yytext += match[0];\n this.match += match[0];\n this.matches = match;\n this.yyleng = this.yytext.length;\n this._more = false;\n this._input = this._input.slice(match[0].length);\n this.matched += match[0];\n token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);\n if (token) return token;\n else return;\n }\n }\n if (this._input === \"\") {\n return this.EOF;\n } else {\n this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\\n'+this.showPosition(),\n {text: \"\", token: null, line: this.yylineno});\n }\n },\nlex:function lex() {\n var r = this.next();\n if (typeof r !== 'undefined') {\n return r;\n } else {\n return this.lex();\n }\n },\nbegin:function begin(condition) {\n this.conditionStack.push(condition);\n },\npopState:function popState() {\n return this.conditionStack.pop();\n },\n_currentRules:function _currentRules() {\n return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;\n },\ntopState:function () {\n return this.conditionStack[this.conditionStack.length-2];\n },\npushState:function begin(condition) {\n this.begin(condition);\n }});\nlexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {\n\nvar YYSTATE=YY_START\nswitch($avoiding_name_collisions) {\ncase 0:\n if(yy_.yytext.slice(-1) !== \"\\\\\") this.begin(\"mu\");\n if(yy_.yytext.slice(-1) === \"\\\\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin(\"emu\");\n if(yy_.yytext) return 14;\n\nbreak;\ncase 1: return 14;\nbreak;\ncase 2: this.popState(); return 14;\nbreak;\ncase 3: return 24;\nbreak;\ncase 4: return 16;\nbreak;\ncase 5: return 20;\nbreak;\ncase 6: return 19;\nbreak;\ncase 7: return 19;\nbreak;\ncase 8: return 23;\nbreak;\ncase 9: return 23;\nbreak;\ncase 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;\nbreak;\ncase 11: return 22;\nbreak;\ncase 12: return 34;\nbreak;\ncase 13: return 33;\nbreak;\ncase 14: return 33;\nbreak;\ncase 15: return 36;\nbreak;\ncase 16: /*ignore whitespace*/\nbreak;\ncase 17: this.popState(); return 18;\nbreak;\ncase 18: this.popState(); return 18;\nbreak;\ncase 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\\\\"/g,'\"'); return 28;\nbreak;\ncase 20: return 30;\nbreak;\ncase 21: return 30;\nbreak;\ncase 22: return 29;\nbreak;\ncase 23: return 33;\nbreak;\ncase 24: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33;\nbreak;\ncase 25: return 'INVALID';\nbreak;\ncase 26: return 5;\nbreak;\n}\n};\nlexer.rules = [/^[^\\x00]*?(?=(\\{\\{))/,/^[^\\x00]+/,/^[^\\x00]{2,}?(?=(\\{\\{))/,/^\\{\\{>/,/^\\{\\{#/,/^\\{\\{\\//,/^\\{\\{\\^/,/^\\{\\{\\s*else\\b/,/^\\{\\{\\{/,/^\\{\\{&/,/^\\{\\{![\\s\\S]*?\\}\\}/,/^\\{\\{/,/^=/,/^\\.(?=[} ])/,/^\\.\\./,/^[\\/.]/,/^\\s+/,/^\\}\\}\\}/,/^\\}\\}/,/^\"(\\\\[\"]|[^\"])*\"/,/^true(?=[}\\s])/,/^false(?=[}\\s])/,/^[0-9]+(?=[}\\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\\s\\/.])/,/^\\[[^\\]]*\\]/,/^./,/^$/];\nlexer.conditions = {\"mu\":{\"rules\":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],\"inclusive\":false},\"emu\":{\"rules\":[2],\"inclusive\":false},\"INITIAL\":{\"rules\":[0,1,26],\"inclusive\":true}};return lexer;})()\nparser.lexer = lexer;\nreturn parser;\n})();\nif (typeof require !== 'undefined' && typeof exports !== 'undefined') {\nexports.parser = handlebars;\nexports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }\nexports.main = function commonjsMain(args) {\n if (!args[1])\n throw new Error('Usage: '+args[0]+' FILE');\n if (typeof process !== 'undefined') {\n var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), \"utf8\");\n } else {\n var cwd = require(\"file\").path(require(\"file\").cwd());\n var source = cwd.join(args[1]).read({charset: \"utf-8\"});\n }\n return exports.parser.parse(source);\n}\nif (typeof module !== 'undefined' && require.main === module) {\n exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require(\"system\").args);\n}\n};\n;\n// lib/handlebars/compiler/base.js\nHandlebars.Parser = handlebars;\n\nHandlebars.parse = function(string) {\n Handlebars.Parser.yy = Handlebars.AST;\n return Handlebars.Parser.parse(string);\n};\n\nHandlebars.print = function(ast) {\n return new Handlebars.PrintVisitor().accept(ast);\n};\n\nHandlebars.logger = {\n DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,\n\n // override in the host environment\n log: function(level, str) {}\n};\n\nHandlebars.log = function(level, str) { Handlebars.logger.log(level, str); };\n;\n// lib/handlebars/compiler/ast.js\n(function() {\n\n Handlebars.AST = {};\n\n Handlebars.AST.ProgramNode = function(statements, inverse) {\n this.type = \"program\";\n this.statements = statements;\n if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }\n };\n\n Handlebars.AST.MustacheNode = function(params, hash, unescaped) {\n this.type = \"mustache\";\n this.id = params[0];\n this.params = params.slice(1);\n this.hash = hash;\n this.escaped = !unescaped;\n };\n\n Handlebars.AST.PartialNode = function(id, context) {\n this.type = \"partial\";\n\n // TODO: disallow complex IDs\n\n this.id = id;\n this.context = context;\n };\n\n var verifyMatch = function(open, close) {\n if(open.original !== close.original) {\n throw new Handlebars.Exception(open.original + \" doesn't match \" + close.original);\n }\n };\n\n Handlebars.AST.BlockNode = function(mustache, program, close) {\n verifyMatch(mustache.id, close);\n this.type = \"block\";\n this.mustache = mustache;\n this.program = program;\n };\n\n Handlebars.AST.InverseNode = function(mustache, program, close) {\n verifyMatch(mustache.id, close);\n this.type = \"inverse\";\n this.mustache = mustache;\n this.program = program;\n };\n\n Handlebars.AST.ContentNode = function(string) {\n this.type = \"content\";\n this.string = string;\n };\n\n Handlebars.AST.HashNode = function(pairs) {\n this.type = \"hash\";\n this.pairs = pairs;\n };\n\n Handlebars.AST.IdNode = function(parts) {\n this.type = \"ID\";\n this.original = parts.join(\".\");\n\n var dig = [], depth = 0;\n\n for(var i=0,l=parts.length; i<l; i++) {\n var part = parts[i];\n\n if(part === \"..\") { depth++; }\n else if(part === \".\" || part === \"this\") { this.isScoped = true; }\n else { dig.push(part); }\n }\n\n this.parts = dig;\n this.string = dig.join('.');\n this.depth = depth;\n this.isSimple = (dig.length === 1) && (depth === 0);\n };\n\n Handlebars.AST.StringNode = function(string) {\n this.type = \"STRING\";\n this.string = string;\n };\n\n Handlebars.AST.IntegerNode = function(integer) {\n this.type = \"INTEGER\";\n this.integer = integer;\n };\n\n Handlebars.AST.BooleanNode = function(bool) {\n this.type = \"BOOLEAN\";\n this.bool = bool;\n };\n\n Handlebars.AST.CommentNode = function(comment) {\n this.type = \"comment\";\n this.comment = comment;\n };\n\n})();;\n// lib/handlebars/utils.js\nHandlebars.Exception = function(message) {\n var tmp = Error.prototype.constructor.apply(this, arguments);\n\n for (var p in tmp) {\n if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }\n }\n\n this.message = tmp.message;\n};\nHandlebars.Exception.prototype = new Error;\n\n// Build out our basic SafeString type\nHandlebars.SafeString = function(string) {\n this.string = string;\n};\nHandlebars.SafeString.prototype.toString = function() {\n return this.string.toString();\n};\n\n(function() {\n var escape = {\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n '\"': \"&quot;\",\n \"'\": \"&#x27;\",\n \"`\": \"&#x60;\"\n };\n\n var badChars = /&(?!\\w+;)|[<>\"'`]/g;\n var possible = /[&<>\"'`]/;\n\n var escapeChar = function(chr) {\n return escape[chr] || \"&amp;\";\n };\n\n Handlebars.Utils = {\n escapeExpression: function(string) {\n // don't escape SafeStrings, since they're already safe\n if (string instanceof Handlebars.SafeString) {\n return string.toString();\n } else if (string == null || string === false) {\n return \"\";\n }\n\n if(!possible.test(string)) { return string; }\n return string.replace(badChars, escapeChar);\n },\n\n isEmpty: function(value) {\n if (typeof value === \"undefined\") {\n return true;\n } else if (value === null) {\n return true;\n } else if (value === false) {\n return true;\n } else if(Object.prototype.toString.call(value) === \"[object Array]\" && value.length === 0) {\n return true;\n } else {\n return false;\n }\n }\n };\n})();;\n// lib/handlebars/compiler/compiler.js\nHandlebars.Compiler = function() {};\nHandlebars.JavaScriptCompiler = function() {};\n\n(function(Compiler, JavaScriptCompiler) {\n Compiler.OPCODE_MAP = {\n appendContent: 1,\n getContext: 2,\n lookupWithHelpers: 3,\n lookup: 4,\n append: 5,\n invokeMustache: 6,\n appendEscaped: 7,\n pushString: 8,\n truthyOrFallback: 9,\n functionOrFallback: 10,\n invokeProgram: 11,\n invokePartial: 12,\n push: 13,\n assignToHash: 15,\n pushStringParam: 16\n };\n\n Compiler.MULTI_PARAM_OPCODES = {\n appendContent: 1,\n getContext: 1,\n lookupWithHelpers: 2,\n lookup: 1,\n invokeMustache: 3,\n pushString: 1,\n truthyOrFallback: 1,\n functionOrFallback: 1,\n invokeProgram: 3,\n invokePartial: 1,\n push: 1,\n assignToHash: 1,\n pushStringParam: 1\n };\n\n Compiler.DISASSEMBLE_MAP = {};\n\n for(var prop in Compiler.OPCODE_MAP) {\n var value = Compiler.OPCODE_MAP[prop];\n Compiler.DISASSEMBLE_MAP[value] = prop;\n }\n\n Compiler.multiParamSize = function(code) {\n return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]];\n };\n\n Compiler.prototype = {\n compiler: Compiler,\n\n disassemble: function() {\n var opcodes = this.opcodes, opcode, nextCode;\n var out = [], str, name, value;\n\n for(var i=0, l=opcodes.length; i<l; i++) {\n opcode = opcodes[i];\n\n if(opcode === 'DECLARE') {\n name = opcodes[++i];\n value = opcodes[++i];\n out.push(\"DECLARE \" + name + \" = \" + value);\n } else {\n str = Compiler.DISASSEMBLE_MAP[opcode];\n\n var extraParams = Compiler.multiParamSize(opcode);\n var codes = [];\n\n for(var j=0; j<extraParams; j++) {\n nextCode = opcodes[++i];\n\n if(typeof nextCode === \"string\") {\n nextCode = \"\\\"\" + nextCode.replace(\"\\n\", \"\\\\n\") + \"\\\"\";\n }\n\n codes.push(nextCode);\n }\n\n str = str + \" \" + codes.join(\" \");\n\n out.push(str);\n }\n }\n\n return out.join(\"\\n\");\n },\n\n guid: 0,\n\n compile: function(program, options) {\n this.children = [];\n this.depths = {list: []};\n this.options = options;\n\n // These changes will propagate to the other compiler components\n var knownHelpers = this.options.knownHelpers;\n this.options.knownHelpers = {\n 'helperMissing': true,\n 'blockHelperMissing': true,\n 'each': true,\n 'if': true,\n 'unless': true,\n 'with': true,\n 'log': true\n };\n if (knownHelpers) {\n for (var name in knownHelpers) {\n this.options.knownHelpers[name] = knownHelpers[name];\n }\n }\n\n return this.program(program);\n },\n\n accept: function(node) {\n return this[node.type](node);\n },\n\n program: function(program) {\n var statements = program.statements, statement;\n this.opcodes = [];\n\n for(var i=0, l=statements.length; i<l; i++) {\n statement = statements[i];\n this[statement.type](statement);\n }\n this.isSimple = l === 1;\n\n this.depths.list = this.depths.list.sort(function(a, b) {\n return a - b;\n });\n\n return this;\n },\n\n compileProgram: function(program) {\n var result = new this.compiler().compile(program, this.options);\n var guid = this.guid++;\n\n this.usePartial = this.usePartial || result.usePartial;\n\n this.children[guid] = result;\n\n for(var i=0, l=result.depths.list.length; i<l; i++) {\n depth = result.depths.list[i];\n\n if(depth < 2) { continue; }\n else { this.addDepth(depth - 1); }\n }\n\n return guid;\n },\n\n block: function(block) {\n var mustache = block.mustache;\n var depth, child, inverse, inverseGuid;\n\n var params = this.setupStackForMustache(mustache);\n\n var programGuid = this.compileProgram(block.program);\n\n if(block.program.inverse) {\n inverseGuid = this.compileProgram(block.program.inverse);\n this.declare('inverse', inverseGuid);\n }\n\n this.opcode('invokeProgram', programGuid, params.length, !!mustache.hash);\n this.declare('inverse', null);\n this.opcode('append');\n },\n\n inverse: function(block) {\n var params = this.setupStackForMustache(block.mustache);\n\n var programGuid = this.compileProgram(block.program);\n\n this.declare('inverse', programGuid);\n\n this.opcode('invokeProgram', null, params.length, !!block.mustache.hash);\n this.declare('inverse', null);\n this.opcode('append');\n },\n\n hash: function(hash) {\n var pairs = hash.pairs, pair, val;\n\n this.opcode('push', '{}');\n\n for(var i=0, l=pairs.length; i<l; i++) {\n pair = pairs[i];\n val = pair[1];\n\n this.accept(val);\n this.opcode('assignToHash', pair[0]);\n }\n },\n\n partial: function(partial) {\n var id = partial.id;\n this.usePartial = true;\n\n if(partial.context) {\n this.ID(partial.context);\n } else {\n this.opcode('push', 'depth0');\n }\n\n this.opcode('invokePartial', id.original);\n this.opcode('append');\n },\n\n content: function(content) {\n this.opcode('appendContent', content.string);\n },\n\n mustache: function(mustache) {\n var params = this.setupStackForMustache(mustache);\n\n this.opcode('invokeMustache', params.length, mustache.id.original, !!mustache.hash);\n\n if(mustache.escaped && !this.options.noEscape) {\n this.opcode('appendEscaped');\n } else {\n this.opcode('append');\n }\n },\n\n ID: function(id) {\n this.addDepth(id.depth);\n\n this.opcode('getContext', id.depth);\n\n this.opcode('lookupWithHelpers', id.parts[0] || null, id.isScoped || false);\n\n for(var i=1, l=id.parts.length; i<l; i++) {\n this.opcode('lookup', id.parts[i]);\n }\n },\n\n STRING: function(string) {\n this.opcode('pushString', string.string);\n },\n\n INTEGER: function(integer) {\n this.opcode('push', integer.integer);\n },\n\n BOOLEAN: function(bool) {\n this.opcode('push', bool.bool);\n },\n\n comment: function() {},\n\n // HELPERS\n pushParams: function(params) {\n var i = params.length, param;\n\n while(i--) {\n param = params[i];\n\n if(this.options.stringParams) {\n if(param.depth) {\n this.addDepth(param.depth);\n }\n\n this.opcode('getContext', param.depth || 0);\n this.opcode('pushStringParam', param.string);\n } else {\n this[param.type](param);\n }\n }\n },\n\n opcode: function(name, val1, val2, val3) {\n this.opcodes.push(Compiler.OPCODE_MAP[name]);\n if(val1 !== undefined) { this.opcodes.push(val1); }\n if(val2 !== undefined) { this.opcodes.push(val2); }\n if(val3 !== undefined) { this.opcodes.push(val3); }\n },\n\n declare: function(name, value) {\n this.opcodes.push('DECLARE');\n this.opcodes.push(name);\n this.opcodes.push(value);\n },\n\n addDepth: function(depth) {\n if(depth === 0) { return; }\n\n if(!this.depths[depth]) {\n this.depths[depth] = true;\n this.depths.list.push(depth);\n }\n },\n\n setupStackForMustache: function(mustache) {\n var params = mustache.params;\n\n this.pushParams(params);\n\n if(mustache.hash) {\n this.hash(mustache.hash);\n }\n\n this.ID(mustache.id);\n\n return params;\n }\n };\n\n JavaScriptCompiler.prototype = {\n // PUBLIC API: You can override these methods in a subclass to provide\n // alternative compiled forms for name lookup and buffering semantics\n nameLookup: function(parent, name, type) {\n\t\t\tif (/^[0-9]+$/.test(name)) {\n return parent + \"[\" + name + \"]\";\n } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {\n\t \treturn parent + \".\" + name;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn parent + \"['\" + name + \"']\";\n }\n },\n\n appendToBuffer: function(string) {\n if (this.environment.isSimple) {\n return \"return \" + string + \";\";\n } else {\n return \"buffer += \" + string + \";\";\n }\n },\n\n initializeBuffer: function() {\n return this.quotedString(\"\");\n },\n\n namespace: \"Handlebars\",\n // END PUBLIC API\n\n compile: function(environment, options, context, asObject) {\n this.environment = environment;\n this.options = options || {};\n\n this.name = this.environment.name;\n this.isChild = !!context;\n this.context = context || {\n programs: [],\n aliases: { self: 'this' },\n registers: {list: []}\n };\n\n this.preamble();\n\n this.stackSlot = 0;\n this.stackVars = [];\n\n this.compileChildren(environment, options);\n\n var opcodes = environment.opcodes, opcode;\n\n this.i = 0;\n\n for(l=opcodes.length; this.i<l; this.i++) {\n opcode = this.nextOpcode(0);\n\n if(opcode[0] === 'DECLARE') {\n this.i = this.i + 2;\n this[opcode[1]] = opcode[2];\n } else {\n this.i = this.i + opcode[1].length;\n this[opcode[0]].apply(this, opcode[1]);\n }\n }\n\n return this.createFunctionContext(asObject);\n },\n\n nextOpcode: function(n) {\n var opcodes = this.environment.opcodes, opcode = opcodes[this.i + n], name, val;\n var extraParams, codes;\n\n if(opcode === 'DECLARE') {\n name = opcodes[this.i + 1];\n val = opcodes[this.i + 2];\n return ['DECLARE', name, val];\n } else {\n name = Compiler.DISASSEMBLE_MAP[opcode];\n\n extraParams = Compiler.multiParamSize(opcode);\n codes = [];\n\n for(var j=0; j<extraParams; j++) {\n codes.push(opcodes[this.i + j + 1 + n]);\n }\n\n return [name, codes];\n }\n },\n\n eat: function(opcode) {\n this.i = this.i + opcode.length;\n },\n\n preamble: function() {\n var out = [];\n\n // this register will disambiguate helper lookup from finding a function in\n // a context. This is necessary for mustache compatibility, which requires\n // that context functions in blocks are evaluated by blockHelperMissing, and\n // then proceed as if the resulting value was provided to blockHelperMissing.\n this.useRegister('foundHelper');\n\n if (!this.isChild) {\n var namespace = this.namespace;\n var copies = \"helpers = helpers || \" + namespace + \".helpers;\";\n if(this.environment.usePartial) { copies = copies + \" partials = partials || \" + namespace + \".partials;\"; }\n out.push(copies);\n } else {\n out.push('');\n }\n\n if (!this.environment.isSimple) {\n out.push(\", buffer = \" + this.initializeBuffer());\n } else {\n out.push(\"\");\n }\n\n // track the last context pushed into place to allow skipping the\n // getContext opcode when it would be a noop\n this.lastContext = 0;\n this.source = out;\n },\n\n createFunctionContext: function(asObject) {\n var locals = this.stackVars;\n if (!this.isChild) {\n locals = locals.concat(this.context.registers.list);\n }\n\n if(locals.length > 0) {\n this.source[1] = this.source[1] + \", \" + locals.join(\", \");\n }\n\n // Generate minimizer alias mappings\n if (!this.isChild) {\n var aliases = []\n for (var alias in this.context.aliases) {\n this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];\n }\n }\n\n if (this.source[1]) {\n this.source[1] = \"var \" + this.source[1].substring(2) + \";\";\n }\n\n // Merge children\n if (!this.isChild) {\n this.source[1] += '\\n' + this.context.programs.join('\\n') + '\\n';\n }\n\n if (!this.environment.isSimple) {\n this.source.push(\"return buffer;\");\n }\n\n var params = this.isChild ? [\"depth0\", \"data\"] : [\"Handlebars\", \"depth0\", \"helpers\", \"partials\", \"data\"];\n\n for(var i=0, l=this.environment.depths.list.length; i<l; i++) {\n params.push(\"depth\" + this.environment.depths.list[i]);\n }\n\n if (asObject) {\n params.push(this.source.join(\"\\n \"));\n\n return Function.apply(this, params);\n } else {\n var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\\n ' + this.source.join(\"\\n \") + '}';\n Handlebars.log(Handlebars.logger.DEBUG, functionSource + \"\\n\\n\");\n return functionSource;\n }\n },\n\n appendContent: function(content) {\n this.source.push(this.appendToBuffer(this.quotedString(content)));\n },\n\n append: function() {\n var local = this.popStack();\n this.source.push(\"if(\" + local + \" || \" + local + \" === 0) { \" + this.appendToBuffer(local) + \" }\");\n if (this.environment.isSimple) {\n this.source.push(\"else { \" + this.appendToBuffer(\"''\") + \" }\");\n }\n },\n\n appendEscaped: function() {\n var opcode = this.nextOpcode(1), extra = \"\";\n this.context.aliases.escapeExpression = 'this.escapeExpression';\n\n if(opcode[0] === 'appendContent') {\n extra = \" + \" + this.quotedString(opcode[1][0]);\n this.eat(opcode);\n }\n\n this.source.push(this.appendToBuffer(\"escapeExpression(\" + this.popStack() + \")\" + extra));\n },\n\n getContext: function(depth) {\n if(this.lastContext !== depth) {\n this.lastContext = depth;\n }\n },\n\n lookupWithHelpers: function(name, isScoped) {\n if(name) {\n var topStack = this.nextStack();\n\n this.usingKnownHelper = false;\n\n var toPush;\n if (!isScoped && this.options.knownHelpers[name]) {\n toPush = topStack + \" = \" + this.nameLookup('helpers', name, 'helper');\n this.usingKnownHelper = true;\n } else if (isScoped || this.options.knownHelpersOnly) {\n toPush = topStack + \" = \" + this.nameLookup('depth' + this.lastContext, name, 'context');\n } else {\n this.register('foundHelper', this.nameLookup('helpers', name, 'helper'));\n toPush = topStack + \" = foundHelper || \" + this.nameLookup('depth' + this.lastContext, name, 'context');\n }\n\n toPush += ';';\n this.source.push(toPush);\n } else {\n this.pushStack('depth' + this.lastContext);\n }\n },\n\n lookup: function(name) {\n var topStack = this.topStack();\n this.source.push(topStack + \" = (\" + topStack + \" === null || \" + topStack + \" === undefined || \" + topStack + \" === false ? \" +\n \t\t\t\ttopStack + \" : \" + this.nameLookup(topStack, name, 'context') + \");\");\n },\n\n pushStringParam: function(string) {\n this.pushStack('depth' + this.lastContext);\n this.pushString(string);\n },\n\n pushString: function(string) {\n this.pushStack(this.quotedString(string));\n },\n\n push: function(name) {\n this.pushStack(name);\n },\n\n invokeMustache: function(paramSize, original, hasHash) {\n this.populateParams(paramSize, this.quotedString(original), \"{}\", null, hasHash, function(nextStack, helperMissingString, id) {\n if (!this.usingKnownHelper) {\n this.context.aliases.helperMissing = 'helpers.helperMissing';\n this.context.aliases.undef = 'void 0';\n this.source.push(\"else if(\" + id + \"=== undef) { \" + nextStack + \" = helperMissing.call(\" + helperMissingString + \"); }\");\n if (nextStack !== id) {\n this.source.push(\"else { \" + nextStack + \" = \" + id + \"; }\");\n }\n }\n });\n },\n\n invokeProgram: function(guid, paramSize, hasHash) {\n var inverse = this.programExpression(this.inverse);\n var mainProgram = this.programExpression(guid);\n\n this.populateParams(paramSize, null, mainProgram, inverse, hasHash, function(nextStack, helperMissingString, id) {\n if (!this.usingKnownHelper) {\n this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';\n this.source.push(\"else { \" + nextStack + \" = blockHelperMissing.call(\" + helperMissingString + \"); }\");\n }\n });\n },\n\n populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) {\n var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data;\n var id = this.popStack(), nextStack;\n var params = [], param, stringParam, stringOptions;\n\n if (needsRegister) {\n this.register('tmp1', program);\n stringOptions = 'tmp1';\n } else {\n stringOptions = '{ hash: {} }';\n }\n\n if (needsRegister) {\n var hash = (hasHash ? this.popStack() : '{}');\n this.source.push('tmp1.hash = ' + hash + ';');\n }\n\n if(this.options.stringParams) {\n this.source.push('tmp1.contexts = [];');\n }\n\n for(var i=0; i<paramSize; i++) {\n param = this.popStack();\n params.push(param);\n\n if(this.options.stringParams) {\n this.source.push('tmp1.contexts.push(' + this.popStack() + ');');\n }\n }\n\n if(inverse) {\n this.source.push('tmp1.fn = tmp1;');\n this.source.push('tmp1.inverse = ' + inverse + ';');\n }\n\n if(this.options.data) {\n this.source.push('tmp1.data = data;');\n }\n\n params.push(stringOptions);\n\n this.populateCall(params, id, helperId || id, fn, program !== '{}');\n },\n\n populateCall: function(params, id, helperId, fn, program) {\n var paramString = [\"depth0\"].concat(params).join(\", \");\n var helperMissingString = [\"depth0\"].concat(helperId).concat(params).join(\", \");\n\n var nextStack = this.nextStack();\n\n if (this.usingKnownHelper) {\n this.source.push(nextStack + \" = \" + id + \".call(\" + paramString + \");\");\n } else {\n this.context.aliases.functionType = '\"function\"';\n var condition = program ? \"foundHelper && \" : \"\"\n this.source.push(\"if(\" + condition + \"typeof \" + id + \" === functionType) { \" + nextStack + \" = \" + id + \".call(\" + paramString + \"); }\");\n }\n fn.call(this, nextStack, helperMissingString, id);\n this.usingKnownHelper = false;\n },\n\n invokePartial: function(context) {\n params = [this.nameLookup('partials', context, 'partial'), \"'\" + context + \"'\", this.popStack(), \"helpers\", \"partials\"];\n\n if (this.options.data) {\n params.push(\"data\");\n }\n\n this.pushStack(\"self.invokePartial(\" + params.join(\", \") + \");\");\n },\n\n assignToHash: function(key) {\n var value = this.popStack();\n var hash = this.topStack();\n\n this.source.push(hash + \"['\" + key + \"'] = \" + value + \";\");\n },\n\n // HELPERS\n\n compiler: JavaScriptCompiler,\n\n compileChildren: function(environment, options) {\n var children = environment.children, child, compiler;\n\n for(var i=0, l=children.length; i<l; i++) {\n child = children[i];\n compiler = new this.compiler();\n\n this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children\n var index = this.context.programs.length;\n child.index = index;\n child.name = 'program' + index;\n this.context.programs[index] = compiler.compile(child, options, this.context);\n }\n },\n\n programExpression: function(guid) {\n if(guid == null) { return \"self.noop\"; }\n\n var child = this.environment.children[guid],\n depths = child.depths.list;\n var programParams = [child.index, child.name, \"data\"];\n\n for(var i=0, l = depths.length; i<l; i++) {\n depth = depths[i];\n\n if(depth === 1) { programParams.push(\"depth0\"); }\n else { programParams.push(\"depth\" + (depth - 1)); }\n }\n\n if(depths.length === 0) {\n return \"self.program(\" + programParams.join(\", \") + \")\";\n } else {\n programParams.shift();\n return \"self.programWithDepth(\" + programParams.join(\", \") + \")\";\n }\n },\n\n register: function(name, val) {\n this.useRegister(name);\n this.source.push(name + \" = \" + val + \";\");\n },\n\n useRegister: function(name) {\n if(!this.context.registers[name]) {\n this.context.registers[name] = true;\n this.context.registers.list.push(name);\n }\n },\n\n pushStack: function(item) {\n this.source.push(this.nextStack() + \" = \" + item + \";\");\n return \"stack\" + this.stackSlot;\n },\n\n nextStack: function() {\n this.stackSlot++;\n if(this.stackSlot > this.stackVars.length) { this.stackVars.push(\"stack\" + this.stackSlot); }\n return \"stack\" + this.stackSlot;\n },\n\n popStack: function() {\n return \"stack\" + this.stackSlot--;\n },\n\n topStack: function() {\n return \"stack\" + this.stackSlot;\n },\n\n quotedString: function(str) {\n return '\"' + str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r') + '\"';\n }\n };\n\n var reservedWords = (\n \"break else new var\" +\n \" case finally return void\" +\n \" catch for switch while\" +\n \" continue function this with\" +\n \" default if throw\" +\n \" delete in try\" +\n \" do instanceof typeof\" +\n \" abstract enum int short\" +\n \" boolean export interface static\" +\n \" byte extends long super\" +\n \" char final native synchronized\" +\n \" class float package throws\" +\n \" const goto private transient\" +\n \" debugger implements protected volatile\" +\n \" double import public let yield\"\n ).split(\" \");\n\n var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};\n\n for(var i=0, l=reservedWords.length; i<l; i++) {\n compilerWords[reservedWords[i]] = true;\n }\n\n\tJavaScriptCompiler.isValidJavaScriptVariableName = function(name) {\n\t\tif(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);\n\nHandlebars.precompile = function(string, options) {\n options = options || {};\n\n var ast = Handlebars.parse(string);\n var environment = new Handlebars.Compiler().compile(ast, options);\n return new Handlebars.JavaScriptCompiler().compile(environment, options);\n};\n\nHandlebars.compile = function(string, options) {\n options = options || {};\n\n var compiled;\n function compile() {\n var ast = Handlebars.parse(string);\n var environment = new Handlebars.Compiler().compile(ast, options);\n var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);\n return Handlebars.template(templateSpec);\n }\n\n // Template is only compiled on first use and cached after that point.\n return function(context, options) {\n if (!compiled) {\n compiled = compile();\n }\n return compiled.call(this, context, options);\n };\n};\n;\n// lib/handlebars/runtime.js\nHandlebars.VM = {\n template: function(templateSpec) {\n // Just add water\n var container = {\n escapeExpression: Handlebars.Utils.escapeExpression,\n invokePartial: Handlebars.VM.invokePartial,\n programs: [],\n program: function(i, fn, data) {\n var programWrapper = this.programs[i];\n if(data) {\n return Handlebars.VM.program(fn, data);\n } else if(programWrapper) {\n return programWrapper;\n } else {\n programWrapper = this.programs[i] = Handlebars.VM.program(fn);\n return programWrapper;\n }\n },\n programWithDepth: Handlebars.VM.programWithDepth,\n noop: Handlebars.VM.noop\n };\n\n return function(context, options) {\n options = options || {};\n return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);\n };\n },\n\n programWithDepth: function(fn, data, $depth) {\n var args = Array.prototype.slice.call(arguments, 2);\n\n return function(context, options) {\n options = options || {};\n\n return fn.apply(this, [context, options.data || data].concat(args));\n };\n },\n program: function(fn, data) {\n return function(context, options) {\n options = options || {};\n\n return fn(context, options.data || data);\n };\n },\n noop: function() { return \"\"; },\n invokePartial: function(partial, name, context, helpers, partials, data) {\n options = { helpers: helpers, partials: partials, data: data };\n\n if(partial === undefined) {\n throw new Handlebars.Exception(\"The partial \" + name + \" could not be found\");\n } else if(partial instanceof Function) {\n return partial(context, options);\n } else if (!Handlebars.compile) {\n throw new Handlebars.Exception(\"The partial \" + name + \" could not be compiled when running in runtime-only mode\");\n } else {\n partials[name] = Handlebars.compile(partial);\n return partials[name](context, options);\n }\n }\n};\n\nHandlebars.template = Handlebars.VM.template;\n;\n\n})();\n//@ sourceURL=handlebars");minispade.register('metamorph', "(function() {// ==========================================================================\n// Project: metamorph\n// Copyright: ©2011 My Company Inc. All rights reserved.\n// ==========================================================================\n\n(function(window) {\n\n var K = function(){},\n guid = 0,\n document = window.document,\n\n // Feature-detect the W3C range API, the extended check is for IE9 which only partially supports ranges\n supportsRange = ('createRange' in document) && (typeof Range !== 'undefined') && Range.prototype.createContextualFragment,\n\n // Internet Explorer prior to 9 does not allow setting innerHTML if the first element\n // is a \"zero-scope\" element. This problem can be worked around by making\n // the first node an invisible text node. We, like Modernizr, use &shy;\n needsShy = (function(){\n var testEl = document.createElement('div');\n testEl.innerHTML = \"<div></div>\";\n testEl.firstChild.innerHTML = \"<script></script>\";\n return testEl.firstChild.innerHTML === '';\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 return \"<script id='\" + this.start + \"' type='text/x-placeholder'></script>\";\n };\n\n endTagFunc = function() {\n return \"<script id='\" + this.end + \"' type='text/x-placeholder'></script>\";\n };\n\n // If we have the W3C range API, this process is relatively straight forward.\n if (supportsRange) {\n\n // Get a range for the current morph. Optionally include the starting and\n // ending placeholders.\n rangeFor = function(morph, outerToo) {\n var range = document.createRange();\n var before = document.getElementById(morph.start);\n var after = document.getElementById(morph.end);\n\n if (outerToo) {\n range.setStartBefore(before);\n range.setEndAfter(after);\n } else {\n range.setStartAfter(before);\n range.setEndBefore(after);\n }\n\n return range;\n };\n\n htmlFunc = function(html, outerToo) {\n // get a range for the current metamorph object\n var range = rangeFor(this, outerToo);\n\n // delete the contents of the range, which will be the\n // nodes between the starting and ending placeholder.\n range.deleteContents();\n\n // create a new document fragment for the HTML\n var fragment = range.createContextualFragment(html);\n\n // insert the fragment into the range\n range.insertNode(fragment);\n };\n\n removeFunc = function() {\n // get a range for the current metamorph object including\n // the starting and ending placeholders.\n var range = rangeFor(this, true);\n\n // delete the entire range.\n range.deleteContents();\n };\n\n appendToFunc = function(node) {\n var range = document.createRange();\n range.setStart(node);\n range.collapse(false);\n var frag = range.createContextualFragment(this.outerHTML());\n node.appendChild(frag);\n };\n\n afterFunc = function(html) {\n var range = document.createRange();\n var after = document.getElementById(this.end);\n\n range.setStartAfter(after);\n range.setEndAfter(after);\n\n var fragment = range.createContextualFragment(html);\n range.insertNode(fragment);\n };\n\n prependFunc = function(html) {\n var range = document.createRange();\n var start = document.getElementById(this.start);\n\n range.setStartAfter(start);\n range.setEndAfter(start);\n\n var fragment = range.createContextualFragment(html);\n range.insertNode(fragment);\n };\n\n } else {\n /**\n * This code is mostly taken from jQuery, with one exception. In jQuery's case, we\n * have some HTML and we need to figure out how to convert it into some nodes.\n *\n * In this case, jQuery needs to scan the HTML looking for an opening tag and use\n * that as the key for the wrap map. In our case, we know the parent node, and\n * can use its type as the key for the wrap map.\n **/\n var wrapMap = {\n select: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n fieldset: [ 1, \"<fieldset>\", \"</fieldset>\" ],\n table: [ 1, \"<table>\", \"</table>\" ],\n tbody: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n tr: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n colgroup: [ 2, \"<table><tbody></tbody><colgroup>\", \"</colgroup></table>\" ],\n map: [ 1, \"<map>\", \"</map>\" ],\n _default: [ 0, \"\", \"\" ]\n };\n\n /**\n * Given a parent node and some HTML, generate a set of nodes. Return the first\n * node, which will allow us to traverse the rest using nextSibling.\n *\n * We need to do this because innerHTML in IE does not really parse the nodes.\n **/\n var firstNodeFor = function(parentNode, html) {\n var arr = wrapMap[parentNode.tagName.toLowerCase()] || wrapMap._default;\n var depth = arr[0], start = arr[1], end = arr[2];\n\n if (needsShy) { html = '&shy;'+html; }\n\n var element = document.createElement('div');\n element.innerHTML = start + html + end;\n\n for (var i=0; i<=depth; i++) {\n element = element.firstChild;\n }\n\n // Look for &shy; to remove it.\n if (needsShy) {\n var shyElement = element;\n\n // Sometimes we get nameless elements with the shy inside\n while (shyElement.nodeType === 1 && !shyElement.nodeName) {\n shyElement = shyElement.firstChild;\n }\n\n // At this point it's the actual unicode character.\n if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === \"\\u00AD\") {\n shyElement.nodeValue = shyElement.nodeValue.slice(1);\n }\n }\n\n return element;\n };\n\n /**\n * In some cases, Internet Explorer can create an anonymous node in\n * the hierarchy with no tagName. You can create this scenario via:\n *\n * div = document.createElement(\"div\");\n * div.innerHTML = \"<table>&shy<script></script><tr><td>hi</td></tr></table>\";\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 <tr>. 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 = \"<table><script id='first'></script><tr><td>hi</td></tr><script id='last'></script></table>\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 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 // 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\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 window.Metamorph = Metamorph;\n})(this);\n\n\n})();\n//@ sourceURL=metamorph");
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,11 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-04-20 00:00:00.000000000 Z
15
+ date: 2012-05-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: execjs
19
- requirement: &70283282286380 !ruby/object:Gem::Requirement
19
+ requirement: !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
@@ -24,10 +24,15 @@ dependencies:
24
24
  version: '1.2'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70283282286380
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '1.2'
28
33
  - !ruby/object:Gem::Dependency
29
34
  name: railties
30
- requirement: &70283282285860 !ruby/object:Gem::Requirement
35
+ requirement: !ruby/object:Gem::Requirement
31
36
  none: false
32
37
  requirements:
33
38
  - - ~>
@@ -35,10 +40,31 @@ dependencies:
35
40
  version: '3.1'
36
41
  type: :runtime
37
42
  prerelease: false
38
- version_requirements: *70283282285860
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: '3.1'
49
+ - !ruby/object:Gem::Dependency
50
+ name: active_model_serializers
51
+ requirement: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
39
65
  - !ruby/object:Gem::Dependency
40
66
  name: rails
41
- requirement: &70283282285380 !ruby/object:Gem::Requirement
67
+ requirement: !ruby/object:Gem::Requirement
42
68
  none: false
43
69
  requirements:
44
70
  - - ~>
@@ -46,7 +72,12 @@ dependencies:
46
72
  version: '3.1'
47
73
  type: :development
48
74
  prerelease: false
49
- version_requirements: *70283282285380
75
+ version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ~>
79
+ - !ruby/object:Gem::Version
80
+ version: '3.1'
50
81
  description:
51
82
  email:
52
83
  - me@keithpitt.com
@@ -56,6 +87,7 @@ extensions: []
56
87
  extra_rdoc_files: []
57
88
  files:
58
89
  - README.md
90
+ - LICENSE
59
91
  - lib/ember/filters/haml.rb
60
92
  - lib/ember/filters/slim.rb
61
93
  - lib/ember/handlebars/assets/ember-precompiler.js
@@ -72,16 +104,22 @@ files:
72
104
  - lib/generators/ember/generator_helpers.rb
73
105
  - lib/generators/ember/install_generator.rb
74
106
  - lib/generators/ember/model_generator.rb
107
+ - lib/generators/ember/view_generator.rb
75
108
  - lib/generators/templates/app.js
76
109
  - lib/generators/templates/array_controller.js
77
110
  - lib/generators/templates/controller.js
78
111
  - lib/generators/templates/model.js
79
- - vendor/assets/javascripts/development/ember-runtime.js
80
- - vendor/assets/javascripts/development/ember.js
81
- - vendor/assets/javascripts/ember-dev.js
82
- - vendor/assets/javascripts/ember-runtime-dev.js
83
- - vendor/assets/javascripts/production/ember-runtime.js
84
- - vendor/assets/javascripts/production/ember.js
112
+ - lib/generators/templates/states.js
113
+ - lib/generators/templates/view.handlebars
114
+ - lib/generators/templates/view.js
115
+ - vendor/ember/development/ember-data.js
116
+ - vendor/ember/development/ember-runtime.js
117
+ - vendor/ember/development/ember.js
118
+ - vendor/ember/production/ember-data.js
119
+ - vendor/ember/production/ember-runtime.js
120
+ - vendor/ember/production/ember.js
121
+ - vendor/ember/spade/ember-data.js
122
+ - vendor/ember/spade/ember.js
85
123
  homepage: https://github.com/emberjs/ember-rails
86
124
  licenses: []
87
125
  post_install_message:
@@ -96,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
134
  version: '0'
97
135
  segments:
98
136
  - 0
99
- hash: 1318040576675237297
137
+ hash: -4293884543779825106
100
138
  required_rubygems_version: !ruby/object:Gem::Requirement
101
139
  none: false
102
140
  requirements:
@@ -105,10 +143,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
143
  version: '0'
106
144
  segments:
107
145
  - 0
108
- hash: 1318040576675237297
146
+ hash: -4293884543779825106
109
147
  requirements: []
110
148
  rubyforge_project:
111
- rubygems_version: 1.8.11
149
+ rubygems_version: 1.8.23
112
150
  signing_key:
113
151
  specification_version: 3
114
152
  summary: Ember for Rails 3.1+
@@ -1,3 +0,0 @@
1
- //= require development/ember
2
-
3
- ember_deprecate("You should require `ember` instead of `ember-dev`");
@@ -1,3 +0,0 @@
1
- //= require development/ember-runtime
2
-
3
- ember_deprecate("You should require `ember-runtime` instead of `ember-runtime-dev`");