diff --git a/CHANGELOG.rst b/CHANGELOG.rst index aa5a7da..91d18f8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,9 @@ Changelog Current ------- -- nothing yet +- Upgraded to Ember.js 1.0.0-RC.6.1 +- Upgraded to Ember Data 0.13-78-g9602df4 +- Downgraded to Handlebars to ensure compatibility until release 0.3.0 (2013-06-07) diff --git a/README.rst b/README.rst index 6fa8a86..df8268c 100644 --- a/README.rst +++ b/README.rst @@ -66,9 +66,9 @@ JS Libraries templates tags ============================= =============================================================================== Tag JS Library ============================= =============================================================================== -``{% handlebars_js %}`` `Handlebars.js`_ (1.0.0) -``{% ember_js %}`` `Ember.js`_ (1.0.0-RC.5) -``{% ember_data_js %}`` `Ember Data`_ (0.13) +``{% handlebars_js %}`` `Handlebars.js`_ (1.0.0-rc.4) +``{% ember_js %}`` `Ember.js`_ (1.0.0-RC.6.1) +``{% ember_data_js %}`` `Ember Data`_ (0.13-78-g9602df4) ``{% tastypie_adapter_js %}`` `Ember Data Tastypie Adapter`_ (9db4b9a) ``{% ember_full_js %}`` Ember.js + Handlebars.js + jQuery (optionnal) ``{% emberpie_js %}`` Ember.js + Handlebars.js + jQuery (optionnal) + Ember Data + Tastypie Adapter diff --git a/doc/templatetags.rst b/doc/templatetags.rst index b59ff47..5b69f1d 100644 --- a/doc/templatetags.rst +++ b/doc/templatetags.rst @@ -26,9 +26,9 @@ JS Libraries templates tags ============================= =============================================================================== Tag JS Library ============================= =============================================================================== -``{% handlebars_js %}`` `Handlebars.js`_ (1.0.0) -``{% ember_js %}`` `Ember.js`_ (1.0.0-RC.5) -``{% ember_data_js %}`` `Ember Data`_ (0.13) +``{% handlebars_js %}`` `Handlebars.js`_ (1.0.0-rc.4) +``{% ember_js %}`` `Ember.js`_ (1.0.0-RC.6.1) +``{% ember_data_js %}`` `Ember Data`_ (0.13-78-g9602df4) ``{% tastypie_adapter_js %}`` `Ember Data Tastypie Adapter`_ (9db4b9a) ``{% ember_full_js %}`` Ember.js + Handlebars.js + jQuery (optionnal) ``{% emberpie_js %}`` Ember.js + Handlebars.js + jQuery (optionnal) + Ember Data + Tastypie Adapter diff --git a/ember/static/js/libs/ember-data.js b/ember/static/js/libs/ember-data.js index 6960c9a..7aa8a6d 100644 --- a/ember/static/js/libs/ember-data.js +++ b/ember/static/js/libs/ember-data.js @@ -1,4 +1,5 @@ -// Last commit: 3981a7c (2013-05-28 05:00:14 -0700) +// Version: v0.13-78-g9602df4 +// Last commit: 9602df4 (2013-07-29 17:00:59 -0700) (function() { @@ -15,11 +16,18 @@ var define, requireModule; if (seen[name]) { return seen[name]; } seen[name] = {}; - var mod = registry[name], - deps = mod.deps, - callback = mod.callback, - reified = [], - exports; + var mod, deps, callback, reified , exports; + + mod = registry[name]; + + if (!mod) { + throw new Error("Module '" + name + "' not found."); + } + + deps = mod.deps; + callback = mod.callback; + reified = []; + exports; for (var i=0, l=deps.length; i 1) { Ember.assert('materializeHasMany expects tuples, references or opaque token, not ' + tuplesOrReferencesOrOpaque[0], tuplesOrReferencesOrOpaque[0].hasOwnProperty('id') && tuplesOrReferencesOrOpaque[0].type); } + + if (tuplesOrReferencesOrOpaque && tuplesOrReferencesOrOpaqueType !== 'string' && tuplesOrReferencesOrOpaque.length > 1) { + Ember.assert('materializeHasMany expects tuples, references or opaque token, not ' + tuplesOrReferencesOrOpaque[0], tuplesOrReferencesOrOpaque[0].hasOwnProperty('id') && tuplesOrReferencesOrOpaque[0].type); + } + if( tuplesOrReferencesOrOpaqueType === "string" ) { this._data.hasMany[name] = tuplesOrReferencesOrOpaque; } else { @@ -4487,8 +4517,6 @@ DS.RelationshipChange.prototype = { /** @private */ getByReference: function(reference) { - var store = this.store; - // return null or undefined if the original reference was null or undefined if (!reference) { return reference; } @@ -4627,9 +4655,9 @@ DS.RelationshipChangeRemove.prototype.sync = function() { secondRecord.suspendRelationshipObservers(function(){ set(secondRecord, secondRecordName, null); }); - } - else if(this.secondRecordKind === "hasMany"){ - secondRecord.suspendRelationshipObservers(function(){ + } + else if(this.secondRecordKind === "hasMany"){ + secondRecord.suspendRelationshipObservers(function(){ get(secondRecord, secondRecordName).removeObject(firstRecord); }); } @@ -4796,8 +4824,7 @@ DS.hasMany = function(type, options) { }; function clearUnmaterializedHasMany(record, relationship) { - var store = get(record, 'store'), - data = get(record, 'data').hasMany; + var data = get(record, 'data').hasMany; var references = data[relationship.key]; @@ -5359,7 +5386,7 @@ DS.RecordArrayManager = Ember.Object.extend({ var reference = get(record, '_reference'); var recordArrays = reference.recordArrays || []; - recordArrays.forEach(function(array) { + forEach(recordArrays, function(array) { array.removeReference(reference); }); }, @@ -5417,7 +5444,7 @@ DS.RecordArrayManager = Ember.Object.extend({ store: this.store }); - references.forEach(function(reference) { + forEach(references, function(reference) { var arrays = this.recordArraysForReference(reference); arrays.add(manyArray); }, this); @@ -5861,11 +5888,14 @@ DS.Serializer = Ember.Object.extend({ this is the opportunity for the serializer to, for example, convert numerical IDs back into number form. + Null or undefined ids will resolve to a null value. + @param {String} id the id from the record @returns {any} the serialized representation of the id */ serializeId: function(id) { - if (isNaN(id)) { return id; } + if(Ember.isEmpty(id)) { return null; } + if(isNaN(+id)) { return id; } return +id; }, @@ -6210,7 +6240,7 @@ DS.Serializer = Ember.Object.extend({ deserializeValue: function(value, attributeType) { var transform = this.transforms ? this.transforms[attributeType] : null; - Ember.assert("You tried to use a attribute type (" + attributeType + ") that has not been registered", transform); + Ember.assert("You tried to use an attribute type (" + attributeType + ") that has not been registered", transform); return transform.deserialize(value); }, @@ -6231,21 +6261,21 @@ DS.Serializer = Ember.Object.extend({ record.materializeAttribute(attributeName, value); }, - materializeRelationships: function(record, hash, prematerialized) { + materializeRelationships: function(record, serialized, prematerialized) { record.eachRelationship(function(name, relationship) { if (relationship.kind === 'hasMany') { if (prematerialized && prematerialized.hasOwnProperty(name)) { var tuplesOrReferencesOrOpaque = this._convertPrematerializedHasMany(relationship.type, prematerialized[name]); record.materializeHasMany(name, tuplesOrReferencesOrOpaque); } else { - this.materializeHasMany(name, record, hash, relationship, prematerialized); + this.materializeHasMany(name, record, serialized, relationship, prematerialized); } } else if (relationship.kind === 'belongsTo') { if (prematerialized && prematerialized.hasOwnProperty(name)) { var tupleOrReference = this._convertTuple(relationship.type, prematerialized[name]); record.materializeBelongsTo(name, tupleOrReference); } else { - this.materializeBelongsTo(name, record, hash, relationship, prematerialized); + this.materializeBelongsTo(name, record, serialized, relationship, prematerialized); } } }, this); @@ -6779,7 +6809,7 @@ var isNone = Ember.isNone, isEmpty = Ember.isEmpty; */ /** - DS.Transforms is a hash of transforms used by DS.Serializer. + DS.JSONTransforms is a hash of transforms used by DS.Serializer. @class JSONTransforms @static @@ -7018,7 +7048,7 @@ DS.JSONSerializer = DS.Serializer.extend({ if (relationship.options && relationship.options.polymorphic && !Ember.isNone(id)) { this.addBelongsToPolymorphic(hash, key, id, child.constructor); } else { - hash[key] = id === undefined ? null : this.serializeId(id); + hash[key] = this.serializeId(id); } } }, @@ -7086,6 +7116,8 @@ DS.JSONSerializer = DS.Serializer.extend({ if (json[root]) { if (record) { loader.updateId(record, json[root]); } this.extractRecordRepresentation(loader, type, json[root]); + } else { + Ember.Logger.warn("Extract requested, but no data given for " + type + ". This may cause weird problems."); } }, @@ -7119,7 +7151,8 @@ DS.JSONSerializer = DS.Serializer.extend({ } this.metadataMapping.forEach(function(property, key){ - if(value = data[property]){ + value = data[property]; + if(!Ember.isNone(value)){ loader.metaForType(type, key, value); } }); @@ -7292,6 +7325,7 @@ DS.JSONSerializer = DS.Serializer.extend({ */ var get = Ember.get, set = Ember.set, merge = Ember.merge; +var forEach = Ember.EnumerableUtils.forEach; function loaderFor(store) { return { @@ -7346,7 +7380,6 @@ DS.loaderFor = loaderFor; To tell your store which adapter to use, set its `adapter` property: App.store = DS.Store.create({ - revision: 3, adapter: App.MyAdapter.create() }); @@ -7368,9 +7401,9 @@ DS.loaderFor = loaderFor; * `deleteRecords()` * `commit()` - For an example implementation, see {{#crossLink "DS.RestAdapter"}} the - included REST adapter.{{/crossLink}}. - + For an example implementation, see `DS.RestAdapter`, the + included REST adapter. + @class Adapter @namespace DS @extends Ember.Object @@ -7747,6 +7780,14 @@ DS.Adapter = Ember.Object.extend(DS._Mappable, { store.recordWasError(record); }, + /** + @method dirtyRecordsForAttributeChange + @param {Ember.OrderedSet} dirtySet + @param {DS.Model} record + @param {String} attributeName + @param {any} newValue + @param {any} oldValue + */ dirtyRecordsForAttributeChange: function(dirtySet, record, attributeName, newValue, oldValue) { if (newValue !== oldValue) { // If this record is embedded, add its parent @@ -7755,15 +7796,32 @@ DS.Adapter = Ember.Object.extend(DS._Mappable, { } }, + /** + @method dirtyRecordsForRecordChange + @param {Ember.OrderedSet} dirtySet + @param {DS.Model} record + */ dirtyRecordsForRecordChange: function(dirtySet, record) { dirtySet.add(record); }, + /** + @method dirtyRecordsForBelongsToChange + @param {Ember.OrderedSet} dirtySet + @param {DS.Model} child + @param {DS.RelationshipChange} relationship + */ dirtyRecordsForBelongsToChange: function(dirtySet, child) { this.dirtyRecordsForRecordChange(dirtySet, child); }, - dirtyRecordsForHasManyChange: function(dirtySet, parent) { + /** + @method dirtyRecordsForHasManyChange + @param {Ember.OrderedSet} dirtySet + @param {DS.Model} parent + @param {DS.RelationshipChange} relationship + */ + dirtyRecordsForHasManyChange: function(dirtySet, parent, relationship) { this.dirtyRecordsForRecordChange(dirtySet, parent); }, @@ -7851,8 +7909,15 @@ DS.Adapter = Ember.Object.extend(DS._Mappable, { @method find */ - find: null, + find: Ember.required(Function), + /** + The class of the serializer to be used by this adapter. + + @property serializer + @type DS.Serializer + @default DS.JSONSerializer + */ serializer: DS.JSONSerializer, registerTransform: function(attributeType, transform) { @@ -7916,34 +7981,83 @@ DS.Adapter = Ember.Object.extend(DS._Mappable, { */ generateIdForRecord: null, + /** + Proxies to the serializer's `materialize` method. + + @method materialize + @param {DS.Model} record + @param {Object} data + @param {Object} prematerialized + */ materialize: function(record, data, prematerialized) { get(this, 'serializer').materialize(record, data, prematerialized); }, + /** + Proxies to the serializer's `serialize` method. + + @method serialize + @param {DS.Model} record + @param {Object} options + */ serialize: function(record, options) { return get(this, 'serializer').serialize(record, options); }, + /** + Proxies to the serializer's `extractId` method. + + @method extractId + @param {DS.Model} type the model class + @param {Object} data + */ extractId: function(type, data) { return get(this, 'serializer').extractId(type, data); }, + /** + @method groupByType + @private + @param enumerable + */ groupByType: function(enumerable) { var map = Ember.MapWithDefault.create({ defaultValue: function() { return Ember.OrderedSet.create(); } }); - enumerable.forEach(function(item) { + forEach(enumerable, function(item) { map.get(item.constructor).add(item); }); return map; }, + /** + The commit method is called when a transaction is being committed. + The `commitDetails` is a map with each record type and a list of + committed, updated and deleted records. + + By default, this just calls the adapter's `save` method. + If you need more advanced handling of commits, e.g., only sending + certain records to the server, you can overwrite this method. + + @method commit + @params {DS.Store} store + @params {Ember.Map} commitDetails see `DS.Transaction#commitDetails`. + */ commit: function(store, commitDetails) { this.save(store, commitDetails); }, + /** + Iterates over each set of records provided in the commit details and + filters with `DS.Adapter#shouldSave` and then calls `createRecords`, + `updateRecords`, and `deleteRecords` for each set as approriate. + + @method save + @params {DS.Store} store + @params {Ember.Map} commitDetails see `DS.Transaction#commitDetails`. + */ save: function(store, commitDetails) { var adapter = this; @@ -7972,26 +8086,126 @@ DS.Adapter = Ember.Object.extend(DS._Mappable, { }, this); }, - shouldSave: Ember.K, + /** + Called on each record before saving. If false is returned, the record + will not be saved. + @method shouldSave + @property {DS.Model} record + @return {Boolean} `true` to save, `false` to not. Defaults to true. + */ + shouldSave: function(record) { + return true; + }, + + /** + Implement this method in a subclass to handle the creation of + new records. + + Serializes the record and send it to the server. + + This implementation should call the adapter's `didCreateRecord` + method on success or `didError` method on failure. + + @method createRecord + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the record + @property {DS.Model} record + */ + createRecord: Ember.required(Function), + + /** + Creates multiple records at once. + + By default, it loops over the supplied array and calls `createRecord` + on each. May be overwritten to improve performance and reduce the number + of server requests. + + @method createRecords + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the records + @property {Array[DS.Model]} records + */ createRecords: function(store, type, records) { records.forEach(function(record) { this.createRecord(store, type, record); }, this); }, + /** + Implement this method in a subclass to handle the updating of + a record. + + Serializes the record update and send it to the server. + + @method updateRecord + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the record + @property {DS.Model} record + */ + updateRecord: Ember.required(Function), + + /** + Updates multiple records at once. + + By default, it loops over the supplied array and calls `updateRecord` + on each. May be overwritten to improve performance and reduce the number + of server requests. + + @method updateRecords + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the records + @property {Array[DS.Model]} records + */ updateRecords: function(store, type, records) { records.forEach(function(record) { this.updateRecord(store, type, record); }, this); }, + /** + Implement this method in a subclass to handle the deletion of + a record. + + Sends a delete request for the record to the server. + + @method deleteRecord + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the record + @property {DS.Model} record + */ + deleteRecord: Ember.required(Function), + + /** + Delete multiple records at once. + + By default, it loops over the supplied array and calls `deleteRecord` + on each. May be overwritten to improve performance and reduce the number + of server requests. + + @method deleteRecords + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the records + @property {Array[DS.Model]} records + */ deleteRecords: function(store, type, records) { records.forEach(function(record) { this.deleteRecord(store, type, record); }, this); }, + /** + Find multiple records at once. + + By default, it loops over the provided ids and calls `find` on each. + May be overwritten to improve performance and reduce the number of + server requests. + + @method findMany + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the records + @property {Array} ids + */ findMany: function(store, type, ids) { ids.forEach(function(id) { this.find(store, type, id); @@ -8000,6 +8214,20 @@ DS.Adapter = Ember.Object.extend(DS._Mappable, { }); DS.Adapter.reopenClass({ + + /** + Registers a custom attribute transform for the adapter class + + The `transform` property is an object with a `serialize` and + `deserialize` property. These are each functions that respectively + serialize the data to send to the backend or deserialize it for + use on the client. + + @method registerTransform + @static + @property {DS.String} attributeType + @property {Object} transform + */ registerTransform: function(attributeType, transform) { var registeredTransforms = this._registeredTransforms || {}; @@ -8008,6 +8236,14 @@ DS.Adapter.reopenClass({ this._registeredTransforms = registeredTransforms; }, + /** + Registers a custom enumerable transform for the adapter class + + @method registerEnumTransform + @static + @property {DS.String} attributeType + @property objects + */ registerEnumTransform: function(attributeType, objects) { var registeredEnumTransforms = this._registeredEnumTransforms || {}; @@ -8016,12 +8252,28 @@ DS.Adapter.reopenClass({ this._registeredEnumTransforms = registeredEnumTransforms; }, + /** + Set adapter attributes for a DS.Model class. + + @method map + @static + @property {DS.Model} type the DS.Model class + @property {Object} attributes + */ map: DS._Mappable.generateMapFunctionFor('attributes', function(key, newValue, map) { var existingValue = map.get(key); merge(existingValue, newValue); }), + /** + Set configuration options for a DS.Model class. + + @method configure + @static + @property {DS.Model} type the DS.Model class + @property {Object} configuration + */ configure: DS._Mappable.generateMapFunctionFor('configurations', function(key, newValue, map) { var existingValue = map.get(key); @@ -8036,6 +8288,16 @@ DS.Adapter.reopenClass({ merge(existingValue, newValue); }), + /** + Resolved conflicts in configuration settings. + + Calls `Ember.merge` by default. + + @method resolveMapConflict + @static + @property oldValue + @property newValue + */ resolveMapConflict: function(oldValue, newValue) { merge(newValue, oldValue); @@ -8174,7 +8436,7 @@ DS.FixtureSerializer = DS.Serializer.extend({ */ var get = Ember.get, fmt = Ember.String.fmt, - dump = Ember.get(window, 'JSON.stringify') || function(object) { return object.toString(); }; + indexOf = Ember.EnumerableUtils.indexOf; /** `DS.FixtureAdapter` is an adapter that loads records from memory. @@ -8207,7 +8469,7 @@ DS.FixtureAdapter = DS.Adapter.extend({ return fixtures.map(function(fixture){ var fixtureIdType = typeof fixture.id; if(fixtureIdType !== "number" && fixtureIdType !== "string"){ - throw new Error(fmt('the id property must be defined as a number or string for fixture %@', [dump(fixture)])); + throw new Error(fmt('the id property must be defined as a number or string for fixture %@', [fixture])); } fixture.id = fixture.id + ''; return fixture; @@ -8273,7 +8535,7 @@ DS.FixtureAdapter = DS.Adapter.extend({ if (fixtures) { fixtures = fixtures.filter(function(item) { - return ids.indexOf(item.id) !== -1; + return indexOf(ids, item.id) !== -1; }); } @@ -8345,7 +8607,7 @@ DS.FixtureAdapter = DS.Adapter.extend({ var existingFixture = this.findExistingFixture(type, record); if(existingFixture) { - var index = type.FIXTURES.indexOf(existingFixture); + var index = indexOf(type.FIXTURES, existingFixture); type.FIXTURES.splice(index, 1); return true; } @@ -8450,8 +8712,6 @@ DS.RESTSerializer = DS.JSONSerializer.extend({ (function() { -/*global jQuery*/ - /** @module data @submodule data-adapters @@ -8459,10 +8719,11 @@ DS.RESTSerializer = DS.JSONSerializer.extend({ var get = Ember.get, set = Ember.set; -function rejectionHandler(reason) { - Ember.Logger.error(reason, reason.message); +DS.rejectionHandler = function(reason) { + Ember.Logger.assert([reason, reason.message, reason.stack]); + throw reason; -} +}; /** The REST adapter allows your store to communicate with an HTTP server by @@ -8535,16 +8796,37 @@ DS.RESTAdapter = DS.Adapter.extend({ this._super.apply(this, arguments); }, + /** + Called on each record before saving. If false is returned, the record + will not be saved. + + By default, this method returns `true` except when the record is embedded. + + @method shouldSave + @property {DS.Model} record + @return {Boolean} `true` to save, `false` to not. Defaults to true. + */ shouldSave: function(record) { var reference = get(record, '_reference'); return !reference.parent; }, + /** + @method dirtyRecordsForRecordChange + @param {Ember.OrderedSet} dirtySet + @param {DS.Model} record + */ dirtyRecordsForRecordChange: function(dirtySet, record) { this._dirtyTree(dirtySet, record); }, + /** + @method dirtyRecordsForHasManyChange + @param {Ember.OrderedSet} dirtySet + @param {DS.Model} record + @param {DS.RelationshipChange} relationship + */ dirtyRecordsForHasManyChange: function(dirtySet, record, relationship) { var embeddedType = get(this, 'serializer').embeddedType(record.constructor, relationship.secondRecordName); @@ -8554,6 +8836,12 @@ DS.RESTAdapter = DS.Adapter.extend({ } }, + /** + @method _dirtyTree + @private + @param {Ember.OrderedSet} dirtySet + @param {DS.Model} record + */ _dirtyTree: function(dirtySet, record) { dirtySet.add(record); @@ -8572,6 +8860,23 @@ DS.RESTAdapter = DS.Adapter.extend({ } }, + /** + Serializes the record and sends it to the server. + + By default, the record is serialized with the adapter's `serialize` + method and assigned to a root obtained by the `rootForType` method. + + The url is created with `buildURL` and then called as a 'POST' request + with the adapter's `ajax` method. + + If successful, the adapter's `didCreateRecord` method is called, + otherwise `didError` + + @method createRecord + @property {DS.Store} store + @property {DS.Model} type the DS.Model class of the record + @property {DS.Model} record + */ createRecord: function(store, type, record) { var root = this.rootForType(type); var adapter = this; @@ -8586,7 +8891,7 @@ DS.RESTAdapter = DS.Adapter.extend({ }, function(xhr) { adapter.didError(store, type, record, xhr); throw xhr; - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, createRecords: function(store, type, records) { @@ -8609,7 +8914,7 @@ DS.RESTAdapter = DS.Adapter.extend({ data: data }).then(function(json) { adapter.didCreateRecords(store, type, records, json); - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, updateRecord: function(store, type, record) { @@ -8622,14 +8927,14 @@ DS.RESTAdapter = DS.Adapter.extend({ data = {}; data[root] = this.serialize(record); - return this.ajax(this.buildURL(root, id), "PUT",{ + return this.ajax(this.buildURL(root, id, record), "PUT",{ data: data }).then(function(json){ adapter.didUpdateRecord(store, type, record, json); }, function(xhr) { adapter.didError(store, type, record, xhr); throw xhr; - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, updateRecords: function(store, type, records) { @@ -8655,7 +8960,7 @@ DS.RESTAdapter = DS.Adapter.extend({ data: data }).then(function(json) { adapter.didUpdateRecords(store, type, records, json); - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, deleteRecord: function(store, type, record) { @@ -8665,12 +8970,12 @@ DS.RESTAdapter = DS.Adapter.extend({ root = this.rootForType(type); adapter = this; - return this.ajax(this.buildURL(root, id), "DELETE").then(function(json){ + return this.ajax(this.buildURL(root, id, record), "DELETE").then(function(json){ adapter.didDeleteRecord(store, type, record, json); }, function(xhr){ adapter.didError(store, type, record, xhr); throw xhr; - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, deleteRecords: function(store, type, records) { @@ -8696,7 +9001,7 @@ DS.RESTAdapter = DS.Adapter.extend({ data: data }).then(function(json){ adapter.didDeleteRecords(store, type, records, json); - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, find: function(store, type, id) { @@ -8705,7 +9010,7 @@ DS.RESTAdapter = DS.Adapter.extend({ return this.ajax(this.buildURL(root, id), "GET"). then(function(json){ adapter.didFindRecord(store, type, json, id); - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, findAll: function(store, type, since) { @@ -8718,7 +9023,7 @@ DS.RESTAdapter = DS.Adapter.extend({ data: this.sinceQuery(since) }).then(function(json) { adapter.didFindAll(store, type, json); - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, findQuery: function(store, type, query, recordArray) { @@ -8729,7 +9034,7 @@ DS.RESTAdapter = DS.Adapter.extend({ data: query }).then(function(json){ adapter.didFindQuery(store, type, json, recordArray); - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, findMany: function(store, type, ids, owner) { @@ -8742,7 +9047,7 @@ DS.RESTAdapter = DS.Adapter.extend({ data: {ids: ids} }).then(function(json) { adapter.didFindMany(store, type, json); - }).then(null, rejectionHandler); + }).then(null, DS.rejectionHandler); }, /** @@ -8792,10 +9097,14 @@ DS.RESTAdapter = DS.Adapter.extend({ }; hash.error = function(jqXHR, textStatus, errorThrown) { - Ember.run(null, reject, errorThrown); + if (jqXHR) { + jqXHR.then = null; + } + + Ember.run(null, reject, jqXHR); }; - jQuery.ajax(hash); + Ember.$.ajax(hash); }); }, @@ -8811,18 +9120,18 @@ DS.RESTAdapter = DS.Adapter.extend({ return serializer.pluralize(string); }, - buildURL: function(record, suffix) { + buildURL: function(root, suffix, record) { var url = [this.url]; Ember.assert("Namespace URL (" + this.namespace + ") must not start with slash", !this.namespace || this.namespace.toString().charAt(0) !== "/"); - Ember.assert("Record URL (" + record + ") must not start with slash", !record || record.toString().charAt(0) !== "/"); + Ember.assert("Root URL (" + root + ") must not start with slash", !root || root.toString().charAt(0) !== "/"); Ember.assert("URL suffix (" + suffix + ") must not start with slash", !suffix || suffix.toString().charAt(0) !== "/"); if (!Ember.isNone(this.namespace)) { url.push(this.namespace); } - url.push(this.pluralize(record)); + url.push(this.pluralize(root)); if (suffix !== undefined) { url.push(suffix); } diff --git a/ember/static/js/libs/ember-data.min.js b/ember/static/js/libs/ember-data.min.js index 7174fc0..9c87561 100644 --- a/ember/static/js/libs/ember-data.min.js +++ b/ember/static/js/libs/ember-data.min.js @@ -7,9 +7,10 @@ -// Last commit: 3981a7c (2013-05-28 05:00:14 -0700) +// Version: v0.13-78-g9602df4 +// Last commit: 9602df4 (2013-07-29 17:00:59 -0700) -!function(){var e,t;!function(){var r={},n={};e=function(e,t,n){r[e]={deps:t,callback:n}},t=function(e){if(n[e])return n[e];n[e]={};for(var i,a=r[e],o=a.deps,s=a.callback,c=[],d=0,u=o.length;u>d;d++)"exports"===o[d]?c.push(i={}):c.push(t(o[d]));var h=s.apply(this,c);return n[e]=i||h}}(),function(){window.DS=Ember.Namespace.create()}(),function(){Ember.set,Ember.onLoad("Ember.Application",function(e){e.initializer({name:"store",initialize:function(e,t){t.register("store:main",t.Store),e.lookup("store:main")}}),e.initializer({name:"injectStore",initialize:function(e,t){t.inject("controller","store","store:main"),t.inject("route","store","store:main")}})})}(),function(){Ember.Date=Ember.Date||{};var e=Date.parse,t=[1,4,5,6,7,10,11];Ember.Date.parse=function(r){var n,i,a=0;if(i=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(r)){for(var o,s=0;o=t[s];++s)i[o]=+i[o]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,"Z"!==i[8]&&void 0!==i[9]&&(a=60*i[10]+i[11],"+"===i[9]&&(a=0-a)),n=Date.UTC(i[1],i[2],i[3],i[4],i[5]+a,i[6],i[7])}else n=e?e(r):0/0;return n},(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Date)&&(Date.parse=Ember.Date.parse)}(),function(){var e=Ember.Evented,t=Ember.DeferredMixin,r=Ember.run,n=Ember.get,i=Ember.Mixin.create(e,t,{init:function(){this._super.apply(this,arguments),this.one("didLoad",this,function(){r(this,"resolve",this)}),this.one("becameError",this,function(){r(this,"reject",this)}),n(this,"isLoaded")&&this.trigger("didLoad")}});DS.LoadPromise=i}(),function(){var e=Ember.get;Ember.set;var t=DS.LoadPromise;DS.RecordArray=Ember.ArrayProxy.extend(t,{type:null,content:null,isLoaded:!1,isUpdating:!1,store:null,objectAtContent:function(t){var r=e(this,"content"),n=r.objectAt(t),i=e(this,"store");return n?i.recordForReference(n):void 0},materializedObjectAt:function(t){var r=e(this,"content").objectAt(t);if(r)return e(this,"store").recordIsMaterialized(r)?this.objectAt(t):void 0},update:function(){if(!e(this,"isUpdating")){var t=e(this,"store"),r=e(this,"type");t.fetchAll(r,this)}},addReference:function(t){e(this,"content").addObject(t)},removeReference:function(t){e(this,"content").removeObject(t)}})}(),function(){var e=Ember.get;DS.FilteredRecordArray=DS.RecordArray.extend({filterFunction:null,isLoaded:!0,replace:function(){var t=e(this,"type").toString();throw new Error("The result of a client-side filter (on "+t+") is immutable.")},updateFilter:Ember.observer(function(){var t=e(this,"manager");t.updateFilter(this,e(this,"type"),e(this,"filterFunction"))},"filterFunction")})}(),function(){var e=Ember.get;Ember.set,DS.AdapterPopulatedRecordArray=DS.RecordArray.extend({query:null,replace:function(){var t=e(this,"type").toString();throw new Error("The result of a server query (on "+t+") is immutable.")},load:function(e){this.setProperties({content:Ember.A(e),isLoaded:!0}),Ember.run.once(this,"trigger","didLoad")}})}(),function(){var e=Ember.get,t=Ember.set;DS.ManyArray=DS.RecordArray.extend({init:function(){this._super.apply(this,arguments),this._changesToSync=Ember.OrderedSet.create()},owner:null,isPolymorphic:!1,isLoaded:!1,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--,0===this.loadingRecordsCount&&(t(this,"isLoaded",!0),this.trigger("didLoad"))},fetch:function(){var t=e(this,"content"),r=e(this,"store"),n=e(this,"owner");r.fetchUnloadedReferences(t,n)},replaceContent:function(t,r,n){n=n.map(function(t){return e(t,"_reference")},this),this._super(t,r,n)},arrangedContentDidChange:function(){this.fetch()},arrayContentWillChange:function(t,r){var n=e(this,"owner"),i=e(this,"name");if(!n._suspendedRelationships)for(var a=t;t+r>a;a++){var o=e(this,"content").objectAt(a),s=DS.RelationshipChange.createChange(n.get("_reference"),o,e(this,"store"),{parentType:n.constructor,changeType:"remove",kind:"hasMany",key:i});this._changesToSync.add(s)}return this._super.apply(this,arguments)},arrayContentDidChange:function(t,r,n){this._super.apply(this,arguments);var i=e(this,"owner"),a=e(this,"name"),o=e(this,"store");if(!i._suspendedRelationships){for(var s=t;t+n>s;s++){var c=e(this,"content").objectAt(s),d=DS.RelationshipChange.createChange(i.get("_reference"),c,o,{parentType:i.constructor,changeType:"add",kind:"hasMany",key:a});d.hasManyName=a,this._changesToSync.add(d)}this._changesToSync.forEach(function(e){e.sync()}),DS.OneToManyChange.ensureSameTransaction(this._changesToSync,o),this._changesToSync.clear()}},createRecord:function(t,r){var n,i=e(this,"owner"),a=e(i,"store"),o=e(this,"type");return r=r||e(i,"transaction"),n=a.createRecord.call(a,o,t,r),this.pushObject(n),n}})}(),function(){var e=Ember.get,t=Ember.set,r=Ember.EnumerableUtils.forEach;DS.Transaction=Ember.Object.extend({init:function(){t(this,"records",Ember.OrderedSet.create())},createRecord:function(t,r){var n=e(this,"store");return n.createRecord(t,r,this)},isEqualOrDefault:function(t){return this===t||t===e(this,"store.defaultTransaction")?!0:void 0},isDefault:Ember.computed(function(){return this===e(this,"store.defaultTransaction")}).volatile(),add:function(t){var r=e(this,"store"),n=e(r,"_adapter"),i=e(n,"serializer");i.eachEmbeddedRecord(t,function(e,t){"load"!==t&&this.add(e)},this),this.adoptRecord(t)},relationships:Ember.computed(function(){var t=Ember.OrderedSet.create(),r=e(this,"records"),n=e(this,"store");return r.forEach(function(r){for(var i=e(r,"_reference"),a=n.relationshipChangesFor(i),o=0;or;r++){var i=e[r];i.data===o&&(t.push(i),i.data=s)}return t},fetchUnloadedReferences:function(e,t){var r=this.unloadedReferences(e);this.fetchMany(r,t)},fetchMany:function(e,t){if(e.length){var r=Ember.MapWithDefault.create({defaultValue:function(){return Ember.A()}});i(e,function(e){r.get(e.type).push(e)}),i(r,function(e){var n=r.get(e),i=a(n,function(e){return e.id}),o=this.adapterForType(e);o.findMany(this,e,i,t)},this)}},hasReferenceForId:function(e,t){return t=u(t),!!this.typeMapFor(e).idToReference[t]},referenceForId:function(e,t){t=u(t);var r=this.typeMapFor(e).idToReference[t];return r||(r=this.createReference(e,t),r.data=o),r},findMany:function(e,t,r,n){if(!Ember.isArray(t)){var i=this.adapterForType(e);return i&&i.findHasMany&&i.findHasMany(this,r,n,t),this.recordArrayManager.createManyArray(e,Ember.A())}var o,s,c,d=a(t,function(t){return"object"!=typeof t&&null!==t?this.referenceForId(e,t):t},this),u=this.unloadedReferences(d),h=this.recordArrayManager.createManyArray(e,Ember.A(d));if(this.loadingRecordArrays,h.loadingRecordsCount(u.length),u.length){for(s=0,c=u.length;c>s;s++)o=u[s],this.recordArrayManager.registerWaitingRecordArray(h,o);this.fetchMany(u,r)}else h.set("isLoaded",!0),Ember.run.once(function(){h.trigger("didLoad")});return h},findQuery:function(e,t){var r=DS.AdapterPopulatedRecordArray.create({type:e,query:t,content:Ember.A([]),store:this}),n=this.adapterForType(e);return n.findQuery(this,e,t,r),r},findAll:function(e){return this.fetchAll(e,this.all(e))},fetchAll:function(e,r){var n=this.adapterForType(e),i=this.typeMapFor(e).metadata.since;return t(r,"isUpdating",!0),n.findAll(this,e,i),r},metaForType:function(e,r,n){var i=this.typeMapFor(e).metadata;t(i,r,n)},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;t(r,"isUpdating",!1)},all:function(e){var t=this.typeMapFor(e),r=t.findAllCache;if(r)return r;var n=DS.RecordArray.create({type:e,content:Ember.A([]),store:this,isLoaded:!0});return this.recordArrayManager.registerFilteredRecordArray(n,e),t.findAllCache=n,n},filter:function(e,t,r){3===arguments.length?this.findQuery(e,t):2===arguments.length&&(r=t);var n=DS.FilteredRecordArray.create({type:e,content:Ember.A([]),store:this,manager:this.recordArrayManager,filterFunction:r});return this.recordArrayManager.registerFilteredRecordArray(n,e,r),n},recordIsLoaded:function(e,t){return this.hasReferenceForId(e,t)?"object"==typeof this.referenceForId(e,t).data:!1},dataWasUpdated:function(t,r,n){e(n,"isDeleted")||"object"==typeof r.data&&this.recordArrayManager.referenceDidChange(r)},save:function(){r(this,"commitDefaultTransaction")},commit:Ember.aliasMethod("save"),commitDefaultTransaction:function(){e(this,"defaultTransaction").commit()},scheduleSave:function(t){e(this,"currentTransaction").add(t),r(this,"flushSavedRecords")},flushSavedRecords:function(){e(this,"currentTransaction").commit(),t(this,"currentTransaction",this.transaction())},didSaveRecord:function(e,t){t?(this.updateId(e,t),this.updateRecordData(e,t)):this.didUpdateAttributes(e),e.adapterDidCommit()},didSaveRecords:function(e,t){var r=0;e.forEach(function(e){this.didSaveRecord(e,t&&t[r++])},this)},recordWasInvalid:function(e,t){e.adapterDidInvalidate(t)},recordWasError:function(e){e.adapterDidError()},didUpdateAttribute:function(e,t,r){e.adapterDidUpdateAttribute(t,r)},didUpdateAttributes:function(e){e.eachAttribute(function(t){this.didUpdateAttribute(e,t)},this)},didUpdateRelationship:function(t,r){var n=e(t,"_reference").clientId,i=this.relationshipChangeFor(n,r);i&&i.adapterDidUpdate()},didUpdateRelationships:function(t){var r=this.relationshipChangesFor(e(t,"_reference"));for(var n in r)r.hasOwnProperty(n)&&r[n].adapterDidUpdate()},didReceiveId:function(t,r){var n=this.typeMapFor(t.constructor),i=e(t,"clientId");e(t,"id"),n.idToCid[r]=i,this.clientIdToId[i]=r},updateRecordData:function(t,r){e(t,"_reference").data=r,t.didChangeData()},updateId:function(t,r){var n=t.constructor,i=this.typeMapFor(n),a=e(t,"_reference"),o=(e(t,"id"),this.preprocessData(n,r));i.idToReference[o]=a,a.id=o},preprocessData:function(e,t){return this.adapterForType(e).extractId(e,t)},typeMapFor:function(t){var r,n=e(this,"typeMaps"),i=Ember.guidFor(t);return(r=n[i])?r:(r={idToReference:{},references:[],metadata:{}},n[i]=r,r)},load:function(e,t,n){var i;("number"==typeof t||"string"==typeof t)&&(i=t,t=n,n=null),n&&n.id?i=n.id:void 0===i&&(i=this.preprocessData(e,t)),i=u(i);var a=this.referenceForId(e,i);return a.record&&r(a.record,"loadedData"),a.data=t,a.prematerialized=n,this.recordArrayManager.referenceDidChange(a),a},loadMany:function(e,t,r){return void 0===r&&(r=t,t=a(r,function(t){return this.preprocessData(e,t)},this)),a(t,function(t,n){return this.load(e,t,r[n])},this)},loadHasMany:function(e,r,n){var i=e.get(r+".type"),o=a(n,function(e){return{id:e,type:i}});e.materializeHasMany(r,o),e.hasManyDidChange(r);var s=e.cacheFor(r);s&&(t(s,"isLoaded",!0),s.trigger("didLoad"))},createReference:function(e,t){var r=this.typeMapFor(e),n=r.idToReference,i={id:t,clientId:this.clientIdCounter++,type:e};return t&&(n[t]=i),r.references.push(i),i},materializeRecord:function(t){var r=t.type._create({id:t.id,store:this,_reference:t});return t.record=r,e(this,"defaultTransaction").adoptRecord(r),r.loadingData(),"object"==typeof t.data&&r.loadedData(),r},dematerializeRecord:function(t){var r=e(t,"_reference"),n=r.type,i=r.id,a=this.typeMapFor(n);t.updateRecordArrays(),i&&delete a.idToReference[i];var o=a.references.indexOf(r);a.references.splice(o,1)},willDestroy:function(){e(DS,"defaultStore")===this&&t(DS,"defaultStore",null)},addRelationshipChangeFor:function(e,t,r,n,i){var a=e.clientId,o=r?r.clientId:r,s=t+n,c=this.relationshipChanges;a in c||(c[a]={}),o in c[a]||(c[a][o]={}),s in c[a][o]||(c[a][o][s]={}),c[a][o][s][i.changeType]=i},removeRelationshipChangeFor:function(e,t,r,n,i){var a=e.clientId,o=r?r.clientId:r,s=this.relationshipChanges,c=t+n;a in s&&o in s[a]&&c in s[a][o]&&delete s[a][o][c][i]},relationshipChangeFor:function(e,t,r,n,i){var a=e.clientId,o=r?r.clientId:r,s=this.relationshipChanges,c=t+n;return a in s&&o in s[a]?i?s[a][o][c][i]:s[a][o][c].add||s[a][o][c].remove:void 0},relationshipChangePairsFor:function(e){var t=[];if(!e)return t;var r=this.relationshipChanges[e.clientId];for(var n in r)if(r.hasOwnProperty(n))for(var i in r[n])r[n].hasOwnProperty(i)&&t.push(r[n][i]);return t},relationshipChangesFor:function(e){var t=[];if(!e)return t;var r=this.relationshipChangePairsFor(e);return i(r,function(e){var r=e.add,n=e.remove;r&&t.push(r),n&&t.push(n)}),t},adapterForType:function(e){this._adaptersMap=this.createInstanceMapFor("adapters");var t=this._adaptersMap.get(e);return t?t:this.get("_adapter")},recordAttributeDidChange:function(e,t,r,n){var i=e.record,a=new Ember.OrderedSet,o=this.adapterForType(i.constructor);o.dirtyRecordsForAttributeChange&&o.dirtyRecordsForAttributeChange(a,i,t,r,n),a.forEach(function(e){e.adapterDidDirty()})},recordBelongsToDidChange:function(e,t,r){var n=this.adapterForType(t.constructor);n.dirtyRecordsForBelongsToChange&&n.dirtyRecordsForBelongsToChange(e,t,r)},recordHasManyDidChange:function(e,t,r){var n=this.adapterForType(t.constructor);n.dirtyRecordsForHasManyChange&&n.dirtyRecordsForHasManyChange(e,t,r)}}),DS.Store.reopenClass({registerAdapter:DS._Mappable.generateMapFunctionFor("adapters",function(e,t,r){r.set(e,t)}),transformMapKey:function(t){if("string"==typeof t){var r;return r=e(Ember.lookup,t)}return t},transformMapValue:function(e,t){return Ember.Object.detect(t)?t.create():t}})}(),function(){var e=Ember.get,t=Ember.set,r=Ember.run.once,n=Ember.ArrayPolyfills.map,i=Ember.computed(function(t){var r=e(this,"parentState");return r?e(r,t):void 0}).property(),a=function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!0;return!1},o=function(t){var r=e(t,"record");r.materializeData()},s=function(t,r){r.oldValue=e(e(t,"record"),r.name);var n=DS.AttributeChange.createChange(r);e(t,"record")._changesToSync[r.name]=n},c=function(t,r){var n=e(t,"record")._changesToSync[r.name];n.value=e(e(t,"record"),r.name),n.sync()};DS.State=Ember.State.extend({isLoading:i,isLoaded:i,isReloading:i,isDirty:i,isSaving:i,isDeleted:i,isError:i,isNew:i,isValid:i,dirtyType:i});var d=DS.State.extend({initialState:"uncommitted",isDirty:!0,uncommitted:DS.State.extend({willSetProperty:s,didSetProperty:c,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},becameClean:function(t){var r=e(t,"record");r.withTransaction(function(e){e.remove(r)}),t.transitionTo("loaded.materializing")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(t){e(t,"record").rollback()}}),inFlight:DS.State.extend({isSaving:!0,enter:function(t){var r=e(t,"record");r.becameInFlight()},materializingData:function(r){t(r,"lastDirtyType",e(this,"dirtyType")),r.transitionTo("materializing")},didCommit:function(t){var r=e(this,"dirtyType"),n=e(t,"record");n.withTransaction(function(e){e.remove(n)}),t.transitionTo("saved"),t.send("invokeLifecycleCallbacks",r)},didChangeData:o,becameInvalid:function(r,n){var i=e(r,"record");t(i,"errors",n),r.transitionTo("invalid"),r.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("error"),e.send("invokeLifecycleCallbacks")}}),invalid:DS.State.extend({isValid:!1,exit:function(t){var r=e(t,"record");r.withTransaction(function(e){e.remove(r)})},deleteRecord:function(t){t.transitionTo("deleted"),e(t,"record").clearRelationships()},willSetProperty:s,didSetProperty:function(r,n){var i=e(r,"record"),o=e(i,"errors"),s=n.name;t(o,s,null),a(o)||r.send("becameValid"),c(r,n)},becomeDirty:Ember.K,rollback:function(e){e.send("becameValid"),e.send("rollback")},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(t){var r=e(t,"record");r.trigger("becameInvalid",r)}})}),u=d.create({dirtyType:"created",isNew:!0}),h=d.create({dirtyType:"updated"});u.states.uncommitted.reopen({deleteRecord:function(t){var r=e(t,"record");r.clearRelationships(),t.transitionTo("deleted.saved")}}),u.states.uncommitted.reopen({rollback:function(e){this._super(e),e.transitionTo("deleted.saved")}}),h.states.uncommitted.reopen({deleteRecord:function(t){var r=e(t,"record");t.transitionTo("deleted"),r.clearRelationships()}});var l={rootState:Ember.State.create({isLoading:!1,isLoaded:!1,isReloading:!1,isDirty:!1,isSaving:!1,isDeleted:!1,isError:!1,isNew:!1,isValid:!0,empty:DS.State.create({loadingData:function(e){e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created")}}),loading:DS.State.create({isLoading:!0,loadedData:o,materializingData:function(e){e.transitionTo("loaded.materializing.firstTime")},becameError:function(e){e.transitionTo("error"),e.send("invokeLifecycleCallbacks")}}),loaded:DS.State.create({initialState:"saved",isLoaded:!0,materializing:DS.State.create({willSetProperty:Ember.K,didSetProperty:Ember.K,didChangeData:o,finishedMaterializing:function(e){e.transitionTo("loaded.saved")},firstTime:DS.State.create({isLoaded:!1,exit:function(t){var n=e(t,"record");r(function(){n.trigger("didLoad")})}})}),reloading:DS.State.create({isReloading:!0,enter:function(t){var r=e(t,"record"),n=e(r,"store");n.reloadRecord(r)},exit:function(t){var n=e(t,"record");r(n,"trigger","didReload")},loadedData:o,materializingData:function(e){e.transitionTo("loaded.materializing")}}),saved:DS.State.create({willSetProperty:s,didSetProperty:c,didChangeData:o,loadedData:o,reloadRecord:function(e){e.transitionTo("loaded.reloading")},materializingData:function(e){e.transitionTo("loaded.materializing")},becomeDirty:function(e){e.transitionTo("updated")},deleteRecord:function(t){t.transitionTo("deleted"),e(t,"record").clearRelationships()},unloadRecord:function(t){var r=e(t,"record");r.clearRelationships(),t.transitionTo("deleted.saved")},didCommit:function(t){var r=e(t,"record");r.withTransaction(function(e){e.remove(r)}),t.send("invokeLifecycleCallbacks",e(t,"lastDirtyType"))},invokeLifecycleCallbacks:function(t,r){var n=e(t,"record");"created"===r?n.trigger("didCreate",n):n.trigger("didUpdate",n),n.trigger("didCommit",n)}}),created:u,updated:h}),deleted:DS.State.create({initialState:"uncommitted",dirtyType:"deleted",isDeleted:!0,isLoaded:!0,isDirty:!0,setup:function(t){var r=e(t,"record"),n=e(r,"store");n.recordArrayManager.remove(r)},uncommitted:DS.State.create({willCommit:function(e){e.transitionTo("inFlight")},rollback:function(t){e(t,"record").rollback()},becomeDirty:Ember.K,becameClean:function(t){var r=e(t,"record");r.withTransaction(function(e){e.remove(r)}),t.transitionTo("loaded.materializing")}}),inFlight:DS.State.create({isSaving:!0,enter:function(t){var r=e(t,"record");r.becameInFlight()},didCommit:function(t){var r=e(t,"record");r.withTransaction(function(e){e.remove(r)}),t.transitionTo("saved"),t.send("invokeLifecycleCallbacks")}}),saved:DS.State.create({isDirty:!1,setup:function(t){var r=e(t,"record"),n=e(r,"store");n.dematerializeRecord(r)},invokeLifecycleCallbacks:function(t){var r=e(t,"record");r.trigger("didDelete",r),r.trigger("didCommit",r)}})}),error:DS.State.create({isError:!0,invokeLifecycleCallbacks:function(t){var r=e(t,"record");r.trigger("becameError",r)}})})};DS.StateManager=Ember.StateManager.extend({record:null,initialState:"rootState",states:l,unhandledEvent:function(t,r){var i,a=t.get("record"),o=[].slice.call(arguments,2);throw i="Attempted to handle event `"+r+"` ",i+="on "+a.toString()+" while in state ",i+=e(t,"currentState.path")+". Called with ",i+=n.call(o,function(e){return Ember.inspect(e)}).join(", "),new Ember.Error(i)}})}(),function(){var e=DS.LoadPromise,t=Ember.get,r=Ember.set,n=Ember.EnumerableUtils.map,i=Ember.computed(function(e){return t(t(this,"stateManager.currentState"),e)}).property("stateManager.currentState").readOnly();DS.Model=Ember.Object.extend(Ember.Evented,e,{isLoading:i,isLoaded:i,isReloading:i,isDirty:i,isSaving:i,isDeleted:i,isError:i,isNew:i,isValid:i,dirtyType:i,clientId:null,id:null,transaction:null,stateManager:null,errors:null,serialize:function(e){var r=t(this,"store");return r.serialize(this,e)},toJSON:function(e){var t=DS.JSONSerializer.create();return t.serialize(this,e)},didLoad:Ember.K,didReload:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,data:Ember.computed(function(){return this._data||this.setupData(),this._data}).property(),materializeData:function(){this.send("materializingData"),t(this,"store").materializeData(this),this.suspendRelationshipObservers(function(){this.notifyPropertyChange("data")})},_data:null,init:function(){this._super();var e=DS.StateManager.create({record:this});r(this,"stateManager",e),this._setup(),e.goToState("empty")},_setup:function(){this._changesToSync={}},send:function(e,r){return t(this,"stateManager").send(e,r)},withTransaction:function(e){var r=t(this,"transaction");r&&e(r)},loadingData:function(){this.send("loadingData")},loadedData:function(){this.send("loadedData")},didChangeData:function(){this.send("didChangeData")},deleteRecord:function(){this.send("deleteRecord")},unloadRecord:function(){this.send("unloadRecord")},clearRelationships:function(){this.eachRelationship(function(e,t){"belongsTo"===t.kind?r(this,e,null):"hasMany"===t.kind&&this.clearHasMany(t)},this)},updateRecordArrays:function(){var e=t(this,"store");e&&e.dataWasUpdated(this.constructor,t(this,"_reference"),this)},adapterDidCommit:function(){var e=t(this,"data").attributes;t(this.constructor,"attributes").forEach(function(r){e[r]=t(this,r)},this),this.send("didCommit"),this.updateRecordArraysLater()},adapterDidDirty:function(){this.send("becomeDirty"),this.updateRecordArraysLater()},dataDidChange:Ember.observer(function(){this.reloadHasManys(),this.send("finishedMaterializing")},"data"),reloadHasManys:function(){var e=t(this.constructor,"relationshipsByName");this.updateRecordArraysLater(),e.forEach(function(e,t){"hasMany"===t.kind&&this.hasManyDidChange(t.key)},this)},hasManyDidChange:function(e){var i=this.cacheFor(e);if(i){var a=t(this.constructor,"relationshipsByName").get(e).type,o=t(this,"store"),s=this._data.hasMany[e]||[],c=n(s,function(e){return"object"==typeof e?e.clientId?e:o.referenceForId(e.type,e.id):o.referenceForId(a,e)});r(i,"content",Ember.A(c))}},updateRecordArraysLater:function(){Ember.run.once(this,this.updateRecordArrays)},setupData:function(){this._data={attributes:{},belongsTo:{},hasMany:{},id:null}},materializeId:function(e){r(this,"id",e)},materializeAttributes:function(e){this._data.attributes=e},materializeAttribute:function(e,t){this._data.attributes[e]=t},materializeHasMany:function(e,t){var r=typeof t;if(t&&"string"!==r&&t.length>1&&Ember.assert("materializeHasMany expects tuples, references or opaque token, not "+t[0],t[0].hasOwnProperty("id")&&t[0].type),"string"===r)this._data.hasMany[e]=t;else{var n=t;t&&Ember.isArray(t)&&(n=this._convertTuplesToReferences(t)),this._data.hasMany[e]=n}},materializeBelongsTo:function(e,t){t&&Ember.assert("materializeBelongsTo expects a tuple or a reference, not a "+t,!t||t.hasOwnProperty("id")&&t.hasOwnProperty("type")),this._data.belongsTo[e]=t},_convertTuplesToReferences:function(e){return n(e,function(e){return this._convertTupleToReference(e)},this)},_convertTupleToReference:function(e){var r=t(this,"store");return e.clientId?e:r.referenceForId(e.type,e.id)},rollback:function(){this._setup(),this.send("becameClean"),this.suspendRelationshipObservers(function(){this.notifyPropertyChange("data")})},toStringExtension:function(){return t(this,"id")},suspendRelationshipObservers:function(e,r){var n=t(this.constructor,"relationshipNames").belongsTo,i=this;try{this._suspendedRelationships=!0,Ember._suspendObservers(i,n,null,"belongsToDidChange",function(){Ember._suspendBeforeObservers(i,n,null,"belongsToWillChange",function(){e.call(r||i)})})}finally{this._suspendedRelationships=!1}},becameInFlight:function(){},resolveOn:function(e){var t=this;return new Ember.RSVP.Promise(function(r,n){function i(){this.off("becameError",a),this.off("becameInvalid",a),r(this)}function a(){this.off(e,i),n(this)}t.one(e,i),t.one("becameError",a),t.one("becameInvalid",a)})},save:function(){return this.get("store").scheduleSave(this),this.resolveOn("didCommit")},reload:function(){return this.send("reloadRecord"),this.resolveOn("didReload")},adapterDidUpdateAttribute:function(e,r){void 0!==r?(t(this,"data.attributes")[e]=r,this.notifyPropertyChange(e)):(r=t(this,e),t(this,"data.attributes")[e]=r),this.updateRecordArraysLater()},adapterDidInvalidate:function(e){this.send("becameInvalid",e)},adapterDidError:function(){this.send("becameError")},trigger:function(e){Ember.tryInvoke(this,e,[].slice.call(arguments,1)),this._super.apply(this,arguments)}});var a=function(e){return function(){var r=t(DS,"defaultStore"),n=[].slice.call(arguments);return n.unshift(this),r[e].apply(r,n)}};DS.Model.reopenClass({_create:DS.Model.create,create:function(){throw new Ember.Error("You should not call `create` on a model. Instead, call `createRecord` with the attributes you would like to set.")},find:a("find"),all:a("all"),query:a("findQuery"),filter:a("filter"),createRecord:a("createRecord")})}(),function(){function e(e,r,n){var i=t(e,"data").attributes,a=i[n];return void 0===a&&(a="function"==typeof r.defaultValue?r.defaultValue():r.defaultValue),a}var t=Ember.get;DS.Model.reopenClass({attributes:Ember.computed(function(){var e=Ember.Map.create();return this.eachComputedProperty(function(t,r){r.isAttribute&&(r.name=t,e.set(t,r))}),e})}),DS.Model.reopen({eachAttribute:function(e,r){t(this.constructor,"attributes").forEach(function(t,n){e.call(r,t,n)},r)},attributeWillChange:Ember.beforeObserver(function(e,r){var n=t(e,"_reference"),i=t(e,"store");e.send("willSetProperty",{reference:n,store:i,name:r})}),attributeDidChange:Ember.observer(function(e,t){e.send("didSetProperty",{name:t})})}),DS.attr=function(t,r){r=r||{};var n={type:t,isAttribute:!0,options:r};return Ember.computed(function(t,n){return arguments.length>1||(n=e(this,r,t)),n}).property("data").meta(n)}}(),function(){var e=DS.AttributeChange=function(e){this.reference=e.reference,this.store=e.store,this.name=e.name,this.oldValue=e.oldValue};e.createChange=function(t){return new e(t)},e.prototype={sync:function(){this.store.recordAttributeDidChange(this.reference,this.name,this.value,this.oldValue),this.destroy()},destroy:function(){var e=this.reference.record;delete e._changesToSync[this.name]}}}(),function(){var e=Ember.get,t=Ember.set,r=Ember.EnumerableUtils.forEach;DS.RelationshipChange=function(e){this.parentReference=e.parentReference,this.childReference=e.childReference,this.firstRecordReference=e.firstRecordReference,this.firstRecordKind=e.firstRecordKind,this.firstRecordName=e.firstRecordName,this.secondRecordReference=e.secondRecordReference,this.secondRecordKind=e.secondRecordKind,this.secondRecordName=e.secondRecordName,this.changeType=e.changeType,this.store=e.store,this.committed={}},DS.RelationshipChangeAdd=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChangeRemove=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChange.create=function(e){return new DS.RelationshipChange(e)},DS.RelationshipChangeAdd.create=function(e){return new DS.RelationshipChangeAdd(e)},DS.RelationshipChangeRemove.create=function(e){return new DS.RelationshipChangeRemove(e)},DS.OneToManyChange={},DS.OneToNoneChange={},DS.ManyToNoneChange={},DS.OneToOneChange={},DS.ManyToManyChange={},DS.RelationshipChange._createChange=function(e){return"add"===e.changeType?DS.RelationshipChangeAdd.create(e):"remove"===e.changeType?DS.RelationshipChangeRemove.create(e):void 0},DS.RelationshipChange.determineRelationshipType=function(e,t){var r,n,i=t.key,a=t.kind,o=e.inverseFor(i);return o&&(r=o.name,n=o.kind),o?"belongsTo"===n?"belongsTo"===a?"oneToOne":"manyToOne":"belongsTo"===a?"oneToMany":"manyToMany":"belongsTo"===a?"oneToNone":"manyToNone"},DS.RelationshipChange.createChange=function(e,t,r,n){var i,a=e.type;return i=DS.RelationshipChange.determineRelationshipType(a,n),"oneToMany"===i?DS.OneToManyChange.createChange(e,t,r,n):"manyToOne"===i?DS.OneToManyChange.createChange(t,e,r,n):"oneToNone"===i?DS.OneToNoneChange.createChange(e,t,r,n):"manyToNone"===i?DS.ManyToNoneChange.createChange(e,t,r,n):"oneToOne"===i?DS.OneToOneChange.createChange(e,t,r,n):"manyToMany"===i?DS.ManyToManyChange.createChange(e,t,r,n):void 0 -},DS.OneToNoneChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,store:r,changeType:n.changeType,firstRecordName:i,firstRecordKind:"belongsTo"});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.ManyToNoneChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:e,childReference:t,secondRecordReference:e,store:r,changeType:n.changeType,secondRecordName:n.key,secondRecordKind:"hasMany"});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.ManyToManyChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"hasMany",secondRecordKind:"hasMany",store:r,changeType:n.changeType,firstRecordName:i});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.OneToOneChange.createChange=function(e,t,r,n){var i;n.parentType?i=n.parentType.inverseFor(n.key).name:n.key&&(i=n.key);var a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"belongsTo",secondRecordKind:"belongsTo",store:r,changeType:n.changeType,firstRecordName:i});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.OneToOneChange.maintainInvariant=function(t,r,n,i){if("add"===t.changeType&&r.recordIsMaterialized(n)){var a=r.recordForReference(n),o=e(a,i);if(o){var s=DS.OneToOneChange.createChange(n,o.get("_reference"),r,{parentType:t.parentType,hasManyName:t.hasManyName,changeType:"remove",key:t.key});r.addRelationshipChangeFor(n,i,t.parentReference,null,s),s.sync()}}},DS.OneToManyChange.createChange=function(e,t,r,n){var i;n.parentType?(i=n.parentType.inverseFor(n.key).name,DS.OneToManyChange.maintainInvariant(n,r,e,i)):n.key&&(i=n.key);var a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"belongsTo",secondRecordKind:"hasMany",store:r,changeType:n.changeType,firstRecordName:i});return r.addRelationshipChangeFor(e,i,t,a.getSecondRecordName(),a),a},DS.OneToManyChange.maintainInvariant=function(t,r,n,i){var a=n.record;if("add"===t.changeType&&a){var o=e(a,i);if(o){var s=DS.OneToManyChange.createChange(n,o.get("_reference"),r,{parentType:t.parentType,hasManyName:t.hasManyName,changeType:"remove",key:t.key});r.addRelationshipChangeFor(n,i,t.parentReference,s.getSecondRecordName(),s),s.sync()}}},DS.OneToManyChange.ensureSameTransaction=function(e){var t=Ember.A();return r(e,function(e){t.addObject(e.getSecondRecord()),t.addObject(e.getFirstRecord())}),DS.Transaction.ensureSameTransaction(t)},DS.RelationshipChange.prototype={getSecondRecordName:function(){var e,t=this.secondRecordName;if(!t){if(e=this.secondRecordReference,!e)return;var r=this.firstRecordReference.type,n=r.inverseFor(this.firstRecordName);this.secondRecordName=n.name}return this.secondRecordName},getFirstRecordName:function(){var e=this.firstRecordName;return e},destroy:function(){var e=this.childReference,t=this.getFirstRecordName(),r=this.getSecondRecordName(),n=this.store;n.removeRelationshipChangeFor(e,t,this.parentReference,r,this.changeType)},getByReference:function(e){return this.store,e?e.record?e.record:void 0:e},getSecondRecord:function(){return this.getByReference(this.secondRecordReference)},getFirstRecord:function(){return this.getByReference(this.firstRecordReference)},ensureSameTransaction:function(){var e=this.getFirstRecord(),t=this.getSecondRecord(),r=DS.Transaction.ensureSameTransaction([e,t]);return this.transaction=r,r},callChangeEvents:function(){var t=this.getFirstRecord(),r=this.getSecondRecord(),n=new Ember.OrderedSet;r&&e(r,"isLoaded")&&this.store.recordHasManyDidChange(n,r,this),t&&this.store.recordBelongsToDidChange(n,t,this),n.forEach(function(e){e.adapterDidDirty()})},coalesce:function(){var e=this.store.relationshipChangePairsFor(this.firstRecordReference);r(e,function(e){var t=e.add,r=e.remove;t&&r&&(t.destroy(),r.destroy())})}},DS.RelationshipChangeAdd.prototype=Ember.create(DS.RelationshipChange.create({})),DS.RelationshipChangeRemove.prototype=Ember.create(DS.RelationshipChange.create({})),DS.RelationshipChangeAdd.prototype.changeType="add",DS.RelationshipChangeAdd.prototype.sync=function(){var r=this.getSecondRecordName(),n=this.getFirstRecordName(),i=this.getFirstRecord(),a=this.getSecondRecord();this.ensureSameTransaction(),this.callChangeEvents(),a&&i&&("belongsTo"===this.secondRecordKind?a.suspendRelationshipObservers(function(){t(a,r,i)}):"hasMany"===this.secondRecordKind&&a.suspendRelationshipObservers(function(){e(a,r).addObject(i)})),i&&a&&e(i,n)!==a&&("belongsTo"===this.firstRecordKind?i.suspendRelationshipObservers(function(){t(i,n,a)}):"hasMany"===this.firstRecordKind&&i.suspendRelationshipObservers(function(){e(i,n).addObject(a)})),this.coalesce()},DS.RelationshipChangeRemove.prototype.changeType="remove",DS.RelationshipChangeRemove.prototype.sync=function(){var r=this.getSecondRecordName(),n=this.getFirstRecordName(),i=this.getFirstRecord(),a=this.getSecondRecord();this.ensureSameTransaction(i,a,r,n),this.callChangeEvents(),a&&i&&("belongsTo"===this.secondRecordKind?a.suspendRelationshipObservers(function(){t(a,r,null)}):"hasMany"===this.secondRecordKind&&a.suspendRelationshipObservers(function(){e(a,r).removeObject(i)})),i&&e(i,n)&&("belongsTo"===this.firstRecordKind?i.suspendRelationshipObservers(function(){t(i,n,null)}):"hasMany"===this.firstRecordKind&&i.suspendRelationshipObservers(function(){e(i,n).removeObject(a)})),this.coalesce()}}(),function(){var e=Ember.get,t=(Ember.set,Ember.isNone);DS.belongsTo=function(r,n){n=n||{};var i={type:r,isRelationship:!0,options:n,kind:"belongsTo"};return Ember.computed(function(n,i){if("string"==typeof r&&(r=e(this,r,!1)||e(Ember.lookup,r)),2===arguments.length)return void 0===i?null:i;var a,o=e(this,"data").belongsTo,s=e(this,"store");return a=o[n],t(a)?null:a.clientId?s.recordForReference(a):s.findById(a.type,a.id)}).property("data").meta(i)},DS.Model.reopen({belongsToWillChange:Ember.beforeObserver(function(t,r){if(e(t,"isLoaded")){var n=e(t,r),i=e(t,"_reference"),a=e(t,"store");if(n){var o=DS.RelationshipChange.createChange(i,e(n,"_reference"),a,{key:r,kind:"belongsTo",changeType:"remove"});o.sync(),this._changesToSync[r]=o}}}),belongsToDidChange:Ember.immediateObserver(function(t,r){if(e(t,"isLoaded")){var n=e(t,r);if(n){var i=e(t,"_reference"),a=e(t,"store"),o=DS.RelationshipChange.createChange(i,e(n,"_reference"),a,{key:r,kind:"belongsTo",changeType:"add"});o.sync(),this._changesToSync[r]&&DS.OneToManyChange.ensureSameTransaction([o,this._changesToSync[r]],a)}}delete this._changesToSync[r]})})}(),function(){function e(e,i){var a=(t(e,"store"),t(e,"data").hasMany),o=a[i.key];if(o){var s=e.constructor.inverseFor(i.key);s&&n(o,function(t){var n;(n=t.record)&&e.suspendRelationshipObservers(function(){r(n,s.name,null)})})}}var t=Ember.get,r=Ember.set,n=Ember.EnumerableUtils.forEach,i=function(e,n){n=n||{};var i={type:e,isRelationship:!0,options:n,kind:"hasMany"};return Ember.computed(function(a){var o,s,c=t(this,"data").hasMany,d=t(this,"store");return"string"==typeof e&&(e=t(this,e,!1)||t(Ember.lookup,e)),o=c[a],s=d.findMany(e,o,this,i),r(s,"owner",this),r(s,"name",a),r(s,"isPolymorphic",n.polymorphic),s}).property().meta(i)};DS.hasMany=function(e,t){return i(e,t)},DS.Model.reopen({clearHasMany:function(t){var r=this.cacheFor(t.name);r?r.clear():e(this,t)}})}(),function(){var e=Ember.get;Ember.set,DS.Model.reopen({didDefineProperty:function(e,t,r){if(r instanceof Ember.Descriptor){var n=r.meta();n.isRelationship&&"belongsTo"===n.kind&&(Ember.addObserver(e,t,null,"belongsToDidChange"),Ember.addBeforeObserver(e,t,null,"belongsToWillChange")),n.isAttribute&&(Ember.addObserver(e,t,null,"attributeDidChange"),Ember.addBeforeObserver(e,t,null,"attributeWillChange")),n.parentType=e.constructor}}}),DS.Model.reopenClass({typeForRelationship:function(t){var r=e(this,"relationshipsByName").get(t);return r&&r.type},inverseFor:function(t){function r(t,n,i){i=i||[];var a=e(n,"relationships");if(a){var o=a.get(t);return o&&i.push.apply(i,a.get(t)),t.superclass&&r(t.superclass,n,i),i}}var n=this.typeForRelationship(t);if(!n)return null;var i,a,o=this.metaForProperty(t).options;if(o.inverse)i=o.inverse,a=Ember.get(n,"relationshipsByName").get(i).kind;else{var s=r(this,n);if(0===s.length)return null;i=s[0].name,a=s[0].kind}return{type:n,name:i,kind:a}},relationships:Ember.computed(function(){var e=new Ember.MapWithDefault({defaultValue:function(){return[]}});return this.eachComputedProperty(function(t,r){if(r.isRelationship){"string"==typeof r.type&&(r.type=Ember.get(Ember.lookup,r.type));var n=e.get(r.type);n.push({name:t,kind:r.kind})}}),e}),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};return this.eachComputedProperty(function(t,r){r.isRelationship&&e[r.kind].push(t)}),e}),relatedTypes:Ember.computed(function(){var t,r=Ember.A([]);return this.eachComputedProperty(function(n,i){i.isRelationship&&(t=i.type,"string"==typeof t&&(t=e(this,t,!1)||e(Ember.lookup,t)),r.contains(t)||r.push(t))}),r}),relationshipsByName:Ember.computed(function(){var t,r=Ember.Map.create();return this.eachComputedProperty(function(n,i){i.isRelationship&&(i.key=n,t=i.type,"string"==typeof t&&(t=e(this,t,!1)||e(Ember.lookup,t),i.type=t),r.set(n,i))}),r}),fields:Ember.computed(function(){var e=Ember.Map.create();return this.eachComputedProperty(function(t,r){r.isRelationship?e.set(t,r.kind):r.isAttribute&&e.set(t,"attribute")}),e}),eachRelationship:function(t,r){e(this,"relationshipsByName").forEach(function(e,n){t.call(r,e,n)})},eachRelatedType:function(t,r){e(this,"relatedTypes").forEach(function(e){t.call(r,e)})}}),DS.Model.reopen({eachRelationship:function(e,t){this.constructor.eachRelationship(e,t)}})}(),function(){var e=Ember.get;Ember.set;var t=Ember.run.once,r=Ember.EnumerableUtils.forEach;DS.RecordArrayManager=Ember.Object.extend({init:function(){this.filteredRecordArrays=Ember.MapWithDefault.create({defaultValue:function(){return[]}}),this.changedReferences=[]},referenceDidChange:function(e){this.changedReferences.push(e),t(this,this.updateRecordArrays)},recordArraysForReference:function(e){return e.recordArrays=e.recordArrays||Ember.OrderedSet.create(),e.recordArrays},updateRecordArrays:function(){r(this.changedReferences,function(t){var n,i=t.type,a=this.filteredRecordArrays.get(i);r(a,function(r){n=e(r,"filterFunction"),this.updateRecordArray(r,n,i,t)},this);var o=t.loadingRecordArrays;if(o){for(var s=0,c=o.length;c>s;s++)o[s].loadedRecord();t.loadingRecordArrays=[]}},this),this.changedReferences=[]},updateRecordArray:function(e,t,r,n){var i,a;t?(a=this.store.recordForReference(n),i=t(a)):i=!0;var o=this.recordArraysForReference(n);i?(o.add(e),e.addReference(n)):i||(o.remove(e),e.removeReference(n))},remove:function(t){var r=e(t,"_reference"),n=r.recordArrays||[];n.forEach(function(e){e.removeReference(r)})},updateFilter:function(t,r,n){for(var i,a,o,s,c=this.store.typeMapFor(r),d=c.references,u=0,h=d.length;h>u;u++)i=d[u],o=!1,a=i.data,"object"==typeof a&&((s=i.record)?e(s,"isDeleted")||(o=!0):o=!0,o&&this.updateRecordArray(t,n,r,i))},createManyArray:function(e,t){var r=DS.ManyArray.create({type:e,content:t,store:this.store});return t.forEach(function(e){var t=this.recordArraysForReference(e);t.add(r)},this),r},registerFilteredRecordArray:function(e,t,r){var n=this.filteredRecordArrays.get(t);n.push(e),this.updateFilter(e,t,r)},registerWaitingRecordArray:function(e,t){var r=t.loadingRecordArrays||[];r.push(e),t.loadingRecordArrays=r}})}(),function(){function e(e){return function(){throw new Ember.Error("Your serializer "+this.toString()+" does not implement the required method "+e)}}var t=Ember.get,r=(Ember.set,Ember.ArrayPolyfills.map),n=Ember.isNone;DS.Serializer=Ember.Object.extend({init:function(){this.mappings=Ember.Map.create(),this.aliases=Ember.Map.create(),this.configurations=Ember.Map.create(),this.globalConfigurations={}},extract:e("extract"),extractMany:e("extractMany"),extractId:e("extractId"),extractAttribute:e("extractAttribute"),extractHasMany:e("extractHasMany"),extractBelongsTo:e("extractBelongsTo"),extractRecordRepresentation:function(e,t,r,i){var a,o={};return a=i?e.sideload(t,r):e.load(t,r),this.eachEmbeddedHasMany(t,function(t,i){var s=this.extractEmbeddedData(r,this.keyFor(i));n(s)||this.extractEmbeddedHasMany(e,i,s,a,o)},this),this.eachEmbeddedBelongsTo(t,function(t,i){var s=this.extractEmbeddedData(r,this.keyFor(i));n(s)||this.extractEmbeddedBelongsTo(e,i,s,a,o)},this),e.prematerialize(a,o),a},extractEmbeddedHasMany:function(e,t,n,i,a){var o=r.call(n,function(r){if(r){var n=this.extractEmbeddedType(t,r),a=this.extractRecordRepresentation(e,n,r,!0),o=this.embeddedType(i.type,t.key);"always"===o&&(a.parent=i);var s=t.parentType,c=s.inverseFor(t.key);if(c){var d=c.name;a.prematerialized[d]=i}return a}},this);a[t.key]=o},extractEmbeddedBelongsTo:function(e,t,r,n,i){var a=this.extractEmbeddedType(t,r),o=this.extractRecordRepresentation(e,a,r,!0);i[t.key]=o;var s=this.embeddedType(n.type,t.key);"always"===s&&(o.parent=n)},extractEmbeddedType:function(e){return e.type},extractEmbeddedData:e(),serialize:function(e,r){r=r||{};var n,i=this.createSerializedForm();return r.includeId&&(n=t(e,"id"))&&this._addId(i,e.constructor,n),r.includeType&&this.addType(i,e.constructor),this.addAttributes(i,e),this.addRelationships(i,e),i},serializeValue:function(e,t){var r=this.transforms?this.transforms[t]:null;return r.serialize(e)},serializeId:function(e){return isNaN(e)?e:+e},addAttributes:function(e,t){t.eachAttribute(function(r,n){this._addAttribute(e,t,r,n.type)},this)},addAttribute:e("addAttribute"),addId:e("addId"),addType:Ember.K,createSerializedForm:function(){return{}},addRelationships:function(e,t){t.eachRelationship(function(r,n){"belongsTo"===n.kind?this._addBelongsTo(e,t,r,n):"hasMany"===n.kind&&this._addHasMany(e,t,r,n)},this)},addBelongsTo:e("addBelongsTo"),addHasMany:e("addHasMany"),keyForAttributeName:function(e,t){return t},primaryKey:function(){return"id"},keyForBelongsTo:function(e,t){return this.keyForAttributeName(e,t)},keyForHasMany:function(e,t){return this.keyForAttributeName(e,t)},materialize:function(e,r,n){var i;Ember.isNone(t(e,"id"))&&(i=n&&n.hasOwnProperty("id")?n.id:this.extractId(e.constructor,r),e.materializeId(i)),this.materializeAttributes(e,r,n),this.materializeRelationships(e,r,n)},deserializeValue:function(e,t){var r=this.transforms?this.transforms[t]:null;return r.deserialize(e)},materializeAttributes:function(e,t,r){e.eachAttribute(function(n,i){r&&r.hasOwnProperty(n)?e.materializeAttribute(n,r[n]):this.materializeAttribute(e,t,n,i.type)},this)},materializeAttribute:function(e,t,r,n){var i=this.extractAttribute(e.constructor,t,r);i=this.deserializeValue(i,n),e.materializeAttribute(r,i)},materializeRelationships:function(e,t,r){e.eachRelationship(function(n,i){if("hasMany"===i.kind)if(r&&r.hasOwnProperty(n)){var a=this._convertPrematerializedHasMany(i.type,r[n]);e.materializeHasMany(n,a)}else this.materializeHasMany(n,e,t,i,r);else if("belongsTo"===i.kind)if(r&&r.hasOwnProperty(n)){var o=this._convertTuple(i.type,r[n]);e.materializeBelongsTo(n,o)}else this.materializeBelongsTo(n,e,t,i,r)},this)},materializeHasMany:function(e,t,r,n){var i=t.constructor,a=this._keyForHasMany(i,n.key),o=this.extractHasMany(i,r,a),s=o;o&&Ember.isArray(o)&&(s=this._convertTuples(n.type,o)),t.materializeHasMany(e,s)},materializeBelongsTo:function(e,t,r,i){var a,o=t.constructor,s=this._keyForBelongsTo(o,i.key),c=null;a=i.options&&i.options.polymorphic?this.extractBelongsToPolymorphic(o,r,s):this.extractBelongsTo(o,r,s),n(a)||(c=this._convertTuple(i.type,a)),t.materializeBelongsTo(e,c)},_convertPrematerializedHasMany:function(e,t){var r;return r="string"==typeof t?t:this._convertTuples(e,t)},_convertTuples:function(e,t){return r.call(t,function(t){return this._convertTuple(e,t)},this)},_convertTuple:function(e,t){var r;return"object"==typeof t?DS.Model.detect(t.type)?t:(r=this.typeFromAlias(t.type),{id:t.id,type:r}):{id:t,type:e}},_primaryKey:function(e){var t=this.configurationForType(e),r=t&&t.primaryKey;return r?r:this.primaryKey(e)},_addAttribute:function(e,r,n,i){var a=this._keyForAttributeName(r.constructor,n),o=t(r,n);this.addAttribute(e,a,this.serializeValue(o,i))},_addId:function(e,t,r){var n=this._primaryKey(t);this.addId(e,n,this.serializeId(r))},_keyForAttributeName:function(e,t){return this._keyFromMappingOrHook("keyForAttributeName",e,t)},_keyForBelongsTo:function(e,t){return this._keyFromMappingOrHook("keyForBelongsTo",e,t)},keyFor:function(e){var t=e.parentType,r=e.key;switch(e.kind){case"belongsTo":return this._keyForBelongsTo(t,r);case"hasMany":return this._keyForHasMany(t,r)}},_keyForHasMany:function(e,t){return this._keyFromMappingOrHook("keyForHasMany",e,t)},_addBelongsTo:function(e,t,r,n){var i=this._keyForBelongsTo(t.constructor,r);this.addBelongsTo(e,t,i,n)},_addHasMany:function(e,t,r,n){var i=this._keyForHasMany(t.constructor,r);this.addHasMany(e,t,i,n)},_keyFromMappingOrHook:function(e,t,r){var n=this.mappingOption(t,r,"key");return n?n:this[e](t,r)},registerTransform:function(e,t){this.transforms[e]=t},registerEnumTransform:function(e,t){var r={deserialize:function(e){return Ember.A(t).objectAt(e)},serialize:function(e){return Ember.EnumerableUtils.indexOf(t,e)},values:t};this.registerTransform(e,r)},map:function(e,t){this.mappings.set(e,t)},configure:function(e,t){if(e&&!t)return Ember.merge(this.globalConfigurations,e),void 0;var r,n;t.alias&&(n=t.alias,this.aliases.set(n,e),delete t.alias),r=Ember.create(this.globalConfigurations),Ember.merge(r,t),this.configurations.set(e,r)},typeFromAlias:function(e){return this._completeAliases(),this.aliases.get(e)},mappingForType:function(e){return this._reifyMappings(),this.mappings.get(e)||{}},configurationForType:function(e){return this._reifyConfigurations(),this.configurations.get(e)||this.globalConfigurations},_completeAliases:function(){this._pluralizeAliases(),this._reifyAliases()},_pluralizeAliases:function(){if(!this._didPluralizeAliases){var e,t=this.aliases,r=this.aliases.sideloadMapping,n=this;t.forEach(function(r,i){e=n.pluralize(r),t.set(e,i)}),r&&(r.forEach(function(e,r){t.set(e,r)}),delete this.aliases.sideloadMapping),this._didPluralizeAliases=!0}},_reifyAliases:function(){if(!this._didReifyAliases){var e,t=this.aliases,r=Ember.Map.create();t.forEach(function(t,n){"string"==typeof n?(e=Ember.get(Ember.lookup,n),r.set(t,e)):r.set(t,n)}),this.aliases=r,this._didReifyAliases=!0}},_reifyMappings:function(){if(!this._didReifyMappings){var e=this.mappings,t=Ember.Map.create();e.forEach(function(e,r){if("string"==typeof e){var n=Ember.get(Ember.lookup,e);t.set(n,r)}else t.set(e,r)}),this.mappings=t,this._didReifyMappings=!0}},_reifyConfigurations:function(){if(!this._didReifyConfigurations){var e=this.configurations,t=Ember.Map.create();e.forEach(function(e,r){if("string"==typeof e&&"plurals"!==e){var n=Ember.get(Ember.lookup,e);t.set(n,r)}else t.set(e,r)}),this.configurations=t,this._didReifyConfigurations=!0}},mappingOption:function(e,t,r){var n=this.mappingForType(e)[t];return n&&n[r]},configOption:function(e,t){var r=this.configurationForType(e);return r[t]},embeddedType:function(e,t){return this.mappingOption(e,t,"embedded")},eachEmbeddedRecord:function(e,t,r){this.eachEmbeddedBelongsToRecord(e,t,r),this.eachEmbeddedHasManyRecord(e,t,r)},eachEmbeddedBelongsToRecord:function(e,r,n){this.eachEmbeddedBelongsTo(e.constructor,function(i,a,o){var s=t(e,i);s&&r.call(n,s,o)})},eachEmbeddedHasManyRecord:function(e,r,n){this.eachEmbeddedHasMany(e.constructor,function(i,a,o){for(var s=t(e,i),c=0,d=t(s,"length");d>c;c++)r.call(n,s.objectAt(c),o)})},eachEmbeddedHasMany:function(e,t,r){this.eachEmbeddedRelationship(e,"hasMany",t,r)},eachEmbeddedBelongsTo:function(e,t,r){this.eachEmbeddedRelationship(e,"belongsTo",t,r)},eachEmbeddedRelationship:function(e,t,r,n){e.eachRelationship(function(i,a){var o=this.embeddedType(e,i);o&&a.kind===t&&r.call(n,i,a,o)},this)},pluralize:function(e){var t=this.configurations.get("plurals");return t&&t[e]||e+"s"},singularize:function(e){var t=this.configurations.get("plurals");if(t)for(var r in t)if(t[r]===e)return r;return e.lastIndexOf("s")===e.length-1?e.substring(0,e.length-1):e}})}(),function(){var e=Ember.isNone,t=Ember.isEmpty;DS.JSONTransforms={string:{deserialize:function(t){return e(t)?null:String(t)},serialize:function(t){return e(t)?null:String(t)}},number:{deserialize:function(e){return t(e)?null:Number(e)},serialize:function(e){return t(e)?null:Number(e)}},"boolean":{deserialize:function(e){var t=typeof e;return"boolean"===t?e:"string"===t?null!==e.match(/^true$|^t$|^1$/i):"number"===t?1===e:!1},serialize:function(e){return Boolean(e)}},date:{deserialize:function(e){var t=typeof e;return"string"===t?new Date(Ember.Date.parse(e)):"number"===t?new Date(e):null===e||void 0===e?e:null},serialize:function(e){if(e instanceof Date){var t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],n=function(e){return 10>e?"0"+e:""+e},i=e.getUTCFullYear(),a=e.getUTCMonth(),o=e.getUTCDate(),s=e.getUTCDay(),c=e.getUTCHours(),d=e.getUTCMinutes(),u=e.getUTCSeconds(),h=t[s],l=n(o),f=r[a];return h+", "+l+" "+f+" "+i+" "+n(c)+":"+n(d)+":"+n(u)+" GMT"}return null}}}}(),function(){var e=Ember.get;Ember.set,DS.JSONSerializer=DS.Serializer.extend({init:function(){this._super(),e(this,"transforms")||this.set("transforms",DS.JSONTransforms),this.sideloadMapping=Ember.Map.create(),this.metadataMapping=Ember.Map.create(),this.configure({meta:"meta",since:"since"})},configure:function(t,r){var n;if(t&&!r){for(n in t)this.metadataMapping.set(e(t,n),n);return this._super(t)}var i,a=r.sideloadAs;a&&(i=this.aliases.sideloadMapping||Ember.Map.create(),i.set(a,t),this.aliases.sideloadMapping=i,delete r.sideloadAs),this._super.apply(this,arguments)},addId:function(e,t,r){e[t]=r},addAttribute:function(e,t,r){e[t]=r},extractAttribute:function(e,t,r){var n=this._keyForAttributeName(e,r);return t[n]},extractId:function(e,t){var r=this._primaryKey(e);return t.hasOwnProperty(r)?t[r]+"":null},extractEmbeddedData:function(e,t){return e[t]},extractHasMany:function(e,t,r){return t[r]},extractBelongsTo:function(e,t,r){return t[r]},extractBelongsToPolymorphic:function(e,t,r){var n,i=this.keyForPolymorphicId(r),a=t[i];return a?(n=this.keyForPolymorphicType(r),{id:a,type:t[n]}):null},addBelongsTo:function(t,r,n,i){var a,o,s,c=r.constructor,d=i.key,u=null,h=i.options&&i.options.polymorphic;this.embeddedType(c,d)?((a=e(r,d))&&(u=this.serialize(a,{includeId:!0,includeType:h})),t[n]=u):(o=e(r,i.key),s=e(o,"id"),i.options&&i.options.polymorphic&&!Ember.isNone(s)?this.addBelongsToPolymorphic(t,n,s,o.constructor):t[n]=void 0===s?null:this.serializeId(s))},addBelongsToPolymorphic:function(e,t,r,n){var i=this.keyForPolymorphicId(t),a=this.keyForPolymorphicType(t);e[i]=r,e[a]=this.rootForType(n)},addHasMany:function(t,r,n,i){var a,o,s=r.constructor,c=i.key,d=[],u=i.options&&i.options.polymorphic;o=this.embeddedType(s,c),"always"===o&&(a=e(r,c),a.forEach(function(e){d.push(this.serialize(e,{includeId:!0,includeType:u}))},this),t[n]=d)},addType:function(e,t){var r=this.keyForEmbeddedType();e[r]=this.rootForType(t)},extract:function(e,t,r,n){var i=this.rootForType(r);this.sideload(e,r,t,i),this.extractMeta(e,r,t),t[i]&&(n&&e.updateId(n,t[i]),this.extractRecordRepresentation(e,r,t[i]))},extractMany:function(e,t,r,n){var i=this.rootForType(r);if(i=this.pluralize(i),this.sideload(e,r,t,i),this.extractMeta(e,r,t),t[i]){var a=t[i],o=[];n&&(n=n.toArray());for(var s=0;sd;d++)"exports"===a[d]?s.push(c={}):s.push(t(a[d]));var h=o.apply(this,s);return n[e]=c||h}}(),function(){window.DS=Ember.Namespace.create({VERSION:"0.13"})}(),function(){Ember.set,Ember.onLoad("Ember.Application",function(e){e.initializer({name:"store",initialize:function(e,t){t.register("store:main",t.Store),e.lookup("store:main")}}),e.initializer({name:"injectStore",initialize:function(e,t){t.inject("controller","store","store:main"),t.inject("route","store","store:main")}})})}(),function(){Ember.Date=Ember.Date||{};var e=Date.parse,t=[1,4,5,6,7,10,11];Ember.Date.parse=function(r){var n,i,a=0;if(i=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(r)){for(var o,s=0;o=t[s];++s)i[o]=+i[o]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,"Z"!==i[8]&&void 0!==i[9]&&(a=60*i[10]+i[11],"+"===i[9]&&(a=0-a)),n=Date.UTC(i[1],i[2],i[3],i[4],i[5]+a,i[6],i[7])}else n=e?e(r):0/0;return n},(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Date)&&(Date.parse=Ember.Date.parse)}(),function(){var e=Ember.Evented,t=Ember.DeferredMixin,r=(Ember.run,Ember.get),n=Ember.Mixin.create(e,t,{init:function(){this._super.apply(this,arguments),this.one("didLoad",this,function(){this.resolve(this)}),this.one("becameError",this,function(){this.reject(this)}),r(this,"isLoaded")&&this.trigger("didLoad")}});DS.LoadPromise=n}(),function(){var e=Ember.get;Ember.set;var t=DS.LoadPromise;DS.RecordArray=Ember.ArrayProxy.extend(t,{type:null,content:null,isLoaded:!1,isUpdating:!1,store:null,objectAtContent:function(t){var r=e(this,"content"),n=r.objectAt(t),i=e(this,"store");return n?i.recordForReference(n):void 0},materializedObjectAt:function(t){var r=e(this,"content").objectAt(t);if(r)return e(this,"store").recordIsMaterialized(r)?this.objectAt(t):void 0},update:function(){if(!e(this,"isUpdating")){var t=e(this,"store"),r=e(this,"type");t.fetchAll(r,this)}},addReference:function(t){e(this,"content").addObject(t)},removeReference:function(t){e(this,"content").removeObject(t)}})}(),function(){var e=Ember.get;DS.FilteredRecordArray=DS.RecordArray.extend({filterFunction:null,isLoaded:!0,replace:function(){var t=e(this,"type").toString();throw new Error("The result of a client-side filter (on "+t+") is immutable.")},updateFilter:Ember.observer(function(){var t=e(this,"manager");t.updateFilter(this,e(this,"type"),e(this,"filterFunction"))},"filterFunction")})}(),function(){var e=Ember.get;Ember.set,DS.AdapterPopulatedRecordArray=DS.RecordArray.extend({query:null,replace:function(){var t=e(this,"type").toString();throw new Error("The result of a server query (on "+t+") is immutable.")},load:function(e){this.setProperties({content:Ember.A(e),isLoaded:!0}),Ember.run.once(this,"trigger","didLoad")}})}(),function(){var e=Ember.get,t=Ember.set,r=Ember.EnumerableUtils.map;DS.ManyArray=DS.RecordArray.extend({init:function(){this._super.apply(this,arguments),this._changesToSync=Ember.OrderedSet.create()},owner:null,isPolymorphic:!1,isLoaded:!1,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--,0===this.loadingRecordsCount&&(t(this,"isLoaded",!0),this.trigger("didLoad"))},fetch:function(){var t=e(this,"content"),r=e(this,"store"),n=e(this,"owner");r.fetchUnloadedReferences(t,n)},replaceContent:function(t,n,i){i=r(i,function(t){return e(t,"_reference")},this),this._super(t,n,i)},arrangedContentDidChange:function(){this.fetch()},arrayContentWillChange:function(t,r){var n=e(this,"owner"),i=e(this,"name");if(!n._suspendedRelationships)for(var a=t;t+r>a;a++){var o=e(this,"content").objectAt(a),s=DS.RelationshipChange.createChange(n.get("_reference"),o,e(this,"store"),{parentType:n.constructor,changeType:"remove",kind:"hasMany",key:i});this._changesToSync.add(s)}return this._super.apply(this,arguments)},arrayContentDidChange:function(t,r,n){this._super.apply(this,arguments);var i=e(this,"owner"),a=e(this,"name"),o=e(this,"store");if(!i._suspendedRelationships){for(var s=t;t+n>s;s++){var c=e(this,"content").objectAt(s),d=DS.RelationshipChange.createChange(i.get("_reference"),c,o,{parentType:i.constructor,changeType:"add",kind:"hasMany",key:a});d.hasManyName=a,this._changesToSync.add(d)}this._changesToSync.forEach(function(e){e.sync()}),DS.OneToManyChange.ensureSameTransaction(this._changesToSync,o),this._changesToSync.clear()}},createRecord:function(t,r){var n,i=e(this,"owner"),a=e(i,"store"),o=e(this,"type");return r=r||e(i,"transaction"),n=a.createRecord.call(a,o,t,r),this.pushObject(n),n}})}(),function(){var e=Ember.get,t=Ember.set,r=Ember.EnumerableUtils.forEach;DS.Transaction=Ember.Object.extend({init:function(){t(this,"records",Ember.OrderedSet.create())},createRecord:function(t,r){var n=e(this,"store");return n.createRecord(t,r,this)},isEqualOrDefault:function(t){return this===t||t===e(this,"store.defaultTransaction")?!0:void 0},isDefault:Ember.computed(function(){return this===e(this,"store.defaultTransaction")}).volatile(),add:function(t){var r=e(this,"store"),n=e(r,"_adapter"),i=e(n,"serializer");i.eachEmbeddedRecord(t,function(e,t){"load"!==t&&this.add(e)},this),this.adoptRecord(t)},relationships:Ember.computed(function(){var t=Ember.OrderedSet.create(),n=e(this,"records"),i=e(this,"store");return r(n,function(r){for(var n=e(r,"_reference"),a=i.relationshipChangesFor(n),o=0;or;r++){var i=e[r];i.data===s&&(t.push(i),i.data=c)}return t},fetchUnloadedReferences:function(e,t){var r=this.unloadedReferences(e);this.fetchMany(r,t)},fetchMany:function(e,t){if(e.length){var r=Ember.MapWithDefault.create({defaultValue:function(){return Ember.A()}});i(e,function(e){r.get(e.type).push(e)}),i(r,function(e){var n=r.get(e),i=o(n,function(e){return e.id}),a=this.adapterForType(e);a.findMany(this,e,i,t)},this)}},hasReferenceForId:function(e,t){return t=h(t),!!this.typeMapFor(e).idToReference[t]},referenceForId:function(e,t){t=h(t);var r=this.typeMapFor(e).idToReference[t];return r||(r=this.createReference(e,t),r.data=s),r},findMany:function(e,t,r,i){if(!Ember.isArray(t)){var a=this.adapterForType(e);return a&&a.findHasMany?a.findHasMany(this,r,i,t):!n(t),this.recordArrayManager.createManyArray(e,Ember.A())}var s,c,d,u=o(t,function(t){return"object"!=typeof t&&null!==t?this.referenceForId(e,t):t},this),h=this.unloadedReferences(u),l=this.recordArrayManager.createManyArray(e,Ember.A(u));if(l.loadingRecordsCount(h.length),h.length){for(c=0,d=h.length;d>c;c++)s=h[c],this.recordArrayManager.registerWaitingRecordArray(l,s);this.fetchMany(h,r)}else l.set("isLoaded",!0),Ember.run.once(function(){l.trigger("didLoad")});return l},findQuery:function(e,t){var r=DS.AdapterPopulatedRecordArray.create({type:e,query:t,content:Ember.A([]),store:this}),n=this.adapterForType(e);return n.findQuery(this,e,t,r),r},findAll:function(e){return this.fetchAll(e,this.all(e))},fetchAll:function(e,r){var n=this.adapterForType(e),i=this.typeMapFor(e).metadata.since;return t(r,"isUpdating",!0),n.findAll(this,e,i),r},metaForType:function(e,r,n){var i=this.typeMapFor(e).metadata;t(i,r,n)},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;t(r,"isUpdating",!1)},all:function(e){var t=this.typeMapFor(e),r=t.findAllCache;if(r)return r;var n=DS.RecordArray.create({type:e,content:Ember.A([]),store:this,isLoaded:!0});return this.recordArrayManager.registerFilteredRecordArray(n,e),t.findAllCache=n,n},filter:function(e,t,r){3===arguments.length?this.findQuery(e,t):2===arguments.length&&(r=t);var n=DS.FilteredRecordArray.create({type:e,content:Ember.A([]),store:this,manager:this.recordArrayManager,filterFunction:r});return this.recordArrayManager.registerFilteredRecordArray(n,e,r),n},recordIsLoaded:function(e,t){return this.hasReferenceForId(e,t)?"object"==typeof this.referenceForId(e,t).data:!1},dataWasUpdated:function(t,r,n){e(n,"isDeleted")||"object"==typeof r.data&&this.recordArrayManager.referenceDidChange(r)},save:function(){r(this,"commitDefaultTransaction")},commit:Ember.aliasMethod("save"),commitDefaultTransaction:function(){e(this,"defaultTransaction").commit()},scheduleSave:function(t){e(this,"currentTransaction").add(t),r(this,"flushSavedRecords")},flushSavedRecords:function(){e(this,"currentTransaction").commit(),t(this,"currentTransaction",this.transaction())},didSaveRecord:function(e,t){t?(this.updateId(e,t),this.updateRecordData(e,t)):this.didUpdateAttributes(e),e.adapterDidCommit()},didSaveRecords:function(e,t){var r=0;i(e,function(e){this.didSaveRecord(e,t&&t[r++])},this)},recordWasInvalid:function(e,t){e.adapterDidInvalidate(t)},recordWasError:function(e){e.adapterDidError()},didUpdateAttribute:function(e,t,r){e.adapterDidUpdateAttribute(t,r)},didUpdateAttributes:function(e){e.eachAttribute(function(t){this.didUpdateAttribute(e,t)},this)},didUpdateRelationship:function(t,r){var n=e(t,"_reference").clientId,i=this.relationshipChangeFor(n,r);i&&i.adapterDidUpdate()},didUpdateRelationships:function(t){var r=this.relationshipChangesFor(e(t,"_reference"));for(var n in r)r.hasOwnProperty(n)&&r[n].adapterDidUpdate()},didReceiveId:function(t,r){var n=this.typeMapFor(t.constructor),i=e(t,"clientId");e(t,"id"),n.idToCid[r]=i,this.clientIdToId[i]=r},updateRecordData:function(t,r){e(t,"_reference").data=r,t.didChangeData()},updateId:function(t,r){var n=t.constructor,i=this.typeMapFor(n),a=e(t,"_reference"),o=(e(t,"id"),this.preprocessData(n,r));i.idToReference[o]=a,a.id=o},preprocessData:function(e,t){return this.adapterForType(e).extractId(e,t)},typeMapFor:function(t){var r,n=e(this,"typeMaps"),i=Ember.guidFor(t);return(r=n[i])?r:(r={idToReference:{},references:[],metadata:{}},n[i]=r,r)},load:function(e,t,n){var i;("number"==typeof t||"string"==typeof t)&&(i=t,t=n,n=null),n&&n.id?i=n.id:void 0===i&&(i=this.preprocessData(e,t)),i=h(i);var a=this.referenceForId(e,i);return a.record&&r(a.record,"loadedData"),a.data=t,a.prematerialized=n,this.recordArrayManager.referenceDidChange(a),a},loadMany:function(e,t,r){return void 0===r&&(r=t,t=o(r,function(t){return this.preprocessData(e,t)},this)),o(t,function(t,n){return this.load(e,t,r[n])},this)},loadHasMany:function(e,r,n){var i=e.get(r+".type"),a=o(n,function(e){return{id:e,type:i}});e.materializeHasMany(r,a),e.hasManyDidChange(r);var s=e.cacheFor(r);s&&(t(s,"isLoaded",!0),s.trigger("didLoad"))},createReference:function(e,t){var r=this.typeMapFor(e),n=r.idToReference,i={id:t,clientId:this.clientIdCounter++,type:e};return t&&(n[t]=i),r.references.push(i),i},materializeRecord:function(t){var r=t.type._create({id:t.id,store:this,_reference:t});return t.record=r,e(this,"defaultTransaction").adoptRecord(r),r.loadingData(),"object"==typeof t.data&&r.loadedData(),r},dematerializeRecord:function(t){var r=e(t,"_reference"),n=r.type,i=r.id,o=this.typeMapFor(n);t.updateRecordArrays(),i&&delete o.idToReference[i];var s=a(o.references,r);o.references.splice(s,1)},willDestroy:function(){e(DS,"defaultStore")===this&&t(DS,"defaultStore",null)},addRelationshipChangeFor:function(e,t,r,n,i){var a=e.clientId,o=r?r.clientId:r,s=t+n,c=this.relationshipChanges;a in c||(c[a]={}),o in c[a]||(c[a][o]={}),s in c[a][o]||(c[a][o][s]={}),c[a][o][s][i.changeType]=i},removeRelationshipChangeFor:function(e,t,r,n,i){var a=e.clientId,o=r?r.clientId:r,s=this.relationshipChanges,c=t+n;a in s&&o in s[a]&&c in s[a][o]&&delete s[a][o][c][i]},relationshipChangeFor:function(e,t,r,n,i){var a=e.clientId,o=r?r.clientId:r,s=this.relationshipChanges,c=t+n;return a in s&&o in s[a]?i?s[a][o][c][i]:s[a][o][c].add||s[a][o][c].remove:void 0},relationshipChangePairsFor:function(e){var t=[];if(!e)return t;var r=this.relationshipChanges[e.clientId];for(var n in r)if(r.hasOwnProperty(n))for(var i in r[n])r[n].hasOwnProperty(i)&&t.push(r[n][i]);return t},relationshipChangesFor:function(e){var t=[];if(!e)return t;var r=this.relationshipChangePairsFor(e);return i(r,function(e){var r=e.add,n=e.remove;r&&t.push(r),n&&t.push(n)}),t},adapterForType:function(e){this._adaptersMap=this.createInstanceMapFor("adapters");var t=this._adaptersMap.get(e);return t?t:this.get("_adapter")},recordAttributeDidChange:function(e,t,r,n){var i=e.record,a=new Ember.OrderedSet,o=this.adapterForType(i.constructor);o.dirtyRecordsForAttributeChange&&o.dirtyRecordsForAttributeChange(a,i,t,r,n),a.forEach(function(e){e.adapterDidDirty()})},recordBelongsToDidChange:function(e,t,r){var n=this.adapterForType(t.constructor);n.dirtyRecordsForBelongsToChange&&n.dirtyRecordsForBelongsToChange(e,t,r)},recordHasManyDidChange:function(e,t,r){var n=this.adapterForType(t.constructor);n.dirtyRecordsForHasManyChange&&n.dirtyRecordsForHasManyChange(e,t,r)}}),DS.Store.reopenClass({registerAdapter:DS._Mappable.generateMapFunctionFor("adapters",function(e,t,r){r.set(e,t)}),transformMapKey:function(t){if("string"==typeof t){var r;return r=e(Ember.lookup,t)}return t},transformMapValue:function(e,t){return Ember.Object.detect(t)?t.create():t}})}(),function(){function e(t){var r,n={};for(var i in t)r=t[i],n[i]=r&&"object"==typeof r?e(r):r;return n}function t(e,t){for(var r in t)e[r]=t[r];return e}function r(r){var n=e(h);return t(n,r)}function n(e,r,i){e=t(r?Ember.create(r):{},e),e.parentState=r,e.stateName=i;for(var a in e)e.hasOwnProperty(a)&&"parentState"!==a&&"stateName"!==a&&"object"==typeof e[a]&&(e[a]=n(e[a],e,i+"."+a));return e}var i=Ember.get,a=Ember.set,o=Ember.run.once;Ember.ArrayPolyfills.map;var s=function(e){var t,r,n,i=Ember.keys(e);for(t=0,r=i.length;r>t;t++)if(n=i[t],e.hasOwnProperty(n)&&e[n])return!0;return!1},c=function(e){e.materializeData()},d=function(e,t){t.oldValue=i(e,t.name);var r=DS.AttributeChange.createChange(t);e._changesToSync[t.name]=r},u=function(e,t){var r=e._changesToSync[t.name];r.value=i(e,t.name),r.sync()},h={initialState:"uncommitted",isDirty:!0,uncommitted:{willSetProperty:d,didSetProperty:u,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},becameClean:function(e){e.withTransaction(function(t){t.remove(e)}),e.transitionTo("loaded.materializing")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollback()}},inFlight:{isSaving:!0,enter:function(e){e.becameInFlight()},materializingData:function(e){a(e,"lastDirtyType",i(this,"dirtyType")),e.transitionTo("materializing")},didCommit:function(e){var t=i(this,"dirtyType");e.withTransaction(function(t){t.remove(e)}),e.transitionTo("saved"),e.send("invokeLifecycleCallbacks",t)},didChangeData:c,becameInvalid:function(e,t){a(e,"errors",t),e.transitionTo("invalid"),e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("error"),e.send("invokeLifecycleCallbacks")}},invalid:{isValid:!1,exit:function(e){e.withTransaction(function(t){t.remove(e)})},deleteRecord:function(e){e.transitionTo("deleted.uncommitted"),e.clearRelationships()},willSetProperty:d,didSetProperty:function(e,t){var r=i(e,"errors"),n=t.name;a(r,n,null),s(r)||e.send("becameValid"),u(e,t)},becomeDirty:Ember.K,rollback:function(e){e.send("becameValid"),e.send("rollback")},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.trigger("becameInvalid",e)}}},l=r({dirtyType:"created",isNew:!0}),f=r({dirtyType:"updated"});l.uncommitted.deleteRecord=function(e){e.clearRelationships(),e.transitionTo("deleted.saved")},l.uncommitted.rollback=function(e){h.uncommitted.rollback.apply(this,arguments),e.transitionTo("deleted.saved")},f.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted"),e.clearRelationships()};var p={isLoading:!1,isLoaded:!1,isReloading:!1,isDirty:!1,isSaving:!1,isDeleted:!1,isError:!1,isNew:!1,isValid:!0,empty:{loadingData:function(e){e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created.uncommitted")}},loading:{isLoading:!0,loadedData:c,materializingData:function(e){e.transitionTo("loaded.materializing.firstTime")},becameError:function(e){e.transitionTo("error"),e.send("invokeLifecycleCallbacks")}},loaded:{initialState:"saved",isLoaded:!0,materializing:{willSetProperty:Ember.K,didSetProperty:Ember.K,didChangeData:c,finishedMaterializing:function(e){e.transitionTo("loaded.saved")},firstTime:{isLoaded:!1,exit:function(e){o(function(){e.trigger("didLoad")})}}},reloading:{isReloading:!0,enter:function(e){var t=i(e,"store");t.reloadRecord(e)},exit:function(e){o(e,"trigger","didReload")},loadedData:c,materializingData:function(e){e.transitionTo("loaded.materializing")}},saved:{willSetProperty:d,didSetProperty:u,didChangeData:c,loadedData:c,reloadRecord:function(e){e.transitionTo("loaded.reloading")},materializingData:function(e){e.transitionTo("loaded.materializing")},becomeDirty:function(e){e.transitionTo("updated.uncommitted")},deleteRecord:function(e){e.transitionTo("deleted.uncommitted"),e.clearRelationships()},unloadRecord:function(e){e.clearRelationships(),e.transitionTo("deleted.saved")},didCommit:function(e){e.withTransaction(function(t){t.remove(e)}),e.send("invokeLifecycleCallbacks",i(e,"lastDirtyType"))},invokeLifecycleCallbacks:function(e,t){"created"===t?e.trigger("didCreate",e):e.trigger("didUpdate",e),e.trigger("didCommit",e)}},created:l,updated:f},deleted:{initialState:"uncommitted",dirtyType:"deleted",isDeleted:!0,isLoaded:!0,isDirty:!0,setup:function(e){var t=i(e,"store");t.recordArrayManager.remove(e)},uncommitted:{willCommit:function(e){e.transitionTo("inFlight")},rollback:function(e){e.rollback()},becomeDirty:Ember.K,becameClean:function(e){e.withTransaction(function(t){t.remove(e)}),e.transitionTo("loaded.materializing")}},inFlight:{isSaving:!0,enter:function(e){e.becameInFlight()},didCommit:function(e){e.withTransaction(function(t){t.remove(e)}),e.transitionTo("saved"),e.send("invokeLifecycleCallbacks")}},saved:{isDirty:!1,setup:function(e){var t=i(e,"store");t.dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.trigger("didDelete",e),e.trigger("didCommit",e)}}},error:{isError:!0,invokeLifecycleCallbacks:function(e){e.trigger("becameError",e)}}};({}).hasOwnProperty,p=n(p,null,"root"),DS.RootState=p}(),function(){var e=DS.LoadPromise,t=Ember.get,r=Ember.set,n=Ember.EnumerableUtils.map;Ember.ArrayPolyfills.map;var i=Ember.computed(function(e){return t(t(this,"currentState"),e)}).property("currentState").readOnly();DS.Model=Ember.Object.extend(Ember.Evented,e,{isLoading:i,isLoaded:i,isReloading:i,isDirty:i,isSaving:i,isDeleted:i,isError:i,isNew:i,isValid:i,dirtyType:i,clientId:null,id:null,transaction:null,currentState:null,errors:null,serialize:function(e){var r=t(this,"store");return r.serialize(this,e)},toJSON:function(e){var t=DS.JSONSerializer.create();return t.serialize(this,e)},didLoad:Ember.K,didReload:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,data:Ember.computed(function(){return this._data||this.setupData(),this._data}).property(),materializeData:function(){this.send("materializingData"),t(this,"store").materializeData(this),this.suspendRelationshipObservers(function(){this.notifyPropertyChange("data")})},_data:null,init:function(){r(this,"currentState",DS.RootState.empty),this._super(),this._setup()},_setup:function(){this._changesToSync={}},send:function(e,r){var n=t(this,"currentState");return n[e]||this._unhandledEvent(n,e,r),n[e](this,r)},transitionTo:function(e){var n=e.split(".",1),i=t(this,"currentState"),a=i;do a.exit&&a.exit(this),a=a.parentState;while(!a.hasOwnProperty(n));var o,s,c=e.split("."),d=[],u=[];for(o=0,s=c.length;s>o;o++)a=a[c[o]],a.enter&&u.push(a),a.setup&&d.push(a);for(o=0,s=u.length;s>o;o++)u[o].enter(this);for(r(this,"currentState",a),o=0,s=d.length;s>o;o++)d[o].setup(this)},_unhandledEvent:function(e,t,r){var n="Attempted to handle event `"+t+"` ";throw n+="on "+String(this)+" while in state ",n+=e.stateName+". ",void 0!==r&&(n+="Called with "+Ember.inspect(r)+"."),new Ember.Error(n)},withTransaction:function(e){var r=t(this,"transaction");r&&e(r)},loadingData:function(){this.send("loadingData")},loadedData:function(){this.send("loadedData")},didChangeData:function(){this.send("didChangeData")},deleteRecord:function(){this.send("deleteRecord")},unloadRecord:function(){this.send("unloadRecord")},clearRelationships:function(){this.eachRelationship(function(e,t){"belongsTo"===t.kind?r(this,e,null):"hasMany"===t.kind&&this.clearHasMany(t)},this)},updateRecordArrays:function(){var e=t(this,"store");e&&e.dataWasUpdated(this.constructor,t(this,"_reference"),this)},adapterDidCommit:function(){var e=t(this,"data").attributes;t(this.constructor,"attributes").forEach(function(r){e[r]=t(this,r)},this),this.send("didCommit"),this.updateRecordArraysLater()},adapterDidDirty:function(){this.send("becomeDirty"),this.updateRecordArraysLater()},dataDidChange:Ember.observer(function(){this.reloadHasManys(),this.send("finishedMaterializing")},"data"),reloadHasManys:function(){var e=t(this.constructor,"relationshipsByName");this.updateRecordArraysLater(),e.forEach(function(e,t){"hasMany"===t.kind&&this.hasManyDidChange(t.key)},this)},hasManyDidChange:function(e){var i=this.cacheFor(e);if(i){var a=t(this.constructor,"relationshipsByName").get(e).type,o=t(this,"store"),s=this._data.hasMany[e]||[],c=n(s,function(e){return"object"==typeof e?e.clientId?e:o.referenceForId(e.type,e.id):o.referenceForId(a,e)});r(i,"content",Ember.A(c))}},updateRecordArraysLater:function(){Ember.run.once(this,this.updateRecordArrays)},setupData:function(){this._data={attributes:{},belongsTo:{},hasMany:{},id:null}},materializeId:function(e){r(this,"id",e)},materializeAttributes:function(e){this._data.attributes=e},materializeAttribute:function(e,t){this._data.attributes[e]=t},materializeHasMany:function(e,t){var r=typeof t;if(t&&"string"!==r&&t.length>1,"string"===r)this._data.hasMany[e]=t;else{var n=t;t&&Ember.isArray(t)&&(n=this._convertTuplesToReferences(t)),this._data.hasMany[e]=n}},materializeBelongsTo:function(e,t){t&&Ember.assert("materializeBelongsTo expects a tuple or a reference, not a "+t,!t||t.hasOwnProperty("id")&&t.hasOwnProperty("type")),this._data.belongsTo[e]=t},_convertTuplesToReferences:function(e){return n(e,function(e){return this._convertTupleToReference(e)},this)},_convertTupleToReference:function(e){var r=t(this,"store");return e.clientId?e:r.referenceForId(e.type,e.id)},rollback:function(){this._setup(),this.send("becameClean"),this.suspendRelationshipObservers(function(){this.notifyPropertyChange("data")})},toStringExtension:function(){return t(this,"id")},suspendRelationshipObservers:function(e,r){var n=t(this.constructor,"relationshipNames").belongsTo,i=this;try{this._suspendedRelationships=!0,Ember._suspendObservers(i,n,null,"belongsToDidChange",function(){Ember._suspendBeforeObservers(i,n,null,"belongsToWillChange",function(){e.call(r||i)})})}finally{this._suspendedRelationships=!1}},becameInFlight:function(){},resolveOn:function(e){var t=this;return new Ember.RSVP.Promise(function(r,n){function i(){this.off("becameError",a),this.off("becameInvalid",a),r(this)}function a(){this.off(e,i),n(this)}t.one(e,i),t.one("becameError",a),t.one("becameInvalid",a)})},save:function(){return this.get("store").scheduleSave(this),this.resolveOn("didCommit")},reload:function(){return this.send("reloadRecord"),this.resolveOn("didReload")},adapterDidUpdateAttribute:function(e,r){void 0!==r?(t(this,"data.attributes")[e]=r,this.notifyPropertyChange(e)):(r=t(this,e),t(this,"data.attributes")[e]=r),this.updateRecordArraysLater()},adapterDidInvalidate:function(e){this.send("becameInvalid",e)},adapterDidError:function(){this.send("becameError")},trigger:function(e){Ember.tryInvoke(this,e,[].slice.call(arguments,1)),this._super.apply(this,arguments)}});var a=function(e){return function(){var r=t(DS,"defaultStore"),n=[].slice.call(arguments);return n.unshift(this),r[e].apply(r,n)}};DS.Model.reopenClass({_create:DS.Model.create,create:function(){throw new Ember.Error("You should not call `create` on a model. Instead, call `createRecord` with the attributes you would like to set.")},find:a("find"),all:a("all"),query:a("findQuery"),filter:a("filter"),createRecord:a("createRecord")})}(),function(){function e(e,r,n){var i=t(e,"data").attributes,a=i[n];return void 0===a&&(a="function"==typeof r.defaultValue?r.defaultValue():r.defaultValue),a}var t=Ember.get;DS.Model.reopenClass({attributes:Ember.computed(function(){var e=Ember.Map.create();return this.eachComputedProperty(function(t,r){r.isAttribute&&(r.name=t,e.set(t,r))}),e})}),DS.Model.reopen({eachAttribute:function(e,r){t(this.constructor,"attributes").forEach(function(t,n){e.call(r,t,n)},r)},attributeWillChange:Ember.beforeObserver(function(e,r){var n=t(e,"_reference"),i=t(e,"store");e.send("willSetProperty",{reference:n,store:i,name:r})}),attributeDidChange:Ember.observer(function(e,t){e.send("didSetProperty",{name:t})})}),DS.attr=function(t,r){r=r||{};var n={type:t,isAttribute:!0,options:r};return Ember.computed(function(t,n){return arguments.length>1||(n=e(this,r,t)),n}).property("data").meta(n)}}(),function(){var e=DS.AttributeChange=function(e){this.reference=e.reference,this.store=e.store,this.name=e.name,this.oldValue=e.oldValue};e.createChange=function(t){return new e(t)},e.prototype={sync:function(){this.store.recordAttributeDidChange(this.reference,this.name,this.value,this.oldValue),this.destroy()},destroy:function(){var e=this.reference.record;delete e._changesToSync[this.name]}}}(),function(){var e=Ember.get,t=Ember.set,r=Ember.EnumerableUtils.forEach;DS.RelationshipChange=function(e){this.parentReference=e.parentReference,this.childReference=e.childReference,this.firstRecordReference=e.firstRecordReference,this.firstRecordKind=e.firstRecordKind,this.firstRecordName=e.firstRecordName,this.secondRecordReference=e.secondRecordReference,this.secondRecordKind=e.secondRecordKind,this.secondRecordName=e.secondRecordName,this.changeType=e.changeType,this.store=e.store,this.committed={}},DS.RelationshipChangeAdd=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChangeRemove=function(e){DS.RelationshipChange.call(this,e)},DS.RelationshipChange.create=function(e){return new DS.RelationshipChange(e)},DS.RelationshipChangeAdd.create=function(e){return new DS.RelationshipChangeAdd(e)},DS.RelationshipChangeRemove.create=function(e){return new DS.RelationshipChangeRemove(e)},DS.OneToManyChange={},DS.OneToNoneChange={},DS.ManyToNoneChange={},DS.OneToOneChange={},DS.ManyToManyChange={},DS.RelationshipChange._createChange=function(e){return"add"===e.changeType?DS.RelationshipChangeAdd.create(e):"remove"===e.changeType?DS.RelationshipChangeRemove.create(e):void 0},DS.RelationshipChange.determineRelationshipType=function(e,t){var r,n,i=t.key,a=t.kind,o=e.inverseFor(i);return o&&(r=o.name,n=o.kind),o?"belongsTo"===n?"belongsTo"===a?"oneToOne":"manyToOne":"belongsTo"===a?"oneToMany":"manyToMany":"belongsTo"===a?"oneToNone":"manyToNone"},DS.RelationshipChange.createChange=function(e,t,r,n){var i,a=e.type;return i=DS.RelationshipChange.determineRelationshipType(a,n),"oneToMany"===i?DS.OneToManyChange.createChange(e,t,r,n):"manyToOne"===i?DS.OneToManyChange.createChange(t,e,r,n):"oneToNone"===i?DS.OneToNoneChange.createChange(e,t,r,n):"manyToNone"===i?DS.ManyToNoneChange.createChange(e,t,r,n):"oneToOne"===i?DS.OneToOneChange.createChange(e,t,r,n):"manyToMany"===i?DS.ManyToManyChange.createChange(e,t,r,n):void 0},DS.OneToNoneChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,store:r,changeType:n.changeType,firstRecordName:i,firstRecordKind:"belongsTo"}); +return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.ManyToNoneChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:e,childReference:t,secondRecordReference:e,store:r,changeType:n.changeType,secondRecordName:n.key,secondRecordKind:"hasMany"});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.ManyToManyChange.createChange=function(e,t,r,n){var i=n.key,a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"hasMany",secondRecordKind:"hasMany",store:r,changeType:n.changeType,firstRecordName:i});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.OneToOneChange.createChange=function(e,t,r,n){var i;n.parentType?i=n.parentType.inverseFor(n.key).name:n.key&&(i=n.key);var a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"belongsTo",secondRecordKind:"belongsTo",store:r,changeType:n.changeType,firstRecordName:i});return r.addRelationshipChangeFor(e,i,t,null,a),a},DS.OneToOneChange.maintainInvariant=function(t,r,n,i){if("add"===t.changeType&&r.recordIsMaterialized(n)){var a=r.recordForReference(n),o=e(a,i);if(o){var s=DS.OneToOneChange.createChange(n,o.get("_reference"),r,{parentType:t.parentType,hasManyName:t.hasManyName,changeType:"remove",key:t.key});r.addRelationshipChangeFor(n,i,t.parentReference,null,s),s.sync()}}},DS.OneToManyChange.createChange=function(e,t,r,n){var i;n.parentType?(i=n.parentType.inverseFor(n.key).name,DS.OneToManyChange.maintainInvariant(n,r,e,i)):n.key&&(i=n.key);var a=DS.RelationshipChange._createChange({parentReference:t,childReference:e,firstRecordReference:e,secondRecordReference:t,firstRecordKind:"belongsTo",secondRecordKind:"hasMany",store:r,changeType:n.changeType,firstRecordName:i});return r.addRelationshipChangeFor(e,i,t,a.getSecondRecordName(),a),a},DS.OneToManyChange.maintainInvariant=function(t,r,n,i){var a=n.record;if("add"===t.changeType&&a){var o=e(a,i);if(o){var s=DS.OneToManyChange.createChange(n,o.get("_reference"),r,{parentType:t.parentType,hasManyName:t.hasManyName,changeType:"remove",key:t.key});r.addRelationshipChangeFor(n,i,t.parentReference,s.getSecondRecordName(),s),s.sync()}}},DS.OneToManyChange.ensureSameTransaction=function(e){var t=Ember.A();return r(e,function(e){t.addObject(e.getSecondRecord()),t.addObject(e.getFirstRecord())}),DS.Transaction.ensureSameTransaction(t)},DS.RelationshipChange.prototype={getSecondRecordName:function(){var e,t=this.secondRecordName;if(!t){if(e=this.secondRecordReference,!e)return;var r=this.firstRecordReference.type,n=r.inverseFor(this.firstRecordName);this.secondRecordName=n.name}return this.secondRecordName},getFirstRecordName:function(){var e=this.firstRecordName;return e},destroy:function(){var e=this.childReference,t=this.getFirstRecordName(),r=this.getSecondRecordName(),n=this.store;n.removeRelationshipChangeFor(e,t,this.parentReference,r,this.changeType)},getByReference:function(e){return e?e.record?e.record:void 0:e},getSecondRecord:function(){return this.getByReference(this.secondRecordReference)},getFirstRecord:function(){return this.getByReference(this.firstRecordReference)},ensureSameTransaction:function(){var e=this.getFirstRecord(),t=this.getSecondRecord(),r=DS.Transaction.ensureSameTransaction([e,t]);return this.transaction=r,r},callChangeEvents:function(){var t=this.getFirstRecord(),r=this.getSecondRecord(),n=new Ember.OrderedSet;r&&e(r,"isLoaded")&&this.store.recordHasManyDidChange(n,r,this),t&&this.store.recordBelongsToDidChange(n,t,this),n.forEach(function(e){e.adapterDidDirty()})},coalesce:function(){var e=this.store.relationshipChangePairsFor(this.firstRecordReference);r(e,function(e){var t=e.add,r=e.remove;t&&r&&(t.destroy(),r.destroy())})}},DS.RelationshipChangeAdd.prototype=Ember.create(DS.RelationshipChange.create({})),DS.RelationshipChangeRemove.prototype=Ember.create(DS.RelationshipChange.create({})),DS.RelationshipChangeAdd.prototype.changeType="add",DS.RelationshipChangeAdd.prototype.sync=function(){var r=this.getSecondRecordName(),n=this.getFirstRecordName(),i=this.getFirstRecord(),a=this.getSecondRecord();this.ensureSameTransaction(),this.callChangeEvents(),a&&i&&("belongsTo"===this.secondRecordKind?a.suspendRelationshipObservers(function(){t(a,r,i)}):"hasMany"===this.secondRecordKind&&a.suspendRelationshipObservers(function(){e(a,r).addObject(i)})),i&&a&&e(i,n)!==a&&("belongsTo"===this.firstRecordKind?i.suspendRelationshipObservers(function(){t(i,n,a)}):"hasMany"===this.firstRecordKind&&i.suspendRelationshipObservers(function(){e(i,n).addObject(a)})),this.coalesce()},DS.RelationshipChangeRemove.prototype.changeType="remove",DS.RelationshipChangeRemove.prototype.sync=function(){var r=this.getSecondRecordName(),n=this.getFirstRecordName(),i=this.getFirstRecord(),a=this.getSecondRecord();this.ensureSameTransaction(i,a,r,n),this.callChangeEvents(),a&&i&&("belongsTo"===this.secondRecordKind?a.suspendRelationshipObservers(function(){t(a,r,null)}):"hasMany"===this.secondRecordKind&&a.suspendRelationshipObservers(function(){e(a,r).removeObject(i)})),i&&e(i,n)&&("belongsTo"===this.firstRecordKind?i.suspendRelationshipObservers(function(){t(i,n,null)}):"hasMany"===this.firstRecordKind&&i.suspendRelationshipObservers(function(){e(i,n).removeObject(a)})),this.coalesce()}}(),function(){var e=Ember.get,t=(Ember.set,Ember.isNone);DS.belongsTo=function(r,n){n=n||{};var i={type:r,isRelationship:!0,options:n,kind:"belongsTo"};return Ember.computed(function(n,i){if("string"==typeof r&&(r=e(this,r,!1)||e(Ember.lookup,r)),2===arguments.length)return void 0===i?null:i;var a,o=e(this,"data").belongsTo,s=e(this,"store");return a=o[n],t(a)?null:a.clientId?s.recordForReference(a):s.findById(a.type,a.id)}).property("data").meta(i)},DS.Model.reopen({belongsToWillChange:Ember.beforeObserver(function(t,r){if(e(t,"isLoaded")){var n=e(t,r),i=e(t,"_reference"),a=e(t,"store");if(n){var o=DS.RelationshipChange.createChange(i,e(n,"_reference"),a,{key:r,kind:"belongsTo",changeType:"remove"});o.sync(),this._changesToSync[r]=o}}}),belongsToDidChange:Ember.immediateObserver(function(t,r){if(e(t,"isLoaded")){var n=e(t,r);if(n){var i=e(t,"_reference"),a=e(t,"store"),o=DS.RelationshipChange.createChange(i,e(n,"_reference"),a,{key:r,kind:"belongsTo",changeType:"add"});o.sync(),this._changesToSync[r]&&DS.OneToManyChange.ensureSameTransaction([o,this._changesToSync[r]],a)}}delete this._changesToSync[r]})})}(),function(){function e(e,i){var a=t(e,"data").hasMany,o=a[i.key];if(o){var s=e.constructor.inverseFor(i.key);s&&n(o,function(t){var n;(n=t.record)&&e.suspendRelationshipObservers(function(){r(n,s.name,null)})})}}var t=Ember.get,r=Ember.set,n=Ember.EnumerableUtils.forEach,i=function(e,n){n=n||{};var i={type:e,isRelationship:!0,options:n,kind:"hasMany"};return Ember.computed(function(a){var o,s,c=t(this,"data").hasMany,d=t(this,"store");return"string"==typeof e&&(e=t(this,e,!1)||t(Ember.lookup,e)),o=c[a],s=d.findMany(e,o,this,i),r(s,"owner",this),r(s,"name",a),r(s,"isPolymorphic",n.polymorphic),s}).property().meta(i)};DS.hasMany=function(e,t){return i(e,t)},DS.Model.reopen({clearHasMany:function(t){var r=this.cacheFor(t.name);r?r.clear():e(this,t)}})}(),function(){var e=Ember.get;Ember.set,DS.Model.reopen({didDefineProperty:function(e,t,r){if(r instanceof Ember.Descriptor){var n=r.meta();n.isRelationship&&"belongsTo"===n.kind&&(Ember.addObserver(e,t,null,"belongsToDidChange"),Ember.addBeforeObserver(e,t,null,"belongsToWillChange")),n.isAttribute&&(Ember.addObserver(e,t,null,"attributeDidChange"),Ember.addBeforeObserver(e,t,null,"attributeWillChange")),n.parentType=e.constructor}}}),DS.Model.reopenClass({typeForRelationship:function(t){var r=e(this,"relationshipsByName").get(t);return r&&r.type},inverseFor:function(t){function r(t,n,i){i=i||[];var a=e(n,"relationships");if(a){var o=a.get(t);return o&&i.push.apply(i,a.get(t)),t.superclass&&r(t.superclass,n,i),i}}var n=this.typeForRelationship(t);if(!n)return null;var i,a,o=this.metaForProperty(t).options;if(o.inverse)i=o.inverse,a=Ember.get(n,"relationshipsByName").get(i).kind;else{var s=r(this,n);if(0===s.length)return null;i=s[0].name,a=s[0].kind}return{type:n,name:i,kind:a}},relationships:Ember.computed(function(){var e=new Ember.MapWithDefault({defaultValue:function(){return[]}});return this.eachComputedProperty(function(t,r){if(r.isRelationship){"string"==typeof r.type&&(r.type=Ember.get(Ember.lookup,r.type));var n=e.get(r.type);n.push({name:t,kind:r.kind})}}),e}),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};return this.eachComputedProperty(function(t,r){r.isRelationship&&e[r.kind].push(t)}),e}),relatedTypes:Ember.computed(function(){var t,r=Ember.A([]);return this.eachComputedProperty(function(n,i){i.isRelationship&&(t=i.type,"string"==typeof t&&(t=e(this,t,!1)||e(Ember.lookup,t)),r.contains(t)||r.push(t))}),r}),relationshipsByName:Ember.computed(function(){var t,r=Ember.Map.create();return this.eachComputedProperty(function(n,i){i.isRelationship&&(i.key=n,t=i.type,"string"==typeof t&&(t=e(this,t,!1)||e(Ember.lookup,t),i.type=t),r.set(n,i))}),r}),fields:Ember.computed(function(){var e=Ember.Map.create();return this.eachComputedProperty(function(t,r){r.isRelationship?e.set(t,r.kind):r.isAttribute&&e.set(t,"attribute")}),e}),eachRelationship:function(t,r){e(this,"relationshipsByName").forEach(function(e,n){t.call(r,e,n)})},eachRelatedType:function(t,r){e(this,"relatedTypes").forEach(function(e){t.call(r,e)})}}),DS.Model.reopen({eachRelationship:function(e,t){this.constructor.eachRelationship(e,t)}})}(),function(){var e=Ember.get;Ember.set;var t=Ember.run.once,r=Ember.EnumerableUtils.forEach;DS.RecordArrayManager=Ember.Object.extend({init:function(){this.filteredRecordArrays=Ember.MapWithDefault.create({defaultValue:function(){return[]}}),this.changedReferences=[]},referenceDidChange:function(e){this.changedReferences.push(e),t(this,this.updateRecordArrays)},recordArraysForReference:function(e){return e.recordArrays=e.recordArrays||Ember.OrderedSet.create(),e.recordArrays},updateRecordArrays:function(){r(this.changedReferences,function(t){var n,i=t.type,a=this.filteredRecordArrays.get(i);r(a,function(r){n=e(r,"filterFunction"),this.updateRecordArray(r,n,i,t)},this);var o=t.loadingRecordArrays;if(o){for(var s=0,c=o.length;c>s;s++)o[s].loadedRecord();t.loadingRecordArrays=[]}},this),this.changedReferences=[]},updateRecordArray:function(e,t,r,n){var i,a;t?(a=this.store.recordForReference(n),i=t(a)):i=!0;var o=this.recordArraysForReference(n);i?(o.add(e),e.addReference(n)):i||(o.remove(e),e.removeReference(n))},remove:function(t){var n=e(t,"_reference"),i=n.recordArrays||[];r(i,function(e){e.removeReference(n)})},updateFilter:function(t,r,n){for(var i,a,o,s,c=this.store.typeMapFor(r),d=c.references,u=0,h=d.length;h>u;u++)i=d[u],o=!1,a=i.data,"object"==typeof a&&((s=i.record)?e(s,"isDeleted")||(o=!0):o=!0,o&&this.updateRecordArray(t,n,r,i))},createManyArray:function(e,t){var n=DS.ManyArray.create({type:e,content:t,store:this.store});return r(t,function(e){var t=this.recordArraysForReference(e);t.add(n)},this),n},registerFilteredRecordArray:function(e,t,r){var n=this.filteredRecordArrays.get(t);n.push(e),this.updateFilter(e,t,r)},registerWaitingRecordArray:function(e,t){var r=t.loadingRecordArrays||[];r.push(e),t.loadingRecordArrays=r}})}(),function(){function e(e){return function(){throw new Ember.Error("Your serializer "+this.toString()+" does not implement the required method "+e)}}var t=Ember.get,r=(Ember.set,Ember.ArrayPolyfills.map),n=Ember.isNone;DS.Serializer=Ember.Object.extend({init:function(){this.mappings=Ember.Map.create(),this.aliases=Ember.Map.create(),this.configurations=Ember.Map.create(),this.globalConfigurations={}},extract:e("extract"),extractMany:e("extractMany"),extractId:e("extractId"),extractAttribute:e("extractAttribute"),extractHasMany:e("extractHasMany"),extractBelongsTo:e("extractBelongsTo"),extractRecordRepresentation:function(e,t,r,i){var a,o={};return a=i?e.sideload(t,r):e.load(t,r),this.eachEmbeddedHasMany(t,function(t,i){var s=this.extractEmbeddedData(r,this.keyFor(i));n(s)||this.extractEmbeddedHasMany(e,i,s,a,o)},this),this.eachEmbeddedBelongsTo(t,function(t,i){var s=this.extractEmbeddedData(r,this.keyFor(i));n(s)||this.extractEmbeddedBelongsTo(e,i,s,a,o)},this),e.prematerialize(a,o),a},extractEmbeddedHasMany:function(e,t,n,i,a){var o=r.call(n,function(r){if(r){var n=this.extractEmbeddedType(t,r),a=this.extractRecordRepresentation(e,n,r,!0),o=this.embeddedType(i.type,t.key);"always"===o&&(a.parent=i);var s=t.parentType,c=s.inverseFor(t.key);if(c){var d=c.name;a.prematerialized[d]=i}return a}},this);a[t.key]=o},extractEmbeddedBelongsTo:function(e,t,r,n,i){var a=this.extractEmbeddedType(t,r),o=this.extractRecordRepresentation(e,a,r,!0);i[t.key]=o;var s=this.embeddedType(n.type,t.key);"always"===s&&(o.parent=n)},extractEmbeddedType:function(e){return e.type},extractEmbeddedData:e(),serialize:function(e,r){r=r||{};var n,i=this.createSerializedForm();return r.includeId&&(n=t(e,"id"))&&this._addId(i,e.constructor,n),r.includeType&&this.addType(i,e.constructor),this.addAttributes(i,e),this.addRelationships(i,e),i},serializeValue:function(e,t){var r=this.transforms?this.transforms[t]:null;return r.serialize(e)},serializeId:function(e){return Ember.isEmpty(e)?null:isNaN(+e)?e:+e},addAttributes:function(e,t){t.eachAttribute(function(r,n){this._addAttribute(e,t,r,n.type)},this)},addAttribute:e("addAttribute"),addId:e("addId"),addType:Ember.K,createSerializedForm:function(){return{}},addRelationships:function(e,t){t.eachRelationship(function(r,n){"belongsTo"===n.kind?this._addBelongsTo(e,t,r,n):"hasMany"===n.kind&&this._addHasMany(e,t,r,n)},this)},addBelongsTo:e("addBelongsTo"),addHasMany:e("addHasMany"),keyForAttributeName:function(e,t){return t},primaryKey:function(){return"id"},keyForBelongsTo:function(e,t){return this.keyForAttributeName(e,t)},keyForHasMany:function(e,t){return this.keyForAttributeName(e,t)},materialize:function(e,r,n){var i;Ember.isNone(t(e,"id"))&&(i=n&&n.hasOwnProperty("id")?n.id:this.extractId(e.constructor,r),e.materializeId(i)),this.materializeAttributes(e,r,n),this.materializeRelationships(e,r,n)},deserializeValue:function(e,t){var r=this.transforms?this.transforms[t]:null;return r.deserialize(e)},materializeAttributes:function(e,t,r){e.eachAttribute(function(n,i){r&&r.hasOwnProperty(n)?e.materializeAttribute(n,r[n]):this.materializeAttribute(e,t,n,i.type)},this)},materializeAttribute:function(e,t,r,n){var i=this.extractAttribute(e.constructor,t,r);i=this.deserializeValue(i,n),e.materializeAttribute(r,i)},materializeRelationships:function(e,t,r){e.eachRelationship(function(n,i){if("hasMany"===i.kind)if(r&&r.hasOwnProperty(n)){var a=this._convertPrematerializedHasMany(i.type,r[n]);e.materializeHasMany(n,a)}else this.materializeHasMany(n,e,t,i,r);else if("belongsTo"===i.kind)if(r&&r.hasOwnProperty(n)){var o=this._convertTuple(i.type,r[n]);e.materializeBelongsTo(n,o)}else this.materializeBelongsTo(n,e,t,i,r)},this)},materializeHasMany:function(e,t,r,n){var i=t.constructor,a=this._keyForHasMany(i,n.key),o=this.extractHasMany(i,r,a),s=o;o&&Ember.isArray(o)&&(s=this._convertTuples(n.type,o)),t.materializeHasMany(e,s)},materializeBelongsTo:function(e,t,r,i){var a,o=t.constructor,s=this._keyForBelongsTo(o,i.key),c=null;a=i.options&&i.options.polymorphic?this.extractBelongsToPolymorphic(o,r,s):this.extractBelongsTo(o,r,s),n(a)||(c=this._convertTuple(i.type,a)),t.materializeBelongsTo(e,c)},_convertPrematerializedHasMany:function(e,t){var r;return r="string"==typeof t?t:this._convertTuples(e,t)},_convertTuples:function(e,t){return r.call(t,function(t){return this._convertTuple(e,t)},this)},_convertTuple:function(e,t){var r;return"object"==typeof t?DS.Model.detect(t.type)?t:(r=this.typeFromAlias(t.type),{id:t.id,type:r}):{id:t,type:e}},_primaryKey:function(e){var t=this.configurationForType(e),r=t&&t.primaryKey;return r?r:this.primaryKey(e)},_addAttribute:function(e,r,n,i){var a=this._keyForAttributeName(r.constructor,n),o=t(r,n);this.addAttribute(e,a,this.serializeValue(o,i))},_addId:function(e,t,r){var n=this._primaryKey(t);this.addId(e,n,this.serializeId(r))},_keyForAttributeName:function(e,t){return this._keyFromMappingOrHook("keyForAttributeName",e,t)},_keyForBelongsTo:function(e,t){return this._keyFromMappingOrHook("keyForBelongsTo",e,t)},keyFor:function(e){var t=e.parentType,r=e.key;switch(e.kind){case"belongsTo":return this._keyForBelongsTo(t,r);case"hasMany":return this._keyForHasMany(t,r)}},_keyForHasMany:function(e,t){return this._keyFromMappingOrHook("keyForHasMany",e,t)},_addBelongsTo:function(e,t,r,n){var i=this._keyForBelongsTo(t.constructor,r);this.addBelongsTo(e,t,i,n)},_addHasMany:function(e,t,r,n){var i=this._keyForHasMany(t.constructor,r);this.addHasMany(e,t,i,n)},_keyFromMappingOrHook:function(e,t,r){var n=this.mappingOption(t,r,"key");return n?n:this[e](t,r)},registerTransform:function(e,t){this.transforms[e]=t},registerEnumTransform:function(e,t){var r={deserialize:function(e){return Ember.A(t).objectAt(e)},serialize:function(e){return Ember.EnumerableUtils.indexOf(t,e)},values:t};this.registerTransform(e,r)},map:function(e,t){this.mappings.set(e,t)},configure:function(e,t){if(e&&!t)return Ember.merge(this.globalConfigurations,e),void 0;var r,n;t.alias&&(n=t.alias,this.aliases.set(n,e),delete t.alias),r=Ember.create(this.globalConfigurations),Ember.merge(r,t),this.configurations.set(e,r)},typeFromAlias:function(e){return this._completeAliases(),this.aliases.get(e)},mappingForType:function(e){return this._reifyMappings(),this.mappings.get(e)||{}},configurationForType:function(e){return this._reifyConfigurations(),this.configurations.get(e)||this.globalConfigurations},_completeAliases:function(){this._pluralizeAliases(),this._reifyAliases()},_pluralizeAliases:function(){if(!this._didPluralizeAliases){var e,t=this.aliases,r=this.aliases.sideloadMapping,n=this;t.forEach(function(r,i){e=n.pluralize(r),t.set(e,i)}),r&&(r.forEach(function(e,r){t.set(e,r)}),delete this.aliases.sideloadMapping),this._didPluralizeAliases=!0}},_reifyAliases:function(){if(!this._didReifyAliases){var e,t=this.aliases,r=Ember.Map.create();t.forEach(function(t,n){"string"==typeof n?(e=Ember.get(Ember.lookup,n),r.set(t,e)):r.set(t,n)}),this.aliases=r,this._didReifyAliases=!0}},_reifyMappings:function(){if(!this._didReifyMappings){var e=this.mappings,t=Ember.Map.create();e.forEach(function(e,r){if("string"==typeof e){var n=Ember.get(Ember.lookup,e);t.set(n,r)}else t.set(e,r)}),this.mappings=t,this._didReifyMappings=!0}},_reifyConfigurations:function(){if(!this._didReifyConfigurations){var e=this.configurations,t=Ember.Map.create();e.forEach(function(e,r){if("string"==typeof e&&"plurals"!==e){var n=Ember.get(Ember.lookup,e);t.set(n,r)}else t.set(e,r)}),this.configurations=t,this._didReifyConfigurations=!0}},mappingOption:function(e,t,r){var n=this.mappingForType(e)[t];return n&&n[r]},configOption:function(e,t){var r=this.configurationForType(e);return r[t]},embeddedType:function(e,t){return this.mappingOption(e,t,"embedded")},eachEmbeddedRecord:function(e,t,r){this.eachEmbeddedBelongsToRecord(e,t,r),this.eachEmbeddedHasManyRecord(e,t,r)},eachEmbeddedBelongsToRecord:function(e,r,n){this.eachEmbeddedBelongsTo(e.constructor,function(i,a,o){var s=t(e,i);s&&r.call(n,s,o)})},eachEmbeddedHasManyRecord:function(e,r,n){this.eachEmbeddedHasMany(e.constructor,function(i,a,o){for(var s=t(e,i),c=0,d=t(s,"length");d>c;c++)r.call(n,s.objectAt(c),o)})},eachEmbeddedHasMany:function(e,t,r){this.eachEmbeddedRelationship(e,"hasMany",t,r)},eachEmbeddedBelongsTo:function(e,t,r){this.eachEmbeddedRelationship(e,"belongsTo",t,r)},eachEmbeddedRelationship:function(e,t,r,n){e.eachRelationship(function(i,a){var o=this.embeddedType(e,i);o&&a.kind===t&&r.call(n,i,a,o)},this)},pluralize:function(e){var t=this.configurations.get("plurals");return t&&t[e]||e+"s"},singularize:function(e){var t=this.configurations.get("plurals");if(t)for(var r in t)if(t[r]===e)return r;return e.lastIndexOf("s")===e.length-1?e.substring(0,e.length-1):e}})}(),function(){var e=Ember.isNone,t=Ember.isEmpty;DS.JSONTransforms={string:{deserialize:function(t){return e(t)?null:String(t)},serialize:function(t){return e(t)?null:String(t)}},number:{deserialize:function(e){return t(e)?null:Number(e)},serialize:function(e){return t(e)?null:Number(e)}},"boolean":{deserialize:function(e){var t=typeof e;return"boolean"===t?e:"string"===t?null!==e.match(/^true$|^t$|^1$/i):"number"===t?1===e:!1},serialize:function(e){return Boolean(e)}},date:{deserialize:function(e){var t=typeof e;return"string"===t?new Date(Ember.Date.parse(e)):"number"===t?new Date(e):null===e||void 0===e?e:null},serialize:function(e){if(e instanceof Date){var t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],n=function(e){return 10>e?"0"+e:""+e},i=e.getUTCFullYear(),a=e.getUTCMonth(),o=e.getUTCDate(),s=e.getUTCDay(),c=e.getUTCHours(),d=e.getUTCMinutes(),u=e.getUTCSeconds(),h=t[s],l=n(o),f=r[a];return h+", "+l+" "+f+" "+i+" "+n(c)+":"+n(d)+":"+n(u)+" GMT"}return null}}}}(),function(){var e=Ember.get;Ember.set,DS.JSONSerializer=DS.Serializer.extend({init:function(){this._super(),e(this,"transforms")||this.set("transforms",DS.JSONTransforms),this.sideloadMapping=Ember.Map.create(),this.metadataMapping=Ember.Map.create(),this.configure({meta:"meta",since:"since"})},configure:function(t,r){var n;if(t&&!r){for(n in t)this.metadataMapping.set(e(t,n),n);return this._super(t)}var i,a=r.sideloadAs;a&&(i=this.aliases.sideloadMapping||Ember.Map.create(),i.set(a,t),this.aliases.sideloadMapping=i,delete r.sideloadAs),this._super.apply(this,arguments)},addId:function(e,t,r){e[t]=r},addAttribute:function(e,t,r){e[t]=r},extractAttribute:function(e,t,r){var n=this._keyForAttributeName(e,r);return t[n]},extractId:function(e,t){var r=this._primaryKey(e);return t.hasOwnProperty(r)?t[r]+"":null},extractEmbeddedData:function(e,t){return e[t]},extractHasMany:function(e,t,r){return t[r]},extractBelongsTo:function(e,t,r){return t[r]},extractBelongsToPolymorphic:function(e,t,r){var n,i=this.keyForPolymorphicId(r),a=t[i];return a?(n=this.keyForPolymorphicType(r),{id:a,type:t[n]}):null},addBelongsTo:function(t,r,n,i){var a,o,s,c=r.constructor,d=i.key,u=null,h=i.options&&i.options.polymorphic;this.embeddedType(c,d)?((a=e(r,d))&&(u=this.serialize(a,{includeId:!0,includeType:h})),t[n]=u):(o=e(r,i.key),s=e(o,"id"),i.options&&i.options.polymorphic&&!Ember.isNone(s)?this.addBelongsToPolymorphic(t,n,s,o.constructor):t[n]=this.serializeId(s))},addBelongsToPolymorphic:function(e,t,r,n){var i=this.keyForPolymorphicId(t),a=this.keyForPolymorphicType(t);e[i]=r,e[a]=this.rootForType(n)},addHasMany:function(t,r,n,i){var a,o,s=r.constructor,c=i.key,d=[],u=i.options&&i.options.polymorphic;o=this.embeddedType(s,c),"always"===o&&(a=e(r,c),a.forEach(function(e){d.push(this.serialize(e,{includeId:!0,includeType:u}))},this),t[n]=d)},addType:function(e,t){var r=this.keyForEmbeddedType();e[r]=this.rootForType(t)},extract:function(e,t,r,n){var i=this.rootForType(r);this.sideload(e,r,t,i),this.extractMeta(e,r,t),t[i]?(n&&e.updateId(n,t[i]),this.extractRecordRepresentation(e,r,t[i])):Ember.Logger.warn("Extract requested, but no data given for "+r+". This may cause weird problems.")},extractMany:function(e,t,r,n){var i=this.rootForType(r);if(i=this.pluralize(i),this.sideload(e,r,t,i),this.extractMeta(e,r,t),t[i]){var a=t[i],o=[];n&&(n=n.toArray());for(var s=0;s 0) { - method.apply(target, args); - } else { - method.call(target); + // method could have been nullified / canceled during flush + if (method) { + // TODO: error handling + if (args && args.length > 0) { + method.apply(target, args); + } else { + method.call(target); + } } queueIndex += 4; } + queue._queueBeingFlushed = null; if (numberOfQueueItems && after) { after(); } if ((priorQueueNameIndex = indexOfPriorQueueWithActions(this, queueNameIndex)) !== -1) { @@ -4910,6 +4929,7 @@ define("backburner/deferred_action_queues", return -1; } + __exports__.DeferredActionQueues = DeferredActionQueues; }); @@ -4999,12 +5019,30 @@ define("backburner/queue", return true; } } + + // if not found in current queue + // could be in the queue that is being flushed + queue = this._queueBeingFlushed; + if (!queue) { + return; + } + for (i = 0, l = queue.length; i < l; i += 4) { + currentTarget = queue[i]; + currentMethod = queue[i+1]; + + if (currentTarget === actionToCancel.target && currentMethod === actionToCancel.method) { + // don't mess with array during flush + // just nullify the method + queue[i+1] = null; + return true; + } + } } }; + __exports__.Queue = Queue; }); - })(); @@ -5112,7 +5150,7 @@ Ember.run = function(target, method) { May be a function or a string. If you pass a string then it will be looked up on the passed target. @param {Object} [args*] Any additional arguments you wish to pass to the method. - @return {Object} return value from invoking the passed function. Please note, + @return {Object} return value from invoking the passed function. Please note, when called within an existing loop, no return value is possible. */ Ember.run.join = function(target, method) { @@ -5248,7 +5286,9 @@ Ember.run.cancelTimers = function () { @return {void} */ Ember.run.sync = function() { - backburner.currentInstance.queues.sync.flush(); + if (backburner.currentInstance) { + backburner.currentInstance.queues.sync.flush(); + } }; /** @@ -5441,6 +5481,38 @@ Ember.run.cancel = function(timer) { return backburner.cancel(timer); }; +/** + Execute the passed method in a specified amount of time, reset timer + upon additional calls. + + ```javascript + var myFunc = function() { console.log(this.name + ' ran.'); }; + var myContext = {name: 'debounce'}; + + Ember.run.debounce(myContext, myFunc, 150); + + // less than 150ms passes + + Ember.run.debounce(myContext, myFunc, 150); + + // 150ms passes + // myFunc is invoked with context myContext + // console logs 'debounce ran.' one time. + ``` + + @method debounce + @param {Object} [target] target of method to invoke + @param {Function|String} method The method to invoke. + May be a function or a string. If you pass a string + then it will be looked up on the passed target. + @param {Object} [args*] Optional arguments to pass to the timeout. + @param {Number} wait Number of milliseconds to wait. + @return {void} +*/ +Ember.run.debounce = function() { + return backburner.debounce.apply(backburner, arguments); +}; + // Make sure it's not an autorun during testing function checkAutoRun() { if (!Ember.run.currentRunLoop) { @@ -7230,6 +7302,8 @@ define("rsvp", __exports__.reject = reject; }); + + })(); (function() { @@ -7354,6 +7428,10 @@ define("container", return value; }, + lookupFactory: function(fullName) { + return factoryFor(this, fullName); + }, + has: function(fullName) { if (this.cache.has(fullName)) { return true; @@ -8074,8 +8152,8 @@ Ember.String = { ``` @method capitalize - @param {String} str - @return {String} + @param {String} str The string to capitalize. + @return {String} The capitalized string. */ capitalize: function(str) { return str.charAt(0).toUpperCase() + str.substr(1); @@ -9448,15 +9526,15 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot Adds an array observer to the receiving array. The array observer object normally must implement two methods: - * `arrayWillChange(start, removeCount, addCount)` - This method will be + * `arrayWillChange(observedObj, start, removeCount, addCount)` - This method will be called just before the array is modified. - * `arrayDidChange(start, removeCount, addCount)` - This method will be + * `arrayDidChange(observedObj, start, removeCount, addCount)` - This method will be called just after the array is modified. - Both callbacks will be passed the starting index of the change as well a - a count of the items to be removed and added. You can use these callbacks - to optionally inspect the array during the change, clear caches, or do - any other bookkeeping necessary. + Both callbacks will be passed the observed object, starting index of the + change as well a a count of the items to be removed and added. You can use + these callbacks to optionally inspect the array during the change, clear + caches, or do any other bookkeeping necessary. In addition to passing a target, you can also include an options hash which you can use to override the method names that will be invoked on the @@ -13464,17 +13542,40 @@ Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable, { @property {Boolean} sortAscending */ sortAscending: true, + + /** + The function used to compare two values. You can override this if you + want to do custom comparisons.Functions must be of the type expected by + Array#sort, i.e. + return 0 if the two parameters are equal, + return a negative value if the first parameter is smaller than the second or + return a positive value otherwise: + + ```javascript + function(x,y){ // These are assumed to be integers + if(x === y) + return 0; + return x < y ? -1 : 1; + } + ``` + @property sortFunction + @type {Function} + @default Ember.compare + */ + sortFunction: Ember.compare, + orderBy: function(item1, item2) { var result = 0, sortProperties = get(this, 'sortProperties'), - sortAscending = get(this, 'sortAscending'); + sortAscending = get(this, 'sortAscending'), + sortFunction = get(this, 'sortFunction'); Ember.assert("you need to define `sortProperties`", !!sortProperties); forEach(sortProperties, function(propertyName) { if (result === 0) { - result = Ember.compare(get(item1, propertyName), get(item2, propertyName)); + result = sortFunction(get(item1, propertyName), get(item2, propertyName)); if ((result !== 0) && !sortAscending) { result = (-1) * result; } @@ -13912,7 +14013,7 @@ Ember Runtime */ var jQuery = Ember.imports.jQuery; -Ember.assert("Ember Views require jQuery 1.8, 1.9, 1.10, or 2.0", jQuery && (jQuery().jquery.match(/^((1\.(8|9|10))|2.0)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY)); +Ember.assert("Ember Views require jQuery 1.7, 1.8, 1.9, 1.10, or 2.0", jQuery && (jQuery().jquery.match(/^((1\.(7|8|9|10))|2.0)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY)); /** Alias for jQuery @@ -14114,6 +14215,45 @@ ClassSet.prototype = { } }; +var BAD_TAG_NAME_TEST_REGEXP = /[^a-zA-Z\-]/; +var BAD_TAG_NAME_REPLACE_REGEXP = /[^a-zA-Z\-]/g; + +function stripTagName(tagName) { + if (!tagName) { + return tagName; + } + + if (!BAD_TAG_NAME_TEST_REGEXP.test(tagName)) { + return tagName; + } + + return tagName.replace(BAD_TAG_NAME_REPLACE_REGEXP, ''); +} + +var BAD_CHARS_REGEXP = /&(?!\w+;)|[<>"'`]/g; +var POSSIBLE_CHARS_REGEXP = /[&<>"'`]/; + +function escapeAttribute(value) { + // Stolen shamelessly from Handlebars + + var escape = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var escapeChar = function(chr) { + return escape[chr] || "&"; + }; + + var string = value.toString(); + + if(!POSSIBLE_CHARS_REGEXP.test(string)) { return string; } + return string.replace(BAD_CHARS_REGEXP, escapeChar); +} + /** `Ember.RenderBuffer` gathers information regarding the a view and generates the final representation. `Ember.RenderBuffer` will generate HTML which can be pushed @@ -14401,14 +14541,14 @@ Ember._RenderBuffer.prototype = style = this.elementStyle, attr, prop; - buffer += '<' + tagName; + buffer += '<' + stripTagName(tagName); if (id) { - buffer += ' id="' + this._escapeAttribute(id) + '"'; + buffer += ' id="' + escapeAttribute(id) + '"'; this.elementId = null; } if (classes) { - buffer += ' class="' + this._escapeAttribute(classes.join(' ')) + '"'; + buffer += ' class="' + escapeAttribute(classes.join(' ')) + '"'; this.classes = null; } @@ -14417,7 +14557,7 @@ Ember._RenderBuffer.prototype = for (prop in style) { if (style.hasOwnProperty(prop)) { - buffer += prop + ':' + this._escapeAttribute(style[prop]) + ';'; + buffer += prop + ':' + escapeAttribute(style[prop]) + ';'; } } @@ -14429,7 +14569,7 @@ Ember._RenderBuffer.prototype = if (attrs) { for (attr in attrs) { if (attrs.hasOwnProperty(attr)) { - buffer += ' ' + attr + '="' + this._escapeAttribute(attrs[attr]) + '"'; + buffer += ' ' + attr + '="' + escapeAttribute(attrs[attr]) + '"'; } } @@ -14444,7 +14584,7 @@ Ember._RenderBuffer.prototype = if (value === true) { buffer += ' ' + prop + '="' + prop + '"'; } else { - buffer += ' ' + prop + '="' + this._escapeAttribute(props[prop]) + '"'; + buffer += ' ' + prop + '="' + escapeAttribute(props[prop]) + '"'; } } } @@ -14459,7 +14599,7 @@ Ember._RenderBuffer.prototype = pushClosingTag: function() { var tagName = this.tagNames.pop(); - if (tagName) { this.buffer += ''; } + if (tagName) { this.buffer += ''; } }, currentTagName: function() { @@ -14557,32 +14697,7 @@ Ember._RenderBuffer.prototype = innerString: function() { return this.buffer; - }, - - _escapeAttribute: function(value) { - // Stolen shamelessly from Handlebars - - var escape = { - "<": "<", - ">": ">", - '"': """, - "'": "'", - "`": "`" - }; - - var badChars = /&(?!\w+;)|[<>"'`]/g; - var possible = /[&<>"'`]/; - - var escapeChar = function(chr) { - return escape[chr] || "&"; - }; - - var string = value.toString(); - - if(!possible.test(string)) { return string; } - return string.replace(badChars, escapeChar); } - }; })(); @@ -14610,6 +14725,47 @@ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt; */ Ember.EventDispatcher = Ember.Object.extend(/** @scope Ember.EventDispatcher.prototype */{ + /** + The set of events names (and associated handler function names) to be setup + and dispatched by the `EventDispatcher`. Custom events can added to this list at setup + time, generally via the `Ember.Application.customEvents` hash. Only override this + default set to prevent the EventDispatcher from listening on some events all together. + + This set will be modified by `setup` to also include any events added at that time. + + @property events + @type Object + */ + events: { + touchstart : 'touchStart', + touchmove : 'touchMove', + touchend : 'touchEnd', + touchcancel : 'touchCancel', + keydown : 'keyDown', + keyup : 'keyUp', + keypress : 'keyPress', + mousedown : 'mouseDown', + mouseup : 'mouseUp', + contextmenu : 'contextMenu', + click : 'click', + dblclick : 'doubleClick', + mousemove : 'mouseMove', + focusin : 'focusIn', + focusout : 'focusOut', + mouseenter : 'mouseEnter', + mouseleave : 'mouseLeave', + submit : 'submit', + input : 'input', + change : 'change', + dragstart : 'dragStart', + drag : 'drag', + dragenter : 'dragEnter', + dragleave : 'dragLeave', + dragover : 'dragOver', + drop : 'drop', + dragend : 'dragEnd' + }, + /** @private @@ -14641,35 +14797,7 @@ Ember.EventDispatcher = Ember.Object.extend(/** @scope Ember.EventDispatcher.pro @param addedEvents {Hash} */ setup: function(addedEvents, rootElement) { - var event, events = { - touchstart : 'touchStart', - touchmove : 'touchMove', - touchend : 'touchEnd', - touchcancel : 'touchCancel', - keydown : 'keyDown', - keyup : 'keyUp', - keypress : 'keyPress', - mousedown : 'mouseDown', - mouseup : 'mouseUp', - contextmenu : 'contextMenu', - click : 'click', - dblclick : 'doubleClick', - mousemove : 'mouseMove', - focusin : 'focusIn', - focusout : 'focusOut', - mouseenter : 'mouseEnter', - mouseleave : 'mouseLeave', - submit : 'submit', - input : 'input', - change : 'change', - dragstart : 'dragStart', - drag : 'drag', - dragenter : 'dragEnter', - dragleave : 'dragLeave', - dragover : 'dragOver', - drop : 'drop', - dragend : 'dragEnd' - }; + var event, events = get(this, 'events'); Ember.$.extend(events, addedEvents || {}); @@ -14916,6 +15044,15 @@ Ember.warn("The VIEW_PRESERVES_CONTEXT flag has been removed and the functionali */ Ember.TEMPLATES = {}; +/** + `Ember.CoreView` is + + @class CoreView + @namespace Ember + @extends Ember.Object + @uses Ember.Evented +*/ + Ember.CoreView = Ember.Object.extend(Ember.Evented, { isView: true, @@ -15619,8 +15756,10 @@ class: ### Event Names - Possible events names for any of the responding approaches described above - are: + All of the event handling approaches described above respond to the same set + of events. The names of the built-in events are listed below. (The hash of + built-in events exists in `Ember.EventDispatcher`.) Additional, custom events + can be registered by using `Ember.Application.customEvents`. Touch events: @@ -15673,8 +15812,7 @@ class: @class View @namespace Ember - @extends Ember.Object - @uses Ember.Evented + @extends Ember.CoreView */ Ember.View = Ember.CoreView.extend( /** @scope Ember.View.prototype */ { @@ -15855,7 +15993,7 @@ Ember.View = Ember.CoreView.extend( If a value that affects template rendering changes, the view should be re-rendered to reflect the new value. - @method _displayPropertyDidChange + @method _contextDidChange */ _contextDidChange: Ember.observer(function() { this.rerender(); @@ -15985,6 +16123,8 @@ Ember.View = Ember.CoreView.extend( _parentViewDidChange: Ember.observer(function() { if (this.isDestroying) { return; } + this.trigger('parentViewDidChange'); + if (get(this, 'parentView.controller') && !get(this, 'controller')) { this.notifyPropertyChange('controller'); } @@ -16256,9 +16396,9 @@ Ember.View = Ember.CoreView.extend( For example, calling `view.$('li')` will return a jQuery object containing all of the `li` elements inside the DOM element of this view. - @property $ + @method $ @param {String} [selector] a jQuery-compatible selector string - @return {jQuery} the CoreQuery object for the DOM node + @return {jQuery} the jQuery object for the DOM node */ $: function(sel) { return this.currentState.$(this, sel); @@ -16939,31 +17079,32 @@ Ember.View = Ember.CoreView.extend( @return {Ember.View} new instance */ createChildView: function(view, attrs) { - if (view.isView && view._parentView === this) { return view; } + if (view.isView && view._parentView === this && view.container === this.container) { + return view; + } + + attrs = attrs || {}; + attrs._parentView = this; + attrs.container = this.container; if (Ember.CoreView.detect(view)) { - attrs = attrs || {}; - attrs._parentView = this; - attrs.container = this.container; attrs.templateData = attrs.templateData || get(this, 'templateData'); view = view.create(attrs); // don't set the property on a virtual view, as they are invisible to // consumers of the view API - if (view.viewName) { set(get(this, 'concreteView'), view.viewName, view); } + if (view.viewName) { + set(get(this, 'concreteView'), view.viewName, view); + } } else { Ember.assert('You must pass instance or subclass of View', view.isView); - if (attrs) { - view.setProperties(attrs); - } + Ember.setProperties(view, attrs); if (!get(view, 'templateData')) { set(view, 'templateData', get(this, 'templateData')); } - - set(view, '_parentView', this); } return view; @@ -17310,8 +17451,8 @@ Ember.View.applyAttributeBindings = function(elem, name, value) { elem.attr(name, value); } } else if (name === 'value' || type === 'boolean') { - // We can't set properties to undefined - if (value === undefined) { value = null; } + // We can't set properties to undefined or null + if (!value) { value = ''; } if (value !== elem.prop(name)) { // value and booleans should always be properties @@ -18011,6 +18152,7 @@ Ember.ContainerView = Ember.View.extend(Ember.MutableArray, { initializeViews: function(views, parentView, templateData) { forEach(views, function(view) { set(view, '_parentView', parentView); + set(view, 'container', parentView && parentView.container); if (!get(view, 'templateData')) { set(view, 'templateData', templateData); @@ -18476,6 +18618,103 @@ Ember.CollectionView.CONTAINER_MAP = { +(function() { +/** +@module ember +@submodule ember-views +*/ + +/** + An `Ember.Component` is a view that is completely + isolated. Property access in its templates go + to the view object and actions are targeted at + the view object. There is no access to the + surrounding context or outer controller; all + contextual information is passed in. + + The easiest way to create an `Ember.Component` is via + a template. If you name a template + `controls/my-foo`, you will be able to use + `{{my-foo}}` in other templates, which will make + an instance of the isolated control. + + ```html + {{app-profile person=currentUser}} + ``` + + ```html + +

{{person.title}}

+ +

{{person.signature}}

+ ``` + + You can also use `yield` inside a template to + include the **contents** of the custom tag: + + ```html + {{#my-profile person=currentUser}} +

Admin mode

+ {{/my-profile}} + ``` + + ```html + + +

{{person.title}}

+ {{yield}} + ``` + + If you want to customize the control, in order to + handle events or actions, you implement a subclass + of `Ember.Component` named after the name of the + control. + + For example, you could implement the action + `hello` for the `app-profile` control: + + ```js + App.AppProfileComponent = Ember.Component.extend({ + hello: function(name) { + console.log("Hello", name) + } + }); + ``` + + And then use it in the control's template: + + ```html + + +

{{person.title}}

+ {{yield}} + + + ``` + + Components must have a `-` in their name to avoid + conflicts with built-in controls that wrap HTML + elements. This is consistent with the same + requirement in web components. + + @class Component + @namespace Ember + @extends Ember.View +*/ +Ember.Component = Ember.View.extend({ + init: function() { + this._super(); + this.set('context', this); + this.set('controller', this); + } +}); + +})(); + + + (function() { })(); @@ -18546,7 +18785,6 @@ Ember.ViewTargetActionSupport = Ember.Mixin.create(Ember.TargetActionSupport, { (function() { -/*globals jQuery*/ /** Ember Views @@ -19071,7 +19309,71 @@ function makeBindings(options) { } } +/** + Register a bound helper or custom view helper. + + ## Simple bound helper example + + ```javascript + Ember.Handlebars.helper('capitalize', function(value) { + return value.toUpperCase(); + }); + ``` + + The above bound helper can be used inside of templates as follows: + + ```handlebars + {{capitalize name}} + ``` + + In this case, when the `name` property of the template's context changes, + the rendered value of the helper will update to reflect this change. + + For more examples of bound helpers, see documentation for + `Ember.Handlebars.registerBoundHelper`. + + ## Custom view helper example + + Assuming a view subclass named `App.CalenderView` were defined, a helper + for rendering instances of this view could be registered as follows: + + ```javascript + Ember.Handlebars.helper('calendar', App.CalendarView): + ``` + + The above bound helper can be used inside of templates as follows: + + ```handlebars + {{calendar}} + ``` + + Which is functionally equivalent to: + + ```handlebars + {{view App.CalendarView}} + ``` + + Options in the helper will be passed to the view in exactly the same + manner as with the `view` helper. + + @method helper + @for Ember.Handlebars + @param {String} name + @param {Function|Ember.View} function or view class constructor + @param {String} dependentKeys* +*/ Ember.Handlebars.helper = function(name, value) { + if (Ember.Component.detect(value)) { + Ember.assert("You tried to register a component named '" + name + "', but component names must include a '-'", name.match(/-/)); + + var proto = value.proto(); + if (!proto.layoutName && !proto.templateName) { + value.reopen({ + layoutName: 'components/' + name + }); + } + } + if (Ember.View.detect(value)) { Ember.Handlebars.registerHelper(name, function(options) { Ember.assert("You can only pass attributes as parameters (not values) to a application-defined helper", arguments.length < 2); @@ -19832,7 +20134,7 @@ Ember._MetamorphView = Ember.View.extend(Ember._Metamorph); /** @class _SimpleMetamorphView @namespace Ember - @extends Ember.View + @extends Ember.CoreView @uses Ember._Metamorph @private */ @@ -22648,7 +22950,6 @@ Ember.SelectOption = Ember.View.extend({ ```html @@ -22681,7 +22982,6 @@ Ember.SelectOption = Ember.View.extend({ ```html @@ -22719,7 +23019,6 @@ Ember.SelectOption = Ember.View.extend({ ```html @@ -22987,8 +23286,8 @@ function program3(depth0,data) { var selection = get(this, 'selection'); var value = get(this, 'value'); - if (selection) { this.selectionDidChange(); } - if (value) { this.valueDidChange(); } + if (!Ember.isNone(selection)) { this.selectionDidChange(); } + if (!Ember.isNone(value)) { this.valueDidChange(); } this._change(); }, @@ -23185,6 +23484,31 @@ function bootstrap() { Ember.Handlebars.bootstrap( Ember.$(document) ); } +function registerComponents(container) { + var templates = Ember.TEMPLATES, match; + if (!templates) { return; } + + for (var prop in templates) { + if (match = prop.match(/^components\/(.*)$/)) { + registerComponent(container, match[1]); + } + } +} + +function registerComponent(container, name) { + Ember.assert("You provided a template named 'components/" + name + "', but custom components must include a '-'", name.match(/-/)); + + var className = name.replace(/-/g, '_'); + var Component = container.lookupFactory('component:' + className) || container.lookupFactory('component:' + name); + var View = Component || Ember.Component.extend(); + + View.reopen({ + layoutName: 'components/' + name + }); + + Ember.Handlebars.helper(name, View); +} + /* We tie this to application.load to ensure that we've at least attempted to bootstrap at the point that the application is loaded. @@ -23196,7 +23520,23 @@ function bootstrap() { from the DOM after processing. */ -Ember.onLoad('application', bootstrap); +Ember.onLoad('Ember.Application', function(Application) { + if (Application.initializer) { + Application.initializer({ + name: 'domTemplates', + initialize: bootstrap + }); + + Application.initializer({ + name: 'registerComponents', + after: 'domTemplates', + initialize: registerComponents + }); + } else { + // for ember-old-router + Ember.onLoad('application', bootstrap); + } +}); })(); @@ -23731,8 +24071,8 @@ define("route-recognizer", (function() { define("router", - ["route-recognizer"], - function(RouteRecognizer) { + ["route-recognizer", "rsvp"], + function(RouteRecognizer, RSVP) { "use strict"; /** @private @@ -23753,11 +24093,148 @@ define("router", */ - function Router() { + var slice = Array.prototype.slice; + + + + /** + @private + + A Transition is a thennable (a promise-like object) that represents + an attempt to transition to another route. It can be aborted, either + explicitly via `abort` or by attempting another transition while a + previous one is still underway. An aborted transition can also + be `retry()`d later. + */ + + function Transition(router, promise) { + this.router = router; + this.promise = promise; + this.data = {}; + this.resolvedModels = {}; + this.providedModels = {}; + this.providedModelsArray = []; + this.sequence = ++Transition.currentSequence; + this.params = {}; + } + + Transition.currentSequence = 0; + + Transition.prototype = { + targetName: null, + urlMethod: 'update', + providedModels: null, + resolvedModels: null, + params: null, + + /** + The Transition's internal promise. Calling `.then` on this property + is that same as calling `.then` on the Transition object itself, but + this property is exposed for when you want to pass around a + Transition's promise, but not the Transition object itself, since + Transition object can be externally `abort`ed, while the promise + cannot. + */ + promise: null, + + /** + Custom state can be stored on a Transition's `data` object. + This can be useful for decorating a Transition within an earlier + hook and shared with a later hook. Properties set on `data` will + be copied to new transitions generated by calling `retry` on this + transition. + */ + data: null, + + /** + A standard promise hook that resolves if the transition + succeeds and rejects if it fails/redirects/aborts. + + Forwards to the internal `promise` property which you can + use in situations where you want to pass around a thennable, + but not the Transition itself. + + @param {Function} success + @param {Function} failure + */ + then: function(success, failure) { + return this.promise.then(success, failure); + }, + + /** + Aborts the Transition. Note you can also implicitly abort a transition + by initiating another transition while a previous one is underway. + */ + abort: function() { + if (this.isAborted) { return this; } + log(this.router, this.sequence, this.targetName + ": transition was aborted"); + this.isAborted = true; + this.router.activeTransition = null; + return this; + }, + + /** + Retries a previously-aborted transition (making sure to abort the + transition if it's still active). Returns a new transition that + represents the new attempt to transition. + */ + retry: function() { + this.abort(); + + var recogHandlers = this.router.recognizer.handlersFor(this.targetName), + newTransition = performTransition(this.router, recogHandlers, this.providedModelsArray, this.params, this.data); + + return newTransition; + }, + + /** + Sets the URL-changing method to be employed at the end of a + successful transition. By default, a new Transition will just + use `updateURL`, but passing 'replace' to this method will + cause the URL to update using 'replaceWith' instead. Omitting + a parameter will disable the URL change, allowing for transitions + that don't update the URL at completion (this is also used for + handleURL, since the URL has already changed before the + transition took place). + + @param {String} method the type of URL-changing method to use + at the end of a transition. Accepted values are 'replace', + falsy values, or any other non-falsy value (which is + interpreted as an updateURL transition). + + @return {Transition} this transition + */ + method: function(method) { + this.urlMethod = method; + return this; + } + }; + + function Router() { this.recognizer = new RouteRecognizer(); } + + /** + Promise reject reasons passed to promise rejection + handlers for failed transitions. + */ + Router.UnrecognizedURLError = function(message) { + this.message = (message || "UnrecognizedURLError"); + this.name = "UnrecognizedURLError"; + }; + + Router.TransitionAborted = function(message) { + this.message = (message || "TransitionAborted"); + this.name = "TransitionAborted"; + }; + + function errorTransition(router, reason) { + return new Transition(router, RSVP.reject(reason)); + } + + Router.prototype = { /** The main entry point into the router. The API is essentially @@ -23788,7 +24265,8 @@ define("router", its ancestors. */ reset: function() { - eachHandler(this.currentHandlerInfos || [], function(handler) { + eachHandler(this.currentHandlerInfos || [], function(handlerInfo) { + var handler = handlerInfo.handler; if (handler.exit) { handler.exit(); } @@ -23797,7 +24275,10 @@ define("router", this.targetHandlerInfos = null; }, + activeTransition: null, + /** + var handler = handlerInfo.handler; The entry point for handling a change to the URL (usually via the back and forward button). @@ -23809,13 +24290,9 @@ define("router", @return {Array} an Array of `[handler, parameter]` tuples */ handleURL: function(url) { - var results = this.recognizer.recognize(url); - - if (!results) { - throw new Error("No route matched the URL '" + url + "'"); - } - - collectObjects(this, results, 0, []); + // Perform a URL-based transition, but don't change + // the URL afterward, since it already happened. + return doTransition(this, arguments).method(null); }, /** @@ -23847,8 +24324,7 @@ define("router", @param {String} name the name of the route */ transitionTo: function(name) { - var args = Array.prototype.slice.call(arguments, 1); - doTransition(this, name, this.updateURL, args); + return doTransition(this, arguments); }, /** @@ -23860,8 +24336,7 @@ define("router", @param {String} name the name of the route */ replaceWith: function(name) { - var args = Array.prototype.slice.call(arguments, 1); - doTransition(this, name, this.replaceURL, args); + return doTransition(this, arguments).method('replace'); }, /** @@ -23875,8 +24350,7 @@ define("router", @return {Object} a serialized parameter hash */ paramsForHandler: function(handlerName, callback) { - var output = this._paramsForHandler(handlerName, [].slice.call(arguments, 1)); - return output.params; + return paramsForHandler(this, handlerName, slice.call(arguments, 1)); }, /** @@ -23890,109 +24364,17 @@ define("router", @return {String} a URL */ generate: function(handlerName) { - var params = this.paramsForHandler.apply(this, arguments); + var params = paramsForHandler(this, handlerName, slice.call(arguments, 1)); return this.recognizer.generate(handlerName, params); }, - /** - @private - - Used internally by `generate` and `transitionTo`. - */ - _paramsForHandler: function(handlerName, objects, doUpdate) { - var handlers = this.recognizer.handlersFor(handlerName), - params = {}, - toSetup = [], - startIdx = handlers.length, - objectsToMatch = objects.length, - object, objectChanged, handlerObj, handler, names, i; - - // Find out which handler to start matching at - for (i=handlers.length-1; i>=0 && objectsToMatch>0; i--) { - if (handlers[i].names.length) { - objectsToMatch--; - startIdx = i; - } - } - - if (objectsToMatch > 0) { - throw "More context objects were passed than there are dynamic segments for the route: "+handlerName; - } - - // Connect the objects to the routes - for (i=0; i= startIdx) { - object = objects.shift(); - objectChanged = true; - // Otherwise use existing context - } else { - object = handler.context; - } - - // Serialize to generate params - if (handler.serialize) { - merge(params, handler.serialize(object, names)); - } - // If it's not a dynamic segment and we're updating - } else if (doUpdate) { - // If we've passed the match point we need to deserialize again - // or if we never had a context - if (i > startIdx || !handler.hasOwnProperty('context')) { - if (handler.deserialize) { - object = handler.deserialize({}); - objectChanged = true; - } - // Otherwise use existing context - } else { - object = handler.context; - } - } - - // Make sure that we update the context here so it's available to - // subsequent deserialize calls - if (doUpdate && objectChanged) { - // TODO: It's a bit awkward to set the context twice, see if we can DRY things up - setContext(handler, object); - } - - toSetup.push({ - isDynamic: !!handlerObj.names.length, - name: handlerObj.handler, - handler: handler, - context: object - }); - - if (i === handlers.length - 1) { - var lastHandler = toSetup[toSetup.length - 1], - additionalHandler; - - if (additionalHandler = lastHandler.handler.additionalHandler) { - handlers.push({ - handler: additionalHandler.call(lastHandler.handler), - names: [] - }); - } - } - } - - return { params: params, toSetup: toSetup }; - }, - isActive: function(handlerName) { - var contexts = [].slice.call(arguments, 1); + var contexts = slice.call(arguments, 1); var targetHandlerInfos = this.targetHandlerInfos, found = false, names, object, handlerInfo, handlerObj; - if (!targetHandlerInfos) { return; } + if (!targetHandlerInfos) { return false; } for (var i=targetHandlerInfos.length-1; i>=0; i--) { handlerInfo = targetHandlerInfos[i]; @@ -24012,165 +24394,169 @@ define("router", }, trigger: function(name) { - var args = [].slice.call(arguments); - trigger(this, args); - } - }; + var args = slice.call(arguments); + trigger(this.currentHandlerInfos, false, args); + }, - function merge(hash, other) { - for (var prop in other) { - if (other.hasOwnProperty(prop)) { hash[prop] = other[prop]; } - } - } + /** + Hook point for logging transition status updates. - function isCurrent(currentHandlerInfos, handlerName) { - return currentHandlerInfos[currentHandlerInfos.length - 1].name === handlerName; - } + @param {String} message The message to log. + */ + log: null + }; /** @private - This function is called the first time the `collectObjects` - function encounters a promise while converting URL parameters - into objects. + Used internally for both URL and named transition to determine + a shared pivot parent route and other data necessary to perform + a transition. + */ + function getMatchPoint(router, handlers, objects, inputParams) { + + var objectsToMatch = objects.length, + matchPoint = handlers.length, + providedModels = {}, i, + currentHandlerInfos = router.currentHandlerInfos || [], + params = {}, + oldParams = router.currentParams || {}, + activeTransition = router.activeTransition, + handlerParams = {}; + + merge(params, inputParams); + + for (i = handlers.length - 1; i >= 0; i--) { + var handlerObj = handlers[i], + handlerName = handlerObj.handler, + oldHandlerInfo = currentHandlerInfos[i], + hasChanged = false; - It triggers the `enter` and `setup` methods on the `loading` - handler. + // Check if handler names have changed. + if (!oldHandlerInfo || oldHandlerInfo.name !== handlerObj.handler) { hasChanged = true; } - @param {Router} router - */ - function loading(router) { - if (!router.isLoading) { - router.isLoading = true; - var handler = router.getHandler('loading'); - - if (handler) { - if (handler.enter) { handler.enter(); } - if (handler.setup) { handler.setup(); } - } - } - } + if (handlerObj.isDynamic) { + // URL transition. - /** - @private + if (objectsToMatch > 0) { + hasChanged = true; + providedModels[handlerName] = objects[--objectsToMatch]; + } else { + handlerParams[handlerName] = {}; + for (var prop in handlerObj.params) { + if (!handlerObj.params.hasOwnProperty(prop)) { continue; } + var newParam = handlerObj.params[prop]; + if (oldParams[prop] !== newParam) { hasChanged = true; } + handlerParams[handlerName][prop] = params[prop] = newParam; + } + } + } else if (handlerObj.hasOwnProperty('names') && handlerObj.names.length) { + // Named transition. + + if (objectsToMatch > 0) { + hasChanged = true; + providedModels[handlerName] = objects[--objectsToMatch]; + } else if (activeTransition && activeTransition.providedModels[handlerName]) { + + // Use model from previous transition attempt, preferably the resolved one. + hasChanged = true; + providedModels[handlerName] = activeTransition.providedModels[handlerName] || + activeTransition.resolvedModels[handlerName]; + } else { + var names = handlerObj.names; + handlerParams[handlerName] = {}; + for (var j = 0, len = names.length; j < len; ++j) { + var name = names[j]; + handlerParams[handlerName][name] = params[name] = oldParams[name]; + } + } + } - This function is called if a promise was previously - encountered once all promises are resolved. + if (hasChanged) { matchPoint = i; } + } - It triggers the `exit` method on the `loading` handler. + if (objectsToMatch > 0) { + throw "More context objects were passed than there are dynamic segments for the route: " + handlers[handlers.length - 1].handler; + } - @param {Router} router - */ - function loaded(router) { - router.isLoading = false; - var handler = router.getHandler('loading'); - if (handler && handler.exit) { handler.exit(); } + return { matchPoint: matchPoint, providedModels: providedModels, params: params, handlerParams: handlerParams }; } /** @private - This function is called if any encountered promise - is rejected. - - It triggers the `exit` method on the `loading` handler, - the `enter` method on the `failure` handler, and the - `setup` method on the `failure` handler with the - `error`. + This method takes a handler name and a list of contexts and returns + a serialized parameter hash suitable to pass to `recognizer.generate()`. @param {Router} router - @param {Object} error the reason for the promise - rejection, to pass into the failure handler's - `setup` method. + @param {String} handlerName + @param {Array[Object]} objects + @return {Object} a serialized parameter hash */ - function failure(router, error) { - loaded(router); - var handler = router.getHandler('failure'); - if (handler) { - if (handler.enter) { handler.enter(); } - if (handler.setup) { handler.setup(error); } + function paramsForHandler(router, handlerName, objects) { + + var handlers = router.recognizer.handlersFor(handlerName), + params = {}, + matchPoint = getMatchPoint(router, handlers, objects).matchPoint, + object, handlerObj, handler, names, i; + + for (i=0; i= matchPoint) { + object = objects.shift(); + // Otherwise use existing context + } else { + object = handler.context; + } + + // Serialize to generate params + merge(params, serialize(handler, object, names)); + } + } + return params; + } + + function merge(hash, other) { + for (var prop in other) { + if (other.hasOwnProperty(prop)) { hash[prop] = other[prop]; } } } /** @private */ - function doTransition(router, name, method, args) { - var output = router._paramsForHandler(name, args, true); - var params = output.params, toSetup = output.toSetup; + function createNamedTransition(router, args) { + var handlers = router.recognizer.handlersFor(args[0]); - var url = router.recognizer.generate(name, params); - method.call(router, url); + log(router, "Attempting transition to " + args[0]); - setupContexts(router, toSetup); + return performTransition(router, handlers, slice.call(args, 1), router.currentParams); } /** @private - - This function is called after a URL change has been handled - by `router.handleURL`. - - Takes an Array of `RecognizedHandler`s, and converts the raw - params hashes into deserialized objects by calling deserialize - on the handlers. This process builds up an Array of - `HandlerInfo`s. It then calls `setupContexts` with the Array. - - If the `deserialize` method on a handler returns a promise - (i.e. has a method called `then`), this function will pause - building up the `HandlerInfo` Array until the promise is - resolved. It will use the resolved value as the context of - `HandlerInfo`. */ - function collectObjects(router, results, index, objects) { - if (results.length === index) { - var lastObject = objects[objects.length - 1], - lastHandler = lastObject && lastObject.handler; - - if (lastHandler && lastHandler.additionalHandler) { - var additionalResult = { - handler: lastHandler.additionalHandler(), - params: {}, - isDynamic: false - }; - results.push(additionalResult); - } else { - loaded(router); - setupContexts(router, objects); - return; - } - } + function createURLTransition(router, url) { - var result = results[index]; - var handler = router.getHandler(result.handler); - var object = handler.deserialize && handler.deserialize(result.params); + var results = router.recognizer.recognize(url), + currentHandlerInfos = router.currentHandlerInfos; - if (object && typeof object.then === 'function') { - loading(router); + log(router, "Attempting URL transition to " + url); - // The chained `then` means that we can also catch errors that happen in `proceed` - object.then(proceed).then(null, function(error) { - failure(router, error); - }); - } else { - proceed(object); + if (!results) { + return errorTransition(router, new Router.UnrecognizedURLError(url)); } - function proceed(value) { - if (handler.context !== object) { - setContext(handler, object); - } - - var updatedObjects = objects.concat([{ - context: value, - name: result.handler, - handler: router.getHandler(result.handler), - isDynamic: result.isDynamic - }]); - collectObjects(router, results, index + 1, updatedObjects); - } + return performTransition(router, results, [], {}); } + /** @private @@ -24193,7 +24579,7 @@ define("router", Consider the following transitions: 1. A URL transition to `/posts/1`. - 1. Triggers the `deserialize` callback on the + 1. Triggers the `*model` callbacks on the `index`, `posts`, and `showPost` handlers 2. Triggers the `enter` callback on the same 3. Triggers the `setup` callback on the same @@ -24209,16 +24595,17 @@ define("router", 3. Triggers the `enter` callback on `about` 4. Triggers the `setup` callback on `about` - @param {Router} router + @param {Transition} transition @param {Array[HandlerInfo]} handlerInfos */ - function setupContexts(router, handlerInfos) { - var partition = - partitionHandlers(router.currentHandlerInfos || [], handlerInfos); + function setupContexts(transition, handlerInfos) { + var router = transition.router, + partition = partitionHandlers(router.currentHandlerInfos || [], handlerInfos); router.targetHandlerInfos = handlerInfos; - eachHandler(partition.exited, function(handler, context) { + eachHandler(partition.exited, function(handlerInfo) { + var handler = handlerInfo.handler; delete handler.context; if (handler.exit) { handler.exit(); } }); @@ -24226,33 +24613,51 @@ define("router", var currentHandlerInfos = partition.unchanged.slice(); router.currentHandlerInfos = currentHandlerInfos; - eachHandler(partition.updatedContext, function(handler, context, handlerInfo) { - setContext(handler, context); - if (handler.setup) { handler.setup(context); } - currentHandlerInfos.push(handlerInfo); + eachHandler(partition.updatedContext, function(handlerInfo) { + handlerEnteredOrUpdated(transition, currentHandlerInfos, handlerInfo, false); + }); + + eachHandler(partition.entered, function(handlerInfo) { + handlerEnteredOrUpdated(transition, currentHandlerInfos, handlerInfo, true); }); - var aborted = false; - eachHandler(partition.entered, function(handler, context, handlerInfo) { - if (aborted) { return; } - if (handler.enter) { handler.enter(); } + if (router.didTransition) { + router.didTransition(handlerInfos); + } + } + + /** + @private + + Helper method used by setupContexts. Handles errors or redirects + that may happen in enter/setup. + */ + function handlerEnteredOrUpdated(transition, currentHandlerInfos, handlerInfo, enter) { + var handler = handlerInfo.handler, + context = handlerInfo.context; + + try { + if (enter && handler.enter) { handler.enter(); } + checkAbort(transition); + setContext(handler, context); - if (handler.setup) { - if (false === handler.setup(context)) { - aborted = true; - } - } - if (!aborted) { - currentHandlerInfos.push(handlerInfo); + if (handler.setup) { handler.setup(context); } + checkAbort(transition); + } catch(e) { + if (!(e instanceof Router.TransitionAborted)) { + // Trigger the `error` event starting from this failed handler. + trigger(currentHandlerInfos.concat(handlerInfo), true, ['error', e, transition]); } - }); - if (!aborted && router.didTransition) { - router.didTransition(handlerInfos); + // Propagate the error so that the transition promise will reject. + throw e; } + + currentHandlerInfos.push(handlerInfo); } + /** @private @@ -24264,11 +24669,7 @@ define("router", */ function eachHandler(handlerInfos, callback) { for (var i=0, l=handlerInfos.length; i=0; i--) { - var handlerInfo = currentHandlerInfos[i], + for (var i=handlerInfos.length-1; i>=0; i--) { + var handlerInfo = handlerInfos[i], handler = handlerInfo.handler; if (handler.events && handler.events[name]) { @@ -24372,7 +24773,7 @@ define("router", } } - if (!eventWasHandled) { + if (!eventWasHandled && !ignoreFailure) { throw new Error("Nothing handled the event '" + name + "'."); } } @@ -24381,10 +24782,372 @@ define("router", handler.context = context; if (handler.contextDidChange) { handler.contextDidChange(); } } + + /** + @private + + Creates, begins, and returns a Transition. + */ + function performTransition(router, recogHandlers, providedModelsArray, params, data) { + + var matchPointResults = getMatchPoint(router, recogHandlers, providedModelsArray, params), + targetName = recogHandlers[recogHandlers.length - 1].handler, + wasTransitioning = false; + + // Check if there's already a transition underway. + if (router.activeTransition) { + if (transitionsIdentical(router.activeTransition, targetName, providedModelsArray)) { + return router.activeTransition; + } + router.activeTransition.abort(); + wasTransitioning = true; + } + + var deferred = RSVP.defer(), + transition = new Transition(router, deferred.promise); + + transition.targetName = targetName; + transition.providedModels = matchPointResults.providedModels; + transition.providedModelsArray = providedModelsArray; + transition.params = matchPointResults.params; + transition.data = data || {}; + router.activeTransition = transition; + + var handlerInfos = generateHandlerInfos(router, recogHandlers); + + // Fire 'willTransition' event on current handlers, but don't fire it + // if a transition was already underway. + if (!wasTransitioning) { + trigger(router.currentHandlerInfos, true, ['willTransition', transition]); + } + + log(router, transition.sequence, "Beginning validation for transition to " + transition.targetName); + validateEntry(transition, handlerInfos, 0, matchPointResults.matchPoint, matchPointResults.handlerParams) + .then(transitionSuccess, transitionFailure); + + return transition; + + function transitionSuccess() { + checkAbort(transition); + + try { + finalizeTransition(transition, handlerInfos); + + // Resolve with the final handler. + deferred.resolve(handlerInfos[handlerInfos.length - 1].handler); + } catch(e) { + deferred.reject(e); + } + + // Don't nullify if another transition is underway (meaning + // there was a transition initiated with enter/setup). + if (!transition.isAborted) { + router.activeTransition = null; + } + } + + function transitionFailure(reason) { + deferred.reject(reason); + } + } + + /** + @private + + Accepts handlers in Recognizer format, either returned from + recognize() or handlersFor(), and returns unified + `HandlerInfo`s. + */ + function generateHandlerInfos(router, recogHandlers) { + var handlerInfos = []; + for (var i = 0, len = recogHandlers.length; i < len; ++i) { + var handlerObj = recogHandlers[i], + isDynamic = handlerObj.isDynamic || (handlerObj.names && handlerObj.names.length); + + handlerInfos.push({ + isDynamic: !!isDynamic, + name: handlerObj.handler, + handler: router.getHandler(handlerObj.handler) + }); + } + return handlerInfos; + } + + /** + @private + */ + function transitionsIdentical(oldTransition, targetName, providedModelsArray) { + + if (oldTransition.targetName !== targetName) { return false; } + + var oldModels = oldTransition.providedModelsArray; + if (oldModels.length !== providedModelsArray.length) { return false; } + + for (var i = 0, len = oldModels.length; i < len; ++i) { + if (oldModels[i] !== providedModelsArray[i]) { return false; } + } + return true; + } + + /** + @private + + Updates the URL (if necessary) and calls `setupContexts` + to update the router's array of `currentHandlerInfos`. + */ + function finalizeTransition(transition, handlerInfos) { + + var router = transition.router, + seq = transition.sequence, + handlerName = handlerInfos[handlerInfos.length - 1].name; + + log(router, seq, "Validation succeeded, finalizing transition;"); + + // Collect params for URL. + var objects = []; + for (var i = 0, len = handlerInfos.length; i < len; ++i) { + var handlerInfo = handlerInfos[i]; + if (handlerInfo.isDynamic) { + objects.push(handlerInfo.context); + } + } + + var params = paramsForHandler(router, handlerName, objects); + + transition.providedModelsArray = []; + transition.providedContexts = {}; + router.currentParams = params; + + var urlMethod = transition.urlMethod; + if (urlMethod) { + var url = router.recognizer.generate(handlerName, params); + + if (urlMethod === 'replace') { + router.replaceURL(url); + } else { + // Assume everything else is just a URL update for now. + router.updateURL(url); + } + } + + setupContexts(transition, handlerInfos); + log(router, seq, "TRANSITION COMPLETE."); + } + + /** + @private + + Internal function used to construct the chain of promises used + to validate a transition. Wraps calls to `beforeModel`, `model`, + and `afterModel` in promises, and checks for redirects/aborts + between each. + */ + function validateEntry(transition, handlerInfos, index, matchPoint, handlerParams) { + + if (index === handlerInfos.length) { + // No more contexts to resolve. + return RSVP.resolve(transition.resolvedModels); + } + + var router = transition.router, + handlerInfo = handlerInfos[index], + handler = handlerInfo.handler, + handlerName = handlerInfo.name, + seq = transition.sequence, + errorAlreadyHandled = false, + resolvedModel; + + if (index < matchPoint) { + log(router, seq, handlerName + ": using context from already-active handler"); + + // We're before the match point, so don't run any hooks, + // just use the already resolved context from the handler. + resolvedModel = handlerInfo.handler.context; + return proceed(); + } + + return RSVP.resolve().then(handleAbort) + .then(beforeModel) + .then(null, handleError) + .then(handleAbort) + .then(model) + .then(null, handleError) + .then(handleAbort) + .then(afterModel) + .then(null, handleError) + .then(handleAbort) + .then(proceed); + + function handleAbort(result) { + + if (transition.isAborted) { + log(transition.router, transition.sequence, "detected abort."); + errorAlreadyHandled = true; + return RSVP.reject(new Router.TransitionAborted()); + } + + return result; + } + + function handleError(reason) { + + if (errorAlreadyHandled) { return RSVP.reject(reason); } + errorAlreadyHandled = true; + transition.abort(); + + log(router, seq, handlerName + ": handling error: " + reason); + + // An error was thrown / promise rejected, so fire an + // `error` event from this handler info up to root. + trigger(handlerInfos.slice(0, index + 1), true, ['error', reason, transition]); + + if (handler.error) { + handler.error(reason, transition); } + + + // Propagate the original error. + return RSVP.reject(reason); + } + + function beforeModel() { + + log(router, seq, handlerName + ": calling beforeModel hook"); + + return handler.beforeModel && handler.beforeModel(transition); + } + + function model() { + log(router, seq, handlerName + ": resolving model"); + + return getModel(handlerInfo, transition, handlerParams[handlerName], index >= matchPoint); + } + + function afterModel(context) { + + log(router, seq, handlerName + ": calling afterModel hook"); + + // Pass the context and resolved parent contexts to afterModel, but we don't + // want to use the value returned from `afterModel` in any way, but rather + // always resolve with the original `context` object. + + resolvedModel = context; + return handler.afterModel && handler.afterModel(resolvedModel, transition); + } + + function proceed() { + log(router, seq, handlerName + ": validation succeeded, proceeding"); + + handlerInfo.context = transition.resolvedModels[handlerInfo.name] = resolvedModel; + return validateEntry(transition, handlerInfos, index + 1, matchPoint, handlerParams); + } + } + + /** + @private + + Throws a TransitionAborted if the provided transition has been aborted. + */ + function checkAbort(transition) { + if (transition.isAborted) { + log(transition.router, transition.sequence, "detected abort."); + throw new Router.TransitionAborted(); + } + } + + /** + @private + + Encapsulates the logic for whether to call `model` on a route, + or use one of the models provided to `transitionTo`. + */ + function getModel(handlerInfo, transition, handlerParams, needsUpdate) { + + var handler = handlerInfo.handler, + handlerName = handlerInfo.name; + + if (!needsUpdate && handler.hasOwnProperty('context')) { + return handler.context; + } + + if (handlerInfo.isDynamic && transition.providedModels.hasOwnProperty(handlerName)) { + var providedModel = transition.providedModels[handlerName]; + return typeof providedModel === 'function' ? providedModel() : providedModel; + } + + return handler.model && handler.model(handlerParams || {}, transition); + } + + /** + @private + */ + function log(router, sequence, msg) { + + if (!router.log) { return; } + + if (arguments.length === 3) { + router.log("Transition #" + sequence + ": " + msg); + } else { + msg = sequence; + router.log(msg); + } + } + + /** + @private + + Begins and returns a Transition based on the provided + arguments. Accepts arguments in the form of both URL + transitions and named transitions. + + @param {Router} router + @param {Array[Object]} args arguments passed to transitionTo, + replaceWith, or handleURL + */ + function doTransition(router, args) { + // Normalize blank transitions to root URL transitions. + var name = args[0] || '/'; + + if (name.charAt(0) === '/') { + return createURLTransition(router, name); + } else { + return createNamedTransition(router, args); + } + } + + /** + @private + + Serializes a handler using its custom `serialize` method or + by a default that looks up the expected property name from + the dynamic segment. + + @param {Object} handler a router handler + @param {Object} model the model to be serialized for this handler + @param {Array[Object]} names the names array attached to an + handler object returned from router.recognizer.handlersFor() + */ + function serialize(handler, model, names) { + + // Use custom serialize if it exists. + if (handler.serialize) { + return handler.serialize(model, names); + } + + if (names.length !== 1) { return; } + + var name = names[0], object = {}; + + if (/_id$/.test(name)) { + object[name] = model.id; + } else { + object[name] = model; + } + return object; + } + return Router; }); - })(); @@ -24570,7 +25333,7 @@ Ember.Router = Ember.Object.extend({ location: 'hash', init: function() { - this.router = this.constructor.router; + this.router = this.constructor.router || this.constructor.map(Ember.K); this._activeViews = {}; setupLocation(this); }, @@ -24615,34 +25378,21 @@ Ember.Router = Ember.Object.extend({ }, handleURL: function(url) { - this.router.handleURL(url); - this.notifyPropertyChange('url'); - }, - - /** - Transition to another route via the `routeTo` event which - will by default be handled by ApplicationRoute. + scheduleLoadingStateEntry(this); - @method routeTo - @param {TransitionEvent} transitionEvent - */ - routeTo: function(transitionEvent) { - var handlerInfos = this.router.currentHandlerInfos; - if (handlerInfos) { - transitionEvent.sourceRoute = handlerInfos[handlerInfos.length - 1].handler; - } + var self = this; - this.send('routeTo', transitionEvent); + return this.router.handleURL(url).then(function() { + transitionCompleted(self); + }); }, - transitionTo: function(name) { - var args = [].slice.call(arguments); - doTransition(this, 'transitionTo', args); + transitionTo: function() { + return doTransition(this, 'transitionTo', arguments); }, replaceWith: function() { - var args = [].slice.call(arguments); - doTransition(this, 'replaceWith', args); + return doTransition(this, 'replaceWith', arguments); }, generate: function() { @@ -24696,17 +25446,6 @@ Ember.Router = Ember.Object.extend({ } }); -Ember.Router.reopenClass({ - defaultFailureHandler: { - setup: function(error) { - Ember.Logger.error('Error while loading route:', error); - - // Using setTimeout allows us to escape from the Promise's try/catch block - setTimeout(function() { throw error; }); - } - } -}); - function getHandlerFunction(router) { var seen = {}, container = router.container, DefaultRoute = container.resolve('route:basic'); @@ -24721,7 +25460,6 @@ function getHandlerFunction(router) { if (!handler) { if (name === 'loading') { return {}; } - if (name === 'failure') { return router.constructor.defaultFailureHandler; } container.register(routeName, DefaultRoute.extend()); handler = container.lookup(routeName); @@ -24732,9 +25470,9 @@ function getHandlerFunction(router) { } if (name === 'application') { - // Inject default `routeTo` handler. + // Inject default `error` handler. handler.events = handler.events || {}; - handler.events.routeTo = handler.events.routeTo || Ember.TransitionEvent.defaultHandler; + handler.events.error = handler.events.error || defaultErrorHandler; } handler.routeName = name; @@ -24742,6 +25480,14 @@ function getHandlerFunction(router) { }; } +function defaultErrorHandler(error, transition) { + Ember.Logger.error('Error while loading route:', error); + + // Using setTimeout allows us to escape from the Promise's try/catch block + setTimeout(function() { throw error; }); +} + + function routePath(handlerInfos) { var path = []; @@ -24786,24 +25532,76 @@ function setupRouter(emberRouter, router, location) { } function doTransition(router, method, args) { + // Normalize blank route to root URL. + args = [].slice.call(args); + args[0] = args[0] || '/'; + var passedName = args[0], name; - if (!router.router.hasRoute(args[0])) { - name = args[0] = passedName + '.index'; - } else { + if (passedName.charAt(0) === '/') { name = passedName; + } else { + if (!router.router.hasRoute(passedName)) { + name = args[0] = passedName + '.index'; + } else { + name = passedName; + } + + Ember.assert("The route " + passedName + " was not found", router.router.hasRoute(name)); + } + + scheduleLoadingStateEntry(router); + + var transitionPromise = router.router[method].apply(router.router, args); + transitionPromise.then(function() { + transitionCompleted(router); + }); + + // We want to return the configurable promise object + // so that callers of this function can use `.method()` on it, + // which obviously doesn't exist for normal RSVP promises. + return transitionPromise; +} + +function scheduleLoadingStateEntry(router) { + if (router._loadingStateActive) { return; } + router._shouldEnterLoadingState = true; + Ember.run.scheduleOnce('routerTransitions', null, enterLoadingState, router); +} + +function enterLoadingState(router) { + if (router._loadingStateActive || !router._shouldEnterLoadingState) { return; } + + var loadingRoute = router.router.getHandler('loading'); + if (loadingRoute) { + if (loadingRoute.enter) { loadingRoute.enter(); } + if (loadingRoute.setup) { loadingRoute.setup(); } + router._loadingStateActive = true; } +} + +function exitLoadingState(router) { + router._shouldEnterLoadingState = false; + if (!router._loadingStateActive) { return; } - Ember.assert("The route " + passedName + " was not found", router.router.hasRoute(name)); + var loadingRoute = router.router.getHandler('loading'); + if (loadingRoute && loadingRoute.exit) { loadingRoute.exit(); } + router._loadingStateActive = false; +} - router.router[method].apply(router.router, args); +function transitionCompleted(router) { router.notifyPropertyChange('url'); + exitLoadingState(router); } Ember.Router.reopenClass({ map: function(callback) { var router = this.router = new Router(); + if (get(this, 'namespace.LOG_TRANSITIONS_INTERNAL')) { + router.log = Ember.Logger.debug; + } + var dsl = Ember.RouterDSL.map(function() { this.resource('application', { path: "/" }, function() { callback.call(this); @@ -24815,6 +25613,7 @@ Ember.Router.reopenClass({ } }); + })(); @@ -24827,7 +25626,9 @@ Ember.Router.reopenClass({ var get = Ember.get, set = Ember.set, classify = Ember.String.classify, - fmt = Ember.String.fmt; + fmt = Ember.String.fmt, + a_forEach = Ember.EnumerableUtils.forEach, + a_replace = Ember.EnumerableUtils.replace; /** The `Ember.Route` class is used to define individual routes. Refer to @@ -24845,7 +25646,7 @@ Ember.Route = Ember.Object.extend({ */ exit: function() { this.deactivate(); - teardownView(this); + this.teardownViews(); }, /** @@ -24869,6 +25670,104 @@ Ember.Route = Ember.Object.extend({ The context of the event will be this route. + ## Bubbling + + By default, an event will stop bubbling once a handler defined + on the `events` hash handles it. To continue bubbling the event, + you must return `true` from the handler. + + ## Built-in events + + There are a few built-in events pertaining to transitions that you + can use to customize transition behavior: `willTransition` and + `error`. + + ### `willTransition` + + The `willTransition` event is fired at the beginning of any + attempted transition with a `Transition` object as the sole + argument. This event can be used for aborting, redirecting, + or decorating the transition from the currently active routes. + + A good example is preventing navigation when a form is + half-filled out: + + ```js + App.ContactFormRoute = Ember.Route.extend({ + events: { + willTransition: function(transition) { + if (this.controller.get('userHasEnteredData')) { + this.controller.displayNavigationConfirm(); + transition.abort(); + } + } + } + }); + ``` + + You can also redirect elsewhere by calling + `this.transitionTo('elsewhere')` from within `willTransition`. + Note that `willTransition` will not be fired for the + redirecting `transitionTo`, since `willTransition` doesn't + fire when there is already a transition underway. If you want + subsequent `willTransition` events to fire for the redirecting + transition, you must first explicitly call + `transition.abort()`. + + ### `error` + + When attempting to transition into a route, any of the hooks + may throw an error, or return a promise that rejects, at which + point an `error` event will be fired on the partially-entered + routes, allowing for per-route error handling logic, or shared + error handling logic defined on a parent route. + + Here is an example of an error handler that will be invoked + for rejected promises / thrown errors from the various hooks + on the route, as well as any unhandled errors from child + routes: + + ```js + App.AdminRoute = Ember.Route.extend({ + beforeModel: function() { + throw "bad things!"; + // ...or, equivalently: + return Ember.RSVP.reject("bad things!"); + }, + + events: { + error: function(error, transition) { + // Assuming we got here due to the error in `beforeModel`, + // we can expect that error === "bad things!", + // but a promise model rejecting would also + // call this hook, as would any errors encountered + // in `afterModel`. + + // The `error` hook is also provided the failed + // `transition`, which can be stored and later + // `.retry()`d if desired. + + this.transitionTo('login'); + } + } + }); + ``` + + `error` events that bubble up all the way to `ApplicationRoute` + will fire a default error handler that logs the error. You can + specify your own global default error handler by overriding the + `error` handler on `ApplicationRoute`: + + ```js + App.ApplicationRoute = Ember.Route.extend({ + events: { + error: function(error, transition) { + this.controllerFor('banner').displayError(error.message); + } + } + }); + ``` + @see {Ember.Route#send} @see {Handlebars.helpers.action} @@ -24894,17 +25793,6 @@ Ember.Route = Ember.Object.extend({ */ activate: Ember.K, - /** - Transition to another route via the `routeTo` event which - will by default be handled by ApplicationRoute. - - @method routeTo - @param {TransitionEvent} transitionEvent - */ - routeTo: function(transitionEvent) { - this.router.routeTo(transitionEvent); - }, - /** Transition into another route. Optionally supply a model for the route in question. The model will be serialized into the URL @@ -24916,13 +25804,6 @@ Ember.Route = Ember.Object.extend({ */ transitionTo: function(name, context) { var router = this.router; - - // If the transition is a no-op, just bail. - if (router.isActive.apply(router, arguments)) { - return; - } - - if (this._checkingRedirect) { this._redirected[this._redirectDepth] = true; } return router.transitionTo.apply(router, arguments); }, @@ -24939,13 +25820,6 @@ Ember.Route = Ember.Object.extend({ */ replaceWith: function() { var router = this.router; - - // If the transition is a no-op, just bail. - if (router.isActive.apply(router, arguments)) { - return; - } - - if (this._checkingRedirect) { this._redirected[this._redirectDepth] = true; } return this.router.replaceWith.apply(this.router, arguments); }, @@ -24953,15 +25827,6 @@ Ember.Route = Ember.Object.extend({ return this.router.send.apply(this.router, arguments); }, - /** - @private - - Internal counter for tracking whether a route handler has - called transitionTo or replaceWith inside its redirect hook. - - */ - _redirectDepth: 0, - /** @private @@ -24970,58 +25835,6 @@ Ember.Route = Ember.Object.extend({ @method setup */ setup: function(context) { - // Determine if this is the top-most transition. - // If so, we'll set up a data structure to track - // whether `transitionTo` or replaceWith gets called - // inside our `redirect` hook. - // - // This is necessary because we set a flag on the route - // inside transitionTo/replaceWith to determine afterwards - // if they were called, but `setup` can be called - // recursively and we need to disambiguate where in the - // call stack the redirect happened. - - // Are we the first call to setup? If so, set up the - // redirect tracking data structure, and remember that - // we're the top-most so we can clean it up later. - var isTop; - if (!this._redirected) { - isTop = true; - this._redirected = []; - } - - // Set a flag on this route saying that we are interested in - // tracking redirects, and increment the depth count. - this._checkingRedirect = true; - var depth = ++this._redirectDepth; - - // Check to see if context is set. This check preserves - // the correct arguments.length inside the `redirect` hook. - if (context === undefined) { - this.redirect(); - } else { - this.redirect(context); - } - - // After the call to `redirect` returns, decrement the depth count. - this._redirectDepth--; - this._checkingRedirect = false; - - // Save off the data structure so we can reset it on the route but - // still reference it later in this method. - var redirected = this._redirected; - - // If this is the top `setup` call in the call stack, clear the - // redirect tracking data structure. - if (isTop) { this._redirected = null; } - - // If we were redirected, there is nothing left for us to do. - // Returning false tells router.js not to continue calling setup - // on any children route handlers. - if (redirected[depth]) { - return false; - } - var controller = this.controllerFor(this.routeName, context); // Assign the route's controller so that it can more easily be @@ -25044,29 +25857,131 @@ Ember.Route = Ember.Object.extend({ }, /** + @deprecated + A hook you can implement to optionally redirect to another route. If you call `this.transitionTo` from inside of this hook, this route will not be entered in favor of the other hook. + This hook is deprecated in favor of using the `afterModel` hook + for performing redirects after the model has resolved. + @method redirect @param {Object} model the model for this route */ redirect: Ember.K, /** - @private + This hook is the first of the route entry validation hooks + called when an attempt is made to transition into a route + or one of its children. It is called before `model` and + `afterModel`, and is appropriate for cases when: + + 1) A decision can be made to redirect elsewhere without + needing to resolve the model first. + 2) Any async operations need to occur first before the + model is attempted to be resolved. + + This hook is provided the current `transition` attempt + as a parameter, which can be used to `.abort()` the transition, + save it for a later `.retry()`, or retrieve values set + on it from a previous hook. You can also just call + `this.transitionTo` to another route to implicitly + abort the `transition`. + + You can return a promise from this hook to pause the + transition until the promise resolves (or rejects). This could + be useful, for instance, for retrieving async code from + the server that is required to enter a route. + + ```js + App.PostRoute = Ember.Route.extend({ + beforeModel: function(transition) { + if (!App.Post) { + return Ember.$.getScript('/models/post.js'); + } + } + }); + ``` + + If `App.Post` doesn't exist in the above example, + `beforeModel` will use jQuery's `getScript`, which + returns a promise that resolves after the server has + successfully retrieved and executed the code from the + server. Note that if an error were to occur, it would + be passed to the `error` hook on `Ember.Route`, but + it's also possible to handle errors specific to + `beforeModel` right from within the hook (to distinguish + from the shared error handling behavior of the `error` + hook): - The hook called by `router.js` to convert parameters into the context - for this handler. The public Ember hook is `model`. + ```js + App.PostRoute = Ember.Route.extend({ + beforeModel: function(transition) { + if (!App.Post) { + var self = this; + return Ember.$.getScript('post.js').then(null, function(e) { + self.transitionTo('help'); + + // Note that the above transitionTo will implicitly + // halt the transition. If you were to return + // nothing from this promise reject handler, + // according to promise semantics, that would + // convert the reject into a resolve and the + // transition would continue. To propagate the + // error so that it'd be handled by the `error` + // hook, you would have to either + return Ember.RSVP.reject(e); + // or + throw e; + }); + } + } + }); + ``` - @method deserialize + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. */ - deserialize: function(params) { - var model = this.model(params); - return this.currentModel = model; + beforeModel: Ember.K, + + /** + This hook is called after this route's model has resolved. + It follows identical async/promise semantics to `beforeModel` + but is provided the route's resolved model in addition to + the `transition`, and is therefore suited to performing + logic that can only take place after the model has already + resolved. + + ```js + App.PostRoute = Ember.Route.extend({ + afterModel: function(posts, transition) { + if (posts.length === 1) { + this.transitionTo('post.show', posts[0]); + } + } + }); + ``` + + Refer to documentation for `beforeModel` for a description + of transition-pausing semantics when a promise is returned + from this hook. + + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. + */ + afterModel: function(resolvedModel, transition) { + this.redirect(resolvedModel, transition); }, + /** @private @@ -25104,10 +26019,15 @@ Ember.Route = Ember.Object.extend({ is not called. Routes without dynamic segments will always execute the model hook. + This hook follows the asynchronous/promise semantics + described in the documentation for `beforeModel`. In particular, + if a promise returned from `model` fails, the error will be + handled by the `error` hook on `Ember.Route`. + @method model @param {Object} params the parameters extracted from the URL */ - model: function(params) { + model: function(params, resolvedParentModels) { var match, name, sawParams, value; for (var prop in params) { @@ -25265,7 +26185,19 @@ Ember.Route = Ember.Object.extend({ @return {Object} the model object */ modelFor: function(name) { - var route = this.container.lookup('route:' + name); + + var route = this.container.lookup('route:' + name), + transition = this.router.router.activeTransition; + + // If we are mid-transition, we want to try and look up + // resolved parent contexts on the current transitionEvent. + if (transition) { + var modelLookupName = (route && route.routeName) || name; + if (transition.resolvedModels.hasOwnProperty(modelLookupName)) { + return transition.resolvedModels[modelLookupName]; + } + } + return route && route.currentModel; }, @@ -25368,7 +26300,22 @@ Ember.Route = Ember.Object.extend({ }, willDestroy: function() { - teardownView(this); + this.teardownViews(); + }, + + teardownViews: function() { + // Tear down the top level view + if (this.teardownTopLevelView) { this.teardownTopLevelView(); } + + // Tear down any outlets rendered with 'into' + var teardownOutletViews = this.teardownOutletViews || []; + a_forEach(teardownOutletViews, function(teardownOutletView) { + teardownOutletView(); + }); + + delete this.teardownTopLevelView; + delete this.teardownOutletViews; + delete this.lastRenderedTemplate; } }); @@ -25457,94 +26404,30 @@ function setupView(view, container, options) { function appendView(route, view, options) { if (options.into) { var parentView = route.router._lookupActiveView(options.into); - route.teardownView = teardownOutlet(parentView, options.outlet); + var teardownOutletView = generateOutletTeardown(parentView, options.outlet); + if (!route.teardownOutletViews) { route.teardownOutletViews = []; } + a_replace(route.teardownOutletViews, 0, 0, [teardownOutletView]); parentView.connectOutlet(options.outlet, view); } else { var rootElement = get(route, 'router.namespace.rootElement'); // tear down view if one is already rendered - if (route.teardownView) { - route.teardownView(); + if (route.teardownTopLevelView) { + route.teardownTopLevelView(); } route.router._connectActiveView(options.name, view); - route.teardownView = teardownTopLevel(view); + route.teardownTopLevelView = generateTopLevelTeardown(view); view.appendTo(rootElement); } } -function teardownTopLevel(view) { +function generateTopLevelTeardown(view) { return function() { view.destroy(); }; } -function teardownOutlet(parentView, outlet) { +function generateOutletTeardown(parentView, outlet) { return function() { parentView.disconnectOutlet(outlet); }; } -function teardownView(route) { - if (route.teardownView) { route.teardownView(); } - - delete route.teardownView; - delete route.lastRenderedTemplate; -} - -})(); - - - -(function() { -/** -@module ember -@submodule ember-routing -*/ - - -/* - A TransitionEvent is passed as the argument for `transitionTo` - events and contains information about an attempted transition - that can be modified or decorated by leafier `transitionTo` event - handlers before the actual transition is committed by ApplicationRoute. - - @class TransitionEvent - @namespace Ember - @extends Ember.Deferred - */ -Ember.TransitionEvent = Ember.Object.extend({ - - /* - The Ember.Route method used to perform the transition. Presently, - the only valid values are 'transitionTo' and 'replaceWith'. - */ - transitionMethod: 'transitionTo', - destinationRouteName: null, - sourceRoute: null, - contexts: null, - - init: function() { - this._super(); - this.contexts = this.contexts || []; - }, - - /* - Convenience method that returns an array that can be used for - legacy `transitionTo` and `replaceWith`. - */ - transitionToArgs: function() { - return [this.destinationRouteName].concat(this.contexts); - } -}); - - -Ember.TransitionEvent.reopenClass({ - /* - This is the default transition event handler that will be injected - into ApplicationRoute. The context, like all route event handlers in - the events hash, will be an `Ember.Route`. - */ - defaultHandler: function(transitionEvent) { - var router = this.router; - router[transitionEvent.transitionMethod].apply(router, transitionEvent.transitionToArgs()); - } -}); - })(); @@ -25622,34 +26505,133 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) { } /** + `Ember.LinkView` renders an element whose `click` event triggers a + transition of the application's instance of `Ember.Router` to + a supplied route by name. + + Instances of `LinkView` will most likely be created through + the `linkTo` Handlebars helper, but properties of this class + can be overridden to customize application-wide behavior. + @class LinkView @namespace Ember @extends Ember.View + @see {Handlebars.helpers.linkTo} **/ var LinkView = Ember.LinkView = Ember.View.extend({ tagName: 'a', namedRoute: null, currentWhen: null, + + /** + Sets the `title` attribute of the `LinkView`'s HTML element. + + @property title + @default null + **/ title: null, + + /** + The CSS class to apply to `LinkView`'s element when its `active` + property is `true`. + + @property activeClass + @type String + @default active + **/ activeClass: 'active', + + /** + The CSS class to apply to a `LinkView`'s element when its `disabled` + property is `true`. + + @property disabledClass + @type String + @default disabled + **/ disabledClass: 'disabled', _isDisabled: false, + + /** + Determines whether the `LinkView` will trigger routing via + the `replaceWith` routing strategy. + + @type Boolean + @default false + **/ replace: false, attributeBindings: ['href', 'title'], classNameBindings: ['active', 'disabled'], - // Even though this isn't a virtual view, we want to treat it as if it is - // so that you can access the parent with {{view.prop}} + /** + By default the `{{linkTo}}` helper responds to the `click` event. You + can override this globally by setting this property to your custom + event name. + + This is particularly useful on mobile when one wants to avoid the 300ms + click delay using some sort of custom `tap` event. + + @property eventName + @type String + @default click + */ + eventName: 'click', + + // this is doc'ed here so it shows up in the events + // section of the API documentation, which is where + // people will likely go looking for it. + /** + Triggers the `LinkView`'s routing behavior. If + `eventName` is changed to a value other than `click` + the routing behavior will trigger on that custom event + instead. + + @event click + **/ + + init: function() { + this._super(); + // Map desired event name to invoke function + var eventName = get(this, 'eventName'); + this.on(eventName, this, this._invoke); + }, + + /** + @private + + Even though this isn't a virtual view, we want to treat it as if it is + so that you can access the parent with {{view.prop}} + + @method concreteView + **/ concreteView: Ember.computed(function() { return get(this, 'parentView'); }).property('parentView'), + /** + + Accessed as a classname binding to apply the `LinkView`'s `disabledClass` + CSS `class` to the element when the link is disabled. + + When `true` interactions with the element will not trigger route changes. + @property disabled + */ disabled: Ember.computed(function(key, value) { if (value !== undefined) { this.set('_isDisabled', value); } return value ? this.get('disabledClass') : false; }), + /** + Accessed as a classname binding to apply the `LinkView`'s `activeClass` + CSS `class` to the element when the link is active. + + A `LinkView` is considered active when its `currentWhen` property is `true` + or the application's current route is the route the `LinkView` would trigger + transitions into. + + @property active + **/ active: Ember.computed(function() { var router = this.get('router'), params = resolvedPaths(this.parameters), @@ -25664,7 +26646,15 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) { return this.get('controller').container.lookup('router:main'); }), - click: function(event) { + /** + @private + + Event handler that invokes the link, activating the associated route. + + @method _invoke + @param {Event} event + */ + _invoke: function(event) { if (!isSimpleClick(event)) { return true; } event.preventDefault(); @@ -25672,26 +26662,25 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) { if (get(this, '_isDisabled')) { return false; } - var router = this.get('router'); - - if (Ember.ENV.ENABLE_ROUTE_TO) { - - var routeArgs = args(this, router); + var router = this.get('router'), + routeArgs = args(this, router); - router.routeTo(Ember.TransitionEvent.create({ - transitionMethod: this.get('replace') ? 'replaceWith' : 'transitionTo', - destinationRouteName: routeArgs[0], - contexts: routeArgs.slice(1) - })); + if (this.get('replace')) { + router.replaceWith.apply(router, routeArgs); } else { - if (this.get('replace')) { - router.replaceWith.apply(router, args(this, router)); - } else { - router.transitionTo.apply(router, args(this, router)); - } + router.transitionTo.apply(router, routeArgs); } }, + /** + Sets the element's `href` attribute to the url for + the `LinkView`'s targeted route. + + If the `LinkView`'s `tagName` is changed to a value other + than `a`, this property will be ignored. + + @property href + **/ href: Ember.computed(function() { if (this.get('tagName') !== 'a') { return false; } @@ -25852,6 +26841,15 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) { }) ``` + It is also possible to override the default event in + this manner: + + ``` javascript + Ember.LinkView.reopen({ + eventName: 'customEventName' + }); + ``` + @method linkTo @for Ember.Handlebars.helpers @param {String} routeName @@ -26043,8 +27041,12 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) { view = container.lookup('view:' + name) || container.lookup('view:default'); - if (controller = options.hash.controller) { - controller = container.lookup('controller:' + controller, lookupOptions); + var controllerName = options.hash.controller; + + // Look up the controller by name, if provided. + if (controllerName) { + controller = container.lookup('controller:' + controllerName, lookupOptions); + Ember.assert("The controller name you supplied '" + controllerName + "' did not resolve to a controller.", !!controller); } else { controller = Ember.controllerFor(container, name, context, lookupOptions); } @@ -26465,10 +27467,12 @@ if (Ember.ENV.EXPERIMENTAL_CONTROL_HELPER) { childView.rerender(); } - Ember.addObserver(this, modelPath, observer); - childView.one('willDestroyElement', this, function() { - Ember.removeObserver(this, modelPath, observer); - }); + if (modelPath) { + Ember.addObserver(this, modelPath, observer); + childView.one('willDestroyElement', this, function() { + Ember.removeObserver(this, modelPath, observer); + }); + } Ember.Handlebars.helpers.view.call(this, childView, options); }); @@ -26593,7 +27597,7 @@ Ember.View.reopen({ _hasEquivalentView: function(outletName, view) { var existingView = get(this, '_outlets.'+outletName); return existingView && - existingView.prototype === view.prototype && + existingView.constructor === view.constructor && existingView.get('template') === view.get('template') && existingView.get('context') === view.get('context'); }, @@ -26622,6 +27626,19 @@ Ember.View.reopen({ (function() { +/** +@module ember +@submodule ember-views +*/ + +// Add a new named queue after the 'actions' queue (where RSVP promises +// resolve), which is used in router transitions to prevent unnecessary +// loading state entry if all context promises resolve on the +// 'actions' queue first. + +var queues = Ember.run.queues, + indexOf = Ember.ArrayPolyfills.indexOf; +queues.splice(indexOf.call(queues, 'actions') + 1, 0, 'routerTransitions'); })(); @@ -27505,11 +28522,14 @@ DeprecatedContainer.prototype = { In addition to creating your application's router, `Ember.Application` is also responsible for telling the router when to start routing. Transitions - between routes can be logged with the LOG_TRANSITIONS flag: + between routes can be logged with the LOG_TRANSITIONS flag, and more + detailed intra-transition logging can be logged with + the LOG_TRANSITIONS_INTERNAL flag: ```javascript window.App = Ember.Application.create({ - LOG_TRANSITIONS: true + LOG_TRANSITIONS: true, // basic logging of successful transitions + LOG_TRANSITIONS_INTERNAL: true // detailed logging of all routing steps }); ``` @@ -28216,6 +29236,8 @@ Ember.ControllerMixin.reopen({ this.get('controllers.post'); // instance of App.PostController ``` + This is only available for singleton controllers. + @property {Array} needs @default [] */ @@ -28278,8 +29300,6 @@ var get = Ember.get, set = Ember.set; */ Ember.State = Ember.Object.extend(Ember.Evented, /** @scope Ember.State.prototype */{ - isState: true, - /** A reference to the parent state. @@ -28389,20 +29409,24 @@ Ember.State = Ember.Object.extend(Ember.Evented, setupChild: function(states, name, value) { if (!value) { return false; } + var instance; - if (value.isState) { + if (value instanceof Ember.State) { set(value, 'name', name); + instance = value; + instance.container = this.container; } else if (Ember.State.detect(value)) { - value = value.create({ - name: name + instance = value.create({ + name: name, + container: this.container }); } - if (value.isState) { - set(value, 'parentState', this); - get(this, 'childStates').pushObject(value); - states[name] = value; - return value; + if (instance instanceof Ember.State) { + set(instance, 'parentState', this); + get(this, 'childStates').pushObject(instance); + states[name] = instance; + return instance; } }, @@ -29631,7 +30655,7 @@ Ember.Test = { chained: false }; thenable.then = function(onSuccess, onFailure) { - var self = this, thenPromise, nextPromise; + var thenPromise, nextPromise; thenable.chained = true; thenPromise = promise.then(onSuccess, onFailure); // this is to ensure all downstream fulfillment @@ -29804,33 +30828,32 @@ Test.QUnitAdapter = Test.Adapter.extend({ (function() { var get = Ember.get, - helper = Ember.Test.registerHelper, - pendingAjaxRequests = 0, + Test = Ember.Test, + helper = Test.registerHelper, countAsync = 0; +Test.pendingAjaxRequests = 0; -Ember.Test.onInjectHelpers(function() { +Test.onInjectHelpers(function() { Ember.$(document).ajaxStart(function() { - pendingAjaxRequests++; + Test.pendingAjaxRequests++; }); Ember.$(document).ajaxStop(function() { - pendingAjaxRequests--; + Test.pendingAjaxRequests--; }); }); function visit(app, url) { - Ember.run(app, app.handleURL, url); app.__container__.lookup('router:main').location.setURL(url); + Ember.run(app, app.handleURL, url); return wait(app); } function click(app, selector, context) { - var $el = find(app, selector, context); - Ember.run(function() { - $el.click(); - }); + var $el = findWithAssert(app, selector, context); + Ember.run($el, 'click'); return wait(app); } @@ -29840,42 +30863,49 @@ function fillIn(app, selector, context, text) { text = context; context = null; } - $el = find(app, selector, context); + $el = findWithAssert(app, selector, context); Ember.run(function() { $el.val(text).change(); }); return wait(app); } +function findWithAssert(app, selector, context) { + var $el = find(app, selector, context); + if ($el.length === 0) { + throw("Element " + selector + " not found."); + } + return $el; +} + function find(app, selector, context) { var $el; context = context || get(app, 'rootElement'); $el = app.$(selector, context); - if ($el.length === 0) { - throw("Element " + selector + " not found."); - } + return $el; } function wait(app, value) { - var promise, obj = {}, helperName; + var promise; - promise = Ember.Test.promise(function(resolve) { + promise = Test.promise(function(resolve) { if (++countAsync === 1) { - Ember.Test.adapter.asyncStart(); + Test.adapter.asyncStart(); } var watcher = setInterval(function() { var routerIsLoading = app.__container__.lookup('router:main').router.isLoading; if (routerIsLoading) { return; } - if (pendingAjaxRequests) { return; } + if (Test.pendingAjaxRequests) { return; } if (Ember.run.hasScheduledTimers() || Ember.run.currentRunLoop) { return; } + clearInterval(watcher); + if (--countAsync === 0) { - Ember.Test.adapter.asyncEnd(); + Test.adapter.asyncEnd(); } - Ember.run(function() { - resolve(value); - }); + + Ember.run(null, resolve, value); }, 10); }); @@ -29930,6 +30960,7 @@ helper('visit', visit); helper('click', click); helper('fillIn', fillIn); helper('find', find); +helper('findWithAssert', findWithAssert); helper('wait', wait); })(); diff --git a/ember/static/js/libs/ember.min.js b/ember/static/js/libs/ember.min.js index 64d6636..fa42cca 100644 --- a/ember/static/js/libs/ember.min.js +++ b/ember/static/js/libs/ember.min.js @@ -8,14 +8,14 @@ // ========================================================================== -// Version: v1.0.0-rc.5-1-gf84c193 -// Last commit: f84c193 (2013-06-01 13:57:19 -0400) +// Version: v1.0.0-rc.6-2-gaa6f429 +// Last commit: aa6f429 (2013-07-25 20:20:00 -0400) -!function(){var e,t;!function(){var r={},n={};e=function(e,t,n){r[e]={deps:t,callback:n}},t=function(e){if(n[e])return n[e];n[e]={};var i,o,s,a,u;if(i=r[e],!i)throw new Error("Module '"+e+"' not found.");o=i.deps,s=i.callback,a=[];for(var c=0,l=o.length;l>c;c++)"exports"===o[c]?a.push(u={}):a.push(t(o[c]));var h=s.apply(this,a);return n[e]=u||h}}(),function(){function e(e){return t.console&&t.console[e]?t.console[e].apply?function(){t.console[e].apply(t.console,arguments)}:function(){var r=Array.prototype.join.call(arguments,", ");t.console[e](r)}:void 0}"undefined"==typeof Ember&&(Ember={});var t=Ember.imports=Ember.imports||this,r=Ember.exports=Ember.exports||this;Ember.lookup=Ember.lookup||this,r.Em=r.Ember=Em=Ember,Ember.isNamespace=!0,Ember.toString=function(){return"Ember"},Ember.VERSION="1.0.0-rc.5",Ember.ENV=Ember.ENV||("undefined"==typeof ENV?{}:ENV),Ember.config=Ember.config||{},Ember.EXTEND_PROTOTYPES=Ember.ENV.EXTEND_PROTOTYPES,"undefined"==typeof Ember.EXTEND_PROTOTYPES&&(Ember.EXTEND_PROTOTYPES=!0),Ember.LOG_STACKTRACE_ON_DEPRECATION=Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION!==!1,Ember.SHIM_ES5=Ember.ENV.SHIM_ES5===!1?!1:Ember.EXTEND_PROTOTYPES,Ember.LOG_VERSION=Ember.ENV.LOG_VERSION===!1?!1:!0,Ember.K=function(){return this},"undefined"==typeof Ember.assert&&(Ember.assert=Ember.K),"undefined"==typeof Ember.warn&&(Ember.warn=Ember.K),"undefined"==typeof Ember.debug&&(Ember.debug=Ember.K),"undefined"==typeof Ember.deprecate&&(Ember.deprecate=Ember.K),"undefined"==typeof Ember.deprecateFunc&&(Ember.deprecateFunc=function(e,t){return t}),Ember.uuid=0,Ember.Logger={log:e("log")||Ember.K,warn:e("warn")||Ember.K,error:e("error")||Ember.K,info:e("info")||Ember.K,debug:e("debug")||e("info")||Ember.K},Ember.onerror=null,Ember.handleErrors=function(e,t){if("function"!=typeof Ember.onerror)return e.call(t||this);try{return e.call(t||this)}catch(r){Ember.onerror(r)}},Ember.merge=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e},Ember.isNone=function(e){return null===e||void 0===e},Ember.none=Ember.deprecateFunc("Ember.none is deprecated. Please use Ember.isNone instead.",Ember.isNone),Ember.isEmpty=function(e){return Ember.isNone(e)||0===e.length&&"function"!=typeof e||"object"==typeof e&&0===Ember.get(e,"length")},Ember.empty=Ember.deprecateFunc("Ember.empty is deprecated. Please use Ember.isEmpty instead.",Ember.isEmpty)}(),function(){var e=Ember.platform={};if(Ember.create=Object.create,Ember.create&&2!==Ember.create({a:1},{a:{value:2}}).a&&(Ember.create=null),!Ember.create||Ember.ENV.STUB_OBJECT_CREATE){var t=function(){};Ember.create=function(e,r){if(t.prototype=e,e=new t,r){t.prototype=e;for(var n in r)t.prototype[n]=r[n].value;e=new t}return t.prototype=null,e},Ember.create.isSimulated=!0}var r,n,i=Object.defineProperty;if(i)try{i({},"a",{get:function(){}})}catch(o){i=null}i&&(r=function(){var e={};return i(e,"a",{configurable:!0,enumerable:!0,get:function(){},set:function(){}}),i(e,"a",{configurable:!0,enumerable:!0,writable:!0,value:!0}),e.a===!0}(),n=function(){try{return i(document.createElement("div"),"definePropertyOnDOM",{}),!0}catch(e){}return!1}(),r?n||(i=function(e,t,r){var n;return n="object"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName,n?e[t]=r.value:Object.defineProperty(e,t,r)}):i=null),e.defineProperty=i,e.hasPropertyAccessors=!0,e.defineProperty||(e.hasPropertyAccessors=!1,e.defineProperty=function(e,t,r){r.get||(e[t]=r.value)},e.defineProperty.isSimulated=!0),Ember.ENV.MANDATORY_SETTER&&!e.hasPropertyAccessors&&(Ember.ENV.MANDATORY_SETTER=!1)}(),function(){var e=function(e){return e&&Function.prototype.toString.call(e).indexOf("[native code]")>-1},t=e(Array.prototype.map)?Array.prototype.map:function(e){if(void 0===this||null===this)throw new TypeError;var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var n=new Array(r),i=arguments[1],o=0;r>o;o++)o in t&&(n[o]=e.call(i,t[o],o,t));return n},r=e(Array.prototype.forEach)?Array.prototype.forEach:function(e){if(void 0===this||null===this)throw new TypeError;var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var n=arguments[1],i=0;r>i;i++)i in t&&e.call(n,t[i],i,t)},n=e(Array.prototype.indexOf)?Array.prototype.indexOf:function(e,t){null===t||void 0===t?t=0:0>t&&(t=Math.max(0,this.length+t));for(var r=t,n=this.length;n>r;r++)if(this[r]===e)return r;return-1};Ember.ArrayPolyfills={map:t,forEach:r,indexOf:n},Ember.SHIM_ES5&&(Array.prototype.map||(Array.prototype.map=t),Array.prototype.forEach||(Array.prototype.forEach=r),Array.prototype.indexOf||(Array.prototype.indexOf=n))}(),function(){function e(e){this.descs={},this.watching={},this.cache={},this.source=e}function t(e,t){return!(!e||"function"!=typeof e[t])}var r=Ember.platform.defineProperty,n=Ember.create,i="__ember"+ +new Date,o=0,s=[],a={},u=Ember.ENV.MANDATORY_SETTER;Ember.GUID_KEY=i;var c={writable:!1,configurable:!1,enumerable:!1,value:null};Ember.generateGuid=function(e,t){t||(t="ember");var n=t+o++;return e&&(c.value=n,r(e,i,c)),n},Ember.guidFor=function(e){if(void 0===e)return"(undefined)";if(null===e)return"(null)";var t,n=typeof e;switch(n){case"number":return t=s[e],t||(t=s[e]="nu"+e),t;case"string":return t=a[e],t||(t=a[e]="st"+o++),t;case"boolean":return e?"(true)":"(false)";default:return e[i]?e[i]:e===Object?"(Object)":e===Array?"(Array)":(t="ember"+o++,c.value=t,r(e,i,c),t)}};var l={writable:!0,configurable:!1,enumerable:!1,value:null},h=Ember.GUID_KEY+"_meta";Ember.META_KEY=h;var m={descs:{},watching:{}};u&&(m.values={}),Ember.EMPTY_META=m,Object.freeze&&Object.freeze(m);var f=Ember.platform.defineProperty.isSimulated;f&&(e.prototype.__preventPlainObject__=!0,e.prototype.toJSON=function(){}),Ember.meta=function(t,i){var o=t[h];return i===!1?o||m:(o?o.source!==t&&(f||r(t,h,l),o=n(o),o.descs=n(o.descs),o.watching=n(o.watching),o.cache={},o.source=t,u&&(o.values=n(o.values)),t[h]=o):(f||r(t,h,l),o=new e(t),u&&(o.values={}),t[h]=o,o.descs.constructor=null),o)},Ember.getMeta=function(e,t){var r=Ember.meta(e,!1);return r[t]},Ember.setMeta=function(e,t,r){var n=Ember.meta(e,!0);return n[t]=r,r},Ember.metaPath=function(e,t,r){for(var i,o,s=Ember.meta(e,r),a=0,u=t.length;u>a;a++){if(i=t[a],o=s[i]){if(o.__ember_source__!==e){if(!r)return void 0;o=s[i]=n(o),o.__ember_source__=e}}else{if(!r)return void 0;o=s[i]={__ember_source__:e}}s=o}return o},Ember.wrap=function(e,t){function r(){}function n(){var n,i=this._super;return this._super=t||r,n=e.apply(this,arguments),this._super=i,n}return n.wrappedFunction=e,n.__ember_observes__=e.__ember_observes__,n.__ember_observesBefore__=e.__ember_observesBefore__,n},Ember.isArray=function(e){return!e||e.setInterval?!1:Array.isArray&&Array.isArray(e)?!0:Ember.Array&&Ember.Array.detect(e)?!0:void 0!==e.length&&"object"==typeof e?!0:!1},Ember.makeArray=function(e){return null===e||void 0===e?[]:Ember.isArray(e)?e:[e]},Ember.canInvoke=t,Ember.tryInvoke=function(e,r,n){return t(e,r)?e[r].apply(e,n||[]):void 0};var p=function(){var e=0;try{try{}finally{throw e++,new Error("needsFinallyFixTest")}}catch(t){}return 1!==e}();Ember.tryFinally=p?function(e,t,r){var n,i,o;r=r||this;try{n=e.call(r)}finally{try{i=t.call(r)}catch(s){o=s}}if(o)throw o;return void 0===i?n:i}:function(e,t,r){var n,i;r=r||this;try{n=e.call(r)}finally{i=t.call(r)}return void 0===i?n:i},Ember.tryCatchFinally=p?function(e,t,r,n){var i,o,s;n=n||this;try{i=e.call(n)}catch(a){i=t.call(n,a)}finally{try{o=r.call(n)}catch(u){s=u}}if(s)throw s;return void 0===o?i:o}:function(e,t,r,n){var i,o;n=n||this;try{i=e.call(n)}catch(s){i=t.call(n,s)}finally{o=r.call(n)}return void 0===o?i:o};var d={},b="Boolean Number String Function Array Date RegExp Object".split(" ");Ember.ArrayPolyfills.forEach.call(b,function(e){d["[object "+e+"]"]=e.toLowerCase()});var E=Object.prototype.toString;Ember.typeOf=function(e){var t;return t=null===e||void 0===e?String(e):d[E.call(e)]||"object","function"===t?Ember.Object&&Ember.Object.detect(e)&&(t="class"):"object"===t&&(t=e instanceof Error?"error":Ember.Object&&e instanceof Ember.Object?"instance":"object"),t}}(),function(){Ember.Instrumentation={};var e=[],t={},r=function(r){for(var n,i=[],o=0,s=e.length;s>o;o++)n=e[o],n.regex.test(r)&&i.push(n.object);return t[r]=i,i},n=function(){var e="undefined"!=typeof window?window.performance||{}:{},t=e.now||e.mozNow||e.webkitNow||e.msNow||e.oNow;return t?t.bind(e):function(){return+new Date}}();Ember.Instrumentation.instrument=function(e,i,o,s){function a(){for(p=0,d=m.length;d>p;p++)f=m[p],b[p]=f.before(e,n(),i);return o.call(s)}function u(e){i=i||{},i.exception=e}function c(){for(p=0,d=m.length;d>p;p++)f=m[p],f.after(e,n(),i,b[p]);Ember.STRUCTURED_PROFILE&&console.timeEnd(l)}var l,h,m=t[e];if(Ember.STRUCTURED_PROFILE&&(l=e+": "+i.object,console.time(l)),m||(m=r(e)),0===m.length)return h=o.call(s),Ember.STRUCTURED_PROFILE&&console.timeEnd(l),h;var f,p,d,b=[];return Ember.tryCatchFinally(a,u,c)},Ember.Instrumentation.subscribe=function(r,n){for(var i,o=r.split("."),s=[],a=0,u=o.length;u>a;a++)i=o[a],"*"===i?s.push("[^\\.]*"):s.push(i);s=s.join("\\."),s+="(\\..*)?";var c={pattern:r,regex:new RegExp("^"+s+"$"),object:n};return e.push(c),t={},c},Ember.Instrumentation.unsubscribe=function(r){for(var n,i=0,o=e.length;o>i;i++)e[i]===r&&(n=i);e.splice(n,1),t={}},Ember.Instrumentation.reset=function(){e=[],t={}},Ember.instrument=Ember.Instrumentation.instrument,Ember.subscribe=Ember.Instrumentation.subscribe}(),function(){var e,t,r,n;n=Array.prototype.concat,e=Array.prototype.map||Ember.ArrayPolyfills.map,t=Array.prototype.forEach||Ember.ArrayPolyfills.forEach,r=Array.prototype.indexOf||Ember.ArrayPolyfills.indexOf;var i=Ember.EnumerableUtils={map:function(t,r,n){return t.map?t.map.call(t,r,n):e.call(t,r,n)},forEach:function(e,r,n){return e.forEach?e.forEach.call(e,r,n):t.call(e,r,n)},indexOf:function(e,t,n){return e.indexOf?e.indexOf.call(e,t,n):r.call(e,t,n)},indexesOf:function(e,t){return void 0===t?[]:i.map(t,function(t){return i.indexOf(e,t)})},addObject:function(e,t){var r=i.indexOf(e,t);-1===r&&e.push(t)},removeObject:function(e,t){var r=i.indexOf(e,t);-1!==r&&e.splice(r,1)},replace:function(e,t,r,i){if(e.replace)return e.replace(t,r,i);var o=n.apply([t,r],i);return e.splice.apply(e,o)},intersection:function(e,t){var r=[];return i.forEach(e,function(e){i.indexOf(t,e)>=0&&r.push(e)}),r}}}(),function(){function e(e){return e.match(a)[0]}function t(t,n){var i,a=s.test(n),u=!a&&o.test(n);if((!t||u)&&(t=Ember.lookup),a&&(n=n.slice(5)),t===Ember.lookup&&(i=e(n),t=r(t,i),n=n.slice(i.length+1)),!n||0===n.length)throw new Error("Invalid Path");return[t,n]}var r,n=Ember.META_KEY,i=Ember.ENV.MANDATORY_SETTER,o=/^([A-Z$]|([0-9][A-Z$])).*[\.\*]/,s=/^this[\.\*]/,a=/^([^\.\*]+)/;r=function(e,t){if(""===t)return e;if(t||"string"!=typeof e||(t=e,e=null),null===e||-1!==t.indexOf("."))return u(e,t);var r,o=e[n],s=o&&o.descs[t];return s?s.get(e,t):(r=i&&o&&o.watching[t]>0?o.values[t]:e[t],void 0!==r||"object"!=typeof e||t in e||"function"!=typeof e.unknownProperty?r:e.unknownProperty(t))},Ember.config.overrideAccessors&&(Ember.get=r,Ember.config.overrideAccessors(),r=Ember.get);var u=Ember._getPath=function(e,n){var i,o,a,u,c;if(null===e&&-1===n.indexOf("."))return r(Ember.lookup,n);for(i=s.test(n),(!e||i)&&(a=t(e,n),e=a[0],n=a[1],a.length=0),o=n.split("."),c=o.length,u=0;null!=e&&c>u;u++)if(e=r(e,o[u],!0),e&&e.isDestroyed)return void 0;return e};Ember.normalizeTuple=function(e,r){return t(e,r)},Ember.getWithDefault=function(e,t,n){var i=r(e,t);return void 0===i?n:i},Ember.get=r,Ember.getPath=Ember.deprecateFunc("getPath is deprecated since get now supports paths",Ember.get)}(),function(){function e(e,t,r){for(var n=-1,i=0,o=e.length;o>i;i++)if(t===e[i][0]&&r===e[i][1]){n=i;break}return n}function t(e,t){var r,n=f(e,!0);return n.listeners||(n.listeners={}),n.hasOwnProperty("listeners")||(n.listeners=m(n.listeners)),r=n.listeners[t],r&&!n.listeners.hasOwnProperty(t)?r=n.listeners[t]=n.listeners[t].slice():r||(r=n.listeners[t]=[]),r}function r(t,r,n){var i=t[p],o=i&&i.listeners&&i.listeners[r];if(o)for(var s=o.length-1;s>=0;s--){var a=o[s][0],u=o[s][1],c=o[s][2],l=e(n,a,u);-1===l&&n.push([a,u,c])}}function n(t,r,n){var i=t[p],o=i&&i.listeners&&i.listeners[r],s=[];if(o){for(var a=o.length-1;a>=0;a--){var u=o[a][0],c=o[a][1],l=o[a][2],h=e(n,u,c);-1===h&&(n.push([u,c,l]),s.push([u,c,l]))}return s}}function i(r,n,i,o,s){o||"function"!=typeof i||(o=i,i=null);var a=t(r,n),u=e(a,i,o),c=0;s&&(c|=d),-1===u&&(a.push([i,o,c]),"function"==typeof r.didAddListener&&r.didAddListener(n,i,o))}function o(r,n,i,o){function s(i,o){var s=t(r,n),a=e(s,i,o);-1!==a&&(s.splice(a,1),"function"==typeof r.didRemoveListener&&r.didRemoveListener(n,i,o))}if(o||"function"!=typeof i||(o=i,i=null),o)s(i,o);else{var a=r[p],u=a&&a.listeners&&a.listeners[n];if(!u)return;for(var c=u.length-1;c>=0;c--)s(u[c][0],u[c][1])}}function s(r,n,i,o,s){function a(){return s.call(i)}function u(){c&&(c[2]&=~b)}o||"function"!=typeof i||(o=i,i=null);var c,l=t(r,n),h=e(l,i,o);return-1!==h&&(c=l[h].slice(),c[2]|=b,l[h]=c),Ember.tryFinally(a,u)}function a(r,n,i,o,s){function a(){return s.call(i)}function u(){for(m=0,f=p.length;f>m;m++)p[m][2]&=~b}o||"function"!=typeof i||(o=i,i=null);var c,l,h,m,f,p=[];for(m=0,f=n.length;f>m;m++){c=n[m],l=t(r,c);var d=e(l,i,o);-1!==d&&(h=l[d].slice(),h[2]|=b,l[d]=h,p.push(h))}return Ember.tryFinally(a,u)}function u(e){var t=e[p].listeners,r=[];if(t)for(var n in t)t[n]&&r.push(n);return r}function c(e,t,r,n){if(e!==Ember&&"function"==typeof e.sendEvent&&e.sendEvent(t,r),!n){var i=e[p];n=i&&i.listeners&&i.listeners[t]}if(n){for(var s=n.length-1;s>=0;s--){var a=n[s];if(a){var u=a[0],c=a[1],l=a[2];l&b||(l&d&&o(e,t,u,c),u||(u=e),"string"==typeof c&&(c=u[c]),r?c.apply(u,r):c.call(u))}}return!0}}function l(e,t){var r=e[p],n=r&&r.listeners&&r.listeners[t];return!(!n||!n.length)}function h(e,t){var r=[],n=e[p],i=n&&n.listeners&&n.listeners[t];if(!i)return r;for(var o=0,s=i.length;s>o;o++){var a=i[o][0],u=i[o][1];r.push([a,u])}return r}var m=Ember.create,f=Ember.meta,p=Ember.META_KEY,d=1,b=2;Ember.addListener=i,Ember.removeListener=o,Ember._suspendListener=s,Ember._suspendListeners=a,Ember.sendEvent=c,Ember.hasListeners=l,Ember.watchedEvents=u,Ember.listenersFor=h,Ember.listenersDiff=n,Ember.listenersUnion=r}(),function(){var e=Ember.guidFor,t=Ember.sendEvent,r=Ember._ObserverSet=function(){this.clear()};r.prototype.add=function(t,r,n){var i,o=this.observerSet,s=this.observers,a=e(t),u=o[a];return u||(o[a]=u={}),i=u[r],void 0===i&&(i=s.push({sender:t,keyName:r,eventName:n,listeners:[]})-1,u[r]=i),s[i].listeners},r.prototype.flush=function(){var e,r,n,i,o=this.observers;for(this.clear(),e=0,r=o.length;r>e;++e)n=o[e],i=n.sender,i.isDestroying||i.isDestroyed||t(i,n.eventName,[i,n.keyName],n.listeners)},r.prototype.clear=function(){this.observerSet={},this.observers=[]}}(),function(){function e(e,t,i){if(!e.isDestroying){var o=n,s=!o;s&&(o=n={}),r(d,e,t,o,i),s&&(n=null)}}function t(e,t,n){if(!e.isDestroying){var o=i,s=!o;s&&(o=i={}),r(b,e,t,o,n),s&&(i=null)}}function r(e,t,r,n,i){var o=s(t);if(n[o]||(n[o]={}),!n[o][r]){n[o][r]=!0;var a=i.deps;if(a=a&&a[r])for(var u in a){var c=i.descs[u];c&&c._suspended===t||e(t,u)}}}var n,i,o=Ember.meta,s=Ember.guidFor,a=Ember.tryFinally,u=Ember.sendEvent,c=Ember.listenersUnion,l=Ember.listenersDiff,h=Ember._ObserverSet,m=new h,f=new h,p=0,d=Ember.propertyWillChange=function(t,r){var n=o(t,!1),i=n.watching[r]>0||"length"===r,s=n.proto,a=n.descs[r];i&&s!==t&&(a&&a.willChange&&a.willChange(t,r),e(t,r,n),E(t,r,n),w(t,r))},b=Ember.propertyDidChange=function(e,r){var n=o(e,!1),i=n.watching[r]>0||"length"===r,s=n.proto,a=n.descs[r];s!==e&&(a&&a.didChange&&a.didChange(e,r),(i||"length"===r)&&(t(e,r,n),v(e,r,n),_(e,r)))},E=function(e,t,r,n){if(r.hasOwnProperty("chainWatchers")){var i=r.chainWatchers;if(i=i[t])for(var o=0,s=i.length;s>o;o++)i[o].willChange(n)}},v=function(e,t,r,n){if(r.hasOwnProperty("chainWatchers")){var i=r.chainWatchers;if(i=i[t])for(var o=i.length-1;o>=0;o--)i[o].didChange(n)}};Ember.overrideChains=function(e,t,r){v(e,t,r,!0)};var g=Ember.beginPropertyChanges=function(){p++},y=Ember.endPropertyChanges=function(){p--,0>=p&&(m.clear(),f.flush())};Ember.changeProperties=function(e,t){g(),a(e,y,t)};var w=function(e,t){if(!e.isDestroying){var r,n,i=t+":before";p?(r=m.add(e,t,i),n=l(e,i,r),u(e,i,[e,t],n)):u(e,i,[e,t])}},_=function(e,t){if(!e.isDestroying){var r,n=t+":change";p?(r=f.add(e,t,n),c(e,n,r)):u(e,n,[e,t])}}}(),function(){function e(e,t,r,o){var s;if(s=t.slice(t.lastIndexOf(".")+1),t=t.slice(0,t.length-(s.length+1)),"this"!==t&&(e=n(e,t)),!s||0===s.length)throw new Error("You passed an empty path");if(!e){if(o)return;throw new Error("Object in path "+t+" could not be found or was destroyed.")}return i(e,s,r)}var t=Ember.META_KEY,r=Ember.ENV.MANDATORY_SETTER,n=Ember._getPath,i=function(n,i,o,s){if("string"==typeof n&&(o=i,i=n,n=null),!n||-1!==i.indexOf("."))return e(n,i,o,s);var a,u,c=n[t],l=c&&c.descs[i];return l?l.set(n,i,o):(a="object"==typeof n&&!(i in n),a&&"function"==typeof n.setUnknownProperty?n.setUnknownProperty(i,o):c&&c.watching[i]>0?(u=r?c.values[i]:n[i],o!==u&&(Ember.propertyWillChange(n,i),r?void 0!==u||i in n?c.values[i]=o:Ember.defineProperty(n,i,null,o):n[i]=o,Ember.propertyDidChange(n,i))):n[i]=o),o};Ember.config.overrideAccessors&&(Ember.set=i,Ember.config.overrideAccessors(),i=Ember.set),Ember.set=i,Ember.setPath=Ember.deprecateFunc("setPath is deprecated since set now supports paths",Ember.set),Ember.trySet=function(e,t,r){return i(e,t,r,!0)},Ember.trySetPath=Ember.deprecateFunc("trySetPath has been renamed to trySet",Ember.trySet)}(),function(){var e=(Ember.get,Ember.set),t=Ember.guidFor,r=Ember.ArrayPolyfills.indexOf,n=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t},i=function(e,t){var r=e.keys.copy(),i=n(e.values);return t.keys=r,t.values=i,t.length=e.length,t},o=Ember.OrderedSet=function(){this.clear()};o.create=function(){return new o},o.prototype={clear:function(){this.presenceSet={},this.list=[]},add:function(e){var r=t(e),n=this.presenceSet,i=this.list;r in n||(n[r]=!0,i.push(e))},remove:function(e){var n=t(e),i=this.presenceSet,o=this.list;delete i[n];var s=r.call(o,e);s>-1&&o.splice(s,1)},isEmpty:function(){return 0===this.list.length},has:function(e){var r=t(e),n=this.presenceSet;return r in n},forEach:function(e,t){for(var r=this.toArray(),n=0,i=r.length;i>n;n++)e.call(t,r[n])},toArray:function(){return this.list.slice()},copy:function(){var e=new o;return e.presenceSet=n(this.presenceSet),e.list=this.toArray(),e}};var s=Ember.Map=function(){this.keys=Ember.OrderedSet.create(),this.values={}};s.create=function(){return new s},s.prototype={length:0,get:function(e){var r=this.values,n=t(e);return r[n]},set:function(r,n){var i=this.keys,o=this.values,s=t(r);i.add(r),o[s]=n,e(this,"length",i.list.length)},remove:function(r){var n=this.keys,i=this.values,o=t(r);return i.hasOwnProperty(o)?(n.remove(r),delete i[o],e(this,"length",n.list.length),!0):!1},has:function(e){var r=this.values,n=t(e);return r.hasOwnProperty(n)},forEach:function(e,r){var n=this.keys,i=this.values;n.forEach(function(n){var o=t(n);e.call(r,n,i[o])})},copy:function(){return i(this,new s)}};var a=Ember.MapWithDefault=function(e){s.call(this),this.defaultValue=e.defaultValue};a.create=function(e){return e?new a(e):new s},a.prototype=Ember.create(s.prototype),a.prototype.get=function(e){var t=this.has(e);if(t)return s.prototype.get.call(this,e);var r=this.defaultValue(e);return this.set(e,r),r},a.prototype.copy=function(){return i(this,new a({defaultValue:this.defaultValue}))}}(),function(){var e=Ember.META_KEY,t=Ember.meta,r=Ember.platform.defineProperty,n=Ember.ENV.MANDATORY_SETTER;Ember.Descriptor=function(){};var i=Ember.MANDATORY_SETTER_FUNCTION=function(){},o=Ember.DEFAULT_GETTER_FUNCTION=function(t){return function(){var r=this[e];return r&&r.values[t]}};Ember.defineProperty=function(e,s,a,u,c){var l,h,m,f;return c||(c=t(e)),l=c.descs,h=c.descs[s],m=c.watching[s]>0,h instanceof Ember.Descriptor&&h.teardown(e,s),a instanceof Ember.Descriptor?(f=a,l[s]=a,n&&m?r(e,s,{configurable:!0,enumerable:!0,writable:!0,value:void 0}):e[s]=void 0,a.setup(e,s)):(l[s]=void 0,null==a?(f=u,n&&m?(c.values[s]=u,r(e,s,{configurable:!0,enumerable:!0,set:i,get:o(s)})):e[s]=u):(f=a,r(e,s,a))),m&&Ember.overrideChains(e,s,c),e.didDefineProperty&&e.didDefineProperty(e,s,f),this}}(),function(){var e=Ember.changeProperties,t=Ember.set;Ember.setProperties=function(r,n){return e(function(){for(var e in n)n.hasOwnProperty(e)&&t(r,e,n[e])}),r}}(),function(){var e=Ember.meta,t=Ember.typeOf,r=Ember.ENV.MANDATORY_SETTER,n=Ember.platform.defineProperty;Ember.watchKey=function(i,o){if("length"!==o||"array"!==t(i)){var s,a=e(i),u=a.watching;u[o]?u[o]=(u[o]||0)+1:(u[o]=1,s=a.descs[o],s&&s.willWatch&&s.willWatch(i,o),"function"==typeof i.willWatchProperty&&i.willWatchProperty(o),r&&o in i&&(a.values[o]=i[o],n(i,o,{configurable:!0,enumerable:!0,set:Ember.MANDATORY_SETTER_FUNCTION,get:Ember.DEFAULT_GETTER_FUNCTION(o)})))}},Ember.unwatchKey=function(t,i){var o,s=e(t),a=s.watching;1===a[i]?(a[i]=0,o=s.descs[i],o&&o.didUnwatch&&o.didUnwatch(t,i),"function"==typeof t.didUnwatchProperty&&t.didUnwatchProperty(i),r&&i in t&&(n(t,i,{configurable:!0,enumerable:!0,writable:!0,value:s.values[i]}),delete s.values[i])):a[i]>1&&a[i]--}}(),function(){function e(e){return e.match(m)[0]}function t(e,t,r){if(e&&"object"==typeof e){var i=n(e),o=i.chainWatchers;i.hasOwnProperty("chainWatchers")||(o=i.chainWatchers={}),o[t]||(o[t]=[]),o[t].push(r),u(e,t)}}function r(e){return n(e,!1).proto===e}var n=Ember.meta,i=Ember.get,o=Ember.normalizeTuple,s=Ember.ArrayPolyfills.forEach,a=Ember.warn,u=Ember.watchKey,c=Ember.unwatchKey,l=Ember.propertyWillChange,h=Ember.propertyDidChange,m=/^([^\.\*]+)/,f=[];Ember.flushPendingChains=function(){if(0!==f.length){var e=f;f=[],s.call(e,function(e){e[0].add(e[1])}),a("Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos",0===f.length)}};var p=Ember.removeChainWatcher=function(e,t,r){if(e&&"object"==typeof e){var i=n(e,!1);if(i.hasOwnProperty("chainWatchers")){var o=i.chainWatchers;if(o[t]){o=o[t];for(var s=0,a=o.length;a>s;s++)o[s]===r&&o.splice(s,1)}c(e,t)}}},d=Ember._ChainNode=function(e,r,n){this._parent=e,this._key=r,this._watching=void 0===n,this._value=n,this._paths={},this._watching&&(this._object=e.value(),this._object&&t(this._object,this._key,this)),this._parent&&"@each"===this._parent._key&&this.value()},b=d.prototype;b.value=function(){if(void 0===this._value&&this._watching){var e=this._parent.value();this._value=e&&!r(e)?i(e,this._key):void 0}return this._value},b.destroy=function(){if(this._watching){var e=this._object;e&&p(e,this._key,this),this._watching=!1}},b.copy=function(e){var t,r=new d(null,null,e),n=this._paths;for(t in n)n[t]<=0||r.add(t);return r},b.add=function(t){var r,n,i,s,a;if(a=this._paths,a[t]=(a[t]||0)+1,r=this.value(),n=o(r,t),n[0]&&n[0]===r)t=n[1],i=e(t),t=t.slice(i.length+1);else{if(!n[0])return f.push([this,t]),n.length=0,void 0;s=n[0],i=t.slice(0,0-(n[1].length+1)),t=n[1]}n.length=0,this.chain(i,t,s)},b.remove=function(t){var r,n,i,s,a;a=this._paths,a[t]>0&&a[t]--,r=this.value(),n=o(r,t),n[0]===r?(t=n[1],i=e(t),t=t.slice(i.length+1)):(s=n[0],i=t.slice(0,0-(n[1].length+1)),t=n[1]),n.length=0,this.unchain(i,t)},b.count=0,b.chain=function(t,r,n){var i,o=this._chains;o||(o=this._chains={}),i=o[t],i||(i=o[t]=new d(this,t,n)),i.count++,r&&r.length>0&&(t=e(r),r=r.slice(t.length+1),i.chain(t,r))},b.unchain=function(t,r){var n=this._chains,i=n[t];r&&r.length>1&&(t=e(r),r=r.slice(t.length+1),i.unchain(t,r)),i.count--,i.count<=0&&(delete n[i._key],i.destroy())},b.willChange=function(){var e=this._chains;if(e)for(var t in e)e.hasOwnProperty(t)&&e[t].willChange();this._parent&&this._parent.chainWillChange(this,this._key,1)},b.chainWillChange=function(e,t,r){this._key&&(t=this._key+"."+t),this._parent?this._parent.chainWillChange(this,t,r+1):(r>1&&l(this.value(),t),t="this."+t,this._paths[t]>0&&l(this.value(),t))},b.chainDidChange=function(e,t,r){this._key&&(t=this._key+"."+t),this._parent?this._parent.chainDidChange(this,t,r+1):(r>1&&h(this.value(),t),t="this."+t,this._paths[t]>0&&h(this.value(),t))},b.didChange=function(e){if(this._watching){var r=this._parent.value();r!==this._object&&(p(this._object,this._key,this),this._object=r,t(r,this._key,this)),this._value=void 0,this._parent&&"@each"===this._parent._key&&this.value()}var n=this._chains;if(n)for(var i in n)n.hasOwnProperty(i)&&n[i].didChange(e);e||this._parent&&this._parent.chainDidChange(this,this._key,1)},Ember.finishChains=function(e){var t=n(e,!1),r=t.chains;r&&(r.value()!==e&&(t.chains=r=r.copy(e)),r.didChange(!0))}}(),function(){function e(e){var r=t(e),i=r.chains;return i?i.value()!==e&&(i=r.chains=i.copy(e)):i=r.chains=new n(null,null,e),i}var t=Ember.meta,r=Ember.typeOf,n=Ember._ChainNode;Ember.watchPath=function(n,i){if("length"!==i||"array"!==r(n)){var o=t(n),s=o.watching;s[i]?s[i]=(s[i]||0)+1:(s[i]=1,e(n).add(i))}},Ember.unwatchPath=function(r,n){var i=t(r),o=i.watching;1===o[n]?(o[n]=0,e(r).remove(n)):o[n]>1&&o[n]--}}(),function(){function e(e){return"*"===e||!h.test(e)}var t=Ember.meta,r=Ember.GUID_KEY,n=Ember.META_KEY,i=Ember.removeChainWatcher,o=Ember.watchKey,s=Ember.unwatchKey,a=Ember.watchPath,u=Ember.unwatchPath,c=Ember.typeOf,l=Ember.generateGuid,h=/[\.\*]/;Ember.watch=function(t,r){("length"!==r||"array"!==c(t))&&(e(r)?o(t,r):a(t,r))},Ember.isWatching=function(e,t){var r=e[n];return(r&&r.watching[t])>0},Ember.watch.flushPending=Ember.flushPendingChains,Ember.unwatch=function(t,r){("length"!==r||"array"!==c(t))&&(e(r)?s(t,r):u(t,r))},Ember.rewatch=function(e){var n=t(e,!1),i=n.chains;r in e&&!e.hasOwnProperty(r)&&l(e,"ember"),i&&i.value()!==e&&(n.chains=i.copy(e))};var m=[];Ember.destroy=function(e){var t,r,o,s,a=e[n];if(a&&(e[n]=null,t=a.chains))for(m.push(t);m.length>0;){if(t=m.pop(),r=t._chains)for(o in r)r.hasOwnProperty(o)&&m.push(r[o]);t._watching&&(s=t._object,s&&i(s,t._key,t))}}}(),function(){function e(e,t){var r=e[t];return r?e.hasOwnProperty(t)||(r=e[t]=m(r)):r=e[t]={},r}function t(t){return e(t,"deps")}function r(r,n,i,o){var s,a,u,c,l,h=r._dependentKeys;if(h)for(s=t(o),a=0,u=h.length;u>a;a++)c=h[a],l=e(s,c),l[i]=(l[i]||0)+1,p(n,c)}function n(r,n,i,o){var s,a,u,c,l,h=r._dependentKeys;if(h)for(s=t(o),a=0,u=h.length;u>a;a++)c=h[a],l=e(s,c),l[i]=(l[i]||0)-1,d(n,c)}function i(e,t){this.func=e,this._cacheable=t&&void 0!==t.cacheable?t.cacheable:!0,this._dependentKeys=t&&t.dependentKeys,this._readOnly=t&&(void 0!==t.readOnly||!!t.readOnly)}function o(e,t){for(var r={},n=0;nt;t++)e.push(arguments[t]);return this._dependentKeys=e,this},b.meta=function(e){return 0===arguments.length?this._meta||{}:(this._meta=e,this)},b.willWatch=function(e,t){var n=e[f];t in n.cache||r(this,e,t,n)},b.didUnwatch=function(e,t){var r=e[f];t in r.cache||n(this,e,t,r)},b.didChange=function(e,t){if(this._cacheable&&this._suspended!==e){var r=l(e);t in r.cache&&(delete r.cache[t],r.watching[t]||n(this,e,t,r))}},b.get=function(e,t){var n,i,o;if(this._cacheable){if(o=l(e),i=o.cache,t in i)return i[t];n=i[t]=this.func.call(e,t),o.watching[t]||r(this,e,t,o)}else n=this.func.call(e,t);return n},b.set=function(e,t,n){var i,o,s=this._cacheable,a=this.func,u=l(e,s),c=u.watching[t],h=this._suspended,m=!1,f=u.cache;if(this._readOnly)throw new Error("Cannot Set: "+t+" on: "+e.toString());this._suspended=e;try{if(s&&f.hasOwnProperty(t)&&(i=f[t],m=!0),a.wrappedFunction&&(a=a.wrappedFunction),3===a.length)o=a.call(e,t,n,i);else{if(2!==a.length)return Ember.defineProperty(e,t,null,i),Ember.set(e,t,n),void 0;o=a.call(e,t,n)}if(m&&i===o)return;c&&Ember.propertyWillChange(e,t),m&&delete f[t],s&&(c||m||r(this,e,t,u),f[t]=o),c&&Ember.propertyDidChange(e,t)}finally{this._suspended=h}return o},b.setup=function(e,t){var n=e[f];n&&n.watching[t]&&r(this,e,t,l(e))},b.teardown=function(e,t){var r=l(e);return(r.watching[t]||t in r.cache)&&n(this,e,t,r),this._cacheable&&delete r.cache[t],null},Ember.computed=function(e){var t;if(arguments.length>1&&(t=h.call(arguments,0,-1),e=h.call(arguments,-1)[0]),"function"!=typeof e)throw new Error("Computed Property declared without a property function");var r=new i(e);return t&&r.property.apply(r,t),r},Ember.cacheFor=function(e,t){var r=l(e,!1).cache;return r&&t in r?r[t]:void 0},s("empty",function(e){return Ember.isEmpty(u(this,e))}),s("notEmpty",function(e){return!Ember.isEmpty(u(this,e))}),s("none",function(e){return Ember.isNone(u(this,e))}),s("not",function(e){return!u(this,e)}),s("bool",function(e){return!!u(this,e)}),s("match",function(e,t){var r=u(this,e);return"string"==typeof r?!!r.match(t):!1}),s("equal",function(e,t){return u(this,e)===t}),s("gt",function(e,t){return u(this,e)>t}),s("gte",function(e,t){return u(this,e)>=t}),s("lt",function(e,t){return u(this,e)1?(c(this,e,r),r):u(this,e)})},Ember.computed.oneWay=function(e){return Ember.computed(e,function(){return u(this,e)})},Ember.computed.defaultTo=function(e){return Ember.computed(function(t,r,n){return 1===arguments.length?null!=n?n:u(this,e):null!=r?r:u(this,e)})}}(),function(){function e(e){return e+r}function t(e){return e+n}var r=":change",n=":before";Ember.addObserver=function(t,r,n,i){return Ember.addListener(t,e(r),n,i),Ember.watch(t,r),this},Ember.observersFor=function(t,r){return Ember.listenersFor(t,e(r))},Ember.removeObserver=function(t,r,n,i){return Ember.unwatch(t,r),Ember.removeListener(t,e(r),n,i),this},Ember.addBeforeObserver=function(e,r,n,i){return Ember.addListener(e,t(r),n,i),Ember.watch(e,r),this},Ember._suspendBeforeObserver=function(e,r,n,i,o){return Ember._suspendListener(e,t(r),n,i,o)},Ember._suspendObserver=function(t,r,n,i,o){return Ember._suspendListener(t,e(r),n,i,o)};var i=Ember.ArrayPolyfills.map;Ember._suspendBeforeObservers=function(e,r,n,o,s){var a=i.call(r,t);return Ember._suspendListeners(e,a,n,o,s)},Ember._suspendObservers=function(t,r,n,o,s){var a=i.call(r,e);return Ember._suspendListeners(t,a,n,o,s)},Ember.beforeObserversFor=function(e,r){return Ember.listenersFor(e,t(r))},Ember.removeBeforeObserver=function(e,r,n,i){return Ember.unwatch(e,r),Ember.removeListener(e,t(r),n,i),this}}(),function(){e("backburner",["backburner/deferred_action_queues","exports"],function(e,t){"use strict";function r(e,t){this.queueNames=e,this.options=t||{},this.options.defaultQueue||(this.options.defaultQueue=e[0]),this.instanceStack=[]}function n(e){e.begin(),o=window.setTimeout(function(){e.end(),o=null})}function i(e){var t,r,n,o,u=+new Date;e.run(function(){for(n=0,o=m.length;o>n&&(t=m[n],!(t>u));n+=2);for(r=m.splice(0,n),n=1,o=r.length;o>n;n+=2)e.schedule(e.options.defaultQueue,null,r[n])}),m.length&&(s=window.setTimeout(function(){i(e),s=null,a=null},m[0]-u),a=m[0])}var o,s,a,u=e.DeferredActionQueues,c=[].slice,l=[].pop,h=[],m=[];r.prototype={queueNames:null,options:null,currentInstance:null,instanceStack:null,begin:function(){var e=this.options&&this.options.onBegin,t=this.currentInstance;t&&this.instanceStack.push(t),this.currentInstance=new u(this.queueNames,this.options),e&&e(this.currentInstance,t)},end:function(){var e=this.options&&this.options.onEnd,t=this.currentInstance,r=null;try{t.flush()}finally{this.currentInstance=null,this.instanceStack.length&&(r=this.instanceStack.pop(),this.currentInstance=r),e&&e(t,r) -}},run:function(e,t){var r;this.begin(),t||(t=e,e=null),"string"==typeof t&&(t=e[t]);var n=!1;try{r=arguments.length>2?t.apply(e,c.call(arguments,2)):t.call(e)}finally{n||(n=!0,this.end())}return r},defer:function(e,t,r){r||(r=t,t=null),"string"==typeof r&&(r=t[r]);var i=this.DEBUG?(new Error).stack:void 0,o=arguments.length>3?c.call(arguments,3):void 0;return this.currentInstance||n(this),this.currentInstance.schedule(e,t,r,o,!1,i)},deferOnce:function(e,t,r){r||(r=t,t=null),"string"==typeof r&&(r=t[r]);var i=this.DEBUG?(new Error).stack:void 0,o=arguments.length>3?c.call(arguments,3):void 0;return this.currentInstance||n(this),this.currentInstance.schedule(e,t,r,o,!0,i)},setTimeout:function(){var e=this,t=l.call(arguments),r=arguments[0],n=arguments[1],o=+new Date+t;n||(n=r,r=null),"string"==typeof n&&(n=r[n]);var u,h;arguments.length>2?(h=c.call(arguments,2),u=function(){n.apply(r,h)}):u=function(){n.call(r)};var f,p;for(f=0,p=m.length;p>f&&!(oa?u:(s&&(clearTimeout(s),s=null),s=window.setTimeout(function(){i(e),s=null,a=null},t),a=o,u)},debounce:function(e,t){for(var r,n=this,i=arguments,o=l.call(i),s=0,a=h.length;a>s;s++)if(r=h[s],r[0]===e&&r[1]===t)return;var u=window.setTimeout(function(){n.run.apply(n,i);for(var o=-1,s=0,a=h.length;a>s;s++)if(r=h[s],r[0]===e&&r[1]===t){o=s;break}o>-1&&h.splice(o,1)},o);h.push([e,t,u])},cancelTimers:function(){for(var e=0,t=h.length;t>e;e++)clearTimeout(h[e][2]);h=[],s&&(clearTimeout(s),s=null),m=[],o&&(clearTimeout(o),o=null)},hasTimers:function(){return!!m.length||o},cancel:function(e){if("object"==typeof e&&e.queue&&e.method)return e.queue.cancel(e);if("function"==typeof e)for(var t=0,r=m.length;r>t;t+=2)if(m[t+1]===e)return m.splice(t,2),!0}},r.prototype.schedule=r.prototype.defer,r.prototype.scheduleOnce=r.prototype.deferOnce,r.prototype.later=r.prototype.setTimeout,t.Backburner=r}),e("backburner/deferred_action_queues",["backburner/queue","exports"],function(e,t){"use strict";function r(e,t){var r=this.queues={};this.queueNames=e=e||[];for(var n,o=0,s=e.length;s>o;o++)n=e[o],r[n]=new i(this,n,t[n])}function n(e,t){for(var r,n,i=0,o=t;o>=i;i++)if(r=e.queueNames[i],n=e.queues[r],n._queue.length)return i;return-1}var i=e.Queue;r.prototype={queueNames:null,queues:null,schedule:function(e,t,r,n,i,o){var s=this.queues,a=s[e];if(!a)throw new Error("You attempted to schedule an action in a queue ("+e+") that doesn't exist");return i?a.pushUnique(t,r,n,o):a.push(t,r,n,o)},flush:function(){for(var e,t,r,i,o=this.queues,s=this.queueNames,a=0,u=s.length;u>a;){e=s[a],t=o[e],r=t._queue.slice(),t._queue=[];var c,l,h,m,f=t.options,p=f&&f.before,d=f&&f.after,b=0,E=r.length;for(E&&p&&p();E>b;)c=r[b],l=r[b+1],h=r[b+2],m=r[b+3],"string"==typeof l&&(l=c[l]),h&&h.length>0?l.apply(c,h):l.call(c),b+=4;E&&d&&d(),-1===(i=n(this,a))?a++:a=i}}},t.DeferredActionQueues=r}),e("backburner/queue",["exports"],function(e){"use strict";function t(e,t,r){this.daq=e,this.name=t,this.options=r,this._queue=[]}t.prototype={daq:null,name:null,options:null,_queue:null,push:function(e,t,r,n){var i=this._queue;return i.push(e,t,r,n),{queue:this,target:e,method:t}},pushUnique:function(e,t,r,n){var i,o,s,a,u=this._queue;for(s=0,a=u.length;a>s;s+=4)if(i=u[s],o=u[s+1],i===e&&o===t)return u[s+2]=r,u[s+3]=n,{queue:this,target:e,method:t};return this._queue.push(e,t,r,n),{queue:this,target:e,method:t}},flush:function(){var e,t,r,n,i,o=this._queue,s=this.options,a=s&&s.before,u=s&&s.after,c=o.length;for(c&&a&&a(),i=0;c>i;i+=4)e=o[i],t=o[i+1],r=o[i+2],n=o[i+3],r&&r.length>0?t.apply(e,r):t.call(e);c&&u&&u(),o.length>c?(this._queue=o.slice(c),this.flush()):this._queue.length=0},cancel:function(e){var t,r,n,i,o=this._queue;for(n=0,i=o.length;i>n;n+=4)if(t=o[n],r=o[n+1],t===e.target&&r===e.method)return o.splice(n,4),!0}},e.Queue=t})}(),function(){function e(){!Ember.run.currentRunLoop}var r=function(e){Ember.run.currentRunLoop=e},n=function(e,t){Ember.run.currentRunLoop=t},i=t("backburner").Backburner,o=new i(["sync","actions","destroy"],{sync:{before:Ember.beginPropertyChanges,after:Ember.endPropertyChanges},defaultQueue:"actions",onBegin:r,onEnd:n}),s=[].slice;Ember.run=function(){var e;if(Ember.onerror)try{e=o.run.apply(o,arguments)}catch(t){Ember.onerror(t)}else e=o.run.apply(o,arguments);return e},Ember.run.join=function(){if(!Ember.run.currentRunLoop)return Ember.run.apply(Ember.run,arguments);var e=s.call(arguments);e.unshift("actions"),Ember.run.schedule.apply(Ember.run,e)},Ember.run.backburner=o,Ember.run,Ember.run.currentRunLoop=null,Ember.run.queues=o.queueNames,Ember.run.begin=function(){o.begin()},Ember.run.end=function(){o.end()},Ember.run.schedule=function(){e(),o.schedule.apply(o,arguments)},Ember.run.hasScheduledTimers=function(){return o.hasTimers()},Ember.run.cancelTimers=function(){o.cancelTimers()},Ember.run.sync=function(){o.currentInstance.queues.sync.flush()},Ember.run.later=function(){return o.later.apply(o,arguments)},Ember.run.once=function(){e();var t=s.call(arguments);return t.unshift("actions"),o.scheduleOnce.apply(o,t)},Ember.run.scheduleOnce=function(){return e(),o.scheduleOnce.apply(o,arguments)},Ember.run.next=function(){var e=s.call(arguments);return e.push(1),o.later.apply(o,e)},Ember.run.cancel=function(e){return o.cancel(e)}}(),function(){function e(e,t){return r(o(t)?Ember.lookup:e,t)}function t(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])}Ember.LOG_BINDINGS=!1||!!Ember.ENV.LOG_BINDINGS;var r=Ember.get,n=(Ember.set,Ember.guidFor),i=/^([A-Z$]|([0-9][A-Z$]))/,o=Ember.isGlobalPath=function(e){return i.test(e)},s=function(e,t){this._direction="fwd",this._from=t,this._to=e,this._directionMap=Ember.Map.create()};s.prototype={copy:function(){var e=new s(this._to,this._from);return this._oneWay&&(e._oneWay=!0),e},from:function(e){return this._from=e,this},to:function(e){return this._to=e,this},oneWay:function(){return this._oneWay=!0,this},toString:function(){var e=this._oneWay?"[oneWay]":"";return"Ember.Binding<"+n(this)+">("+this._from+" -> "+this._to+")"+e},connect:function(t){var r=this._from,n=this._to;return Ember.trySet(t,n,e(t,r)),Ember.addObserver(t,r,this,this.fromDidChange),this._oneWay||Ember.addObserver(t,n,this,this.toDidChange),this._readyToSync=!0,this},disconnect:function(e){var t=!this._oneWay;return Ember.removeObserver(e,this._from,this,this.fromDidChange),t&&Ember.removeObserver(e,this._to,this,this.toDidChange),this._readyToSync=!1,this},fromDidChange:function(e){this._scheduleSync(e,"fwd")},toDidChange:function(e){this._scheduleSync(e,"back")},_scheduleSync:function(e,t){var r=this._directionMap,n=r.get(e);n||(Ember.run.schedule("sync",this,this._sync,e),r.set(e,t)),"back"===n&&"fwd"===t&&r.set(e,"fwd")},_sync:function(t){var n=Ember.LOG_BINDINGS;if(!t.isDestroyed&&this._readyToSync){var i=this._directionMap,o=i.get(t),s=this._from,a=this._to;if(i.remove(t),"fwd"===o){var u=e(t,this._from);n&&Ember.Logger.log(" ",this.toString(),"->",u,t),this._oneWay?Ember.trySet(t,a,u):Ember._suspendObserver(t,a,this,this.toDidChange,function(){Ember.trySet(t,a,u)})}else if("back"===o){var c=r(t,this._to);n&&Ember.Logger.log(" ",this.toString(),"<-",c,t),Ember._suspendObserver(t,s,this,this.fromDidChange,function(){Ember.trySet(Ember.isGlobalPath(s)?Ember.lookup:t,s,c)})}}}},t(s,{from:function(){var e=this,t=new e;return t.from.apply(t,arguments)},to:function(){var e=this,t=new e;return t.to.apply(t,arguments)},oneWay:function(e,t){var r=this,n=new r(null,e);return n.oneWay(t)}}),Ember.Binding=s,Ember.bind=function(e,t,r){return new Ember.Binding(t,r).connect(e)},Ember.oneWay=function(e,t,r){return new Ember.Binding(t,r).oneWay().connect(e)}}(),function(){function e(e){var t=Ember.meta(e,!0),r=t.mixins;return r?t.hasOwnProperty("mixins")||(r=t.mixins=x(r)):r=t.mixins={},r}function t(e,t){return t&&t.length>0&&(e.mixins=_.call(t,function(e){if(e instanceof g)return e;var t=new g;return t.properties=e,t})),e}function r(e){return"function"==typeof e&&e.isMethod!==!1&&e!==Boolean&&e!==Object&&e!==Number&&e!==Array&&e!==Date&&e!==String}function n(e,t){var r;return t instanceof g?(r=P(t),e[r]?V:(e[r]=t,t.properties)):t}function i(e,t,r){var n;return n=t.concatenatedProperties||r.concatenatedProperties,e.concatenatedProperties&&(n=n?n.concat(e.concatenatedProperties):e.concatenatedProperties),n}function o(e,t,r,n,i){var o;return void 0===n[t]&&(o=i[t]),o=o||e.descs[t],o&&o instanceof Ember.ComputedProperty?(r=x(r),r.func=Ember.wrap(r.func,o.func),r):r}function s(e,t,r,n,i){var o;return void 0===i[t]&&(o=n[t]),o=o||e[t],"function"!=typeof o?r:Ember.wrap(r,o)}function a(e,t,r,n){var i=n[t]||e[t];return i?"function"==typeof i.concat?i.concat(r):Ember.makeArray(i).concat(r):Ember.makeArray(r)}function u(e,t,n,i,u,c,l){if(n instanceof Ember.Descriptor){if(n===y&&u[t])return V;n.func&&(n=o(i,t,n,c,u)),u[t]=n,c[t]=void 0}else r(n)?n=s(e,t,n,c,u):(l&&C.call(l,t)>=0||"concatenatedProperties"===t)&&(n=a(e,t,n,c)),u[t]=void 0,c[t]=n}function c(e,t,r,o,s,a){function l(e){delete r[e],delete o[e]}for(var h,m,f,p,d,b=0,E=e.length;E>b;b++)if(h=e[b],m=n(t,h),m!==V)if(m){d=Ember.meta(s),p=i(m,o,s);for(f in m)m.hasOwnProperty(f)&&(a.push(f),u(s,f,m[f],d,r,o,p));m.hasOwnProperty("toString")&&(s.toString=m.toString)}else h.mixins&&(c(h.mixins,t,r,o,s,a),h._without&&O.call(h._without,l))}function l(e,t,r,n){if(T.test(t)){var i=n.bindings;i?n.hasOwnProperty("bindings")||(i=n.bindings=x(n.bindings)):i=n.bindings={},i[t]=r}}function h(e,t){var r,n,i,o=t.bindings;if(o){for(r in o)n=o[r],n&&(i=r.slice(0,-7),n instanceof Ember.Binding?(n=n.copy(),n.to(i)):n=new Ember.Binding(i,n),n.connect(e),e[r]=n);t.bindings={}}}function m(e,t){return h(e,t||Ember.meta(e)),e}function f(e,t,r,n,i){var o,s=t.methodName;return n[s]||i[s]?(o=i[s],t=n[s]):r.descs[s]?(t=r.descs[s],o=void 0):(t=void 0,o=e[s]),{desc:t,value:o}}function p(e,t,r,n,i){if("function"==typeof r){var o=r[n];if(o)for(var s=0,a=o.length;a>s;s++)Ember[i](e,o[s],null,t)}}function d(e,t,r){var n=e[t];p(e,t,n,"__ember_observesBefore__","removeBeforeObserver"),p(e,t,n,"__ember_observes__","removeObserver"),p(e,t,r,"__ember_observesBefore__","addBeforeObserver"),p(e,t,r,"__ember_observes__","addObserver")}function b(t,r,n){var i,o,s,a={},u={},h=Ember.meta(t),p=[];c(r,e(t),a,u,t,p);for(var b=0,E=p.length;E>b;b++)if(i=p[b],"constructor"!==i&&u.hasOwnProperty(i)&&(s=a[i],o=u[i],s!==y)){for(;s&&s instanceof w;){var v=f(t,s,h,a,u);s=v.desc,o=v.value}(void 0!==s||void 0!==o)&&(d(t,i,o),l(t,i,o,h),A(t,i,s,o,h))}return n||m(t,h),t}function E(e,t,r){var n=P(e);if(r[n])return!1;if(r[n]=!0,e===t)return!0;for(var i=e.mixins,o=i?i.length:0;--o>=0;)if(E(i[o],t,r))return!0;return!1}function v(e,t,r){if(!r[P(t)])if(r[P(t)]=!0,t.properties){var n=t.properties;for(var i in n)n.hasOwnProperty(i)&&(e[i]=!0)}else t.mixins&&O.call(t.mixins,function(t){v(e,t,r)})}var g,y,w,_=Ember.ArrayPolyfills.map,C=Ember.ArrayPolyfills.indexOf,O=Ember.ArrayPolyfills.forEach,S=[].slice,x=Ember.create,A=Ember.defineProperty,P=Ember.guidFor,V={},T=Ember.IS_BINDING=/^.+Binding$/;Ember.mixin=function(e){var t=S.call(arguments,1);return b(e,t,!1),e},Ember.Mixin=function(){return t(this,arguments)},g=Ember.Mixin,g.prototype={properties:null,mixins:null,ownerConstructor:null},g._apply=b,g.applyPartial=function(e){var t=S.call(arguments,1);return b(e,t,!0)},g.finishPartial=m,Ember.anyUnprocessedMixins=!1,g.create=function(){Ember.anyUnprocessedMixins=!0;var e=this;return t(new e,arguments)};var N=g.prototype;N.reopen=function(){var e,t;this.properties?(e=g.create(),e.properties=this.properties,delete this.properties,this.mixins=[e]):this.mixins||(this.mixins=[]);var r,n=arguments.length,i=this.mixins;for(r=0;n>r;r++)e=arguments[r],e instanceof g?i.push(e):(t=g.create(),t.properties=e,i.push(t));return this},N.apply=function(e){return b(e,[this],!1)},N.applyPartial=function(e){return b(e,[this],!0)},N.detect=function(e){if(!e)return!1;if(e instanceof g)return E(e,this,{});var t=Ember.meta(e,!1).mixins;return t?!!t[P(this)]:!1},N.without=function(){var e=new g(this);return e._without=S.call(arguments),e},N.keys=function(){var e={},t={},r=[];v(e,this,t);for(var n in e)e.hasOwnProperty(n)&&r.push(n);return r},g.mixins=function(e){var t=Ember.meta(e,!1).mixins,r=[];if(!t)return r;for(var n in t){var i=t[n];i.properties||r.push(i)}return r},y=new Ember.Descriptor,y.toString=function(){return"(Required Property)"},Ember.required=function(){return y},w=function(e){this.methodName=e},w.prototype=new Ember.Descriptor,Ember.alias=function(e){return new w(e)},Ember.alias=Ember.deprecateFunc("Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead.",Ember.alias),Ember.aliasMethod=function(e){return new w(e)},Ember.observer=function(e){var t=S.call(arguments,1);return e.__ember_observes__=t,e},Ember.immediateObserver=function(){for(var e=0,t=arguments.length;t>e;e++)arguments[e];return Ember.observer.apply(this,arguments)},Ember.beforeObserver=function(e){var t=S.call(arguments,1);return e.__ember_observesBefore__=t,e}}(),function(){e("rsvp/all",["rsvp/defer","exports"],function(e,t){"use strict";function r(e){var t=[],r=n(),i=e.length;0===i&&r.resolve([]);for(var o=function(e){return function(t){s(e,t)}},s=function(e,n){t[e]=n,0===--i&&r.resolve(t)},a=function(e){r.reject(e)},u=0;ur;r++)if(e[r][0]===t)return r;return-1},n=function(e){var t=e._promiseCallbacks;return t||(t=e._promiseCallbacks={}),t},i={mixin:function(e){return e.on=this.on,e.off=this.off,e.trigger=this.trigger,e},on:function(e,t,i){var o,s,a=n(this);for(e=e.split(/\s+/),i=i||this;s=e.shift();)o=a[s],o||(o=a[s]=[]),-1===r(o,t)&&o.push([t,i])},off:function(e,t){var i,o,s,a=n(this);for(e=e.split(/\s+/);o=e.shift();)t?(i=a[o],s=r(i,t),-1!==s&&i.splice(s,1)):a[o]=[]},trigger:function(e,r){var i,o,s,a,u,c=n(this);if(i=c[e])for(var l=0;l2?e(Array.prototype.slice.call(arguments,1)):e(n)}}function i(e){return function(){var t,r,i=Array.prototype.slice.call(arguments),a=new o(function(e,n){t=e,r=n});return s(i).then(function(i){i.push(n(t,r));try{e.apply(this,i)}catch(o){r(o)}}),a}}var o=e.Promise,s=t.all;r.denodeify=i}),e("rsvp/promise",["rsvp/config","rsvp/events","exports"],function(e,t,r){"use strict";function n(e){return i(e)||"object"==typeof e&&null!==e}function i(e){return"function"==typeof e}function o(e,t){e===t?a(e,t):s(e,t)||a(e,t)}function s(e,t){var r=null;if(n(t)){try{r=t.then}catch(s){return u(e,s),!0}if(i(r)){try{r.call(t,function(r){t!==r?o(e,r):a(e,r)},function(t){u(e,t)})}catch(s){u(e,s)}return!0}}return!1}function a(e,t){c.async(function(){e.trigger("promise:resolved",{detail:t}),e.isFulfilled=!0,e.fulfillmentValue=t})}function u(e,t){c.async(function(){e.trigger("promise:failed",{detail:t}),e.isRejected=!0,e.rejectedReason=t})}var c=e.config,l=t.EventTarget,h=function(e){var t=this,r=!1;if("function"!=typeof e)throw new TypeError("You must pass a resolver function as the sole argument to the promise constructor");if(!(t instanceof h))return new h(e);var n=function(e){r||(r=!0,o(t,e))},i=function(e){r||(r=!0,u(t,e))};this.on("promise:resolved",function(e){this.trigger("success",{detail:e.detail})},this),this.on("promise:failed",function(e){this.trigger("error",{detail:e.detail})},this);try{e(n,i)}catch(s){i(s)}},m=function(e,t,r,n){var a,c,l,h,m=i(r);if(m)try{a=r(n.detail),l=!0}catch(f){h=!0,c=f}else a=n.detail,l=!0;s(t,a)||(m&&l?o(t,a):h?u(t,c):"resolve"===e?o(t,a):"reject"===e&&u(t,a))};h.prototype={constructor:h,then:function(e,t){var r=new h(function(){});return this.isFulfilled&&c.async(function(){m("resolve",r,e,{detail:this.fulfillmentValue})},this),this.isRejected&&c.async(function(){m("reject",r,t,{detail:this.rejectedReason})},this),this.on("promise:resolved",function(t){m("resolve",r,e,t)}),this.on("promise:failed",function(e){m("reject",r,t,e)}),r}},l.mixin(h.prototype),r.Promise=h}),e("rsvp/reject",["rsvp/promise","exports"],function(e,t){"use strict";function r(e){return new n(function(t,r){r(e)})}var n=e.Promise;t.reject=r}),e("rsvp/resolve",["rsvp/promise","exports"],function(e,t){"use strict";function r(e){return"function"==typeof e||"object"==typeof e&&null!==e}function n(e){var t=new i(function(t,n){var i;try{r(e)?(i=e.then,"function"==typeof i?i.call(e,t,n):t(e)):t(e)}catch(o){n(o)}});return t}var i=e.Promise;t.resolve=n}),e("rsvp",["rsvp/events","rsvp/promise","rsvp/node","rsvp/all","rsvp/hash","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"],function(e,t,r,n,i,o,s,a,u,c){"use strict";function l(e,t){E[e]=t}var h=e.EventTarget,m=t.Promise,f=r.denodeify,p=n.all,d=i.hash,b=o.defer,E=s.config,v=a.resolve,g=u.reject;c.Promise=m,c.EventTarget=h,c.all=p,c.hash=d,c.defer=b,c.denodeify=f,c.configure=l,c.resolve=v,c.reject=g})}(),function(){e("container",[],function(){function e(e){this.parent=e,this.dict={}}function t(t){this.parent=t,this.children=[],this.resolver=t&&t.resolver||function(){},this.registry=new e(t&&t.registry),this.cache=new e(t&&t.cache),this.typeInjections=new e(t&&t.typeInjections),this.injections={},this._options=new e(t&&t._options),this._typeOptions=new e(t&&t._typeOptions)}function r(e){throw new Error(e+" is not currently supported on child containers")}function n(e,t){var r=o(e,t,"singleton");return r!==!1}function i(e,t){var r={};if(!t)return r;for(var n,i,o=0,s=t.length;s>o;o++)n=t[o],i=e.lookup(n.fullName),r[n.property]=i;return r}function o(e,t,r){var n=e._options.get(t);if(n&&void 0!==n[r])return n[r];var i=t.split(":")[0];return n=e._typeOptions.get(i),n?n[r]:void 0}function s(e,t){var r=e.normalize(t);return e.resolve(r)}function a(e,t){var r,n=s(e,t),a=t.split(":"),u=a[0];if(o(e,t,"instantiate")===!1)return n;if(n){var c=[];c=c.concat(e.typeInjections.get(u)||[]),c=c.concat(e.injections[t]||[]);var l=i(e,c);return l.container=e,l._debugContainerKey=t,r=n.create(l)}}function u(e,t){e.cache.eachLocal(function(r,n){o(e,r,"instantiate")!==!1&&t(n)})}function c(e){e.cache.eachLocal(function(t,r){o(e,t,"instantiate")!==!1&&r.destroy()}),e.cache.dict={}}return e.prototype={get:function(e){var t=this.dict;return t.hasOwnProperty(e)?t[e]:this.parent?this.parent.get(e):void 0},set:function(e,t){this.dict[e]=t},has:function(e){var t=this.dict;return t.hasOwnProperty(e)?!0:this.parent?this.parent.has(e):!1},eachLocal:function(e,t){var r=this.dict;for(var n in r)r.hasOwnProperty(n)&&e.call(t,n,r[n])}},t.prototype={child:function(){var e=new t(this);return this.children.push(e),e},set:function(e,t,r){e[t]=r},register:function(e,t,r,n){var i;-1!==e.indexOf(":")?(n=r,r=t,i=e):i=e+":"+t;var o=this.normalize(i);this.registry.set(o,r),this._options.set(o,n||{})},resolve:function(e){return this.resolver(e)||this.registry.get(e)},normalize:function(e){return e},lookup:function(e,t){if(e=this.normalize(e),t=t||{},this.cache.has(e)&&t.singleton!==!1)return this.cache.get(e);var r=a(this,e);return r?(n(this,e)&&t.singleton!==!1&&this.cache.set(e,r),r):void 0},has:function(e){return this.cache.has(e)?!0:!!s(this,e)},optionsForType:function(e,t){this.parent&&r("optionsForType"),this._typeOptions.set(e,t)},options:function(e,t){this.optionsForType(e,t)},typeInjection:function(e,t,n){this.parent&&r("typeInjection");var i=this.typeInjections.get(e);i||(i=[],this.typeInjections.set(e,i)),i.push({property:t,fullName:n})},injection:function(e,t,n){if(this.parent&&r("injection"),-1===e.indexOf(":"))return this.typeInjection(e,t,n);var i=this.injections[e]=this.injections[e]||[];i.push({property:t,fullName:n})},destroy:function(){this.isDestroyed=!0;for(var e=0,t=this.children.length;t>e;e++)this.children[e].destroy();this.children=[],u(this,function(e){e.destroy()}),delete this.parent,this.isDestroyed=!0},reset:function(){for(var e=0,t=this.children.length;t>e;e++)c(this.children[e]);c(this)}},t})}(),function(){function e(r,n,i,o){var s,a,u;if("object"!=typeof r||null===r)return r;if(n&&(a=t(i,r))>=0)return o[a];if("array"===Ember.typeOf(r)){if(s=r.slice(),n)for(a=s.length;--a>=0;)s[a]=e(s[a],n,i,o)}else if(Ember.Copyable&&Ember.Copyable.detect(r))s=r.copy(n,i,o);else{s={};for(u in r)r.hasOwnProperty(u)&&"__"!==u.substring(0,2)&&(s[u]=n?e(r[u],n,i,o):r[u])}return n&&(i.push(r),o.push(s)),s}var t=Ember.EnumerableUtils.indexOf;Ember.compare=function n(e,t){if(e===t)return 0;var r=Ember.typeOf(e),i=Ember.typeOf(t),o=Ember.Comparable;if(o){if("instance"===r&&o.detect(e.constructor))return e.constructor.compare(e,t);if("instance"===i&&o.detect(t.constructor))return 1-t.constructor.compare(t,e)}var s=Ember.ORDER_DEFINITION_MAPPING;if(!s){var a=Ember.ORDER_DEFINITION;s=Ember.ORDER_DEFINITION_MAPPING={};var u,c;for(u=0,c=a.length;c>u;++u)s[a[u]]=u;delete Ember.ORDER_DEFINITION}var l=s[r],h=s[i];if(h>l)return-1;if(l>h)return 1;switch(r){case"boolean":case"number":return t>e?-1:e>t?1:0;case"string":var m=e.localeCompare(t);return 0>m?-1:m>0?1:0;case"array":for(var f=e.length,p=t.length,d=Math.min(f,p),b=0,E=0;0===b&&d>E;)b=n(e[E],t[E]),E++;return 0!==b?b:p>f?-1:f>p?1:0;case"instance":return Ember.Comparable&&Ember.Comparable.detect(e)?e.compare(e,t):0;case"date":var v=e.getTime(),g=t.getTime();return g>v?-1:v>g?1:0;default:return 0}},Ember.copy=function(t,r){return"object"!=typeof t||null===t?t:Ember.Copyable&&Ember.Copyable.detect(t)?t.copy(r):e(t,r,r?[]:null,r?[]:null)},Ember.inspect=function(e){if("object"!=typeof e||null===e)return e+"";var t,r=[];for(var n in e)if(e.hasOwnProperty(n)){if(t=e[n],"toString"===t)continue;"function"===Ember.typeOf(t)&&(t="function() { ... }"),r.push(n+": "+t)}return"{"+r.join(", ")+"}"},Ember.isEqual=function(e,t){return e&&"function"==typeof e.isEqual?e.isEqual(t):e===t},Ember.ORDER_DEFINITION=Ember.ENV.ORDER_DEFINITION||["undefined","null","boolean","number","string","array","object","instance","function","class","date"],Ember.keys=Object.keys,(!Ember.keys||Ember.create.isSimulated)&&(Ember.keys=function(e){var t=[];for(var r in e)"__"!==r.substring(0,2)&&"_super"!==r&&e.hasOwnProperty(r)&&t.push(r);return t});var r=["description","fileName","lineNumber","message","name","number","stack"];Ember.Error=function(){for(var e=Error.apply(this,arguments),t=0;tn;n++){var o=Ember.String.camelize(t[n]);r.push(o.charAt(0).toUpperCase()+o.substr(1))}return r.join(".")},underscore:function(e){return e.replace(i,"$1_$2").replace(o,"_").toLowerCase()},capitalize:function(e){return e.charAt(0).toUpperCase()+e.substr(1)}}}(),function(){var e=Ember.String.fmt,t=Ember.String.w,r=Ember.String.loc,n=Ember.String.camelize,i=Ember.String.decamelize,o=Ember.String.dasherize,s=Ember.String.underscore,a=Ember.String.capitalize,u=Ember.String.classify;(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.String)&&(String.prototype.fmt=function(){return e(this,arguments)},String.prototype.w=function(){return t(this)},String.prototype.loc=function(){return r(this,arguments)},String.prototype.camelize=function(){return n(this)},String.prototype.decamelize=function(){return i(this)},String.prototype.dasherize=function(){return o(this)},String.prototype.underscore=function(){return s(this)},String.prototype.classify=function(){return u(this)},String.prototype.capitalize=function(){return a(this)})}(),function(){var e=Array.prototype.slice;(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Function)&&(Function.prototype.property=function(){var e=Ember.computed(this);return e.property.apply(e,arguments)},Function.prototype.observes=function(){return this.__ember_observes__=e.call(arguments),this},Function.prototype.observesBefore=function(){return this.__ember_observesBefore__=e.call(arguments),this})}(),function(){function e(){return 0===a.length?{}:a.pop()}function t(e){return a.push(e),null}function r(e,t){function r(r){var o=n(r,e);return i?t===o:!!o}var i=2===arguments.length;return r}var n=Ember.get,i=Ember.set,o=Array.prototype.slice,s=Ember.EnumerableUtils.indexOf,a=[];Ember.Enumerable=Ember.Mixin.create({isEnumerable:!0,nextObject:Ember.required(Function),firstObject:Ember.computed(function(){if(0===n(this,"length"))return void 0;var r,i=e();return r=this.nextObject(0,null,i),t(i),r}).property("[]"),lastObject:Ember.computed(function(){var r=n(this,"length");if(0===r)return void 0;var i,o=e(),s=0,a=null;do a=i,i=this.nextObject(s++,a,o);while(void 0!==i);return t(o),a}).property("[]"),contains:function(e){return void 0!==this.find(function(t){return t===e})},forEach:function(r,i){if("function"!=typeof r)throw new TypeError;var o=n(this,"length"),s=null,a=e();void 0===i&&(i=null);for(var u=0;o>u;u++){var c=this.nextObject(u,s,a);r.call(i,c,u,this),s=c}return s=null,a=t(a),this},getEach:function(e){return this.mapProperty(e)},setEach:function(e,t){return this.forEach(function(r){i(r,e,t)})},map:function(e,t){var r=Ember.A([]);return this.forEach(function(n,i,o){r[i]=e.call(t,n,i,o)}),r},mapProperty:function(e){return this.map(function(t){return n(t,e)})},filter:function(e,t){var r=Ember.A([]);return this.forEach(function(n,i,o){e.call(t,n,i,o)&&r.push(n)}),r},reject:function(e,t){return this.filter(function(){return!e.apply(t,arguments)})},filterProperty:function(){return this.filter(r.apply(this,arguments))},rejectProperty:function(e,t){var r=function(r){return n(r,e)===t},i=function(t){return!!n(t,e)},o=2===arguments.length?r:i;return this.reject(o)},find:function(r,i){var o=n(this,"length");void 0===i&&(i=null);for(var s,a,u=null,c=!1,l=e(),h=0;o>h&&!c;h++)s=this.nextObject(h,u,l),(c=r.call(i,s,h,this))&&(a=s),u=s;return s=u=null,l=t(l),a},findProperty:function(){return this.find(r.apply(this,arguments))},every:function(e,t){return!this.find(function(r,n,i){return!e.call(t,r,n,i)})},everyProperty:function(){return this.every(r.apply(this,arguments))},some:function(e,t){return!!this.find(function(r,n,i){return!!e.call(t,r,n,i)})},someProperty:function(){return this.some(r.apply(this,arguments))},reduce:function(e,t,r){if("function"!=typeof e)throw new TypeError;var n=t;return this.forEach(function(t,i){n=e.call(null,n,t,i,this,r)},this),n},invoke:function(e){var t,r=Ember.A([]);return arguments.length>1&&(t=o.call(arguments,1)),this.forEach(function(n,i){var o=n&&n[e];"function"==typeof o&&(r[i]=t?o.apply(n,t):o.call(n))},this),r},toArray:function(){var e=Ember.A([]);return this.forEach(function(t,r){e[r]=t}),e},compact:function(){return this.filter(function(e){return null!=e})},without:function(e){if(!this.contains(e))return this;var t=Ember.A([]);return this.forEach(function(r){r!==e&&(t[t.length]=r)}),t},uniq:function(){var e=Ember.A([]);return this.forEach(function(t){s(e,t)<0&&e.push(t)}),e},"[]":Ember.computed(function(){return this}),addEnumerableObserver:function(e,t){var r=t&&t.willChange||"enumerableWillChange",i=t&&t.didChange||"enumerableDidChange",o=n(this,"hasEnumerableObservers");return o||Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.addListener(this,"@enumerable:before",e,r),Ember.addListener(this,"@enumerable:change",e,i),o||Ember.propertyDidChange(this,"hasEnumerableObservers"),this},removeEnumerableObserver:function(e,t){var r=t&&t.willChange||"enumerableWillChange",i=t&&t.didChange||"enumerableDidChange",o=n(this,"hasEnumerableObservers");return o&&Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.removeListener(this,"@enumerable:before",e,r),Ember.removeListener(this,"@enumerable:change",e,i),o&&Ember.propertyDidChange(this,"hasEnumerableObservers"),this},hasEnumerableObservers:Ember.computed(function(){return Ember.hasListeners(this,"@enumerable:change")||Ember.hasListeners(this,"@enumerable:before")}),enumerableContentWillChange:function(e,t){var r,i,o;return r="number"==typeof e?e:e?n(e,"length"):e=-1,i="number"==typeof t?t:t?n(t,"length"):t=-1,o=0>i||0>r||0!==i-r,-1===e&&(e=null),-1===t&&(t=null),Ember.propertyWillChange(this,"[]"),o&&Ember.propertyWillChange(this,"length"),Ember.sendEvent(this,"@enumerable:before",[this,e,t]),this},enumerableContentDidChange:function(e,t){var r,i,o;return r="number"==typeof e?e:e?n(e,"length"):e=-1,i="number"==typeof t?t:t?n(t,"length"):t=-1,o=0>i||0>r||0!==i-r,-1===e&&(e=null),-1===t&&(t=null),Ember.sendEvent(this,"@enumerable:change",[this,e,t]),o&&Ember.propertyDidChange(this,"length"),Ember.propertyDidChange(this,"[]"),this}})}(),function(){var e=Ember.get,t=(Ember.set,Ember.isNone),r=Ember.EnumerableUtils.map,n=Ember.cacheFor;Ember.Array=Ember.Mixin.create(Ember.Enumerable,{length:Ember.required(),objectAt:function(t){return 0>t||t>=e(this,"length")?void 0:e(this,t)},objectsAt:function(e){var t=this;return r(e,function(e){return t.objectAt(e)})},nextObject:function(e){return this.objectAt(e)},"[]":Ember.computed(function(t,r){return void 0!==r&&this.replace(0,e(this,"length"),r),this}),firstObject:Ember.computed(function(){return this.objectAt(0)}),lastObject:Ember.computed(function(){return this.objectAt(e(this,"length")-1)}),contains:function(e){return this.indexOf(e)>=0},slice:function(r,n){var i=Ember.A([]),o=e(this,"length");for(t(r)&&(r=0),(t(n)||n>o)&&(n=o),0>r&&(r=o+r),0>n&&(n=o+n);n>r;)i[i.length]=this.objectAt(r++);return i},indexOf:function(t,r){var n,i=e(this,"length");for(void 0===r&&(r=0),0>r&&(r+=i),n=r;i>n;n++)if(this.objectAt(n,!0)===t)return n;return-1},lastIndexOf:function(t,r){var n,i=e(this,"length");for((void 0===r||r>=i)&&(r=i-1),0>r&&(r+=i),n=r;n>=0;n--)if(this.objectAt(n)===t)return n;return-1},addArrayObserver:function(t,r){var n=r&&r.willChange||"arrayWillChange",i=r&&r.didChange||"arrayDidChange",o=e(this,"hasArrayObservers");return o||Ember.propertyWillChange(this,"hasArrayObservers"),Ember.addListener(this,"@array:before",t,n),Ember.addListener(this,"@array:change",t,i),o||Ember.propertyDidChange(this,"hasArrayObservers"),this},removeArrayObserver:function(t,r){var n=r&&r.willChange||"arrayWillChange",i=r&&r.didChange||"arrayDidChange",o=e(this,"hasArrayObservers");return o&&Ember.propertyWillChange(this,"hasArrayObservers"),Ember.removeListener(this,"@array:before",t,n),Ember.removeListener(this,"@array:change",t,i),o&&Ember.propertyDidChange(this,"hasArrayObservers"),this -},hasArrayObservers:Ember.computed(function(){return Ember.hasListeners(this,"@array:change")||Ember.hasListeners(this,"@array:before")}),arrayContentWillChange:function(t,r,n){void 0===t?(t=0,r=n=-1):(void 0===r&&(r=-1),void 0===n&&(n=-1)),Ember.isWatching(this,"@each")&&e(this,"@each"),Ember.sendEvent(this,"@array:before",[this,t,r,n]);var i,o;if(t>=0&&r>=0&&e(this,"hasEnumerableObservers")){i=[],o=t+r;for(var s=t;o>s;s++)i.push(this.objectAt(s))}else i=r;return this.enumerableContentWillChange(i,n),this},arrayContentDidChange:function(t,r,i){void 0===t?(t=0,r=i=-1):(void 0===r&&(r=-1),void 0===i&&(i=-1));var o,s;if(t>=0&&i>=0&&e(this,"hasEnumerableObservers")){o=[],s=t+i;for(var a=t;s>a;a++)o.push(this.objectAt(a))}else o=i;this.enumerableContentDidChange(r,o),Ember.sendEvent(this,"@array:change",[this,t,r,i]);var u=e(this,"length"),c=n(this,"firstObject"),l=n(this,"lastObject");return this.objectAt(0)!==c&&(Ember.propertyWillChange(this,"firstObject"),Ember.propertyDidChange(this,"firstObject")),this.objectAt(u-1)!==l&&(Ember.propertyWillChange(this,"lastObject"),Ember.propertyDidChange(this,"lastObject")),this},"@each":Ember.computed(function(){return this.__each||(this.__each=new Ember.EachProxy(this)),this.__each})})}(),function(){Ember.Comparable=Ember.Mixin.create({isComparable:!0,compare:Ember.required(Function)})}(),function(){var e=Ember.get;Ember.set,Ember.Copyable=Ember.Mixin.create({copy:Ember.required(Function),frozenCopy:function(){if(Ember.Freezable&&Ember.Freezable.detect(this))return e(this,"isFrozen")?this:this.copy().freeze();throw new Error(Ember.String.fmt("%@ does not support freezing",[this]))}})}(),function(){var e=Ember.get,t=Ember.set;Ember.Freezable=Ember.Mixin.create({isFrozen:!1,freeze:function(){return e(this,"isFrozen")?this:(t(this,"isFrozen",!0),this)}}),Ember.FROZEN_ERROR="Frozen object cannot be modified."}(),function(){var e=Ember.EnumerableUtils.forEach;Ember.MutableEnumerable=Ember.Mixin.create(Ember.Enumerable,{addObject:Ember.required(Function),addObjects:function(t){return Ember.beginPropertyChanges(this),e(t,function(e){this.addObject(e)},this),Ember.endPropertyChanges(this),this},removeObject:Ember.required(Function),removeObjects:function(t){return Ember.beginPropertyChanges(this),e(t,function(e){this.removeObject(e)},this),Ember.endPropertyChanges(this),this}})}(),function(){var e="Index out of range",t=[],r=Ember.get;Ember.set,Ember.MutableArray=Ember.Mixin.create(Ember.Array,Ember.MutableEnumerable,{replace:Ember.required(),clear:function(){var e=r(this,"length");return 0===e?this:(this.replace(0,e,t),this)},insertAt:function(t,n){if(t>r(this,"length"))throw new Error(e);return this.replace(t,0,[n]),this},removeAt:function(n,i){if("number"==typeof n){if(0>n||n>=r(this,"length"))throw new Error(e);void 0===i&&(i=1),this.replace(n,i,t)}return this},pushObject:function(e){return this.insertAt(r(this,"length"),e),e},pushObjects:function(e){return this.replace(r(this,"length"),0,e),this},popObject:function(){var e=r(this,"length");if(0===e)return null;var t=this.objectAt(e-1);return this.removeAt(e-1,1),t},shiftObject:function(){if(0===r(this,"length"))return null;var e=this.objectAt(0);return this.removeAt(0),e},unshiftObject:function(e){return this.insertAt(0,e),e},unshiftObjects:function(e){return this.replace(0,0,e),this},reverseObjects:function(){var e=r(this,"length");if(0===e)return this;var t=this.toArray().reverse();return this.replace(0,e,t),this},setObjects:function(e){if(0===e.length)return this.clear();var t=r(this,"length");return this.replace(0,t,e),this},removeObject:function(e){for(var t=r(this,"length")||0;--t>=0;){var n=this.objectAt(t);n===e&&this.removeAt(t)}return this},addObject:function(e){return this.contains(e)||this.pushObject(e),this}})}(),function(){var e=Ember.get,t=Ember.set;Ember.Observable=Ember.Mixin.create({get:function(t){return e(this,t)},getProperties:function(){var t={},r=arguments;1===arguments.length&&"array"===Ember.typeOf(arguments[0])&&(r=arguments[0]);for(var n=0;nt;t++)n.push(arguments[t]);Ember.sendEvent(this,e,n)},fire:function(){this.trigger.apply(this,arguments)},off:function(e,t,r){return Ember.removeListener(this,e,t,r),this},has:function(e){return Ember.hasListeners(this,e)}})}(),function(){var e=t("rsvp");e.configure("async",function(e,t){Ember.run.schedule("actions",t,e)});var r=Ember.get;Ember.DeferredMixin=Ember.Mixin.create({then:function(e,t){function n(t){return t===o?e(s):e(t)}var i,o,s;return s=this,i=r(this,"_deferred"),o=i.promise,o.then(e&&n,t)},resolve:function(e){var t,n;t=r(this,"_deferred"),n=t.promise,e===this?t.resolve(n):t.resolve(e)},reject:function(e){r(this,"_deferred").reject(e)},_deferred:Ember.computed(function(){return e.defer()})})}(),function(){Ember.Container=t("container"),Ember.Container.set=Ember.set}(),function(){function e(){var e,t,o=!1,s=function(){o||s.proto(),n(this,i,v),n(this,"_super",v);var u=a(this);if(u.proto=this,e){var l=e;e=null,this.reopen.apply(this,l)}if(t){var h=t;t=null;for(var m=this.concatenatedProperties,f=0,d=h.length;d>f;f++){var g=h[f];for(var y in g)if(g.hasOwnProperty(y)){var w=g[y],_=Ember.IS_BINDING;if(_.test(y)){var C=u.bindings;C?u.hasOwnProperty("bindings")||(C=u.bindings=r(u.bindings)):C=u.bindings={},C[y]=w}var O=u.descs[y];if(m&&E(m,y)>=0){var S=this[y];w=S?"function"==typeof S.concat?S.concat(w):Ember.makeArray(S).concat(w):Ember.makeArray(w)}O?O.set(this,y,w):"function"!=typeof this.setUnknownProperty||y in this?b?Ember.defineProperty(this,y,null,w):this[y]=w:this.setUnknownProperty(y,w)}}}p(this,u),delete u.proto,c(this),this.init.apply(this,arguments)};return s.toString=m.prototype.toString,s.willReopen=function(){o&&(s.PrototypeMixin=m.create(s.PrototypeMixin)),o=!1},s._initMixins=function(t){e=t},s._initProperties=function(e){t=e},s.proto=function(){var e=s.superclass;return e&&e.proto(),o||(o=!0,s.PrototypeMixin.applyPartial(s.prototype),u(s.prototype)),this.prototype},s}function t(e){return function(){return e}}var r=(Ember.set,Ember.get,Ember.create),n=Ember.platform.defineProperty,i=Ember.GUID_KEY,o=Ember.guidFor,s=Ember.generateGuid,a=Ember.meta,u=Ember.rewatch,c=Ember.finishChains,l=Ember.destroy,h=Ember.run.schedule,m=Ember.Mixin,f=m._apply,p=m.finishPartial,d=m.prototype.reopen,b=Ember.ENV.MANDATORY_SETTER,E=Ember.EnumerableUtils.indexOf,v={configurable:!0,writable:!0,enumerable:!1,value:void 0},g=e();g.toString=function(){return"Ember.CoreObject"},g.PrototypeMixin=m.create({reopen:function(){return f(this,arguments,!0),this},isInstance:!0,init:function(){},concatenatedProperties:null,isDestroyed:!1,isDestroying:!1,destroy:function(){return this.isDestroying?void 0:(this.isDestroying=!0,h("actions",this,this.willDestroy),h("destroy",this,this._scheduledDestroy),this)},willDestroy:Ember.K,_scheduledDestroy:function(){this.isDestroyed||(l(this),this.isDestroyed=!0)},bind:function(e,t){return t instanceof Ember.Binding||(t=Ember.Binding.from(t)),t.to(e).connect(this),t},toString:function(){var e="function"==typeof this.toStringExtension,r=e?":"+this.toStringExtension():"",n="<"+this.constructor.toString()+":"+o(this)+r+">";return this.toString=t(n),n}}),g.PrototypeMixin.ownerConstructor=g,Ember.config.overridePrototypeMixin&&Ember.config.overridePrototypeMixin(g.PrototypeMixin),g.__super__=null;var y=m.create({ClassMixin:Ember.required(),PrototypeMixin:Ember.required(),isClass:!0,isMethod:!1,extend:function(){var t,n=e();return n.ClassMixin=m.create(this.ClassMixin),n.PrototypeMixin=m.create(this.PrototypeMixin),n.ClassMixin.ownerConstructor=n,n.PrototypeMixin.ownerConstructor=n,d.apply(n.PrototypeMixin,arguments),n.superclass=this,n.__super__=this.prototype,t=n.prototype=r(this.prototype),t.constructor=n,s(t,"ember"),a(t).proto=t,n.ClassMixin.apply(n),n},createWithMixins:function(){var e=this;return arguments.length>0&&this._initMixins(arguments),new e},create:function(){var e=this;return arguments.length>0&&this._initProperties(arguments),new e},reopen:function(){return this.willReopen(),d.apply(this.PrototypeMixin,arguments),this},reopenClass:function(){return d.apply(this.ClassMixin,arguments),f(this,arguments,!1),this},detect:function(e){if("function"!=typeof e)return!1;for(;e;){if(e===this)return!0;e=e.superclass}return!1},detectInstance:function(e){return e instanceof this},metaForProperty:function(e){var t=a(this.proto(),!1).descs[e];return t._meta||{}},eachComputedProperty:function(e,t){var r,n=this.proto(),i=a(n).descs,o={};for(var s in i)r=i[s],r instanceof Ember.ComputedProperty&&e.call(t||this,s,r._meta||o)}});y.ownerConstructor=g,Ember.config.overrideClassMixin&&Ember.config.overrideClassMixin(y),g.ClassMixin=y,y.apply(g),Ember.CoreObject=g}(),function(){Ember.Object=Ember.CoreObject.extend(Ember.Observable),Ember.Object.toString=function(){return"Ember.Object"}}(),function(){function e(t,r,i){var s=t.length;c[t.join(".")]=r;for(var a in r)if(l.call(r,a)){var u=r[a];if(t[s]=a,u&&u.toString===n)u.toString=o(t.join(".")),u[m]=t.join(".");else if(u&&u.isNamespace){if(i[h(u)])continue;i[h(u)]=!0,e(t,u,i)}}t.length=s}function t(){var e,t,r=Ember.Namespace,n=Ember.lookup;if(!r.PROCESSED)for(var i in n)if("parent"!==i&&"top"!==i&&"frameElement"!==i&&"webkitStorageInfo"!==i&&!("globalStorage"===i&&n.StorageList&&n.globalStorage instanceof n.StorageList||n.hasOwnProperty&&!n.hasOwnProperty(i))){try{e=Ember.lookup[i],t=e&&e.isNamespace}catch(o){continue}t&&(e[m]=i)}}function r(e){var t=e.superclass;return t?t[m]?t[m]:r(t):void 0}function n(){Ember.BOOTED||this[m]||i();var e;if(this[m])e=this[m];else{var t=r(this);e=t?"(subclass of "+t+")":"(unknown mixin)",this.toString=o(e)}return e}function i(){var r=!u.PROCESSED,n=Ember.anyUnprocessedMixins;if(r&&(t(),u.PROCESSED=!0),r||n){for(var i,o=u.NAMESPACES,s=0,a=o.length;a>s;s++)i=o[s],e([i.toString()],i,{});Ember.anyUnprocessedMixins=!1}}function o(e){return function(){return e}}var s=Ember.get,a=Ember.ArrayPolyfills.indexOf,u=Ember.Namespace=Ember.Object.extend({isNamespace:!0,init:function(){Ember.Namespace.NAMESPACES.push(this),Ember.Namespace.PROCESSED=!1},toString:function(){var e=s(this,"name");return e?e:(t(),this[Ember.GUID_KEY+"_name"])},nameClasses:function(){e([this.toString()],this,{})},destroy:function(){var e=Ember.Namespace.NAMESPACES;Ember.lookup[this.toString()]=void 0,e.splice(a.call(e,this),1),this._super()}});u.reopenClass({NAMESPACES:[Ember],NAMESPACES_BY_ID:{},PROCESSED:!1,processAll:i,byName:function(e){return Ember.BOOTED||i(),c[e]}});var c=u.NAMESPACES_BY_ID,l={}.hasOwnProperty,h=Ember.guidFor,m=Ember.NAME_KEY=Ember.GUID_KEY+"_name";Ember.Mixin.prototype.toString=n}(),function(){Ember.Application=Ember.Namespace.extend()}(),function(){var e="Index out of range",t=[],r=Ember.get;Ember.set,Ember.ArrayProxy=Ember.Object.extend(Ember.MutableArray,{content:null,arrangedContent:Ember.computed.alias("content"),objectAtContent:function(e){return r(this,"arrangedContent").objectAt(e)},replaceContent:function(e,t,n){r(this,"content").replace(e,t,n)},_contentWillChange:Ember.beforeObserver(function(){this._teardownContent()},"content"),_teardownContent:function(){var e=r(this,"content");e&&e.removeArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},contentArrayWillChange:Ember.K,contentArrayDidChange:Ember.K,_contentDidChange:Ember.observer(function(){r(this,"content"),this._setupContent()},"content"),_setupContent:function(){var e=r(this,"content");e&&e.addArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},_arrangedContentWillChange:Ember.beforeObserver(function(){var e=r(this,"arrangedContent"),t=e?r(e,"length"):0;this.arrangedContentArrayWillChange(this,0,t,void 0),this.arrangedContentWillChange(this),this._teardownArrangedContent(e)},"arrangedContent"),_arrangedContentDidChange:Ember.observer(function(){var e=r(this,"arrangedContent"),t=e?r(e,"length"):0;this._setupArrangedContent(),this.arrangedContentDidChange(this),this.arrangedContentArrayDidChange(this,0,void 0,t)},"arrangedContent"),_setupArrangedContent:function(){var e=r(this,"arrangedContent");e&&e.addArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"})},_teardownArrangedContent:function(){var e=r(this,"arrangedContent");e&&e.removeArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"})},arrangedContentWillChange:Ember.K,arrangedContentDidChange:Ember.K,objectAt:function(e){return r(this,"content")&&this.objectAtContent(e)},length:Ember.computed(function(){var e=r(this,"arrangedContent");return e?r(e,"length"):0}),_replace:function(e,t,n){var i=r(this,"content");return i&&this.replaceContent(e,t,n),this},replace:function(){if(r(this,"arrangedContent")!==r(this,"content"))throw new Ember.Error("Using replace on an arranged ArrayProxy is not allowed.");this._replace.apply(this,arguments)},_insertAt:function(t,n){if(t>r(this,"content.length"))throw new Error(e);return this._replace(t,0,[n]),this},insertAt:function(e,t){if(r(this,"arrangedContent")===r(this,"content"))return this._insertAt(e,t);throw new Ember.Error("Using insertAt on an arranged ArrayProxy is not allowed.")},removeAt:function(n,i){if("number"==typeof n){var o,s=r(this,"content"),a=r(this,"arrangedContent"),u=[];if(0>n||n>=r(this,"length"))throw new Error(e);for(void 0===i&&(i=1),o=n;n+i>o;o++)u.push(s.indexOf(a.objectAt(o)));for(u.sort(function(e,t){return t-e}),Ember.beginPropertyChanges(),o=0;or;r++){i=arguments[r];for(o in i)!i.hasOwnProperty(o)||o in t||(e||(e={}),e[o]=null)}e&&this._initMixins([e])}return this._super.apply(this,arguments)}})}(),function(){function e(e,t,r,i,o){var s,a=r._objects;for(a||(a=r._objects={});--o>=i;){var u=e.objectAt(o);u&&(Ember.addBeforeObserver(u,t,r,"contentKeyWillChange"),Ember.addObserver(u,t,r,"contentKeyDidChange"),s=n(u),a[s]||(a[s]=[]),a[s].push(o))}}function t(e,t,r,i,o){var s=r._objects;s||(s=r._objects={});for(var a,u;--o>=i;){var c=e.objectAt(o);c&&(Ember.removeBeforeObserver(c,t,r,"contentKeyWillChange"),Ember.removeObserver(c,t,r,"contentKeyDidChange"),u=n(c),a=s[u],a[a.indexOf(o)]=null)}}var r=(Ember.set,Ember.get),n=Ember.guidFor,i=Ember.EnumerableUtils.forEach,o=Ember.Object.extend(Ember.Array,{init:function(e,t,r){this._super(),this._keyName=t,this._owner=r,this._content=e},objectAt:function(e){var t=this._content.objectAt(e);return t&&r(t,this._keyName)},length:Ember.computed(function(){var e=this._content;return e?r(e,"length"):0})}),s=/^.+:(before|change)$/;Ember.EachProxy=Ember.Object.extend({init:function(e){this._super(),this._content=e,e.addArrayObserver(this),i(Ember.watchedEvents(this),function(e){this.didAddListener(e)},this)},unknownProperty:function(e){var t;return t=new o(this._content,e,this),Ember.defineProperty(this,e,null,t),this.beginObservingContentKey(e),t},arrayWillChange:function(e,r,n){var i,o,s=this._keys;o=n>0?r+n:-1,Ember.beginPropertyChanges(this);for(i in s)s.hasOwnProperty(i)&&(o>0&&t(e,i,this,r,o),Ember.propertyWillChange(this,i));Ember.propertyWillChange(this._content,"@each"),Ember.endPropertyChanges(this)},arrayDidChange:function(t,r,n,i){var o,s,a=this._keys;s=i>0?r+i:-1,Ember.beginPropertyChanges(this);for(o in a)a.hasOwnProperty(o)&&(s>0&&e(t,o,this,r,s),Ember.propertyDidChange(this,o));Ember.propertyDidChange(this._content,"@each"),Ember.endPropertyChanges(this)},didAddListener:function(e){s.test(e)&&this.beginObservingContentKey(e.slice(0,-7))},didRemoveListener:function(e){s.test(e)&&this.stopObservingContentKey(e.slice(0,-7))},beginObservingContentKey:function(t){var n=this._keys;if(n||(n=this._keys={}),n[t])n[t]++;else{n[t]=1;var i=this._content,o=r(i,"length");e(i,t,this,0,o)}},stopObservingContentKey:function(e){var n=this._keys;if(n&&n[e]>0&&--n[e]<=0){var i=this._content,o=r(i,"length");t(i,e,this,0,o)}},contentKeyWillChange:function(e,t){Ember.propertyWillChange(this,t)},contentKeyDidChange:function(e,t){Ember.propertyDidChange(this,t)}})}(),function(){var e=Ember.get;Ember.set;var t=Ember.Mixin.create(Ember.MutableArray,Ember.Observable,Ember.Copyable,{get:function(e){return"length"===e?this.length:"number"==typeof e?this[e]:this._super(e)},objectAt:function(e){return this[e]},replace:function(t,r,n){if(this.isFrozen)throw Ember.FROZEN_ERROR;var i=n?e(n,"length"):0;if(this.arrayContentWillChange(t,r,i),n&&0!==n.length){var o=[t,r].concat(n);this.splice.apply(this,o)}else this.splice(t,r);return this.arrayContentDidChange(t,r,i),this},unknownProperty:function(e,t){var r;return void 0!==t&&void 0===r&&(r=this[e]=t),r},indexOf:function(e,t){var r,n=this.length;for(t=void 0===t?0:0>t?Math.ceil(t):Math.floor(t),0>t&&(t+=n),r=t;n>r;r++)if(this[r]===e)return r;return-1},lastIndexOf:function(e,t){var r,n=this.length;for(t=void 0===t?n-1:0>t?Math.ceil(t):Math.floor(t),0>t&&(t+=n),r=t;r>=0;r--)if(this[r]===e)return r;return-1},copy:function(e){return e?this.map(function(e){return Ember.copy(e,!0)}):this.slice()}}),r=["length"];Ember.EnumerableUtils.forEach(t.keys(),function(e){Array.prototype[e]&&r.push(e)}),r.length>0&&(t=t.without.apply(t,r)),Ember.NativeArray=t,Ember.A=function(e){return void 0===e&&(e=[]),Ember.Array.detect(e)?e:Ember.NativeArray.apply(e)},Ember.NativeArray.activate=function(){t.apply(Array.prototype),Ember.A=function(e){return e||[]}},(Ember.EXTEND_PROTOTYPES===!0||Ember.EXTEND_PROTOTYPES.Array)&&Ember.NativeArray.activate()}(),function(){var e=Ember.get,t=Ember.set,r=Ember.guidFor,n=Ember.isNone,i=Ember.String.fmt;Ember.Set=Ember.CoreObject.extend(Ember.MutableEnumerable,Ember.Copyable,Ember.Freezable,{length:0,clear:function(){if(this.isFrozen)throw new Error(Ember.FROZEN_ERROR);var n=e(this,"length");if(0===n)return this;var i;this.enumerableContentWillChange(n,0),Ember.propertyWillChange(this,"firstObject"),Ember.propertyWillChange(this,"lastObject");for(var o=0;n>o;o++)i=r(this[o]),delete this[i],delete this[o];return t(this,"length",0),Ember.propertyDidChange(this,"firstObject"),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(n,0),this},isEqual:function(t){if(!Ember.Enumerable.detect(t))return!1;var r=e(this,"length");if(e(t,"length")!==r)return!1;for(;--r>=0;)if(!t.contains(this[r]))return!1;return!0},add:Ember.aliasMethod("addObject"),remove:Ember.aliasMethod("removeObject"),pop:function(){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);var t=this.length>0?this[this.length-1]:null;return this.remove(t),t},push:Ember.aliasMethod("addObject"),shift:Ember.aliasMethod("pop"),unshift:Ember.aliasMethod("push"),addEach:Ember.aliasMethod("addObjects"),removeEach:Ember.aliasMethod("removeObjects"),init:function(e){this._super(),e&&this.addObjects(e)},nextObject:function(e){return this[e]},firstObject:Ember.computed(function(){return this.length>0?this[0]:void 0}),lastObject:Ember.computed(function(){return this.length>0?this[this.length-1]:void 0}),addObject:function(i){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(n(i))return this;var o,s=r(i),a=this[s],u=e(this,"length");return a>=0&&u>a&&this[a]===i?this:(o=[i],this.enumerableContentWillChange(null,o),Ember.propertyWillChange(this,"lastObject"),u=e(this,"length"),this[s]=u,this[u]=i,t(this,"length",u+1),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(null,o),this)},removeObject:function(i){if(e(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(n(i))return this;var o,s,a=r(i),u=this[a],c=e(this,"length"),l=0===u,h=u===c-1;return u>=0&&c>u&&this[u]===i&&(s=[i],this.enumerableContentWillChange(s,null),l&&Ember.propertyWillChange(this,"firstObject"),h&&Ember.propertyWillChange(this,"lastObject"),c-1>u&&(o=this[c-1],this[u]=o,this[r(o)]=u),delete this[a],delete this[c-1],t(this,"length",c-1),l&&Ember.propertyDidChange(this,"firstObject"),h&&Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(s,null)),this},contains:function(e){return this[r(e)]>=0},copy:function(){var n=this.constructor,i=new n,o=e(this,"length");for(t(i,"length",o);--o>=0;)i[o]=this[o],i[r(this[o])]=o;return i},toString:function(){var e,t=this.length,r=[];for(e=0;t>e;e++)r[e]=this[e];return i("Ember.Set<%@>",[r.join(",")])}})}(),function(){var e=Ember.DeferredMixin;Ember.get;var t=Ember.Object.extend(e);t.reopenClass({promise:function(e,r){var n=t.create();return e.call(r,n),n}}),Ember.Deferred=t}(),function(){var e=Ember.ArrayPolyfills.forEach,t=Ember.ENV.EMBER_LOAD_HOOKS||{},r={};Ember.onLoad=function(e,n){var i;t[e]=t[e]||Ember.A(),t[e].pushObject(n),(i=r[e])&&n(i)},Ember.runLoadHooks=function(n,i){r[n]=i,t[n]&&e.call(t[n],function(e){e(i)})}}(),function(){var e=Ember.get;Ember.ControllerMixin=Ember.Mixin.create({isController:!0,target:null,container:null,parentController:null,store:null,model:Ember.computed.alias("content"),send:function(t){var r,n=[].slice.call(arguments,1);this[t]?this[t].apply(this,n):(r=e(this,"target"))&&r.send.apply(r,arguments)}}),Ember.Controller=Ember.Object.extend(Ember.ControllerMixin)}(),function(){var e=Ember.get,t=(Ember.set,Ember.EnumerableUtils.forEach);Ember.SortableMixin=Ember.Mixin.create(Ember.MutableEnumerable,{sortProperties:null,sortAscending:!0,orderBy:function(r,n){var i=0,o=e(this,"sortProperties"),s=e(this,"sortAscending");return t(o,function(t){0===i&&(i=Ember.compare(e(r,t),e(n,t)),0===i||s||(i=-1*i))}),i},destroy:function(){var r=e(this,"content"),n=e(this,"sortProperties");return r&&n&&t(r,function(e){t(n,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},isSorted:Ember.computed.bool("sortProperties"),arrangedContent:Ember.computed("content","sortProperties.@each",function(){var r=e(this,"content"),n=e(this,"isSorted"),i=e(this,"sortProperties"),o=this;return r&&n?(r=r.slice(),r.sort(function(e,t){return o.orderBy(e,t)}),t(r,function(e){t(i,function(t){Ember.addObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),Ember.A(r)):r}),_contentWillChange:Ember.beforeObserver(function(){var r=e(this,"content"),n=e(this,"sortProperties");r&&n&&t(r,function(e){t(n,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},"content"),sortAscendingWillChange:Ember.beforeObserver(function(){this._lastSortAscending=e(this,"sortAscending")},"sortAscending"),sortAscendingDidChange:Ember.observer(function(){if(e(this,"sortAscending")!==this._lastSortAscending){var t=e(this,"arrangedContent");t.reverseObjects()}},"sortAscending"),contentArrayWillChange:function(r,n,i,o){var s=e(this,"isSorted");if(s){var a=e(this,"arrangedContent"),u=r.slice(n,n+i),c=e(this,"sortProperties");t(u,function(e){a.removeObject(e),t(c,function(t){Ember.removeObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this)}return this._super(r,n,i,o)},contentArrayDidChange:function(r,n,i,o){var s=e(this,"isSorted"),a=e(this,"sortProperties");if(s){var u=r.slice(n,n+o);t(u,function(e){this.insertItemSorted(e),t(a,function(t){Ember.addObserver(e,t,this,"contentItemSortPropertyDidChange")},this)},this)}return this._super(r,n,i,o)},insertItemSorted:function(t){var r=e(this,"arrangedContent"),n=e(r,"length"),i=this._binarySearch(t,0,n);r.insertAt(i,t)},contentItemSortPropertyDidChange:function(t){var r=e(this,"arrangedContent"),n=r.indexOf(t),i=r.objectAt(n-1),o=r.objectAt(n+1),s=i&&this.orderBy(t,i),a=o&&this.orderBy(t,o);(0>s||a>0)&&(r.removeObject(t),this.insertItemSorted(t))},_binarySearch:function(t,r,n){var i,o,s,a;return r===n?r:(a=e(this,"arrangedContent"),i=r+Math.floor((n-r)/2),o=a.objectAt(i),s=this.orderBy(o,t),0>s?this._binarySearch(t,i+1,n):s>0?this._binarySearch(t,r,i):i)}})}(),function(){var e=Ember.get,t=(Ember.set,Ember.EnumerableUtils.forEach),r=Ember.EnumerableUtils.replace;Ember.ArrayController=Ember.ArrayProxy.extend(Ember.ControllerMixin,Ember.SortableMixin,{itemController:null,lookupItemController:function(){return e(this,"itemController")},objectAtContent:function(t){var r=e(this,"length"),n=e(this,"arrangedContent"),i=n&&n.objectAt(t);if(t>=0&&r>t){var o=this.lookupItemController(i);if(o)return this.controllerAt(t,i,o)}return i},arrangedContentDidChange:function(){this._super(),this._resetSubControllers()},arrayContentDidChange:function(n,i,o){var s=e(this,"_subControllers"),a=s.slice(n,n+i);t(a,function(e){e&&e.destroy()}),r(s,n,i,new Array(o)),this._super(n,i,o)},init:function(){this.get("content")||Ember.defineProperty(this,"content",void 0,Ember.A()),this._super(),this.set("_subControllers",Ember.A())},controllerAt:function(t,r,n){var i=e(this,"container"),o=e(this,"_subControllers"),s=o[t];if(s||(s=i.lookup("controller:"+n,{singleton:!1}),o[t]=s),!s)throw new Error('Could not resolve itemController: "'+n+'"');return s.set("target",this),s.set("parentController",e(this,"parentController")||this),s.set("content",r),s},_subControllers:null,_resetSubControllers:function(){var r=e(this,"_subControllers");r&&t(r,function(e){e&&e.destroy()}),this.set("_subControllers",Ember.A())}})}(),function(){Ember.ObjectController=Ember.ObjectProxy.extend(Ember.ControllerMixin)}(),function(){var e=Ember.imports.jQuery;Ember.$=e}(),function(){if(Ember.$){var e=Ember.String.w("dragstart drag dragenter dragleave dragover drop dragend");Ember.EnumerableUtils.forEach(e,function(e){Ember.$.event.fixHooks[e]={props:["dataTransfer"]}})}}(),function(){function e(e){var t=e.shiftKey||e.metaKey||e.altKey||e.ctrlKey,r=e.which>1;return!t&&!r}var t=this.document&&function(){var e=document.createElement("div");return e.innerHTML="
",e.firstChild.innerHTML="",""===e.firstChild.innerHTML}(),r=this.document&&function(){var e=document.createElement("div");return e.innerHTML="Test: Value","Test:"===e.childNodes[0].nodeValue&&" Value"===e.childNodes[2].nodeValue}(),n=function(e,t){if(e.getAttribute("id")===t)return e;var r,i,o,s=e.childNodes.length;for(r=0;s>r;r++)if(i=e.childNodes[r],o=1===i.nodeType&&n(i,t))return o},i=function(e,i){t&&(i="­"+i);var o=[];if(r&&(i=i.replace(/(\s+)(",""===e.firstChild.innerHTML}(),o=r&&function(){var e=r.createElement("div");return e.innerHTML="Test: Value","Test:"===e.childNodes[0].nodeValue&&" Value"===e.childNodes[2].nodeValue}(),s=function(r){var n;n=this instanceof s?this:new e,n.innerHTML=r;var i="metamorph-"+t++;return n.start=i+"-start",n.end=i+"-end",n};e.prototype=s.prototype;var a,u,c,l,h,m,f,p,d;if(l=function(){return this.startTag()+this.innerHTML+this.endTag()},p=function(){return""},d=function(){return""},n)a=function(e,t){var n=r.createRange(),i=r.getElementById(e.start),o=r.getElementById(e.end);return t?(n.setStartBefore(i),n.setEndAfter(o)):(n.setStartAfter(i),n.setEndBefore(o)),n},u=function(e,t){var r=a(this,t);r.deleteContents();var n=r.createContextualFragment(e);r.insertNode(n)},c=function(){var e=a(this,!0);e.deleteContents()},h=function(e){var t=r.createRange();t.setStart(e),t.collapse(!1);var n=t.createContextualFragment(this.outerHTML());e.appendChild(n)},m=function(e){var t=r.createRange(),n=r.getElementById(this.end);t.setStartAfter(n),t.setEndAfter(n);var i=t.createContextualFragment(e);t.insertNode(i)},f=function(e){var t=r.createRange(),n=r.getElementById(this.start);t.setStartAfter(n),t.setEndAfter(n);var i=t.createContextualFragment(e);t.insertNode(i)};else{var b={select:[1,""],fieldset:[1,"
","
"],table:[1,"","
"],tbody:[2,"","
"],tr:[3,"","
"],colgroup:[2,"","
"],map:[1,"",""],_default:[0,"",""]},E=function(e,t){if(e.getAttribute("id")===t)return e;var r,n,i,o=e.childNodes.length;for(r=0;o>r;r++)if(n=e.childNodes[r],i=1===n.nodeType&&E(n,t))return i},v=function(e,t){var n=[];if(o&&(t=t.replace(/(\s+)(",""===e.firstChild.innerHTML}(),r=this.document&&function(){var e=document.createElement("div");return e.innerHTML="Test: Value","Test:"===e.childNodes[0].nodeValue&&" Value"===e.childNodes[2].nodeValue}(),n=function(e,t){if(e.getAttribute("id")===t)return e;var r,i,o,s=e.childNodes.length;for(r=0;s>r;r++)if(i=e.childNodes[r],o=1===i.nodeType&&n(i,t))return o},i=function(e,i){t&&(i="­"+i);var o=[];if(r&&(i=i.replace(/(\s+)(",""===e.firstChild.innerHTML}(),o=r&&function(){var e=r.createElement("div");return e.innerHTML="Test: Value","Test:"===e.childNodes[0].nodeValue&&" Value"===e.childNodes[2].nodeValue}(),s=function(r){var n;n=this instanceof s?this:new e,n.innerHTML=r;var i="metamorph-"+t++;return n.start=i+"-start",n.end=i+"-end",n};e.prototype=s.prototype;var a,u,c,l,h,m,f,p,d;if(l=function(){return this.startTag()+this.innerHTML+this.endTag()},p=function(){return""},d=function(){return""},n)a=function(e,t){var n=r.createRange(),i=r.getElementById(e.start),o=r.getElementById(e.end);return t?(n.setStartBefore(i),n.setEndAfter(o)):(n.setStartAfter(i),n.setEndBefore(o)),n},u=function(e,t){var r=a(this,t);r.deleteContents();var n=r.createContextualFragment(e);r.insertNode(n)},c=function(){var e=a(this,!0);e.deleteContents()},h=function(e){var t=r.createRange();t.setStart(e),t.collapse(!1);var n=t.createContextualFragment(this.outerHTML());e.appendChild(n)},m=function(e){var t=r.createRange(),n=r.getElementById(this.end);t.setStartAfter(n),t.setEndAfter(n);var i=t.createContextualFragment(e);t.insertNode(i)},f=function(e){var t=r.createRange(),n=r.getElementById(this.start);t.setStartAfter(n),t.setEndAfter(n);var i=t.createContextualFragment(e);t.insertNode(i)};else{var b={select:[1,""],fieldset:[1,"
","
"],table:[1,"","
"],tbody:[2,"","
"],tr:[3,"","
"],colgroup:[2,"","
"],map:[1,"",""],_default:[0,"",""]},E=function(e,t){if(e.getAttribute("id")===t)return e;var r,n,i,o=e.childNodes.length;for(r=0;o>r;r++)if(n=e.childNodes[r],i=1===n.nodeType&&E(n,t))return i},v=function(e,t){var n=[];if(o&&(t=t.replace(/(\s+)(