mes 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +32 -0
  5. data/Rakefile +1 -0
  6. data/bin/mes +11 -0
  7. data/lib/middleman_ember_scaffold/cli/generators.rb +21 -0
  8. data/lib/middleman_ember_scaffold/cli.rb +91 -0
  9. data/lib/middleman_ember_scaffold/generators/scaffold.rb +22 -0
  10. data/lib/middleman_ember_scaffold/load_paths.rb +1 -0
  11. data/lib/middleman_ember_scaffold/template/Capfile +4 -0
  12. data/lib/middleman_ember_scaffold/template/Gemfile +10 -0
  13. data/lib/middleman_ember_scaffold/template/README.md +30 -0
  14. data/lib/middleman_ember_scaffold/template/component.json +14 -0
  15. data/lib/middleman_ember_scaffold/template/components/ember/component.json +20 -0
  16. data/lib/middleman_ember_scaffold/template/components/ember/ember.js +27755 -0
  17. data/lib/middleman_ember_scaffold/template/components/ember/ember.min.js +20 -0
  18. data/lib/middleman_ember_scaffold/template/components/ember-data/README.md +4 -0
  19. data/lib/middleman_ember_scaffold/template/components/ember-data/component.json +22 -0
  20. data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data-spade.js +1 -0
  21. data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.amd.js +7819 -0
  22. data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.js +8769 -0
  23. data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.min.js +12 -0
  24. data/lib/middleman_ember_scaffold/template/components/ember-data/ember-data.prod.js +7802 -0
  25. data/lib/middleman_ember_scaffold/template/components/handlebars/component.json +17 -0
  26. data/lib/middleman_ember_scaffold/template/components/handlebars/handlebars.js +2201 -0
  27. data/lib/middleman_ember_scaffold/template/components/handlebars/handlebars.runtime.js +321 -0
  28. data/lib/middleman_ember_scaffold/template/components/jquery/component.json +14 -0
  29. data/lib/middleman_ember_scaffold/template/components/jquery/composer.json +26 -0
  30. data/lib/middleman_ember_scaffold/template/components/jquery/jquery-migrate.js +496 -0
  31. data/lib/middleman_ember_scaffold/template/components/jquery/jquery-migrate.min.js +3 -0
  32. data/lib/middleman_ember_scaffold/template/components/jquery/jquery.js +9597 -0
  33. data/lib/middleman_ember_scaffold/template/components/jquery/jquery.min.js +5 -0
  34. data/lib/middleman_ember_scaffold/template/config/deploy.rb +66 -0
  35. data/lib/middleman_ember_scaffold/template/config.rb +91 -0
  36. data/lib/middleman_ember_scaffold/template/source/app/application.coffee +15 -0
  37. data/lib/middleman_ember_scaffold/template/source/app/controllers/application_controller.coffee +1 -0
  38. data/lib/middleman_ember_scaffold/template/source/app/controllers/index_controller.coffee +1 -0
  39. data/lib/middleman_ember_scaffold/template/source/app/main.coffee +17 -0
  40. data/lib/middleman_ember_scaffold/template/source/app/models/foo.coffee +1 -0
  41. data/lib/middleman_ember_scaffold/template/source/app/routes.coffee +11 -0
  42. data/lib/middleman_ember_scaffold/template/source/app/views/application_view.coffee +2 -0
  43. data/lib/middleman_ember_scaffold/template/source/app/views/index_view.coffee +2 -0
  44. data/lib/middleman_ember_scaffold/template/source/index.html.haml +1 -0
  45. data/lib/middleman_ember_scaffold/template/source/layout.haml +8 -0
  46. data/lib/middleman_ember_scaffold/template/source/stylesheets/application.css.scss +2 -0
  47. data/lib/middleman_ember_scaffold/template/source/stylesheets/variables.scss +279 -0
  48. data/lib/middleman_ember_scaffold/template/source/templates_emblem/application/index.emblem +2 -0
  49. data/lib/middleman_ember_scaffold/template/source/templates_emblem/application.emblem +4 -0
  50. data/lib/middleman_ember_scaffold/template/vendor/javascripts/.gitkeep +0 -0
  51. data/lib/middleman_ember_scaffold/template/vendor/javascripts/bootstrap-dropdown.js +165 -0
  52. data/lib/middleman_ember_scaffold/template/vendor/javascripts/bootstrap-modal.js +374 -0
  53. data/lib/middleman_ember_scaffold/template/vendor/javascripts/bootstrap-modalmanager.js +412 -0
  54. data/lib/middleman_ember_scaffold/template/vendor/javascripts/bootstrap-popover.js +114 -0
  55. data/lib/middleman_ember_scaffold/template/vendor/javascripts/bootstrap-tabs.js +144 -0
  56. data/lib/middleman_ember_scaffold/template/vendor/javascripts/bootstrap-tooltip.js +361 -0
  57. data/lib/middleman_ember_scaffold/template/vendor/javascripts/date.js +104 -0
  58. data/lib/middleman_ember_scaffold/template/vendor/javascripts/ember-data.js +8769 -0
  59. data/lib/middleman_ember_scaffold/template/vendor/javascripts/ember.js +27755 -0
  60. data/lib/middleman_ember_scaffold/template/vendor/javascripts/handlebars.js +2201 -0
  61. data/lib/middleman_ember_scaffold/template/vendor/javascripts/jquery.js +9597 -0
  62. data/lib/middleman_ember_scaffold/template/vendor/javascripts/jquery.validate.min.js +2 -0
  63. data/lib/middleman_ember_scaffold/template/vendor/javascripts/json2.js +480 -0
  64. data/lib/middleman_ember_scaffold/template/vendor/javascripts/underscore.js +1 -0
  65. data/lib/middleman_ember_scaffold/template/vendor/javascripts/utils.js +19 -0
  66. data/lib/middleman_ember_scaffold/template/vendor/stylesheets/.gitkeep +0 -0
  67. data/lib/middleman_ember_scaffold/template/watch +2 -0
  68. data/lib/middleman_ember_scaffold/version.rb +3 -0
  69. data/lib/middleman_ember_scaffold.rb +5 -0
  70. data/mes.gemspec +24 -0
  71. metadata +167 -0
@@ -0,0 +1,12 @@
1
+ // ==========================================================================
2
+ // Project: Ember Data
3
+ // Copyright: ©2011-2012 Tilde Inc. and contributors.
4
+ // Portions ©2011 Living Social Inc. and contributors.
5
+ // License: Licensed under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+
9
+
10
+ (function(){window.DS=Ember.Namespace.create({CURRENT_API_REVISION:11})})(),function(){var a=Ember.DeferredMixin,b=Ember.Evented,c=Ember.run,d=Ember.get,e=Ember.Mixin.create(b,a,{init:function(){this._super.apply(this,arguments),this.one("didLoad",function(){c(this,"resolve",this)}),d(this,"isLoaded")&&this.trigger("didLoad")}});DS.LoadPromise=e}(),function(){var a=Ember.get,b=Ember.set,c=DS.LoadPromise;DS.RecordArray=Ember.ArrayProxy.extend(Ember.Evented,c,{type:null,content:null,isLoaded:!1,isUpdating:!1,store:null,objectAtContent:function(b){var c=a(this,"content"),d=c.objectAt(b),e=a(this,"store");if(d)return e.recordForReference(d)},materializedObjectAt:function(b){var c=a(this,"content").objectAt(b);if(!c)return;if(a(this,"store").recordIsMaterialized(c))return this.objectAt(b)},update:function(){if(a(this,"isUpdating"))return;var b=a(this,"store"),c=a(this,"type");b.fetchAll(c,this)},addReference:function(b){a(this,"content").addObject(b)},removeReference:function(b){a(this,"content").removeObject(b)}})}(),function(){var a=Ember.get;DS.FilteredRecordArray=DS.RecordArray.extend({filterFunction:null,isLoaded:!0,replace:function(){var b=a(this,"type").toString();throw new Error("The result of a client-side filter (on "+b+") is immutable.")},updateFilter:Ember.observer(function(){var b=a(this,"store");b.updateRecordArrayFilter(this,a(this,"type"),a(this,"filterFunction"))},"filterFunction")})}(),function(){var a=Ember.get,b=Ember.set;DS.AdapterPopulatedRecordArray=DS.RecordArray.extend({query:null,replace:function(){var b=a(this,"type").toString();throw new Error("The result of a server query (on "+b+") is immutable.")},load:function(c){var d=a(this,"store"),e=a(this,"type");this.beginPropertyChanges(),b(this,"content",Ember.A(c)),b(this,"isLoaded",!0),this.endPropertyChanges();var f=this;Ember.run.once(function(){f.trigger("didLoad")})}})}(),function(){var a=Ember.get,b=Ember.set;DS.ManyArray=DS.RecordArray.extend({init:function(){this._super.apply(this,arguments),this._changesToSync=Ember.OrderedSet.create()},owner:null,isLoaded:!1,loadingRecordsCount:function(a){this.loadingRecordsCount=a},loadedRecord:function(){this.loadingRecordsCount--,this.loadingRecordsCount===0&&(b(this,"isLoaded",!0),this.trigger("didLoad"))},fetch:function(){var b=a(this,"content"),c=a(this,"store"),d=a(this,"type"),e=a(this,"owner");c.fetchUnloadedReferences(d,b,e)},replaceContent:function(b,c,d){d=d.map(function(b){return a(b,"_reference")},this),this._super(b,c,d)},arrangedContentDidChange:function(){this.fetch()},arrayContentWillChange:function(b,c,d){var e=a(this,"owner"),f=a(this,"name");if(!e._suspendedRelationships)for(var g=b;g<b+c;g++){var h=a(this,"content").objectAt(g),i=DS.RelationshipChange.createChange(e.get("_reference"),h,a(this,"store"),{parentType:e.constructor,changeType:"remove",kind:"hasMany",key:f});this._changesToSync.add(i)}return this._super.apply(this,arguments)},arrayContentDidChange:function(b,c,d){this._super.apply(this,arguments);var e=a(this,"owner"),f=a(this,"name"),g=a(this,"store");if(!e._suspendedRelationships){for(var h=b;h<b+d;h++){var i=a(this,"content").objectAt(h),j=DS.RelationshipChange.createChange(e.get("_reference"),i,g,{parentType:e.constructor,changeType:"add",kind:"hasMany",key:f});j.hasManyName=f,this._changesToSync.add(j)}this._changesToSync.forEach(function(a){a.sync()}),DS.OneToManyChange.ensureSameTransaction(this._changesToSync,g),this._changesToSync.clear()}},createRecord:function(b,c){var d=a(this,"owner"),e=a(d,"store"),f=a(this,"type"),g;return c=c||a(d,"transaction"),g=e.createRecord.call(e,f,b,c),this.pushObject(g),g}})}(),function(){}(),function(){var a=Ember.get,b=Ember.set,c=Ember.String.fmt,d=Ember.EnumerableUtils.removeObject,e=Ember.EnumerableUtils.forEach,f=function(){return[]};DS.Transaction=Ember.Object.extend({init:function(){b(this,"buckets",{clean:Ember.OrderedSet.create(),created:Ember.OrderedSet.create(),updated:Ember.OrderedSet.create(),deleted:Ember.OrderedSet.create(),inflight:Ember.OrderedSet.create()}),b(this,"relationships",Ember.OrderedSet.create())},createRecord:function(b,c){var d=a(this,"store");return d.createRecord(b,c,this)},isEqualOrDefault:function(b){if(this===b||b===a(this,"store.defaultTransaction"))return!0},isDefault:Ember.computed(function(){return this===a(this,"store.defaultTransaction")}),add:function(b){var c=a(b,"transaction"),d=a(this,"store.defaultTransaction");if(c===this)return;this.adoptRecord(b)},relationshipBecameDirty:function(b){a(this,"relationships").add(b)},relationshipBecameClean:function(b){a(this,"relationships").remove(b)},commit:function(){var d=a(this,"store"),e=a(d,"_adapter"),f=a(d,"defaultTransaction"),g=function(a){var b=a.copy();return b.forEach(function(a){a.send("willCommit")}),b},h=a(this,"relationships"),i={created:g(this.bucketForType("created")),updated:g(this.bucketForType("updated")),deleted:g(this.bucketForType("deleted")),relationships:h};this===f&&b(d,"defaultTransaction",d.transaction()),this.removeCleanRecords();if(!i.created.isEmpty()||!i.updated.isEmpty()||!i.deleted.isEmpty()||!h.isEmpty())if(e&&e.commit)e.commit(d,i);else throw c("Adapter is either null or does not implement `commit` method",this);h.forEach(function(a){a.destroy()})},rollback:function(){["created","updated","deleted","inflight"].forEach(function(a){var b=this.bucketForType(a);e(b,function(a){a.send("rollback")}),b.clear()},this),this.removeCleanRecords()},remove:function(b){var c=a(this,"store.defaultTransaction");c.adoptRecord(b)},removeCleanRecords:function(){var a=this.bucketForType("clean");a.forEach(function(a){this.remove(a)},this),a.clear()},bucketForType:function(b){var c=a(this,"buckets");return a(c,b)},adoptRecord:function(c){var d=a(c,"transaction");d&&d.removeFromBucket("clean",c),this.addToBucket("clean",c),b(c,"transaction",this)},addToBucket:function(a,b){this.bucketForType(a).add(b)},removeFromBucket:function(a,b){this.bucketForType(a).remove(b)},recordBecameDirty:function(a,b){this.removeFromBucket("clean",b),this.addToBucket(a,b)},recordBecameInFlight:function(a,b){this.removeFromBucket(a,b),this.addToBucket("inflight",b)},recordIsMoving:function(a,b){this.removeFromBucket(a,b),this.addToBucket("clean",b)},recordBecameClean:function(a,b){this.removeFromBucket(a,b),this.remove(b)}})}(),function(){var a=Ember.String.classify,b=Ember.get,c=function(a,b,c){return a},d=function(a,b){return a},e=function(a,b){return b};DS._Mappable=Ember.Mixin.create({createInstanceMapFor:function(a){var b=Ember.metaPath(this,["DS.Mappable"],!0);b.values=b.values||{};if(b.values[a])return b.values[a];var c=b.values[a]=new Ember.Map,d=this.constructor;while(d&&d!==DS.Store)this._copyMap(a,d,c),d=d.superclass;return b.values[a]=c,c},_copyMap:function(a,b,f){function i(g,h){var i=(b.transformMapKey||d)(g,h),j=(b.transformMapValue||e)(g,h),k=f.get(i),l=j;k&&(l=(this.constructor.resolveMapConflict||c)(k,l,a)),f.set(i,l)}var g=Ember.metaPath(b,["DS.Mappable"],!0),h=g[a];h&&h.forEach(i,this)}}),DS._Mappable.generateMapFunctionFor=function(a,b){return function(c,d){var e=Ember.metaPath(this,["DS.Mappable"],!0),f=e[a]||Ember.MapWithDefault.create({defaultValue:function(){return{}}});b.call(this,c,d,f),e[a]=f}}}(),function(){var a=Ember.get,b=Ember.set,c=Ember.String.fmt,d=Ember.run.once,e=Ember.EnumerableUtils.forEach,f="unloaded",g="loading",h={materialized:!0},i={created:!0},j=function(a){return a==null?null:a+""},k=Ember.EnumerableUtils.map;DS.Store=Ember.Object.extend(DS._Mappable,{init:function(){var c=a(this,"revision");if(c!==DS.CURRENT_API_REVISION&&!Ember.ENV.TESTING)throw new Error("Error: The Ember Data library has had breaking API changes since the last time you updated the library. Please review the list of breaking changes at https://github.com/emberjs/data/blob/master/BREAKING_CHANGES.md, then update your store's `revision` property to "+DS.CURRENT_API_REVISION);(!a(DS,"defaultStore")||a(this,"isDefaultStore"))&&b(DS,"defaultStore",this),this.typeMaps={},this.recordCache=[],this.clientIdToId={},this.clientIdToType={},this.clientIdToData={},this.clientIdToPrematerializedData={},this.recordArraysByClientId={},this.relationshipChanges={},this.recordReferences={},this.loadingRecordArrays={},b(this,"defaultTransaction",this.transaction())},transaction:function(){return DS.Transaction.create({store:this})},ensureSameTransaction:function(b){var c=Ember.A();e(b,function(b){b&&c.pushObject(a(b,"transaction"))});var d=c.reduce(function(b,c){return!a(c,"isDefault")&&b===null?c:b},null);return d?e(b,function(a){a&&d.add(a)}):d=c.objectAt(0),d},materializeData:function(b){var c=a(b,"clientId"),d=this.clientIdToData,e=this.adapterForType(b.constructor),f=d[c];d[c]=h;var g=this.clientIdToPrematerializedData[c];b.setupData(),f!==i&&e.materialize(b,f,g)},recordIsMaterialized:function(a){return!!this.recordCache[a.clientId]},adapter:"DS.RESTAdapter",serialize:function(a,b){return this.adapterForType(a.constructor).serialize(a,b)},_adapter:Ember.computed(function(){var b=a(this,"adapter");return typeof b=="string"&&(b=a(this,b,!1)||a(Ember.lookup,b)),DS.Adapter.detect(b)&&(b=b.create()),b}).property("adapter"),clientIdCounter:1,createRecord:function(c,d,e){d=d||{};var f=c._create({store:this});e=e||a(this,"defaultTransaction"),e.adoptRecord(f);var g=d.id,h;Ember.isNone(g)&&(h=this.adapterForType(c),h&&h.generateIdForRecord&&(g=j(h.generateIdForRecord(this,f)),d.id=g)),g=j(g);var k=this.pushData(i,g,c);return b(f,"clientId",k),f.loadedData(),f.setupData(),this.recordCache[k]=f,f.setProperties(d),Ember.run(f,"resolve",f),f},deleteRecord:function(a){a.deleteRecord()},unloadRecord:function(a){a.unloadRecord()},find:function(a,b){return b===undefined?this.findAll(a):Ember.typeOf(b)==="object"?this.findQuery(a,b):this.findById(a,j(b))},findById:function(a,b){var c=this.typeMapFor(a).idToCid[b];if(c)return this.findByClientId(a,c);c=this.pushData(g,b,a);var d=this.materializeRecord(a,c,b),e=this.adapterForType(a);if(e&&e.find)e.find(this,a,b);else throw"Adapter is either null or does not implement `find` method";return d},reloadRecord:function(b){var c=b.constructor,d=this.adapterForType(c),e=a(b,"id");d.find(this,c,e)},findByClientId:function(a,b){var c,d,e;return d=this.recordCache[b],d||(e=this.clientIdToId[b],d=this.materializeRecord(a,b,e),c=this.clientIdToData,typeof c[b]=="object"&&d.loadedData()),d},neededReferences:function(a,b){var c=[],d=this.clientIdToData,e;for(var h=0,i=b.length;h<i;h++)e=b[h],d[e.clientId]===f&&(c.push(e),d[e.clientId]=g);return c},fetchUnloadedReferences:function(a,b,c){var d=this.neededReferences(a,b);this.fetchMany(a,d,c)},fetchMany:function(a,b,c){if(!b.length)return;var d=k(b,function(a){return a.id}),e=this.adapterForType(a);if(e&&e.findMany)e.findMany(this,a,d,c);else throw"Adapter is either null or does not implement `findMany` method"},referenceForId:function(a,b){var c=this.clientIdForId(a,b);return this.referenceForClientId(c)},referenceForClientId:function(a){var b=this.recordReferences;if(b[a])return b[a];var c=this.clientIdToType[a];return b[a]={id:this.idForClientId(a),clientId:a,type:c}},recordForReference:function(a){return this.findByClientId(a.type,a.clientId)},findMany:function(a,b,d,e){if(!Ember.isArray(b)){var f=this.adapterForType(a);if(f&&f.findHasMany)f.findHasMany(this,d,e,b);else throw c("Adapter is either null or does not implement `findHasMany` method",this);return this.createManyArray(a,Ember.A())}var g=k(b,function(b){return typeof b!="object"&&b!==null?this.referenceForId(a,b):b},this),h=this.neededReferences(a,g),i=this.createManyArray(a,Ember.A(g)),j=this.loadingRecordArrays,l,m,n,o;i.loadingRecordsCount(h.length);if(h.length){for(n=0,o=h.length;n<o;n++)l=h[n],m=l.clientId,j[m]?j[m].push(i):this.loadingRecordArrays[m]=[i];this.fetchMany(a,h,d)}else i.set("isLoaded",!0),Ember.run.once(function(){i.trigger("didLoad")});return i},findQuery:function(a,b){var c=DS.AdapterPopulatedRecordArray.create({type:a,query:b,content:Ember.A([]),store:this}),d=this.adapterForType(a);if(d&&d.findQuery)d.findQuery(this,a,b,c);else throw"Adapter is either null or does not implement `findQuery` method";return c},findAll:function(a){var b=this.all(a);return this.fetchAll(a,b),b},fetchAll:function(a,c){var d=this.typeMapFor(a).sinceToken,e=this.adapterForType(a);b(c,"isUpdating",!0);if(e&&e.findAll)e.findAll(this,a,d);else throw"Adapter is either null or does not implement `findAll` method"},sinceForType:function(a,b){this.typeMapFor(a).sinceToken=b},didUpdateAll:function(a){var c=this.typeMapFor(a).findAllCache;b(c,"isUpdating",!1)},all:function(a){var b=this.typeMapFor(a),c=b.findAllCache;if(c)return c;var d=DS.RecordArray.create({type:a,content:Ember.A([]),store:this,isLoaded:!0});return this.registerRecordArray(d,a),b.findAllCache=d,d},filter:function(a,b,c){arguments.length===3?this.findQuery(a,b):arguments.length===2&&(c=b);var d=DS.FilteredRecordArray.create({type:a,content:Ember.A([]),store:this,filterFunction:c});return this.registerRecordArray(d,a,c),d},recordIsLoaded:function(a,b){return!Ember.isNone(this.typeMapFor(a).idToCid[b])},dataWasUpdated:function(b,c,d){if(a(d,"isDeleted"))return;var e=this.clientIdToData,f=c.clientId,g=e[f];typeof g=="object"&&this.updateRecordArrays(b,f)},commit:function(){a(this,"defaultTransaction").commit()},didSaveRecord:function(a,b){a.adapterDidCommit(),b?(this.updateId(a,b),this.updateRecordData(a,b)):this.didUpdateAttributes(a)},didSaveRecords:function(a,b){var c=0;a.forEach(function(a){this.didSaveRecord(a,b&&b[c++])},this)},recordWasInvalid:function(a,b){a.adapterDidInvalidate(b)},recordWasError:function(a){a.adapterDidError()},didUpdateAttribute:function(a,b,c){a.adapterDidUpdateAttribute(b,c)},didUpdateAttributes:function(a){a.eachAttribute(function(b){this.didUpdateAttribute(a,b)},this)},didUpdateRelationship:function(b,c){var d=this.relationshipChangeFor(a(b,"clientId"),c);d&&d.adapterDidUpdate()},didUpdateRelationships:function(b){var c=this.relationshipChangesFor(a(b,"_reference"));for(var d in c){if(!c.hasOwnProperty(d))continue;c[d].adapterDidUpdate()}},didReceiveId:function(b,c){var d=this.typeMapFor(b.constructor),e=a(b,"clientId"),f=a(b,"id");d.idToCid[c]=e,this.clientIdToId[e]=c},updateRecordData:function(b,c){var d=a(b,"clientId"),e=this.clientIdToData;e[d]=c,b.didChangeData()},updateId:function(b,c){var d=this.typeMapFor(b.constructor),e=a(b,"clientId"),f=a(b,"id"),g=b.constructor,h=this.preprocessData(g,c);d.idToCid[h]=e,this.clientIdToId[e]=h,this.referenceForClientId(e).id=h},preprocessData:function(a,b){return this.adapterForType(a).extractId(a,b)},registerRecordArray:function(a,b,c){var d=this.typeMapFor(b).recordArrays;d.push(a),this.updateRecordArrayFilter(a,b,c)},createManyArray:function(a,b){var c=DS.ManyArray.create({type:a,content:b,store:this});return b.forEach(function(a){var b=this.recordArraysForClientId(a);b.add(c)},this),c},updateRecordArrayFilter:function(b,c,d){var e=this.typeMapFor(c),f=this.clientIdToData,g=e.clientIds,h,i,j,k;for(var l=0,m=g.length;l<m;l++)h=g[l],j=!1,i=f[h],typeof i=="object"&&((k=this.recordCache[h])?a(k,"isDeleted")||(j=!0):j=!0,j&&this.updateRecordArray(b,d,c,h))},updateRecordArraysLater:function(a,b){Ember.run.once(this,function(){this.updateRecordArrays(a,b)})},updateRecordArrays:function(b,c){var d=this.typeMapFor(b).recordArrays,e;d.forEach(function(d){e=a(d,"filterFunction"),this.updateRecordArray(d,e,b,c)},this);var f=this.loadingRecordArrays[c];if(f){for(var g=0,h=f.length;g<h;g++)f[g].loadedRecord();this.loadingRecordArrays[c]=null}},updateRecordArray:function(b,c,d,e){var f,g;c?(g=this.findByClientId(d,e),f=c(g)):f=!0;var h=a(b,"content"),i=h.indexOf(e)!==-1,j=this.recordArraysForClientId(e),k=this.referenceForClientId(e);f?(j.add(b),b.addReference(k)):f||(j.remove(b),b.removeReference(k))},removeFromRecordArrays:function(b){var c=a(b,"_reference"),d=this.recordArraysForClientId(c.clientId);d.forEach(function(a){a.removeReference(c)})},recordArraysForClientId:function(b){var c=a(this,"recordArraysByClientId"),d=c[b];return d||(d=c[b]=Ember.OrderedSet.create()),d},typeMapFor:function(b){var c=a(this,"typeMaps"),d=Ember.guidFor(b),e=c[d];return e?e:c[d]={idToCid:{},clientIds:[],recordArrays:[]}},clientIdForId:function(a,b){b=j(b);var c=this.typeMapFor(a).idToCid[b];return c!==undefined?c:this.pushData(f,b,a)},clientIdsForIds:function(a,b){var c=this.typeMapFor(a),d=c.idToCid;return k(b,function(b){b=j(b);var c=d[b];return c?c:this.pushData(f,b,a)},this)},typeForClientId:function(a){return this.clientIdToType[a]},idForClientId:function(a){return this.clientIdToId[a]},load:function(a,b,c){var e;if(typeof b=="number"||typeof b=="string")e=b,b=c,c=null;if(c&&c.id)e=c.id;else if(e===undefined){var f=this.adapterForType(a);e=this.preprocessData(a,b)}e=j(e);var g=this.typeMapFor(a),h=this.clientIdToData,i=g.idToCid[e],k=this.clientIdToPrematerializedData;if(i!==undefined){h[i]=b,k[i]=c;var l=this.recordCache[i];l&&d(l,"loadedData")}else i=this.pushData(b,e,a),k[i]=c;return this.updateRecordArraysLater(a,i),this.referenceForClientId(i)},prematerialize:function(a,b){this.clientIdToPrematerializedData[a.clientId]=b},loadMany:function(a,b,c){return c===undefined&&(c=b,b=k(c,function(b){return this.preprocessData(a,b)},this)),k(b,function(b,d){return this.load(a,b,c[d])},this)},loadHasMany:function(a,c,d){a.materializeHasMany(c,d),a.hasManyDidChange(c);var e=a.cacheFor(c);e&&b(e,"isLoaded",!0)},pushData:function(a,b,c){var d=this.typeMapFor(c),e=d.idToCid,f=this.clientIdToId,g=this.clientIdToType,h=d.clientIds,i=this.clientIdToData,j=++this.clientIdCounter;return i[j]=a,g[j]=c,b&&(e[b]=j,f[j]=b),h.push(j),j},materializeRecord:function(c,d,e){var f;return this.recordCache[d]=f=c._create({store:this,clientId:d}),b(f,"id",e),a(this,"defaultTransaction").adoptRecord(f),f.loadingData(),f},dematerializeRecord:function(b){var c=a(b,"id"),d=a(b,"clientId"),e=this.typeForClientId(d),f=this.typeMapFor(e);b.updateRecordArrays(),delete this.recordCache[d],delete this.clientIdToId[d],delete this.clientIdToType[d],delete this.clientIdToData[d],delete this.recordArraysByClientId[d],c&&delete f.idToCid[c]},willDestroy:function(){a(DS,"defaultStore")===this&&b(DS,"defaultStore",null)},addRelationshipChangeFor:function(a,b,c,d,e){var f=a.clientId,g=c?c.clientId:c,h=b+d,i=this.relationshipChanges;f in i||(i[f]={}),g in i[f]||(i[f][g]={}),h in i[f][g]||(i[f][g][h]={}),i[f][g][h][e.changeType]=e},removeRelationshipChangeFor:function(a,b,c,d,e){var f=a.clientId,g=c?c.clientId:c,h=this.relationshipChanges,i=b+d;if(f in h&&g in h[f]&&i in h[f][g])delete h[f][g][i][e];else return},relationshipChangeFor:function(a,b,c,d,e){var f=this.relationshipChanges,g=b+d;if(a in f&&c in f[a])return e?f[a][c][g][e]:f[a][c][g].add||f[a][c][g].remove;return},relationshipChangePairsFor:function(a){var b=[];if(!a)return b;var c=this.relationshipChanges[a.clientId];for(var d in c)if(c.hasOwnProperty(d))for(var e in c[d])c[d].hasOwnProperty(e)&&b.push(c[d][e]);return b},relationshipChangesFor:function(a){var b=[];if(!a)return b;var c=this.relationshipChangePairsFor(a);return e(c,function(a){var c=a.add,d=a.remove;c&&b.push(c),d&&b.push(d)}),b},adapterForType:function(a){this._adaptersMap=this.createInstanceMapFor("adapters");var b=this._adaptersMap.get(a);return b?b:this.get("_adapter")},recordAttributeDidChange:function(a,b,c,d){var e=this.recordForReference(a),f=new Ember.OrderedSet,g=this.adapterForType(e.constructor);g.dirtyRecordsForAttributeChange&&g.dirtyRecordsForAttributeChange(f,e,b,c,d),f.forEach(function(a){a.adapterDidDirty()})},recordBelongsToDidChange:function(a,b,c){var d=this.adapterForType(b.constructor);d.dirtyRecordsForBelongsToChange&&d.dirtyRecordsForBelongsToChange(a,b,c)},recordHasManyDidChange:function(a,b,c){var d=this.adapterForType(b.constructor);d.dirtyRecordsForHasManyChange&&d.dirtyRecordsForHasManyChange(a,b,c)}}),DS.Store.reopenClass({registerAdapter:DS._Mappable.generateMapFunctionFor("adapters",function(a,b,c){c.set(a,b)}),transformMapKey:function(b){if(typeof b=="string"){var c;return c=a(Ember.lookup,b),c}return b},transformMapValue:function(a,b){return Ember.Object.detect(b)?b.create():b}})}(),function(){var a=Ember.get,b=Ember.set,c=Ember.guidFor,d=Ember.run.once,e=Ember.ArrayPolyfills.map,f=Ember.computed(function(b){var c=a(this,"parentState");if(c)return a(c,b)}).property(),g=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},h=function(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!0;return!1},i=function(b){var c=a(b,"record");c.materializeData()},j=function(b,c){c.oldValue=a(a(b,"record"),c.name);var d=DS.AttributeChange.createChange(c);a(b,"record")._changesToSync[c.attributeName]=d},k=function(b,c){var d=a(b,"record")._changesToSync[c.attributeName];d.value=a(a(b,"record"),c.name),d.sync()},l=function(a){var b=a.get("record");b.updateRecordArraysLater()};DS.State=Ember.State.extend({isLoaded:f,isReloading:f,isDirty:f,isSaving:f,isDeleted:f,isError:f,isNew:f,isValid:f,dirtyType:f});var m=DS.State.extend({initialState:"uncommitted",isDirty:!0,uncommitted:DS.State.extend({enter:function(b){var c=a(this,"dirtyType"),d=a(b,"record");d.withTransaction(function(a){a.recordBecameDirty(c,d)})},willSetProperty:j,didSetProperty:k,becomeDirty:Ember.K,willCommit:function(a){a.transitionTo("inFlight")},becameClean:function(b){var c=a(b,"record"),d=a(this,"dirtyType");c.withTransaction(function(a){a.recordBecameClean(d,c)}),b.transitionTo("loaded.materializing")},becameInvalid:function(b){var c=a(this,"dirtyType"),d=a(b,"record");d.withTransaction(function(a){a.recordBecameInFlight(c,d)}),b.transitionTo("invalid")},rollback:function(b){a(b,"record").rollback()}}),inFlight:DS.State.extend({isSaving:!0,enter:function(b){var c=a(this,"dirtyType"),d=a(b,"record");d.becameInFlight(),d.withTransaction(function(a){a.recordBecameInFlight(c,d)})},didCommit:function(b){var c=a(this,"dirtyType"),d=a(b,"record");d.withTransaction(function(a){a.recordBecameClean("inflight",d)}),b.transitionTo("saved"),b.send("invokeLifecycleCallbacks",c)},becameInvalid:function(c,d){var e=a(c,"record");b(e,"errors",d),c.transitionTo("invalid"),c.send("invokeLifecycleCallbacks")},becameError:function(a){a.transitionTo("error"),a.send("invokeLifecycleCallbacks")}}),invalid:DS.State.extend({isValid:!1,exit:function(b){var c=a(b,"record");c.withTransaction(function(a){a.recordBecameClean("inflight",c)})},deleteRecord:function(b){b.transitionTo("deleted"),a(b,"record").clearRelationships()},willSetProperty:j,didSetProperty:function(c,d){var e=a(c,"record"),f=a(e,"errors"),g=d.name;b(f,g,null),h(f)||c.send("becameValid"),k(c,d)},becomeDirty:Ember.K,rollback:function(a){a.send("becameValid"),a.send("rollback")},becameValid:function(a){a.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(b){var c=a(b,"record");c.trigger("becameInvalid",c)}})}),n=m.create({dirtyType:"created",isNew:!0}),o=m.create({dirtyType:"updated"});n.states.uncommitted.reopen({deleteRecord:function(b){var c=a(b,"record");c.withTransaction(function(a){a.recordIsMoving("created",c)}),c.clearRelationships(),b.transitionTo("deleted.saved")}}),n.states.uncommitted.reopen({rollback:function(a){this._super(a),a.transitionTo("deleted.saved")}}),o.states.uncommitted.reopen({deleteRecord:function(b){var c=a(b,"record");c.withTransaction(function(a){a.recordIsMoving("updated",c)}),b.transitionTo("deleted"),a(b,"record").clearRelationships()}});var p={rootState:Ember.State.create({isLoaded:!1,isReloading:!1,isDirty:!1,isSaving:!1,isDeleted:!1,isError:!1,isNew:!1,isValid:!0,empty:DS.State.create({loadingData:function(a){a.transitionTo("loading")},loadedData:function(a){a.transitionTo("loaded.created")}}),loading:DS.State.create({loadedData:i,materializingData:function(a){a.transitionTo("loaded.materializing.firstTime")}}),loaded:DS.State.create({initialState:"saved",isLoaded:!0,materializing:DS.State.create({isLoaded:!1,willSetProperty:Ember.K,didSetProperty:Ember.K,didChangeData:i,finishedMaterializing:function(a){a.transitionTo("loaded.saved")},firstTime:DS.State.create({exit:function(b){var c=a(b,"record");Ember.run.once(function(){c.trigger("didLoad")})}})}),reloading:DS.State.create({isReloading:!0,enter:function(b){var c=a(b,"record"),d=a(c,"store");d.reloadRecord(c)},exit:function(b){var c=a(b,"record");d(c,"trigger","didReload")},loadedData:i,materializingData:function(a){a.transitionTo("loaded.materializing")}}),saved:DS.State.create({willSetProperty:j,didSetProperty:k,didChangeData:i,loadedData:i,reloadRecord:function(a){a.transitionTo("loaded.reloading")},materializingData:function(a){a.transitionTo("loaded.materializing")},becomeDirty:function(a){a.transitionTo("updated")},deleteRecord:function(b){b.transitionTo("deleted"),a(b,"record").clearRelationships()},unloadRecord:function(b){b.transitionTo("deleted.saved"),a(b,"record").clearRelationships()},invokeLifecycleCallbacks:function(b,c){var d=a(b,"record");c==="created"?d.trigger("didCreate",d):d.trigger("didUpdate",d)}}),created:n,updated:o}),deleted:DS.State.create({initialState:"uncommitted",dirtyType:"deleted",isDeleted:!0,isLoaded:!0,isDirty:!0,setup:function(b){var c=a(b,"record"),d=a(c,"store");d.removeFromRecordArrays(c)},uncommitted:DS.State.create({enter:function(b){var c=a(b,"record");c.withTransaction(function(a){a.recordBecameDirty("deleted",c)})},willCommit:function(a){a.transitionTo("inFlight")},rollback:function(b){a(b,"record").rollback()},becomeDirty:Ember.K,becameClean:function(b){var c=a(b,"record");c.withTransaction(function(a){a.recordBecameClean("deleted",c)}),b.transitionTo("loaded.materializing")}}),inFlight:DS.State.create({isSaving:!0,enter:function(b){var c=a(b,"record");c.becameInFlight(),c.withTransaction(function(a){a.recordBecameInFlight("deleted",c)})},didCommit:function(b){var c=a(b,"record");c.withTransaction(function(a){a.recordBecameClean("inflight",c)}),b.transitionTo("saved"),b.send("invokeLifecycleCallbacks")}}),saved:DS.State.create({isDirty:!1,setup:function(b){var c=a(b,"record"),d=a(c,"store");d.dematerializeRecord(c)},invokeLifecycleCallbacks:function(b){var c=a(b,"record");c.trigger("didDelete",c)}})}),error:DS.State.create({isError:!0,invokeLifecycleCallbacks:function(b){var c=a(b,"record");c.trigger("becameError",c)}})})};DS.StateManager=Ember.StateManager.extend({record:null,initialState:"rootState",states:p,unhandledEvent:function(b,c){var d=b.get("record"),f=[].slice.call(arguments,2),g;throw g="Attempted to handle event `"+c+"` ",g+="on "+d.toString()+" while in state ",g+=a(b,"currentState.path")+". Called with ",g+=e.call(f,function(a){return Ember.inspect(a)}).join(", "),new Ember.Error(g)}})}(),function(){var a=DS.LoadPromise,b=Ember.get,c=Ember.set,d=Ember.isNone,e=Ember.EnumerableUtils.map,f=Ember.computed(function(a){return b(b(this,"stateManager.currentState"),a)}).property("stateManager.currentState");DS.Model=Ember.Object.extend(Ember.Evented,a,{isLoaded:f,isReloading:f,isDirty:f,isSaving:f,isDeleted:f,isError:f,isNew:f,isValid:f,clientId:null,id:null,transaction:null,stateManager:null,errors:null,serialize:function(a){var c=b(this,"store");return c.serialize(this,a)},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.materializeData(),this._data}).property(),materializeData:function(){this.send("materializingData"),b(this,"store").materializeData(this),this.suspendRelationshipObservers(function(){this.notifyPropertyChange("data")})},_data:null,init:function(){this._super();var a=DS.StateManager.create({record:this});c(this,"stateManager",a),this._setup(),a.goToState("empty")},_setup:function(){this._relationshipChanges={},this._changesToSync={}},send:function(a,c){return b(this,"stateManager").send(a,c)},withTransaction:function(a){var c=b(this,"transaction");c&&a(c)},loadingData:function(){this.send("loadingData")},loadedData:function(){this.send("loadedData")},didChangeData:function(){this.send("didChangeData")},setProperty:function(a,b,c){this.send("setProperty",{key:a,value:b,oldValue:c})},reload:function(){this.send("reloadRecord")},deleteRecord:function(){this.send("deleteRecord")},unloadRecord:function(){this.send("unloadRecord")},clearRelationships:function(){this.eachRelationship(function(a,d){d.kind==="belongsTo"?c(this,a,null):d.kind==="hasMany"&&b(this,a).clear()},this)},updateRecordArrays:function(){var a=b(this,"store");a&&a.dataWasUpdated(this.constructor,b(this,"_reference"),this)},adapterDidCommit:function(){var a=b(this,"data").attributes;b(this.constructor,"attributes").forEach(function(c,d){a[c]=b(this,c)},this),this.send("didCommit"),this.updateRecordArraysLater()},adapterDidDirty:function(){this.send("becomeDirty"),this.updateRecordArraysLater()},dataDidChange:Ember.observer(function(){var a=b(this.constructor,"relationshipsByName");this.updateRecordArraysLater(),a.forEach(function(a,b){b.kind==="hasMany"&&this.hasManyDidChange(b.key)},this),this.send("finishedMaterializing")},"data"),hasManyDidChange:function(a){var d=this.cacheFor(a);if(d){var f=b(this.constructor,"relationshipsByName").get(a).type,g=b(this,"store"),h=this._data.hasMany[a]||[],i=e(h,function(a){return typeof a=="object"?a:g.referenceForId(f,a)});c(d,"content",Ember.A(i))}},updateRecordArraysLater:function(){Ember.run.once(this,this.updateRecordArrays)},setupData:function(a){this._data={attributes:{},belongsTo:{},hasMany:{},id:null}},materializeId:function(a){c(this,"id",a)},materializeAttributes:function(a){this._data.attributes=a},materializeAttribute:function(a,b){this._data.attributes[a]=b},materializeHasMany:function(a,b){this._data.hasMany[a]=b},materializeBelongsTo:function(a,b){this._data.belongsTo[a]=b},rollback:function(){this._setup(),this.send("becameClean"),this.suspendRelationshipObservers(function(){this.notifyPropertyChange("data")})},toStringExtension:function(){return b(this,"id")},suspendRelationshipObservers:function(a,c){var d=b(this.constructor,"relationshipNames").belongsTo,e=this;try{this._suspendedRelationships=!0,Ember._suspendObservers(e,d,null,"belongsToDidChange",function(){Ember._suspendBeforeObservers(e,d,null,"belongsToWillChange",function(){a.call(c||e)})})}finally{this._suspendedRelationships=!1}},becameInFlight:function(){},adapterDidUpdateAttribute:function(a,c){c!==undefined?(b(this,"data.attributes")[a]=c,this.notifyPropertyChange(a)):(c=b(this,a),b(this,"data.attributes")[a]=c),this.updateRecordArraysLater()},_reference:Ember.computed(function(){return b(this,"store").referenceForClientId(b(this,"clientId"))}),adapterDidInvalidate:function(a){this.send("becameInvalid",a)},adapterDidError:function(){this.send("becameError")},trigger:function(a){Ember.tryInvoke(this,a,[].slice.call(arguments,1)),this._super.apply(this,arguments)}});var g=function(a){return function(){var c=b(DS,"defaultStore"),d=[].slice.call(arguments);return d.unshift(this),c[a].apply(c,d)}};DS.Model.reopenClass({isLoaded:g("recordIsLoaded"),find:g("find"),all:g("all"),filter:g("filter"),_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.")},createRecord:g("createRecord")})}(),function(){function c(b,c,d){var e=a(b,"data").attributes,f=e[d];return f===undefined&&(f=c.defaultValue),f}var a=Ember.get;DS.Model.reopenClass({attributes:Ember.computed(function(){var a=Ember.Map.create();return this.eachComputedProperty(function(b,c){c.isAttribute&&(c.name=b,a.set(b,c))}),a})});var b=DS.AttributeChange=function(a){this.reference=a.reference,this.store=a.store,this.name=a.name,this.oldValue=a.oldValue};b.createChange=function(a){return new b(a)},b.prototype={sync:function(){this.store.recordAttributeDidChange(this.reference,this.name,this.value,this.oldValue),this.destroy()},destroy:function(){delete this.store.recordForReference(this.reference)._changesToSync[this.name]}},DS.Model.reopen({eachAttribute:function(b,c){a(this.constructor,"attributes").forEach(function(a,d){b.call(c,a,d)},c)},attributeWillChange:Ember.beforeObserver(function(b,c){var d=a(b,"_reference"),e=a(b,"store");b.send("willSetProperty",{reference:d,store:e,name:c})}),attributeDidChange:Ember.observer(function(a,b){a.send("didSetProperty",{name:b})})}),DS.attr=function(a,b){b=b||{};var d={type:a,isAttribute:!0,options:b};return Ember.computed(function(a,d,e){var f;return arguments.length>1||(d=c(this,b,a)),d}).property("data").meta(d)}}(),function(){}(),function(){var a=Ember.get,b=Ember.set,c=Ember.isNone;DS.belongsTo=function(b,c){c=c||{};var d={type:b,isRelationship:!0,options:c,kind:"belongsTo"};return Ember.computed(function(c,d){if(arguments.length===2
11
+ )return d===undefined?null:d;var e=a(this,"data").belongsTo,f=a(this,"store"),g;return typeof b=="string"&&(b=a(this,b,!1)||a(Ember.lookup,b)),g=e[c],g?typeof g=="object"?f.recordForReference(g):f.find(b,g):null}).property("data").meta(d)},DS.Model.reopen({belongsToWillChange:Ember.beforeObserver(function(b,c){if(a(b,"isLoaded")){var d=a(b,c),e=a(b,"_reference"),f=a(b,"store");if(d){var g=DS.RelationshipChange.createChange(e,a(d,"_reference"),f,{key:c,kind:"belongsTo",changeType:"remove"});g.sync(),this._changesToSync[c]=g}}}),belongsToDidChange:Ember.immediateObserver(function(b,c){if(a(b,"isLoaded")){var d=a(b,c);if(d){var e=a(b,"_reference"),f=a(b,"store"),g=DS.RelationshipChange.createChange(e,a(d,"_reference"),f,{key:c,kind:"belongsTo",changeType:"add"});g.sync(),this._changesToSync[c]&&DS.OneToManyChange.ensureSameTransaction([g,this._changesToSync[c]],f)}}delete this._changesToSync[c]})})}(),function(){var a=Ember.get,b=Ember.set,c=function(c,d){d=d||{};var e={type:c,isRelationship:!0,options:d,kind:"hasMany"};return Ember.computed(function(d,f){var g=a(this,"data").hasMany,h=a(this,"store"),i,j;return typeof c=="string"&&(c=a(this,c,!1)||a(Ember.lookup,c)),i=g[d],j=h.findMany(c,i||[],this,e),b(j,"owner",this),b(j,"name",d),j}).property().meta(e)};DS.hasMany=function(a,b){return c(a,b)}}(),function(){var a=Ember.get,b=Ember.set;DS.Model.reopen({didDefineProperty:function(a,b,c){if(c instanceof Ember.Descriptor){var d=c.meta();d.isRelationship&&d.kind==="belongsTo"&&(Ember.addObserver(a,b,null,"belongsToDidChange"),Ember.addBeforeObserver(a,b,null,"belongsToWillChange")),d.isAttribute&&(Ember.addObserver(a,b,null,"attributeDidChange"),Ember.addBeforeObserver(a,b,null,"attributeWillChange")),d.parentType=a.constructor}}}),DS.Model.reopenClass({typeForRelationship:function(b){var c=a(this,"relationshipsByName").get(b);return c&&c.type},relationships:Ember.computed(function(){var a=new Ember.MapWithDefault({defaultValue:function(){return[]}});return this.eachComputedProperty(function(b,c){if(c.isRelationship){typeof c.type=="string"&&(c.type=Ember.get(Ember.lookup,c.type));var d=a.get(c.type);d.push({name:b,kind:c.kind})}}),a}),relationshipNames:Ember.computed(function(){var a={hasMany:[],belongsTo:[]};return this.eachComputedProperty(function(b,c){c.isRelationship&&a[c.kind].push(b)}),a}),relationshipsByName:Ember.computed(function(){var b=Ember.Map.create(),c;return this.eachComputedProperty(function(d,e){e.isRelationship&&(e.key=d,c=e.type,typeof c=="string"&&(c=a(this,c,!1)||a(Ember.lookup,c),e.type=c),b.set(d,e))}),b}),fields:Ember.computed(function(){var a=Ember.Map.create(),b;return this.eachComputedProperty(function(b,c){c.isRelationship?a.set(b,c.kind):c.isAttribute&&a.set(b,"attribute")}),a}),eachRelationship:function(b,c){a(this,"relationshipsByName").forEach(function(a,d){b.call(c,a,d)})}}),DS.Model.reopen({eachRelationship:function(a,b){this.constructor.eachRelationship(a,b)}}),DS._inverseRelationshipFor=function(b,c){var d=a(b,"relationships"),e=d.get(c),f,g,h;if(!e)return;if(e.length>1)return;return e[0]},DS._inverseTypeFor=function(b,c){var d=a(b,"relationshipsByName"),e=d.get(c);if(e)return e.type}}(),function(){function d(a,b,c){var d=a.metaForProperty(c).options,e;return(e=d.inverse)?e:DS._inverseRelationshipFor(b,a).name}function e(a,b,c){var d=b.metaForProperty(c).options,e;return(e=d.inverse)?e:DS._inverseRelationshipFor(a,b).name}var a=Ember.get,b=Ember.set,c=Ember.EnumerableUtils.forEach;DS.RelationshipChange=function(a){this.parentReference=a.parentReference,this.childReference=a.childReference,this.firstRecordReference=a.firstRecordReference,this.firstRecordKind=a.firstRecordKind,this.firstRecordName=a.firstRecordName,this.secondRecordReference=a.secondRecordReference,this.secondRecordKind=a.secondRecordKind,this.secondRecordName=a.secondRecordName,this.store=a.store,this.committed={},this.changeType=a.changeType},DS.RelationshipChangeAdd=function(a){DS.RelationshipChange.call(this,a)},DS.RelationshipChangeRemove=function(a){DS.RelationshipChange.call(this,a)},DS.RelationshipChange.create=function(a){return new DS.RelationshipChange(a)},DS.RelationshipChangeAdd.create=function(a){return new DS.RelationshipChangeAdd(a)},DS.RelationshipChangeRemove.create=function(a){return new DS.RelationshipChangeRemove(a)},DS.OneToManyChange={},DS.OneToNoneChange={},DS.ManyToNoneChange={},DS.OneToOneChange={},DS.ManyToManyChange={},DS.RelationshipChange._createChange=function(a){if(a.changeType==="add")return DS.RelationshipChangeAdd.create(a);if(a.changeType==="remove")return DS.RelationshipChangeRemove.create(a)},DS.RelationshipChange.determineRelationshipType=function(b,c){var d=c.key,e,f,g,h,i=c.kind,j=b.metaForProperty(d).options,k=DS._inverseTypeFor(b,d);if(j.inverse)e=j.inverse,g=a(k,"relationshipsByName").get(e).kind;else if(h=DS._inverseRelationshipFor(k,b))e=h.name,g=h.kind;return e?g==="belongsTo"?i==="belongsTo"?"oneToOne":"manyToOne":i==="belongsTo"?"oneToMany":"manyToMany":i==="belongsTo"?"oneToNone":"manyToNone"},DS.RelationshipChange.createChange=function(a,b,c,d){var e=a.type,f,g;g=DS.RelationshipChange.determineRelationshipType(e,d);if(g==="oneToMany")return DS.OneToManyChange.createChange(a,b,c,d);if(g==="manyToOne")return DS.OneToManyChange.createChange(b,a,c,d);if(g==="oneToNone")return DS.OneToNoneChange.createChange(a,b,c,d);if(g==="manyToNone")return DS.ManyToNoneChange.createChange(a,b,c,d);if(g==="oneToOne")return DS.OneToOneChange.createChange(a,b,c,d);if(g==="manyToMany")return DS.ManyToManyChange.createChange(a,b,c,d)},DS.OneToNoneChange.createChange=function(a,b,c,d){var e=d.key,f=DS.RelationshipChange._createChange({parentReference:b,childReference:a,firstRecordReference:a,store:c,changeType:d.changeType,firstRecordName:e,firstRecordKind:"belongsTo"});return c.addRelationshipChangeFor(a,e,b,null,f),f},DS.ManyToNoneChange.createChange=function(a,b,c,d){var e=d.key,f=DS.RelationshipChange._createChange({parentReference:a,childReference:b,secondRecordReference:a,store:c,changeType:d.changeType,secondRecordName:d.key,secondRecordKind:"hasMany"});return c.addRelationshipChangeFor(a,e,b,null,f),f},DS.ManyToManyChange.createChange=function(a,b,c,d){var e=a.type,f;f=d.key;var g=DS.RelationshipChange._createChange({parentReference:b,childReference:a,firstRecordReference:a,secondRecordReference:b,firstRecordKind:"hasMany",secondRecordKind:"hasMany",store:c,changeType:d.changeType,firstRecordName:f});return c.addRelationshipChangeFor(a,f,b,null,g),g},DS.OneToOneChange.createChange=function(a,b,c,e){var f=a.type,g;e.parentType?g=d(e.parentType,f,e.key):e.key&&(g=e.key);var h=DS.RelationshipChange._createChange({parentReference:b,childReference:a,firstRecordReference:a,secondRecordReference:b,firstRecordKind:"belongsTo",secondRecordKind:"belongsTo",store:c,changeType:e.changeType,firstRecordName:g});return c.addRelationshipChangeFor(a,g,b,null,h),h},DS.OneToOneChange.maintainInvariant=function(b,c,d,e){if(b.changeType==="add"&&c.recordIsMaterialized(d)){var f=c.recordForReference(d),g=a(f,e);if(g){var h=DS.OneToOneChange.createChange(d,g.get("_reference"),c,{parentType:b.parentType,hasManyName:b.hasManyName,changeType:"remove",key:b.key});c.addRelationshipChangeFor(d,e,b.parentReference,null,h),h.sync()}}},DS.OneToManyChange.createChange=function(a,b,c,e){var f=a.type,g;e.parentType?(g=d(e.parentType,f,e.key),DS.OneToManyChange.maintainInvariant(e,c,a,g)):e.key&&(g=e.key);var h=DS.RelationshipChange._createChange({parentReference:b,childReference:a,firstRecordReference:a,secondRecordReference:b,firstRecordKind:"belongsTo",secondRecordKind:"hasMany",store:c,changeType:e.changeType,firstRecordName:g});return c.addRelationshipChangeFor(a,g,b,null,h),h},DS.OneToManyChange.maintainInvariant=function(b,c,d,e){if(b.changeType==="add"&&c.recordIsMaterialized(d)){var f=c.recordForReference(d),g=a(f,e);if(g){var h=DS.OneToManyChange.createChange(d,g.get("_reference"),c,{parentType:b.parentType,hasManyName:b.hasManyName,changeType:"remove",key:b.key});c.addRelationshipChangeFor(d,e,b.parentReference,null,h),h.sync()}}},DS.OneToManyChange.ensureSameTransaction=function(a,b){var d=Ember.A();c(a,function(a){d.addObject(a.getSecondRecord()),d.addObject(a.getFirstRecord())});var e=b.ensureSameTransaction(d);c(a,function(a){a.transaction=e})},DS.RelationshipChange.prototype={getSecondRecordName:function(){var a=this.secondRecordName,b=this.store,c;if(!a){c=this.secondRecordReference;if(!c)return;var d=this.firstRecordReference.type,f=DS._inverseTypeFor(d,this.firstRecordName);a=e(f,d,this.firstRecordName),this.secondRecordName=a}return a},getFirstRecordName:function(){var a=this.firstRecordName,b=this.store,c,d;if(!a){c=this.secondRecordReference,d=this.firstRecordReference;if(!d||!c)return;a=DS._inverseRelationshipFor(d.type,c.type).name,this.firstRecordName=a}return a},destroy:function(){var a=this.childReference,b=this.getFirstRecordName(),c=this.getSecondRecordName(),d=this.store,e,f,g,h,i;d.removeRelationshipChangeFor(a,b,this.parentReference,c,this.changeType),(i=this.transaction)&&i.relationshipBecameClean(this)},getByReference:function(a){var b=this.store;if(!a)return a;if(b.recordIsMaterialized(a))return b.recordForReference(a)},getSecondRecord:function(){return this.getByReference(this.secondRecordReference)},getFirstRecord:function(){return this.getByReference(this.firstRecordReference)},ensureSameTransaction:function(){var a=this.getFirstRecord(),b=this.getSecondRecord(),c=this.store.ensureSameTransaction([a,b]);return this.transaction=c,c},callChangeEvents:function(){var b=this.getSecondRecordName(),c=this.getFirstRecordName(),d=this.getFirstRecord(),e=this.getSecondRecord(),f=new Ember.OrderedSet;e&&a(e,"isLoaded")&&this.store.recordHasManyDidChange(f,e,this),d&&this.store.recordBelongsToDidChange(f,d,this),f.forEach(function(a){a.adapterDidDirty()})},coalesce:function(){var a=this.store.relationshipChangePairsFor(this.firstRecordReference);c(a,function(a){var b=a.add,c=a.remove;b&&c&&(b.destroy(),c.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 c=this.getSecondRecordName(),d=this.getFirstRecordName(),e=this.getFirstRecord(),f=this.getSecondRecord(),g=this.ensureSameTransaction();g.relationshipBecameDirty(this),this.callChangeEvents(),f&&e&&(this.secondRecordKind==="belongsTo"?f.suspendRelationshipObservers(function(){b(f,c,e)}):this.secondRecordKind==="hasMany"&&f.suspendRelationshipObservers(function(){a(f,c).addObject(e)})),e&&f&&a(e,d)!==f&&(this.firstRecordKind==="belongsTo"?e.suspendRelationshipObservers(function(){b(e,d,f)}):this.firstdRecordKind==="hasMany"&&e.suspendRelationshipObservers(function(){a(e,d).addObject(f)})),this.coalesce()},DS.RelationshipChangeRemove.prototype.changeType="remove",DS.RelationshipChangeRemove.prototype.sync=function(){var c=this.getSecondRecordName(),d=this.getFirstRecordName(),e=this.getFirstRecord(),f=this.getSecondRecord(),g=this.ensureSameTransaction(e,f,c,d);g.relationshipBecameDirty(this),this.callChangeEvents(),f&&e&&(this.secondRecordKind==="belongsTo"?b(f,c,null):this.secondRecordKind==="hasMany"&&f.suspendRelationshipObservers(function(){a(f,c).removeObject(e)})),e&&a(e,d)&&(this.firstRecordKind==="belongsTo"?e.suspendRelationshipObservers(function(){b(e,d,null)}):this.firstdRecordKind==="hasMany"&&e.suspendRelationshipObservers(function(){a(e,d).removeObject(f)})),this.coalesce()}}(),function(){}(),function(){var a=Ember.set;Ember.onLoad("Ember.Application",function(b){b.registerInjection?(b.registerInjection({name:"store",before:"controllers",injection:function(b,c,d){if(!c)return;d==="Store"&&a(c,"store",b[d].create())}}),b.registerInjection({name:"giveStoreToControllers",after:["store","controllers"],injection:function(a,b,c){if(!b)return;if(/^[A-Z].*Controller$/.test(c)){var d=c.charAt(0).toLowerCase()+c.substr(1),e=b.get("store"),f=b.get(d);if(!f)return;f.set("store",e)}}})):b.initializer&&(b.initializer({name:"store",initialize:function(a,b){a.register("store","main",b.Store),a.lookup("store:main")}}),b.initializer({name:"injectStore",initialize:function(a){a.typeInjection("controller","store","store:main"),a.typeInjection("route","store","store:main")}}))})}(),function(){function e(a){return function(){throw new Ember.Error("Your serializer "+this.toString()+" does not implement the required method "+a)}}var a=Ember.get,b=Ember.set,c=Ember.ArrayPolyfills.map,d=Ember.isNone;DS.Serializer=Ember.Object.extend({init:function(){this.mappings=Ember.Map.create(),this.configurations=Ember.Map.create(),this.globalConfigurations={}},extract:e("extract"),extractMany:e("extractMany"),extractRecordRepresentation:function(a,b,c,e){var f=this.mappingForType(b),g,h={},i;return e?i=a.sideload(b,c):i=a.load(b,c),this.eachEmbeddedHasMany(b,function(b,e){var f=c[this.keyFor(e)];d(f)||this.extractEmbeddedHasMany(a,e,f,i,h)},this),this.eachEmbeddedBelongsTo(b,function(b,e){var f=c[this.keyFor(e)];d(f)||this.extractEmbeddedBelongsTo(a,e,f,i,h)},this),a.prematerialize(i,h),i},extractEmbeddedHasMany:function(a,b,d,e,f){var g=c.call(d,function(c){if(!c)return;var d=this.extractRecordRepresentation(a,b.type,c,!0),f=this.embeddedType(e.type,b.key);return f==="always"&&(d.parent=e),d},this);f[b.key]=g},extractEmbeddedBelongsTo:function(a,b,c,d,e){var f=this.extractRecordRepresentation(a,b.type,c,!0);e[b.key]=f;var g=this.embeddedType(d.type,b.key);g==="always"&&(f.parent=d)},serialize:function(b,c){c=c||{};var d=this.createSerializedForm(),e;return c.includeId&&(e=a(b,"id"))&&this._addId(d,b.constructor,e),this.addAttributes(d,b),this.addRelationships(d,b),d},serializeValue:function(a,b){var c=this.transforms?this.transforms[b]:null;return c.serialize(a)},serializeId:function(a){return isNaN(a)?a:+a},addAttributes:function(a,b){b.eachAttribute(function(c,d){this._addAttribute(a,b,c,d.type)},this)},addAttribute:Ember.K,addId:Ember.K,addRelationships:function(a,b){b.eachRelationship(function(c,d){d.kind==="belongsTo"?this._addBelongsTo(a,b,c,d):d.kind==="hasMany"&&this._addHasMany(a,b,c,d)},this)},addBelongsTo:Ember.K,addHasMany:Ember.K,keyForAttributeName:function(a,b){return b},primaryKey:function(a){return"id"},keyForBelongsTo:function(a,b){return this.keyForAttributeName(a,b)},keyForHasMany:function(a,b){return this.keyForAttributeName(a,b)},materialize:function(b,c,d){var e;Ember.isNone(a(b,"id"))&&(d&&d.hasOwnProperty("id")?e=d.id:e=this.extractId(b.constructor,c),b.materializeId(e)),this.materializeAttributes(b,c,d),this.materializeRelationships(b,c,d)},deserializeValue:function(a,b){var c=this.transforms?this.transforms[b]:null;return c.deserialize(a)},materializeAttributes:function(a,b,c){a.eachAttribute(function(d,e){c&&c.hasOwnProperty(d)?a.materializeAttribute(d,c[d]):this.materializeAttribute(a,b,d,e.type)},this)},materializeAttribute:function(a,b,c,d){var e=this.extractAttribute(a.constructor,b,c);e=this.deserializeValue(e,d),a.materializeAttribute(c,e)},materializeRelationships:function(a,b,c){a.eachRelationship(function(d,e){e.kind==="hasMany"?c&&c.hasOwnProperty(d)?a.materializeHasMany(d,c[d]):this.materializeHasMany(d,a,b,e,c):e.kind==="belongsTo"&&(c&&c.hasOwnProperty(d)?a.materializeBelongsTo(d,c[d]):this.materializeBelongsTo(d,a,b,e,c))},this)},materializeHasMany:function(a,b,c,d){var e=this._keyForHasMany(b.constructor,d.key);b.materializeHasMany(a,this.extractHasMany(b.constructor,c,e))},materializeBelongsTo:function(a,b,c,d){var e=this._keyForBelongsTo(b.constructor,d.key);b.materializeBelongsTo(a,this.extractBelongsTo(b.constructor,c,e))},_extractEmbeddedRelationship:function(a,b,c,d){var e=this["_keyFor"+d](a,c);if(this.embeddedType(a,c))return this["extractEmbedded"+d](a,b,e)},_extractEmbeddedBelongsTo:function(a,b,c){return this._extractEmbeddedRelationship(a,b,c,"BelongsTo")},_extractEmbeddedHasMany:function(a,b,c){return this._extractEmbeddedRelationship(a,b,c,"HasMany")},_primaryKey:function(a){var b=this.configurationForType(a),c=b&&b.primaryKey;return c?c:this.primaryKey(a)},_addAttribute:function(b,c,d,e){var f=this._keyForAttributeName(c.constructor,d),g=a(c,d);this.addAttribute(b,f,this.serializeValue(g,e))},_addId:function(a,b,c){var d=this._primaryKey(b);this.addId(a,d,this.serializeId(c))},_keyForAttributeName:function(a,b){return this._keyFromMappingOrHook("keyForAttributeName",a,b)},_keyForBelongsTo:function(a,b){return this._keyFromMappingOrHook("keyForBelongsTo",a,b)},keyFor:function(a){var b=a.parentType,c=a.key;switch(a.kind){case"belongsTo":return this._keyForBelongsTo(b,c);case"hasMany":return this._keyForHasMany(b,c)}},_keyForHasMany:function(a,b){return this._keyFromMappingOrHook("keyForHasMany",a,b)},_addBelongsTo:function(a,b,c,d){var e=this._keyForBelongsTo(b.constructor,c);this.addBelongsTo(a,b,e,d)},_addHasMany:function(a,b,c,d){var e=this._keyForHasMany(b.constructor,c);this.addHasMany(a,b,e,d)},_keyFromMappingOrHook:function(a,b,c){var d=this.mappingOption(b,c,"key");return d?d:this[a](b,c)},registerTransform:function(a,b){this.transforms[a]=b},registerEnumTransform:function(a,b){var c={deserialize:function(a){return b.objectAt(a)},serialize:function(a){return b.indexOf(a)},values:b};this.registerTransform(a,c)},map:function(a,b){this.mappings.set(a,b)},configure:function(a,b){if(a&&!b){Ember.merge(this.globalConfigurations,a);return}var c=Ember.create(this.globalConfigurations);Ember.merge(c,b),this.configurations.set(a,c)},mappingForType:function(a){return this._reifyMappings(),this.mappings.get(a)||{}},configurationForType:function(a){return this._reifyConfigurations(),this.configurations.get(a)||this.globalConfigurations},_reifyMappings:function(){if(this._didReifyMappings)return;var a=this.mappings,b=Ember.Map.create();a.forEach(function(a,c){if(typeof a=="string"){var d=Ember.get(Ember.lookup,a);b.set(d,c)}else b.set(a,c)}),this.mappings=b,this._didReifyMappings=!0},_reifyConfigurations:function(){if(this._didReifyConfigurations)return;var a=this.configurations,b=Ember.Map.create();a.forEach(function(a,c){if(typeof a=="string"&&a!=="plurals"){var d=Ember.get(Ember.lookup,a);b.set(d,c)}else b.set(a,c)}),this.configurations=b,this._didReifyConfigurations=!0},mappingOption:function(a,b,c){var d=this.mappingForType(a)[b];return d&&d[c]},configOption:function(a,b){var c=this.configurationForType(a);return c[b]},embeddedType:function(a,b){return this.mappingOption(a,b,"embedded")},eachEmbeddedRecord:function(a,b,c){this.eachEmbeddedBelongsToRecord(a,b,c),this.eachEmbeddedHasManyRecord(a,b,c)},eachEmbeddedBelongsToRecord:function(b,c,d){var e=b.constructor;this.eachEmbeddedBelongsTo(b.constructor,function(e,f,g){var h=a(b,e);h&&c.call(d,h,g)})},eachEmbeddedHasManyRecord:function(b,c,d){var e=b.constructor;this.eachEmbeddedHasMany(b.constructor,function(e,f,g){var h=a(b,e);for(var i=0,j=a(h,"length");i<j;i++)c.call(d,h.objectAt(i),g)})},eachEmbeddedHasMany:function(a,b,c){this.eachEmbeddedRelationship(a,"hasMany",b,c)},eachEmbeddedBelongsTo:function(a,b,c){this.eachEmbeddedRelationship(a,"belongsTo",b,c)},eachEmbeddedRelationship:function(a,b,c,d){a.eachRelationship(function(e,f){var g=this.embeddedType(a,e);g&&f.kind===b&&c.call(d,e,f,g)},this)}})}(),function(){var a=Ember.isNone;DS.JSONTransforms={string:{deserialize:function(b){return a(b)?null:String(b)},serialize:function(b){return a(b)?null:String(b)}},number:{deserialize:function(b){return a(b)?null:Number(b)},serialize:function(b){return a(b)?null:Number(b)}},"boolean":{deserialize:function(a){var b=typeof a;return b==="boolean"?a:b==="string"?a.match(/^true$|^t$|^1$/i)!==null:b==="number"?a===1:!1},serialize:function(a){return Boolean(a)}},date:{deserialize:function(a){var b=typeof a,c=null;return b==="string"||b==="number"?(b==="string"&&a.search(/^\d{4}-\d{2}-\d{2}$/)!==-1&&(a+="T00:00:00Z"),c=new Date(a),b==="string"&&isNaN(c)&&(c=new Date(Date.parse(a.replace(/\-/ig,"/").replace(/Z$/,"").split(".")[0]))),c):a===null||a===undefined?a:null},serialize:function(a){if(a instanceof Date){var b=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],d=function(a){return a<10?"0"+a:""+a},e=a.getUTCFullYear(),f=a.getUTCMonth(),g=a.getUTCDate(),h=a.getUTCDay(),i=a.getUTCHours(),j=a.getUTCMinutes(),k=a.getUTCSeconds(),l=b[h],m=d(g),n=c[f];return l+", "+m+" "+n+" "+e+" "+d(i)+":"+d(j)+":"+d(k)+" GMT"}return a===undefined?undefined:null}}}}(),function(){var a=Ember.get,b=Ember.set,c=0;DS.JSONSerializer=DS.Serializer.extend({init:function(){this._super(),a(this,"transforms")||this.set("transforms",DS.JSONTransforms),this.sideloadMapping=Ember.Map.create(),this.configure({meta:"meta",since:"since"})},configure:function(a,b){if(a&&!b)return this._super(a);var c=b.sideloadAs;c&&(this.sideloadMapping.set(c,a),delete b.sideloadAs),this._super.apply(this,arguments)},addId:function(a,b,c){a[b]=c},addAttribute:function(a,b,c){a[b]=c},createSerializedForm:function(){return{}},extractAttribute:function(a,b,c){var d=this._keyForAttributeName(a,c);return b[d]},extractId:function(a,b){var c=this._primaryKey(a);return b.hasOwnProperty(c)?b[c]+"":null},extractHasMany:function(a,b,c){return b[c]},extractBelongsTo:function(a,b,c){return b[c]},addBelongsTo:function(b,c,d,e){var f=c.constructor,g=e.key,h=null,i;if(this.embeddedType(f,g)){if(i=a(c,g))h=this.serialize(i,{includeId:!0});b[d]=h}else{var j=a(c,e.key+".id");Ember.isNone(j)||(b[d]=j)}},addHasMany:function(b,c,d,e){var f=c.constructor,g=e.key,h=[],i,j;j=this.embeddedType(f,g);if(j!=="always")return;i=a(c,g),i.forEach(function(a){h.push(this.serialize(a,{includeId:!0}))},this),b[d]=h},extract:function(a,b,c,d){var e=this.rootForType(c);this.sideload(a,c,b,e),this.extractMeta(a,c,b),b[e]&&(d&&a.updateId(d,b[e]),this.extractRecordRepresentation(a,c,b[e]))},extractMany:function(a,b,c,d){var e=this.rootForType(c);e=this.pluralize(e),this.sideload(a,c,b,e),this.extractMeta(a,c,b);if(b[e]){var f=b[e],g=[];d&&(d=d.toArray());for(var h=0;h<f.length;h++){d&&a.updateId(d[h],f[h]);var i=this.extractRecordRepresentation(a,c,f[h]);g.push(i)}a.populateArray(g)}},extractMeta:function(a,b,c){var d=c[this.configOption(b,"meta")],e;if(!d)return;(e=d[this.configOption(b,"since")])&&a.sinceForType(b,e)},sideload:function(b,c,d,e){var f,g,h={};h[e]=!0;for(var i in d){if(!d.hasOwnProperty(i))continue;if(i===e)continue;if(i===this.configOption(c,"meta"))continue;f=c.typeForRelationship(i),f||(f=this.sideloadMapping.get(i),typeof f=="string"&&(f=a(Ember.lookup,f))),this.sideloadRelationships(b,f,d,i,h)}},sideloadRelationships:function(b,c,d,e,f){if(f[e])return;f[e]=!0,a(c,"relationshipsByName").forEach(function(a,c){a=c.key||a,c.kind==="belongsTo"&&(a=this.pluralize(a)),d[a]&&this.sideloadRelationships(b,c.type,d,a,f)},this),this.loadValue(b,c,d[e])},loadValue:function(a,b,c){if(c instanceof Array)for(var d=0;d<c.length;d++)a.sideload(b,c[d]);else a.sideload(b,c)},pluralize:function(a){var b=this.configurations.get("plurals");return b&&b[a]||a+"s"},rootForType:function(a){var b=a.toString(),c=b.split("."),d=c[c.length-1];return d.replace(/([A-Z])/g,"_$1").toLowerCase().slice(1)}})}(),function(){function a(a){return{load:function(b,c,d){return a.load(b,c,d)},loadMany:function(b,c){return a.loadMany(b,c)},updateId:function(b,c){return a.updateId(b,c)},populateArray:Ember.K,sideload:function(b,c){return a.load(b,c)},sideloadMany:function(b,c){return a.loadMany(b,c)},prematerialize:function(b,c){a.prematerialize(b,c)},sinceForType:function(b,c){a.sinceForType(b,c)}}}DS.loaderFor=a;var b=Ember.get,c=Ember.set,d=Ember.merge;DS.Adapter=Ember.Object.extend(DS._Mappable,{init:function(){var a=b(this,"serializer");Ember.Object.detect(a)&&(a=a.create(),c(this,"serializer",a)),this._attributesMap=this.createInstanceMapFor("attributes"),this._configurationsMap=this.createInstanceMapFor("configurations"),this._outstandingOperations=new Ember.MapWithDefault({defaultValue:function(){return 0}}),this._dependencies=new Ember.MapWithDefault({defaultValue:function(){return new Ember.OrderedSet}}),this.registerSerializerTransforms(this.constructor,a,{}),this.registerSerializerMappings(a)},load:function(c,d,e){var f=a(c);b(this,"serializer").extractRecordRepresentation(f,d,e)},didCreateRecord:function(a,c,d,e){a.didSaveRecord(d);if(e){var f=DS.loaderFor(a),g=b(this,"serializer");f.load=function(b,c,e){return a.updateId(d,c),a.load(b,c,e)},b(this,"serializer").extract(f,e,c)}},didCreateRecords:function(a,c,d,e){d.forEach(function(b){a.didSaveRecord(b)},this);if(e){var f=DS.loaderFor(a);b(this,"serializer").extractMany(f,e,c,d)}},didSaveRecord:function(a,c,d,e){a.didSaveRecord(d);var f=b(this,"serializer"),g=f.mappingForType(c);f.eachEmbeddedRecord(d,function(b,c){if(c==="load")return;this.didSaveRecord(a,b.constructor,b)},this);if(e){var h=DS.loaderFor(a);f.extract(h,e,c)}},didUpdateRecord:function(){this.didSaveRecord.apply(this,arguments)},didDeleteRecord:function(){this.didSaveRecord.apply(this,arguments)},didSaveRecords:function(a,c,d,e){d.forEach(function(b){a.didSaveRecord(b)},this);if(e){var f=DS.loaderFor(a);b(this,"serializer").extractMany(f,e,c)}},didUpdateRecords:function(){this.didSaveRecords.apply(this,arguments)},didDeleteRecords:function(){this.didSaveRecords.apply(this,arguments)},didFindRecord:function(a,c,d,e){var f=DS.loaderFor(a);f.load=function(b,c,d){return d=d||{},d.id=e,a.load(b,c,d)},b(this,"serializer").extract(f,d,c)},didFindAll:function(a,c,d){var e=DS.loaderFor(a),f=b(this,"serializer");a.didUpdateAll(c),f.extractMany(e,d,c)},didFindQuery:function(a,c,d,e){var f=DS.loaderFor(a);f.populateArray=function(a){e.load(a)},b(this,"serializer").extractMany(f,d,c)},didFindMany:function(a,c,d){var e=DS.loaderFor(a);b(this,"serializer").extractMany(e,d,c)},didError:function(a,b,c){a.recordWasError(c)},dirtyRecordsForAttributeChange:function(a,b,c,d,e){d!==e&&this.dirtyRecordsForRecordChange(a,b)},dirtyRecordsForRecordChange:function(a,b){a.add(b)},dirtyRecordsForBelongsToChange:function(a,b){this.dirtyRecordsForRecordChange(a,b)},dirtyRecordsForHasManyChange:function(a,b){this.dirtyRecordsForRecordChange(a,b)},registerSerializerTransforms:function(a,b,c){var d=a._registeredTransforms,e,f;for(f in d){if(!d.hasOwnProperty(f)||f in c)continue;c[f]=!0,b.registerTransform(f,d[f])}(e=a.superclass)&&this.registerSerializerTransforms(e,b,c)},registerSerializerMappings:function(a){var b=this._attributesMap,c=this._configurationsMap;b.forEach(a.map,a),c.forEach(a.configure,a)},find:null,serializer:DS.JSONSerializer,registerTransform:function(a,c){b(this,"serializer").registerTransform(a,c)},registerEnumTransform:function(a,c){b(this,"serializer").registerEnumTransform(a,c)},generateIdForRecord:null,materialize:function(a,c,d){b(this,"serializer").materialize(a,c,d)},serialize:function(a,c){return b(this,"serializer").serialize(a,c)},extractId:function(a,c){return b(this,"serializer").extractId(a,c)},groupByType:function(a){var b=Ember.MapWithDefault.create({defaultValue:function(){return Ember.OrderedSet.create()}});return a.forEach(function(a){b.get(a.constructor).add(a)}),b},commit:function(a,b){this.save(a,b)},save:function(a,b){function d(a){var b=Ember.OrderedSet.create();return a.forEach(function(a){c.shouldSave(a)&&b.add(a)}),b}var c=this;this.groupByType(b.created).forEach(function(b,c){this.createRecords(a,b,d(c))},this),this.groupByType(b.updated).forEach(function(b,c){this.updateRecords(a,b,d(c))},this),this.groupByType(b.deleted).forEach(function(b,c){this.deleteRecords(a,b,d(c))},this)},shouldSave:Ember.K,createRecords:function(a,b,c){c.forEach(function(c){this.createRecord(a,b,c)},this)},updateRecords:function(a,b,c){c.forEach(function(c){this.updateRecord(a,b,c)},this)},deleteRecords:function(a,b,c){c.forEach(function(c){this.deleteRecord(a,b,c)},this)},findMany:function(a,b,c){c.forEach(function(c){this.find(a,b,c)},this)}}),DS.Adapter.reopenClass({registerTransform:function(a,b){var c=this._registeredTransforms||{};c[a]=b,this._registeredTransforms=c},map:DS._Mappable.generateMapFunctionFor("attributes",function(a,b,c){var e=c.get(a);d(e,b)}),configure:DS._Mappable.generateMapFunctionFor("configurations",function(a,b,c){var e=c.get(a),f=b&&b.mappings;f&&(this.map(a,f),delete b.mappings),d(e,b)}),resolveMapConflict:function(a,b,c){return d(b,a),b}})}(),function(){var a=Ember.get;DS.FixtureAdapter=DS.Adapter.extend({simulateRemoteResponse:!0,latency:50,fixturesForType:function(a){if(a.FIXTURES){var b=Ember.A(a.FIXTURES);return b.map(function(a){if(!a.id)throw new Error("the id property must be defined for fixture %@".fmt(a));return a.id=a.id+"",a})}return null},queryFixtures:function(a,b,c){return a},mockJSON:function(a,b){return this.serialize(b,{includeId:!0})},generateIdForRecord:function(a,b){return Ember.guidFor(b)},find:function(a,b,c){var d=this.fixturesForType(b);d&&(d=d.findProperty("id",c)),d&&this.simulateRemoteCall(function(){a.load(b,d)},a,b)},findMany:function(a,b,c){var d=this.fixturesForType(b);d&&(d=d.filter(function(a){return c.indexOf(a.id)!==-1})),d&&this.simulateRemoteCall(function(){a.loadMany(b,d)},a,b)},findAll:function(a,b){var c=this.fixturesForType(b);this.simulateRemoteCall(function(){a.loadMany(b,c),a.didUpdateAll(b)},a,b)},findQuery:function(a,b,c,d){var e=this.fixturesForType(b);e=this.queryFixtures(e,c,b),e&&this.simulateRemoteCall(function(){d.load(e)},a,b)},createRecord:function(a,b,c){var d=this.mockJSON(b,c);d.id=this.generateIdForRecord(a,c),this.simulateRemoteCall(function(){a.didSaveRecord(c,d)},a,b,c)},updateRecord:function(a,b,c){var d=this.mockJSON(b,c);this.simulateRemoteCall(function(){a.didSaveRecord(c,d)},a,b,c)},deleteRecord:function(a,b,c){this.simulateRemoteCall(function(){a.didSaveRecord(c)},a,b,c)},simulateRemoteCall:function(b,c,d,e){a(this,"simulateRemoteResponse")?setTimeout(b,a(this,"latency")):b()}})}(),function(){DS.RESTSerializer=DS.JSONSerializer.extend({keyForAttributeName:function(a,b){return Ember.String.decamelize(b)},keyForBelongsTo:function(a,b){var c=this.keyForAttributeName(a,b);return this.embeddedType(a,b)?c:c+"_id"}})}(),function(){var a=Ember.get,b=Ember.set,c=Ember.merge;DS.RESTAdapter=DS.Adapter.extend({bulkCommit:!1,since:"since",serializer:DS.RESTSerializer,init:function(){this._super.apply(this,arguments)},shouldSave:function(b){var c=a(b,"_reference");return!c.parent},createRecord:function(a,b,c){var d=this.rootForType(b),e={};e[d]=this.serialize(c,{includeId:!0}),this.ajax(this.buildURL(d),"POST",{data:e,context:this,success:function(d){Ember.run(this,function(){this.didCreateRecord(a,b,c,d)})},error:function(d){this.didError(a,b,c,d)}})},dirtyRecordsForRecordChange:function(a,b){this._dirtyTree(a,b)},dirtyRecordsForHasManyChange:function(b,c,d){var e=a(this,"serializer").embeddedType(c.constructor,d.secondRecordName);e==="always"&&(d.childReference.parent=d.parentReference,this._dirtyTree(b,c))},_dirtyTree:function(b,c){b.add(c),a(this,"serializer").eachEmbeddedRecord(c,function(a,c){if(c!=="always")return;if(b.has(a))return;this._dirtyTree(b,a)},this);var d=c.get("_reference");if(d.parent){var e=a(c,"store"),f=e.recordForReference(d.parent);this._dirtyTree(b,f)}},createRecords:function(b,c,d){if(a(this,"bulkCommit")===!1)return this._super(b,c,d);var e=this.rootForType(c),f=this.pluralize(e),g={};g[f]=[],d.forEach(function(a){g[f].push(this.serialize(a,{includeId:!0}))},this),this.ajax(this.buildURL(e),"POST",{data:g,context:this,success:function(a){Ember.run(this,function(){this.didCreateRecords(b,c,d,a)})}})},updateRecord:function(b,c,d){var e=a(d,"id"),f=this.rootForType(c),g={};g[f]=this.serialize(d),this.ajax(this.buildURL(f,e),"PUT",{data:g,context:this,success:function(a){Ember.run(this,function(){this.didSaveRecord(b,c,d,a)})},error:function(a){this.didError(b,c,d,a)}})},updateRecords:function(b,c,d){if(a(this,"bulkCommit")===!1)return this._super(b,c,d);var e=this.rootForType(c),f=this.pluralize(e),g={};g[f]=[],d.forEach(function(a){g[f].push(this.serialize(a,{includeId:!0}))},this),this.ajax(this.buildURL(e,"bulk"),"PUT",{data:g,context:this,success:function(a){Ember.run(this,function(){this.didSaveRecords(b,c,d,a)})}})},deleteRecord:function(b,c,d){var e=a(d,"id"),f=this.rootForType(c);this.ajax(this.buildURL(f,e),"DELETE",{context:this,success:function(a){Ember.run(this,function(){this.didSaveRecord(b,c,d,a)})}})},deleteRecords:function(b,c,d){if(a(this,"bulkCommit")===!1)return this._super(b,c,d);var e=this.rootForType(c),f=this.pluralize(e),g=a(this,"serializer"),h={};h[f]=[],d.forEach(function(b){h[f].push(g.serializeId(a(b,"id")))}),this.ajax(this.buildURL(e,"bulk"),"DELETE"
12
+ ,{data:h,context:this,success:function(a){Ember.run(this,function(){this.didSaveRecords(b,c,d,a)})}})},find:function(a,b,c){var d=this.rootForType(b);this.ajax(this.buildURL(d,c),"GET",{success:function(d){Ember.run(this,function(){this.didFindRecord(a,b,d,c)})}})},findAll:function(a,b,c){var d=this.rootForType(b);this.ajax(this.buildURL(d),"GET",{data:this.sinceQuery(c),success:function(c){Ember.run(this,function(){this.didFindAll(a,b,c)})}})},findQuery:function(a,b,c,d){var e=this.rootForType(b);this.ajax(this.buildURL(e),"GET",{data:c,success:function(c){Ember.run(this,function(){this.didFindQuery(a,b,c,d)})}})},findMany:function(a,b,c,d){var e=this.rootForType(b);c=this.serializeIds(c),this.ajax(this.buildURL(e),"GET",{data:{ids:c},success:function(c){Ember.run(this,function(){this.didFindMany(a,b,c)})}})},serializeIds:function(b){var c=a(this,"serializer");return Ember.EnumerableUtils.map(b,function(a){return c.serializeId(a)})},didError:function(a,b,c,d){if(d.status===422){var e=JSON.parse(d.responseText);a.recordWasInvalid(c,e.errors)}else this._super.apply(this,arguments)},ajax:function(a,b,c){c.url=a,c.type=b,c.dataType="json",c.contentType="application/json; charset=utf-8",c.context=this,c.data&&b!=="GET"&&(c.data=JSON.stringify(c.data)),jQuery.ajax(c)},url:"",rootForType:function(b){var c=a(this,"serializer");return c.rootForType(b)},pluralize:function(b){var c=a(this,"serializer");return c.pluralize(b)},buildURL:function(a,b){var c=[this.url];return this.namespace!==undefined&&c.push(this.namespace),c.push(this.pluralize(a)),b!==undefined&&c.push(b),c.join("/")},sinceQuery:function(b){var c={};return c[a(this,"since")]=b,b?c:null}})}(),function(){}(),function(){}()