ember-data-source 1.0.0.beta.11 → 1.0.0.beta.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
- (function(e){var r,t,i,a;(function(){var e;if(!Array.isArray){e=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}else{e=Array.isArray}var n={},s={},o={};var u=false;r=function(r,t,i){if(!e(t)){i=t;t=[]}n[r]={deps:t,callback:i}};function d(e,r,t){var a=e.length;var n=new Array(a);var s;var o;for(var u=0,d=a;u<d;u++){s=e[u];if(s==="exports"){o=n[u]=t}else{n[u]=i(c(s,r))}}return{deps:n,exports:o}}a=i=t=function(e){if(o[e]!==u&&s.hasOwnProperty(e)){return s[e]}if(!n[e]){throw new Error("Could not find module "+e)}var r=n[e];var t;var i;var a=false;s[e]={};try{t=d(r.deps,e,s[e]);i=r.callback.apply(this,t.deps);a=true}finally{if(!a){o[e]=u}}return t.exports?s[e]:s[e]=i};function c(e,r){if(e.charAt(0)!=="."){return e}var t=e.split("/");var i=r.split("/");var a;if(i.length===1){a=i}else{a=i.slice(0,-1)}for(var n=0,s=t.length;n<s;n++){var o=t[n];if(o===".."){a.pop()}else if(o==="."){continue}else{a.push(o)}}return a.join("/")}a.entries=a._eak_seen=n;a.clear=function(){a.entries=a._eak_seen=n={};s=o={}}})();r("activemodel-adapter",["activemodel-adapter/system","exports"],function(e,r){"use strict";var t=e.ActiveModelAdapter;var i=e.ActiveModelSerializer;r.ActiveModelAdapter=t;r.ActiveModelSerializer=i});r("activemodel-adapter/setup-container",["ember-data/system/container_proxy","activemodel-adapter/system/active_model_serializer","activemodel-adapter/system/active_model_adapter","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];var s=t["default"];i["default"]=function o(e,r){var t=new a(e);t.registerDeprecations([{deprecated:"serializer:_ams",valid:"serializer:-active-model"},{deprecated:"adapter:_ams",valid:"adapter:-active-model"}]);e.register("serializer:-active-model",n);e.register("adapter:-active-model",s)}});r("activemodel-adapter/system",["activemodel-adapter/system/active_model_adapter","activemodel-adapter/system/active_model_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.ActiveModelAdapter=i;t.ActiveModelSerializer=a});r("activemodel-adapter/system/active_model_adapter",["ember-data/adapters","ember-data/system/adapter","ember-inflector","exports"],function(e,r,t,i){"use strict";var a=e.RESTAdapter;var n=r.InvalidError;var s=t.pluralize;var o=Ember.EnumerableUtils.forEach;var u=Ember.String.decamelize,d=Ember.String.underscore;var c=a.extend({defaultSerializer:"-active-model",pathForType:function(e){var r=u(e);var t=d(r);return s(t)},ajaxError:function(e){var r=this._super(e);if(e&&e.status===422){var t=Ember.$.parseJSON(e.responseText),i={};if(t.errors!==undefined){var a=t.errors;o(Ember.keys(a),function(e){i[Ember.String.camelize(e)]=a[e]})}return new n(i)}else{return r}}});i["default"]=c});r("activemodel-adapter/system/active_model_serializer",["ember-inflector","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e.singularize;var a=r["default"];var n=Ember.get,s=Ember.EnumerableUtils.forEach,o=Ember.String.camelize,u=Ember.String.capitalize,d=Ember.String.decamelize,c=Ember.String.underscore;var l=a.extend({keyForAttribute:function(e){return d(e)},keyForRelationship:function(e,r){var t=d(e);if(r==="belongsTo"){return t+"_id"}else if(r==="hasMany"){return i(t)+"_ids"}else{return t}},serializeHasMany:Ember.K,serializeIntoHash:function(e,r,t,i){var a=c(d(r.typeKey));e[a]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var a=n(e,i);var s=c(i+"_type");if(Ember.isNone(a)){r[s]=null}else{r[s]=u(o(a.constructor.typeKey))}},normalize:function(e,r,t){this.normalizeLinks(r);return this._super(e,r,t)},normalizeLinks:function(e){if(e.links){var r=e.links;for(var t in r){var i=o(t);if(i!==t){r[i]=r[t];delete r[t]}}}},normalizeRelationships:function(e,r){if(this.keyForRelationship){e.eachRelationship(function(e,t){var i,a;if(t.options.polymorphic){i=this.keyForAttribute(e);a=r[i];if(a&&a.type){a.type=this.typeForRoot(a.type)}else if(a&&t.kind==="hasMany"){var n=this;s(a,function(e){e.type=n.typeForRoot(e.type)})}}else{i=this.keyForRelationship(e,t.kind);if(!r.hasOwnProperty(i)){return}a=r[i]}r[e]=a;if(e!==i){delete r[i]}},this)}}});t["default"]=l});r("ember-data",["ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],function(e,r,t,i,a,n,s,o,u,d,c,l,f,h,p,m,y,v,b,g,R,E){"use strict";Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;var _=e["default"];var A=t.PromiseArray;var F=t.PromiseObject;var z=i.Store;var x=a.Model;var T=a.Errors;var S=a.RootState;var k=a.attr;var M=n.InvalidError;var D=n.Adapter;var P=s["default"];var O=o.RecordArray;var C=o.FilteredRecordArray;var w=o.AdapterPopulatedRecordArray;var $=o.ManyArray;var I=u["default"];var L=d.RESTAdapter;var j=d.FixtureAdapter;var K=c["default"];var U=l["default"];var B=h["default"];var N=p.ActiveModelAdapter;var V=p.ActiveModelSerializer;var H=m.Transform;var W=m.DateTransform;var q=m.NumberTransform;var Q=m.StringTransform;var X=m.BooleanTransform;var J=y.hasMany;var G=y.belongsTo;var Y=b["default"];var Z=g["default"];var er=R.Relationship;_.Store=z;_.PromiseArray=A;_.PromiseObject=F;_.Model=x;_.RootState=S;_.attr=k;_.Errors=T;_.Adapter=D;_.InvalidError=M;_.DebugAdapter=P;_.RecordArray=O;_.FilteredRecordArray=C;_.AdapterPopulatedRecordArray=w;_.ManyArray=$;_.RecordArrayManager=I;_.RESTAdapter=L;_.FixtureAdapter=j;_.RESTSerializer=U;_.JSONSerializer=K;_.Transform=H;_.DateTransform=W;_.StringTransform=Q;_.NumberTransform=q;_.BooleanTransform=X;_.ActiveModelAdapter=N;_.ActiveModelSerializer=V;_.EmbeddedRecordsMixin=B;_.belongsTo=G;_.hasMany=J;_.Relationship=er;_.ContainerProxy=Z;_._setupContainer=Y;Ember.lookup.DS=_;E["default"]=_});r("ember-data/adapters",["ember-data/adapters/fixture_adapter","ember-data/adapters/rest_adapter","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.RESTAdapter=a;t.FixtureAdapter=i});r("ember-data/adapters/fixture_adapter",["ember-data/system/adapter","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.String.fmt;var a=Ember.EnumerableUtils.indexOf;var n=0;var s=e["default"];r["default"]=s.extend({serializer:null,simulateRemoteResponse:true,latency:50,fixturesForType:function(e){if(e.FIXTURES){var r=Ember.A(e.FIXTURES);return r.map(function(e){var r=typeof e.id;if(r!=="number"&&r!=="string"){throw new Error(i("the id property must be defined as a number or string for fixture %@",[e]))}e.id=e.id+"";return e})}return null},queryFixtures:function(e,r,t){},updateFixtures:function(e,r){if(!e.FIXTURES){e.FIXTURES=[]}var t=e.FIXTURES;this.deleteLoadedFixture(e,r);t.push(r)},mockJSON:function(e,r,t){return e.serializerFor(r).serialize(t,{includeId:true})},generateIdForRecord:function(e){return"fixture-"+n++},find:function(e,r,t){var i=this.fixturesForType(r);var a;if(i){a=Ember.A(i).findBy("id",t)}if(a){return this.simulateRemoteCall(function(){return a},this)}},findMany:function(e,r,t){var i=this.fixturesForType(r);if(i){i=i.filter(function(e){return a(t,e.id)!==-1})}if(i){return this.simulateRemoteCall(function(){return i},this)}},findAll:function(e,r){var t=this.fixturesForType(r);return this.simulateRemoteCall(function(){return t},this)},findQuery:function(e,r,t,i){var a=this.fixturesForType(r);a=this.queryFixtures(a,t,r);if(a){return this.simulateRemoteCall(function(){return a},this)}},createRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},updateRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},deleteRecord:function(e,r,t){this.deleteLoadedFixture(r,t);return this.simulateRemoteCall(function(){return null})},deleteLoadedFixture:function(e,r){var t=this.findExistingFixture(e,r);if(t){var i=a(e.FIXTURES,t);e.FIXTURES.splice(i,1);return true}},findExistingFixture:function(e,r){var i=this.fixturesForType(e);var a=t(r,"id");return this.findFixtureById(i,a)},findFixtureById:function(e,r){return Ember.A(e).find(function(e){if(""+t(e,"id")===""+r){return true}else{return false}})},simulateRemoteCall:function(e,r){var i=this;return new Ember.RSVP.Promise(function(a){var n=Ember.copy(e.call(r),true);if(t(i,"simulateRemoteResponse")){Ember.run.later(function(){a(n)},t(i,"latency"))}else{Ember.run.schedule("actions",null,function(){a(n)})}},"DS: FixtureAdapter#simulateRemoteCall")}})});r("ember-data/adapters/rest_adapter",["ember-data/system/adapter","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.Adapter;var a=e.InvalidError;var n=r.MapWithDefault;var s=Ember.get;var o=Ember.ArrayPolyfills.forEach;t["default"]=i.extend({defaultSerializer:"-rest",coalesceFindRequests:false,find:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET")},findAll:function(e,r,t){var i;if(t){i={since:t}}return this.ajax(this.buildURL(r.typeKey),"GET",{data:i})},findQuery:function(e,r,t){return this.ajax(this.buildURL(r.typeKey),"GET",{data:t})},findMany:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET",{data:{ids:t}})},findHasMany:function(e,r,t,i){var a=s(this,"host");var n=s(r,"id");var o=r.constructor.typeKey;if(a&&t.charAt(0)==="/"&&t.charAt(1)!=="/"){t=a+t}return this.ajax(this.urlPrefix(t,this.buildURL(o,n)),"GET")},findBelongsTo:function(e,r,t,i){var a=s(r,"id");var n=r.constructor.typeKey;return this.ajax(this.urlPrefix(t,this.buildURL(n,a)),"GET")},createRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t,{includeId:true});return this.ajax(this.buildURL(r.typeKey,null,t),"POST",{data:i})},updateRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t);var n=s(t,"id");return this.ajax(this.buildURL(r.typeKey,n,t),"PUT",{data:i})},deleteRecord:function(e,r,t){var i=s(t,"id");return this.ajax(this.buildURL(r.typeKey,i,t),"DELETE")},buildURL:function(e,r,t){var i=[],a=s(this,"host"),n=this.urlPrefix();if(e){i.push(this.pathForType(e))}if(r&&!Ember.isArray(r)){i.push(encodeURIComponent(r))}if(n){i.unshift(n)}i=i.join("/");if(!a&&i){i="/"+i}return i},urlPrefix:function(e,r){var t=s(this,"host");var i=s(this,"namespace");var a=[];if(e){if(e.charAt(0)==="/"){if(t){e=e.slice(1);a.push(t)}}else if(!/^http(s)?:\/\//.test(e)){a.push(r)}}else{if(t){a.push(t)}if(i){a.push(i)}}if(e){a.push(e)}return a.join("/")},_stripIDFromURL:function(e,r){var t=e.modelFor(r);var i=this.buildURL(t.typeKey,r.get("id"),r);var a=i.split("/");var n=a[a.length-1];var s=r.get("id");if(n===s){a[a.length-1]=""}else if(u(n,"?id="+s)){a[a.length-1]=n.substring(0,n.length-s.length-1)}return a.join("/")},groupRecordsForFindMany:function(e,r){var t=n.create({defaultValue:function(){return[]}});var i=this;o.call(r,function(r){var a=i._stripIDFromURL(e,r);t.get(a).push(r)});function a(r,t){var a=i._stripIDFromURL(e,r[0]);var n=0;var s=[[]];o.call(r,function(e){var r="&ids[]=".length+e.get("id.length");if(a.length+n+r>=t){n=0;s.push([])}n+=r;var i=s.length-1;s[i].push(e)});return s}var s=[];t.forEach(function(e,r){var t=2048;var i=a(e,t);o.call(i,function(e){s.push(e)})});return s},pathForType:function(e){var r=Ember.String.camelize(e);return Ember.String.pluralize(r)},ajaxError:function(e,r){if(e&&typeof e==="object"){e.then=null}return e},ajaxSuccess:function(e,r){return r},ajax:function(e,r,t){var i=this;return new Ember.RSVP.Promise(function(n,s){var o=i.ajaxOptions(e,r,t);o.success=function(e,r,t){e=i.ajaxSuccess(t,e);if(e instanceof a){Ember.run(null,s,e)}else{Ember.run(null,n,e)}};o.error=function(e,r,t){Ember.run(null,s,i.ajaxError(e,e.responseText))};Ember.$.ajax(o)},"DS: RESTAdapter#ajax "+r+" to "+e)},ajaxOptions:function(e,r,t){var i=t||{};i.url=e;i.type=r;i.dataType="json";i.context=this;if(i.data&&r!=="GET"){i.contentType="application/json; charset=utf-8";i.data=JSON.stringify(i.data)}var a=s(this,"headers");if(a!==undefined){i.beforeSend=function(e){o.call(Ember.keys(a),function(r){e.setRequestHeader(r,a[r])})}}return i}});function u(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}});r("ember-data/core",["exports"],function(e){"use strict";var r;if("undefined"===typeof r){r=Ember.Namespace.create({VERSION:"1.0.0-beta.11"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",r.VERSION)}}e["default"]=r});r("ember-data/ember-initializer",["ember-data/setup-container"],function(e){"use strict";var r=e["default"];var t=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:r});e.initializer({name:"store",after:"ember-data",initialize:t});e.initializer({name:"activeModelAdapter",before:"store",initialize:t});e.initializer({name:"transforms",before:"store",initialize:t});e.initializer({name:"data-adapter",before:"store",initialize:t});e.initializer({name:"injectStore",before:"store",initialize:t})})});r("ember-data/ext/date",[],function(){"use strict";Ember.Date=Ember.Date||{};var e=Date.parse,r=[1,4,5,6,7,10,11];Ember.Date.parse=function(t){var i,a,n=0;if(a=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(var s=0,o;o=r[s];++s){a[o]=+a[o]||0}a[2]=(+a[2]||1)-1;a[3]=+a[3]||1;if(a[8]!=="Z"&&a[9]!==undefined){n=a[10]*60+a[11];if(a[9]==="+"){n=0-n}}i=Date.UTC(a[1],a[2],a[3],a[4],a[5]+n,a[6],a[7])}else{i=e?e(t):NaN}return i};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}});r("ember-data/initializers/data_adapter",["ember-data/system/debug/debug_adapter","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=function i(e){e.register("data-adapter:main",t)}});r("ember-data/initializers/store",["ember-data/serializers","ember-data/adapters","ember-data/system/container_proxy","ember-data/system/store","exports"],function(e,r,t,i,a){"use strict";var n=e.JSONSerializer;var s=e.RESTSerializer;var o=r.RESTAdapter;var u=t["default"];var d=i["default"];a["default"]=function c(e,r){e.register("store:main",e.lookupFactory("store:application")||r&&r.Store||d);var t=new u(e);t.registerDeprecations([{deprecated:"serializer:_default",valid:"serializer:-default"},{deprecated:"serializer:_rest",valid:"serializer:-rest"},{deprecated:"adapter:_rest",valid:"adapter:-rest"}]);e.register("serializer:-default",n);e.register("serializer:-rest",s);e.register("adapter:-rest",o);e.lookup("store:main")}});r("ember-data/initializers/store_injections",["exports"],function(e){"use strict";e["default"]=function r(e){e.injection("controller","store","store:main");e.injection("route","store","store:main");e.injection("serializer","store","store:main");e.injection("data-adapter","store","store:main")}});r("ember-data/initializers/transforms",["ember-data/transforms","exports"],function(e,r){"use strict";var t=e.BooleanTransform;var i=e.DateTransform;var a=e.StringTransform;var n=e.NumberTransform;r["default"]=function s(e){e.register("transform:boolean",t);e.register("transform:date",i);e.register("transform:number",n);e.register("transform:string",a)}});r("ember-data/serializers",["ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.JSONSerializer=i;t.RESTSerializer=a});r("ember-data/serializers/embedded_records_mixin",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.EnumerableUtils.forEach;var i=Ember.String.camelize;var a=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return n(this,this.store,e,i)},keyForRelationship:function(e,r){if(this.hasDeserializeRecordsOption(e)){return this.keyForAttribute(e)}else{return this._super(e,r)||e}},serializeBelongsTo:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o=e.get(a);var u;if(n){u=this.keyForRelationship(a,i.kind);if(!o){t[u]=null}else{t[u]=r(o,"id")}}else if(s){u=this.keyForAttribute(a);if(!o){t[u]=null}else{t[u]=o.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,i,t[u])}}},serializeHasMany:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o;if(n){o=this.keyForRelationship(a,i.kind);t[o]=r(e,a).mapBy("id")}else if(s){o=this.keyForAttribute(a);t[o]=r(e,a).map(function(r){var t=r.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,i,t);return t},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var a=e.constructor.inverseFor(t.key);if(a){var n=a.name;var s=this.store.serializerFor(r.constructor);var o=s.keyForRelationship(n,a.kind);if(o){delete i[o]}}}},hasEmbeddedAlwaysOption:function(e){var r=this.attrsOption(e);return r&&r.embedded==="always"},hasSerializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.serialize==="records"},hasSerializeIdsOption:function(e){var r=this.attrsOption(e);return r&&(r.serialize==="ids"||r.serialize==="id")},noSerializeOptionSpecified:function(e){var r=this.attrsOption(e);return!(r&&(r.serialize||r.embedded))},hasDeserializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.deserialize==="records"},attrsOption:function(e){var r=this.get("attrs");return r&&(r[i(e)]||r[e])}});function n(e,r,t,i){t.eachRelationship(function(t,a){if(e.hasDeserializeRecordsOption(t)){var n=r.modelFor(a.type.typeKey);if(a.kind==="hasMany"){if(a.options.polymorphic){o(r,t,i)}else{s(r,t,n,i)}}if(a.kind==="belongsTo"){u(r,t,n,i)}}});return i}function s(e,r,i,a){if(!a[r]){return a}var n=[];var s=e.serializerFor(i.typeKey);t(a[r],function(r){var t=s.normalize(i,r,null);e.push(i,t);n.push(t.id)});a[r]=n;return a}function o(e,i,a){if(!a[i]){return a}var n=[];t(a[i],function(t){var i=t.type;var a=e.serializerFor(i);var s=e.modelFor(i);var o=r(a,"primaryKey");var u=a.normalize(s,t,null);e.push(s,u);n.push({id:u[o],type:i})});a[i]=n;return a}function u(e,r,t,i){if(!i[r]){return i}var a=e.serializerFor(t.typeKey);var n=a.normalize(t,i[r],null);e.push(t,n);i[r]=n.id;return i}e["default"]=a});r("ember-data/serializers/json_serializer",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.isNone;var i=Ember.ArrayPolyfills.map;var a=Ember.merge;e["default"]=Ember.Object.extend({primaryKey:"id",applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var a=this.transformFor(i);r[e]=a.deserialize(r[e])},this);return r},normalize:function(e,r){if(!r){return r}this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);this.applyTransforms(e,r);return r},normalizePayload:function(e){return e},normalizeAttributes:function(e,r){var t;if(this.keyForAttribute){e.eachAttribute(function(e){t=this.keyForAttribute(e);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeRelationships:function(e,r){var t;if(this.keyForRelationship){e.eachRelationship(function(e,i){t=this.keyForRelationship(e,i.kind);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeUsingDeclaredMapping:function(e,t){var i=r(this,"attrs"),a,n;if(i){for(n in i){a=this._getMappedKey(n);if(!t.hasOwnProperty(a)){continue}if(a!==n){t[n]=t[a];delete t[a]}}}},normalizeId:function(e){var t=r(this,"primaryKey");if(t==="id"){return}e.id=e[t];delete e[t]},_getMappedKey:function(e){var t=r(this,"attrs");var i;if(t&&t[e]){i=t[e];if(i.key){i=i.key}if(typeof i==="string"){e=i}}return e},_canSerialize:function(e){var t=r(this,"attrs");return!t||!t[e]||t[e].serialize!==false},serialize:function(e,t){var i={};if(t&&t.includeId){var a=r(e,"id");if(a){i[r(this,"primaryKey")]=a}}e.eachAttribute(function(r,t){this.serializeAttribute(e,i,r,t)},this);e.eachRelationship(function(r,t){if(t.kind==="belongsTo"){this.serializeBelongsTo(e,i,t)}else if(t.kind==="hasMany"){this.serializeHasMany(e,i,t)}},this);return i},serializeIntoHash:function(e,r,t,i){a(e,this.serialize(t,i))},serializeAttribute:function(e,t,i,a){var n=a.type;if(this._canSerialize(i)){var s=r(e,i);if(n){var o=this.transformFor(n);s=o.serialize(s)}var u=this._getMappedKey(i);if(u===i&&this.keyForAttribute){u=this.keyForAttribute(i)}t[u]=s}},serializeBelongsTo:function(e,i,a){var n=a.key;if(this._canSerialize(n)){var s=r(e,n);var o=this._getMappedKey(n);if(o===n&&this.keyForRelationship){o=this.keyForRelationship(n,"belongsTo")}if(t(s)||t(r(s,"id"))){i[o]=null}else{i[o]=r(s,"id")}if(a.options.polymorphic){this.serializePolymorphicType(e,i,a)}}},serializeHasMany:function(e,t,i){var a=i.key;if(this._canSerialize(a)){var n;n=this._getMappedKey(a);if(n===a&&this.keyForRelationship){n=this.keyForRelationship(a,"hasMany")}var s=e.constructor.determineRelationshipType(i);if(s==="manyToNone"||s==="manyToMany"){t[n]=r(e,a).mapBy("id")}}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,a){this.extractMeta(e,r,t);var n="extract"+a.charAt(0).toUpperCase()+a.substr(1);return this[n](e,r,t,i,a)},extractFindAll:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindQuery:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindHasMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractCreateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractUpdateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractDeleteRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractFind:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractFindBelongsTo:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSave:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSingle:function(e,r,t,i,a){t=this.normalizePayload(t);return this.normalize(r,t)},extractArray:function(e,r,t,a,n){var s=this.normalizePayload(t);var o=this;return i.call(s,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(t&&t.meta){e.metaForType(r,t.meta);delete t.meta}},keyForAttribute:function(e){return e},keyForRelationship:function(e,r){return e},transformFor:function(e,r){var t=this.container.lookup("transform:"+e);return t}})});r("ember-data/serializers/rest_serializer",["ember-data/serializers/json_serializer","ember-inflector/system/string","exports"],function(e,r,t){"use strict";var i=e["default"];var a=Ember.get;var n=Ember.ArrayPolyfills.forEach;var s=Ember.ArrayPolyfills.map;var o=Ember.String.camelize;var u=r.singularize;function d(e){return e==null?null:e+""}var c=i.extend({normalize:function(e,r,t){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);if(this.normalizeHash&&this.normalizeHash[t]){this.normalizeHash[t](r)}this.applyTransforms(e,r);return r},extractSingle:function(e,r,t,i){var a=this.normalizePayload(t);var s=r.typeKey;var o;for(var u in a){var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=l.typeKey===s;var h=a[u];if(f&&Ember.typeOf(h)!=="array"){o=this.normalize(r,h,u);continue}n.call(h,function(r){var t=this.typeForRoot(u);var a=e.modelFor(t);var n=e.serializerFor(a);r=n.normalize(a,r,u);var s=f&&!i&&!o;var c=f&&d(r.id)===i;if(s||c){o=r}else{e.push(t,r)}},this)}return o},extractArray:function(e,r,t){var i=this.normalizePayload(t);var a=r.typeKey;var n;for(var o in i){var u=o;var d=false;if(o.charAt(0)==="_"){d=true;u=o.substr(1)}var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=e.serializerFor(l);var h=!d&&l.typeKey===a;var p=s.call(i[o],function(e){return f.normalize(l,e,o)},this);if(h){n=p}else{e.pushMany(c,p)}}return n},pushPayload:function(e,r){var t=this.normalizePayload(r);for(var i in t){var a=this.typeForRoot(i);if(!e.modelFactoryFor(a,i)){continue}var n=e.modelFor(a);var o=e.serializerFor(n);var u=s.call(Ember.makeArray(t[i]),function(e){return o.normalize(n,e,i)},this);e.pushMany(a,u)}},typeForRoot:function(e){return o(u(e))},serialize:function(e,r){return this._super.apply(this,arguments)},serializeIntoHash:function(e,r,t,i){e[r.typeKey]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var n=a(e,i);i=this.keyForAttribute?this.keyForAttribute(i):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.constructor.typeKey)}}});t["default"]=c});r("ember-data/setup-container",["ember-data/initializers/store","ember-data/initializers/transforms","ember-data/initializers/store_injections","ember-data/initializers/data_adapter","activemodel-adapter/setup-container","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=t["default"];var d=i["default"];var c=a["default"];n["default"]=function l(e,r){d(e,r);o(e,r);u(e,r);s(e,r);c(e,r)}});r("ember-data/system/adapter",["exports"],function(e){"use strict";var r=Ember.get;var t=["description","fileName","lineNumber","message","name","number","stack"];function i(e){var r=Error.prototype.constructor.call(this,"The backend rejected the commit because it was invalid: "+Ember.inspect(e));this.errors=e;for(var i=0,a=t.length;i<a;i++){this[t[i]]=r[t[i]]}}i.prototype=Ember.create(Error.prototype);var a=Ember.Object.extend({find:Ember.required(Function),findAll:null,findQuery:null,generateIdForRecord:null,serialize:function(e,t){return r(e,"store").serializerFor(e.constructor.typeKey).serialize(e,t)},createRecord:Ember.required(Function),updateRecord:Ember.required(Function),deleteRecord:Ember.required(Function),coalesceFindRequests:true,groupRecordsForFindMany:function(e,r){return[r]}});e.InvalidError=i;e.Adapter=a;e["default"]=a});r("ember-data/system/container_proxy",["exports"],function(e){"use strict";function r(e){this.container=e}r.prototype.aliasedFactory=function(e,r){var t=this;return{create:function(){if(r){r()}return t.container.lookup(e)}}};r.prototype.registerAlias=function(e,r,t){var i=this.aliasedFactory(r,t);return this.container.register(e,i)};r.prototype.registerDeprecation=function(e,r){var t=function(){};return this.registerAlias(e,r,t)};r.prototype.registerDeprecations=function(e){var r,t,i,a;for(r=e.length;r>0;r--){t=e[r-1];i=t["deprecated"];a=t["valid"];this.registerDeprecation(i,a)}};e["default"]=r});r("ember-data/system/debug",["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],function(e,r,t){"use strict";var i=r["default"];t["default"]=i});r("ember-data/system/debug/debug_adapter",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;var i=Ember.get;var a=Ember.String.capitalize;var n=Ember.String.underscore;r["default"]=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==t&&t.detect(e)},columnsForType:function(e){var r=[{name:"id",desc:"Id"}];var t=0;var s=this;i(e,"attributes").forEach(function(e,i){if(t++>s.attributeLimit){return false}var o=a(n(i).replace("_"," "));r.push({name:i,desc:o})});return r},getRecords:function(e){return this.get("store").all(e)},getRecordColumnValues:function(e){var r=this,t=0;var a={id:i(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var s=i(e,n);a[n]=s});return a},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(i(e,t))});return r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("isDirty")&&!e.get("isNew"),isClean:!e.get("isDirty")}},getRecordColor:function(e){var r="black";if(e.get("isNew")){r="green"}else if(e.get("isDirty")){r="blue"}return r},observeRecord:function(e,r){var t=Ember.A(),i=this;var a=Ember.A(["id","isNew","isDirty"]);e.eachAttribute(function(e){a.push(e)});a.forEach(function(a){var n=function(){r(i.wrapRecord(e))};Ember.addObserver(e,a,n);t.push(function(){Ember.removeObserver(e,a,n)})});var n=function(){t.forEach(function(e){e()})};return n}})});r("ember-data/system/debug/debug_info",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;t.reopen({_debugInfo:function(){var e=["id"],r={belongsTo:[],hasMany:[]},t=[];this.eachAttribute(function(r,t){e.push(r)},this);this.eachRelationship(function(e,i){r[i.kind].push(e);t.push(e)});var i=[{name:"Attributes",properties:e,expand:true},{name:"Belongs To",properties:r.belongsTo,expand:true},{name:"Has Many",properties:r.hasMany,expand:true},{name:"Flags",properties:["isLoaded","isDirty","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:true,groups:i,expensiveProperties:t}}}});r["default"]=t});r("ember-data/system/map",["exports"],function(e){"use strict";var r,t;function i(){Ember.OrderedSet.apply(this,arguments)}function a(){Ember.Map.apply(this,arguments)}function n(){Ember.MapWithDefault.apply(this,arguments)}var s=Ember.Map.create();s.set("key","value");var o=false;s.forEach(function(e,r){o=e==="key"&&r==="value"});a.prototype=Object.create(Ember.Map.prototype);n.prototype=Object.create(Ember.MapWithDefault.prototype);i.prototype=Object.create(Ember.OrderedSet.prototype);i.create=function(){return new i};function u(e){return function(r,t){e.call(this,t,r)}}if(o){r=function(e,r){this.__super$forEach(u(e),r)};t=function(e){this.remove(e)};a.prototype.__super$forEach=Ember.Map.prototype.forEach;a.prototype.forEach=r;a.prototype["delete"]=t;n.prototype.forEach=r;n.prototype.__super$forEach=Ember.MapWithDefault.prototype.forEach;n.prototype["delete"]=t;i.prototype["delete"]=t}n.constructor=n;a.constructor=a;n.create=function(e){if(e){return new n(e)}else{return new a}};a.create=function(){return new this.constructor};e["default"]=a;e.Map=a;e.MapWithDefault=n;e.OrderedSet=i});r("ember-data/system/model",["ember-data/system/model/model","ember-data/system/model/attributes","ember-data/system/model/states","ember-data/system/model/errors","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var u=i["default"];a.Model=n;a.RootState=o;a.attr=s;a.Errors=u});r("ember-data/system/model/attributes",["ember-data/system/model/model","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r.Map;var n=Ember.get;i.reopenClass({attributes:Ember.computed(function(){var e=a.create();this.eachComputedProperty(function(r,t){if(t.isAttribute){t.name=r;e.set(r,t)}});return e}).readOnly(),transformedAttributes:Ember.computed(function(){var e=a.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)}});return e}).readOnly(),eachAttribute:function(e,r){n(this,"attributes").forEach(function(t,i){e.call(r,i,t)},r)},eachTransformedAttribute:function(e,r){n(this,"transformedAttributes").forEach(function(t,i){e.call(r,i,t)})}});i.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function s(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function o(e,r){return e._attributes.hasOwnProperty(r)||e._inFlightAttributes.hasOwnProperty(r)||e._data.hasOwnProperty(r)
2
- }function u(e,r){if(e._attributes.hasOwnProperty(r)){return e._attributes[r]}else if(e._inFlightAttributes.hasOwnProperty(r)){return e._inFlightAttributes[r]}else{return e._data[r]}}t["default"]=function d(e,r){r=r||{};var t={type:e,isAttribute:true,options:r};return Ember.computed("data",function(e,t){if(arguments.length>1){var i=u(this,e);if(t!==i){this._attributes[e]=t;this.send("didSetProperty",{name:e,oldValue:i,originalValue:this._data[e],value:t})}return t}else if(o(this,e)){return u(this,e)}else{return s(this,r,e)}}).meta(t)}});r("ember-data/system/model/errors",["ember-data/system/map","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.isEmpty;var a=Ember.EnumerableUtils.map;var n=e.MapWithDefault;r["default"]=Ember.Object.extend(Ember.Enumerable,Ember.Evented,{registerHandlers:function(e,r,t){this.on("becameInvalid",e,r);this.on("becameValid",e,t)},errorsByAttributeName:Ember.reduceComputed("content",{initialValue:function(){return n.create({defaultValue:function(){return Ember.A()}})},addedItem:function(e,r){e.get(r.attribute).pushObject(r);return e},removedItem:function(e,r){e.get(r.attribute).removeObject(r);return e}}),errorsFor:function(e){return t(this,"errorsByAttributeName").get(e)},messages:Ember.computed.mapBy("content","message"),content:Ember.computed(function(){return Ember.A()}),unknownProperty:function(e){var r=this.errorsFor(e);if(i(r)){return null}return r},nextObject:function(e,r,i){return t(this,"content").objectAt(e)},length:Ember.computed.oneWay("content.length").readOnly(),isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var i=t(this,"isEmpty");r=this._findOrCreateMessages(e,r);t(this,"content").addObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(i&&!t(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return a(Ember.makeArray(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(t(this,"isEmpty")){return}var r=t(this,"content").rejectBy("attribute",e);t(this,"content").setObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(t(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(t(this,"isEmpty")){return}t(this,"content").clear();this.enumerableContentDidChange();this.trigger("becameValid")},has:function(e){return!i(this.errorsFor(e))}})});r("ember-data/system/model/model",["ember-data/system/model/states","ember-data/system/model/errors","ember-data/system/promise_proxies","ember-data/system/relationships/relationship","exports"],function(e,r,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=i.PromiseObject;var d=a.createRelationshipFor;var c=Ember.get;var l=Ember.set;var f=Ember.merge;var h=Ember.RSVP.Promise;var p=Ember.ArrayPolyfills.forEach;var m=Ember.ArrayPolyfills.map;var y;var v=Ember.computed("currentState",function(e,r){return c(c(this,"currentState"),e)}).readOnly();var b=Object.create(null);var g=Object.create(null);function R(e){return g[e]||(g[e]=e.split("."))}function E(e){return b[e]||(b[e]=R(e)[0])}var _=Ember.Object.extend(Ember.Evented,{_recordArrays:undefined,_relationships:undefined,_loadingRecordArrays:undefined,isEmpty:v,isLoading:v,isLoaded:v,isDirty:v,isSaving:v,isDeleted:v,isNew:v,isValid:v,dirtyType:v,isError:false,isReloading:false,clientId:null,id:null,currentState:s.empty,errors:Ember.computed(function(){var e=o.create();e.registerHandlers(this,function(){this.send("becameInvalid")},function(){this.send("becameValid")});return e}).readOnly(),serialize:function(e){var r=c(this,"store");return r.serialize(this,e)},toJSON:function(e){if(!y){y=t("ember-data/serializers/json_serializer")["default"]}var r=y.create({container:this.container});return r.serialize(this,e)},didLoad:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,data:Ember.computed(function(){this._data=this._data||{};return this._data}).readOnly(),_data:null,init:function(){this._super();this._setup()},_setup:function(){this._changesToSync={};this._deferredTriggers=[];this._data={};this._attributes={};this._inFlightAttributes={};this._relationships={};this._implicitRelationships=Object.create(null);var e=this;this.constructor.eachRelationship(function(r,t){e._relationships[r]=d(e,t,e.store)})},send:function(e,r){var t=c(this,"currentState");if(!t[e]){this._unhandledEvent(t,e,r)}return t[e](this,r)},transitionTo:function(e){var r=E(e);var t=c(this,"currentState");var i=t;do{if(i.exit){i.exit(this)}i=i.parentState}while(!i.hasOwnProperty(r));var a=R(e);var n=[],s=[],o,u;for(o=0,u=a.length;o<u;o++){i=i[a[o]];if(i.enter){s.push(i)}if(i.setup){n.push(i)}}for(o=0,u=s.length;o<u;o++){s[o].enter(this)}l(this,"currentState",i);for(o=0,u=n.length;o<u;o++){n[o].setup(this)}this.updateRecordArraysLater()},_unhandledEvent:function(e,r,t){var i="Attempted to handle event `"+r+"` ";i+="on "+String(this)+" while in state ";i+=e.stateName+". ";if(t!==undefined){i+="Called with "+Ember.inspect(t)+"."}throw new Ember.Error(i)},withTransaction:function(e){var r=c(this,"transaction");if(r){e(r)}},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData")},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},deleteRecord:function(){this.send("deleteRecord")},destroyRecord:function(){this.deleteRecord();return this.save()},unloadRecord:function(){if(this.isDestroyed){return}this.send("unloadRecord")},clearRelationships:function(){this.eachRelationship(function(e,r){var t=this._relationships[e];if(t){t.clear();t.destroy()}},this)},disconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].disconnect()},this);var e=this;p.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].disconnect()})},reconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].reconnect()},this);var e=this;p.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].reconnect()})},updateRecordArrays:function(){this._updatingRecordArraysLater=false;c(this,"store").dataWasUpdated(this.constructor,this)},_preloadData:function(e){var r=this;p.call(Ember.keys(e),function(t){var i=c(e,t);var a=r.constructor.metaForProperty(t);if(a.isRelationship){r._preloadRelationship(t,i)}else{c(r,"_data")[t]=i}})},_preloadRelationship:function(e,r){var t=this.constructor.metaForProperty(e);var i=t.type;if(t.kind==="hasMany"){this._preloadHasMany(e,r,i)}else{this._preloadBelongsTo(e,r,i)}},_preloadHasMany:function(e,r,t){var i=this;var a=m.call(r,function(e){return i._convertStringOrNumberIntoRecord(e,t)});this._relationships[e].updateRecordsFromAdapter(a)},_preloadBelongsTo:function(e,r,t){var i=this._convertStringOrNumberIntoRecord(r,t);this._relationships[e].setRecord(i)},_convertStringOrNumberIntoRecord:function(e,r){if(Ember.typeOf(e)==="string"||Ember.typeOf(e)==="number"){return this.store.recordForId(r,e)}return e},changedAttributes:function(){var e=c(this,"_data");var r=c(this,"_attributes");var t={};var i;for(i in r){t[i]=[e[i],r[i]]}return t},adapterWillCommit:function(){this.send("willCommit")},adapterDidCommit:function(e){l(this,"isError",false);if(e){this._data=e}else{Ember.mixin(this._data,this._inFlightAttributes)}this._inFlightAttributes={};this.send("didCommit");this.updateRecordArraysLater();if(!e){return}this.notifyPropertyChange("data")},adapterDidDirty:function(){this.send("becomeDirty");this.updateRecordArraysLater()},updateRecordArraysLater:function(){if(this._updatingRecordArraysLater){return}this._updatingRecordArraysLater=true;Ember.run.schedule("actions",this,this.updateRecordArrays)},setupData:function(e,r){if(r){Ember.merge(this._data,e)}else{this._data=e}if(e){this.pushedData()}this.notifyPropertyChange("data")},materializeId:function(e){l(this,"id",e)},materializeAttributes:function(e){f(this._data,e)},materializeAttribute:function(e,r){this._data[e]=r},rollback:function(){this._attributes={};if(c(this,"isError")){this._inFlightAttributes={};l(this,"isError",false)}if(c(this,"isDeleted")){this.reconnectRelationships()}if(!c(this,"isValid")){this._inFlightAttributes={}}this.send("rolledBack");this.notifyPropertyChange("data")},toStringExtension:function(){return c(this,"id")},save:function(){var e="DS: Model#save "+this;var r=Ember.RSVP.defer(e);this.get("store").scheduleSave(this,r);this._inFlightAttributes=this._attributes;this._attributes={};return u.create({promise:r.promise})},reload:function(){l(this,"isReloading",true);var e=this;var r="DS: Model#reload of "+this;var t=new h(function(r){e.send("reloadRecord",r)},r).then(function(){e.set("isReloading",false);e.set("isError",false);return e},function(r){e.set("isError",true);throw r},"DS: Model#reload complete, update flags")["finally"](function(){e.updateRecordArrays()});return u.create({promise:t})},adapterDidUpdateAttribute:function(e,r){if(r!==undefined){this._data[e]=r;this.notifyPropertyChange(e)}else{this._data[e]=this._inFlightAttributes[e]}this.updateRecordArraysLater()},adapterDidInvalidate:function(e){var r=c(this,"errors");function t(t){if(e[t]){r.add(t,e[t])}}this.eachAttribute(t);this.eachRelationship(t)},adapterDidError:function(){this.send("becameError");l(this,"isError",true)},trigger:function(){var e=arguments.length;var r=new Array(e-1);var t=arguments[0];for(var i=1;i<e;i++){r[i-1]=arguments[i]}Ember.tryInvoke(this,t,r);this._super.apply(this,arguments)},triggerLater:function(){var e=arguments.length;var r=new Array(e);for(var t=0;t<e;t++){r[t]=arguments[t]}if(this._deferredTriggers.push(r)!==1){return}Ember.run.schedule("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){for(var e=0,r=this._deferredTriggers.length;e<r;e++){this.trigger.apply(this,this._deferredTriggers[e])}this._deferredTriggers.length=0},willDestroy:function(){this._super();this.clearRelationships()},willMergeMixin:function(e){}});_.reopenClass({_create:_.create,create:function(){throw new Ember.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.")}});n["default"]=_});r("ember-data/system/model/states",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.set;function i(e,r){if(r.value===r.originalValue){delete e._attributes[r.name];e.send("propertyWasReset",r.name)}else if(r.value!==r.oldValue){e.send("becomeDirty")}e.updateRecordArraysLater()}var a={initialState:"uncommitted",isDirty:true,uncommitted:{didSetProperty:i,loadingData:Ember.K,propertyWasReset:function(e,r){var t=Ember.keys(e._attributes);var i=t>0;if(!i){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollback()}},inFlight:{isSaving:true,didSetProperty:i,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:function(e){},willCommit:Ember.K,didCommit:function(e){var t=r(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",t)},becameInvalid:function(e){e.transitionTo("invalid");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},invalid:{isValid:false,deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},didSetProperty:function(e,t){r(e,"errors").remove(t.name);i(e,t)},becomeDirty:Ember.K,willCommit:function(e){r(e,"errors").clear();e.transitionTo("inFlight")},rolledBack:function(e){r(e,"errors").clear()},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes={}}}};function n(e){var r={},t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=n(t)}else{r[i]=t}}return r}function s(e,r){for(var t in r){e[t]=r[t]}return e}function o(e){var r=n(a);return s(r,e)}var u=o({dirtyType:"created",isNew:true});u.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var d=o({dirtyType:"updated"});u.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved")};u.uncommitted.rollback=function(e){a.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};u.uncommitted.propertyWasReset=Ember.K;function c(e){}d.inFlight.unloadRecord=c;d.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var l={isEmpty:false,isLoading:false,isLoaded:false,isDirty:false,isSaving:false,isDeleted:false,isNew:false,isValid:true,rolledBack:Ember.K,unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},propertyWasReset:Ember.K,empty:{isEmpty:true,loadingData:function(e,r){e._loadingPromise=r;e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created.uncommitted");e.notifyPropertyChange("data")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");t(e,"isError",false)},becameError:function(e){e.triggerLater("becameError",e)},notFound:function(e){e.transitionTo("empty")}},loaded:{initialState:"saved",isLoaded:true,loadingData:Ember.K,saved:{setup:function(e){var r=e._attributes;var t=false;for(var i in r){if(r.hasOwnProperty(i)){t=true;break}}if(t){e.adapterDidDirty()}},didSetProperty:i,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},didCommit:function(e){e.send("invokeLifecycleCallbacks",r(e,"lastDirtyType"))},notFound:Ember.K},created:u,updated:d},deleted:{initialState:"uncommitted",dirtyType:"deleted",isDeleted:true,isLoaded:true,isDirty:true,setup:function(e){e.updateRecordArrays()},uncommitted:{willCommit:function(e){e.transitionTo("inFlight")},rollback:function(e){e.rollback()},becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved")}},inFlight:{isSaving:true,unloadRecord:c,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},saved:{isDirty:false,setup:function(e){var t=r(e,"store");t.dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function f(e,r,t){e=s(r?Ember.create(r):{},e);e.parentState=r;e.stateName=t;for(var i in e){if(!e.hasOwnProperty(i)||i==="parentState"||i==="stateName"){continue}if(typeof e[i]==="object"){e[i]=f(e[i],e,t+"."+i)}}return e}l=f(l,null,"root");e["default"]=l});r("ember-data/system/promise_proxies",["exports"],function(e){"use strict";var r=Ember.RSVP.Promise;var t=Ember.get;var i=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var a=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var n=function(e,t){return a.create({promise:r.resolve(e,t)})};var s=function(e,t){return i.create({promise:r.resolve(e,t)})};var o=i.extend({reload:function(){return t(this,"content").reload()}});var u=function(e,t){return o.create({promise:r.resolve(e,t)})};e.PromiseArray=i;e.PromiseObject=a;e.PromiseManyArray=o;e.promiseArray=s;e.promiseObject=n;e.promiseManyArray=u});r("ember-data/system/record_array_manager",["ember-data/system/record_arrays","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.RecordArray;var a=e.FilteredRecordArray;var n=e.AdapterPopulatedRecordArray;var s=e.ManyArray;var o=r.MapWithDefault;var u=r.OrderedSet;var d=Ember.get;var c=Ember.EnumerableUtils.forEach;t["default"]=Ember.Object.extend({init:function(){this.filteredRecordArrays=o.create({defaultValue:function(){return[]}});this.changedRecords=[];this._adapterPopulatedRecordArrays=[]},recordDidChange:function(e){if(this.changedRecords.push(e)!==1){return}Ember.run.schedule("actions",this,this.updateRecordArrays)},recordArraysForRecord:function(e){e._recordArrays=e._recordArrays||u.create();return e._recordArrays},updateRecordArrays:function(){c(this.changedRecords,function(e){if(d(e,"isDeleted")){this._recordWasDeleted(e)}else{this._recordWasChanged(e)}},this);this.changedRecords.length=0},_recordWasDeleted:function(e){var r=e._recordArrays;if(!r){return}r.forEach(function(r){r.removeRecord(e)});e._recordArrays=null},_recordWasChanged:function(e){var r=e.constructor;var t=this.filteredRecordArrays.get(r);var i;c(t,function(t){i=d(t,"filterFunction");this.updateRecordArray(t,i,r,e)},this);var a=e._loadingRecordArrays;if(a){for(var n=0,s=a.length;n<s;n++){a[n].loadedRecord()}e._loadingRecordArrays=[]}},updateRecordArray:function(e,r,t,i){var a;if(!r){a=true}else{a=r(i)}var n=this.recordArraysForRecord(i);if(a){if(!n.has(e)){e.pushRecord(i);n.add(e)}}else if(!a){n["delete"](e);e.removeRecord(i)}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var a=i.records,n;for(var s=0,o=a.length;s<o;s++){n=a[s];if(!d(n,"isDeleted")&&!d(n,"isEmpty")){this.updateRecordArray(e,t,r,n)}}},createManyArray:function(e,r){var t=s.create({type:e,content:r,store:this.store});c(r,function(e){var r=this.recordArraysForRecord(e);r.add(t)},this);return t},createRecordArray:function(e){var r=i.create({type:e,content:Ember.A(),store:this.store,isLoaded:true});this.registerFilteredRecordArray(r,e);return r},createFilteredRecordArray:function(e,r,t){var i=a.create({query:t,type:e,content:Ember.A(),store:this.store,manager:this,filterFunction:r});this.registerFilteredRecordArray(i,e,r);return i},createAdapterPopulatedRecordArray:function(e,r){var t=n.create({type:e,query:r,content:Ember.A(),store:this.store,manager:this});this._adapterPopulatedRecordArrays.push(t);return t},registerFilteredRecordArray:function(e,r,t){var i=this.filteredRecordArrays.get(r);i.push(e);this.updateFilter(e,r,t)},registerWaitingRecordArray:function(e,r){var t=e._loadingRecordArrays||[];t.push(r);e._loadingRecordArrays=t},willDestroy:function(){this._super();c(h(l(this.filteredRecordArrays.values)),f);c(this._adapterPopulatedRecordArrays,f)}});function l(e){var r=[];var t=Ember.keys(e);for(var i=0;i<t.length;i++){r.push(e[t[i]])}return r}function f(e){e.destroy()}function h(e){var r=e.length;var t=Ember.A();for(var i=0;i<r;i++){t=t.concat(e[i])}return t}});r("ember-data/system/record_arrays",["ember-data/system/record_arrays/record_array","ember-data/system/record_arrays/filtered_record_array","ember-data/system/record_arrays/adapter_populated_record_array","ember-data/system/record_arrays/many_array","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var u=i["default"];a.RecordArray=n;a.FilteredRecordArray=s;a.AdapterPopulatedRecordArray=o;a.ManyArray=u});r("ember-data/system/record_arrays/adapter_populated_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;function a(e){var r=Object.create(null);for(var t in e){r[t]=e[t]}return r}r["default"]=t.extend({query:null,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},load:function(e){var r=i(this,"store");var t=i(this,"type");var n=r.pushMany(t,e);var s=r.metadataFor(t);this.setProperties({content:Ember.A(n),isLoaded:true,meta:a(s)});n.forEach(function(e){this.manager.recordArraysForRecord(e).add(this)},this);Ember.run.once(this,"trigger","didLoad")}})});r("ember-data/system/record_arrays/filtered_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;r["default"]=t.extend({filterFunction:null,isLoaded:true,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=i(this,"manager");e.updateFilter(this,i(this,"type"),i(this,"filterFunction"))},updateFilter:Ember.observer(function(){Ember.run.once(this,this._updateFilter)},"filterFunction")})});r("ember-data/system/record_arrays/many_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get,a=Ember.set;r["default"]=t.extend({init:function(){this._super.apply(this,arguments)},isPolymorphic:false,isLoaded:false,relationship:null,promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--;if(this.loadingRecordsCount===0){a(this,"isLoaded",true);this.trigger("didLoad")}},replaceContent:function(e,r,t){var a;if(r>0){a=i(this,"content").slice(e,e+r);this.get("relationship").removeRecords(a)}if(t){this.get("relationship").addRecords(t,e)}},reload:function(){return this.relationship.reload()},createRecord:function(e){var r=i(this,"store");var t=i(this,"type");var a;a=r.createRecord.call(r,t,e);this.pushObject(a);return a}})});r("ember-data/system/record_arrays/record_array",["ember-data/system/promise_proxies","exports"],function(e,r){"use strict";var t=e.PromiseArray;var i=Ember.get;r["default"]=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=i(this,"content");return r.objectAt(e)},update:function(){if(i(this,"isUpdating")){return}var e=i(this,"store");var r=i(this,"type");return e.fetchAll(r,this)},addRecord:function(e,r){var t=i(this,"content");if(r===undefined){t.addObject(e)}else{if(!t.contains(e)){t.insertAt(r,e)}}},pushRecord:function(e){i(this,"content").pushObject(e)},removeRecord:function(e){i(this,"content").removeObject(e)},save:function(){var e="DS: RecordArray#save "+i(this,"type");var r=Ember.RSVP.all(this.invoke("save"),e).then(function(e){return Ember.A(e)},null,"DS: RecordArray#save apply Ember.NativeArray");return t.create({promise:r})},_dissociateFromOwnRecords:function(){var e=this;this.forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},willDestroy:function(){this._dissociateFromOwnRecords();this._super()}})});r("ember-data/system/relationship-meta",["ember-inflector/system","exports"],function(e,r){"use strict";var t=e.singularize;function i(e,r){var i,a;i=r.type||r.key;if(typeof i==="string"){if(r.kind==="hasMany"){i=t(i)}a=e.modelFor(i)}else{a=r.type}return a}r.typeForRelationshipMeta=i;function a(e,r){return{key:r.key,kind:r.kind,type:i(e,r),options:r.options,parentType:r.parentType,isRelationship:true}}r.relationshipFromMeta=a});r("ember-data/system/relationships",["./relationships/belongs_to","./relationships/has_many","ember-data/system/relationships/ext","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];i.belongsTo=a;i.hasMany=n});r("ember-data/system/relationships/belongs_to",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}else{}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"belongsTo",key:null};return Ember.computed(function(e,r){if(arguments.length>1){if(r===undefined){r=null}if(r&&r.then){this._relationships[e].setRecordPromise(r)}else{this._relationships[e].setRecord(r)}}return this._relationships[e].getRecord()}).meta(t)}t.reopen({notifyBelongsToAdded:function(e,r){this.notifyPropertyChange(e)},notifyBelongsToRemoved:function(e){this.notifyPropertyChange(e)}});r["default"]=i});r("ember-data/system/relationships/ext",["ember-data/system/relationship-meta","ember-data/system/model","ember-data/system/map"],function(e,r,t){"use strict";var i=e.typeForRelationshipMeta;var a=e.relationshipFromMeta;var n=r.Model;var s=t.Map;var o=t.MapWithDefault;var u=Ember.get;var d=Ember.ArrayPolyfills.filter;n.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});n.reopenClass({typeForRelationship:function(e){var r=u(this,"relationshipsByName").get(e);return r&&r.type},inverseMap:Ember.computed(function(){return Object.create(null)}),inverseFor:function(e){var r=u(this,"inverseMap");if(r[e]){return r[e]}else{var t=this._findInverseFor(e);r[e]=t;return t}},_findInverseFor:function(e){var r=this.typeForRelationship(e);if(!r){return null}var t=this.metaForProperty(e).options;if(t.inverse===null){return null}var i,a,n;if(t.inverse){i=t.inverse;n=Ember.get(r,"relationshipsByName").get(i);a=n.kind}else{var s=c(this,r);if(s.length===0){return null}var o=d.call(s,function(t){var i=r.metaForProperty(t.name).options;return e===i.inverse});if(o.length===1){s=o}i=s[0].name;a=s[0].kind}function c(r,t,i){var a=i||[];var n=u(t,"relationships");if(!n){return}var s=n.get(r);s=d.call(s,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(s){a.push.apply(a,s)}if(r.superclass){c(r.superclass,t,a)}return a}return{type:r,name:i,kind:a}},relationships:Ember.computed(function(){var e=new o({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var a=e.get(i(this.store,t));a.push({name:r,kind:t.kind})}});return e}).cacheable(false).readOnly(),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Ember.computed(function(){var e;var r=Ember.A();this.eachComputedProperty(function(t,a){if(a.isRelationship){a.key=t;e=i(this.store,a);if(!r.contains(e)){r.push(e)}}});return r}).cacheable(false).readOnly(),relationshipsByName:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var n=a(this.store,t);n.type=i(this.store,t);e.set(r,n)}});return e}).cacheable(false).readOnly(),fields:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){e.set(r,t.kind)}else if(t.isAttribute){e.set(r,"attribute")}});return e}).readOnly(),eachRelationship:function(e,r){u(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){u(this,"relatedTypes").forEach(function(t){e.call(r,t)})},determineRelationshipType:function(e){var r=e.key;var t=e.kind;var i=this.inverseFor(r);var a,n;if(!i){return t==="belongsTo"?"oneToNone":"manyToNone"}a=i.name;n=i.kind;if(n==="belongsTo"){return t==="belongsTo"?"oneToOne":"manyToOne"}else{return t==="belongsTo"?"oneToMany":"manyToMany"}}});n.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return u(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e)}})});r("ember-data/system/relationships/has_many",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"hasMany",key:null};return Ember.computed(function(e){var r=this._relationships[e];return r.getRecords()}).meta(t).readOnly()}t.reopen({notifyHasManyAdded:function(e,r,t){var i=this._relationships[e];var a=i.manyArray;a.addRecord(r,t);this.notifyPropertyChange(e)},notifyHasManyRemoved:function(e,r){var t=this._relationships[e];var i=t.manyArray;i.removeRecord(r)}});r["default"]=i});r("ember-data/system/relationships/relationship",["ember-data/system/promise_proxies","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.PromiseManyArray;var a=e.PromiseObject;var n=r.OrderedSet;var s=function(e,r,t,i){this.members=new n;this.store=e;this.key=i.key;this.inverseKey=t;this.record=r;this.key=i.key;this.isAsync=i.options.async;this.relationshipMeta=i;this.inverseKeyForImplicit=this.store.modelFor(this.record.constructor).typeKey+this.key;this.linkPromise=null};s.prototype={constructor:s,destroy:Ember.K,clear:function(){this.members.forEach(function(e){this.removeRecord(e)},this)},disconnect:function(){this.members.forEach(function(e){this.removeRecordFromInverse(e)},this)},reconnect:function(){this.members.forEach(function(e){this.addRecordToInverse(e)},this)},removeRecords:function(e){var r=this;e.forEach(function(e){r.removeRecord(e)})},addRecords:function(e,r){var t=this;e.forEach(function(e){t.addRecord(e,r);if(r!==undefined){r++}})},addRecord:function(e,r){if(!this.members.has(e)){this.members.add(e);this.notifyRecordRelationshipAdded(e,r);if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new s(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)}this.record.updateRecordArrays()}},removeRecord:function(e){if(this.members.has(e)){this.removeRecordFromOwn(e);if(this.inverseKey){this.removeRecordFromInverse(e)}else{if(e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record)}}}},addRecordToInverse:function(e){if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}},removeRecordFromInverse:function(e){var r=e._relationships[this.inverseKey];if(r){r.removeRecordFromOwn(this.record)}},removeRecordFromOwn:function(e){this.members["delete"](e);this.notifyRecordRelationshipRemoved(e);this.record.updateRecordArrays()},updateLink:function(e){if(e!==this.link){this.link=e;this.linkPromise=null;this.record.notifyPropertyChange(this.key)}},findLink:function(){if(this.linkPromise){return this.linkPromise}else{var e=this.fetchLink();this.linkPromise=e;return e.then(function(e){return e})}},updateRecordsFromAdapter:function(e){this.computeChanges(e)},notifyRecordRelationshipAdded:Ember.K,notifyRecordRelationshipRemoved:Ember.K};var o=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.manyArray=e.recordArrayManager.createManyArray(this.belongsToType,Ember.A());this.manyArray.relationship=this;this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic};o.prototype=Object.create(s.prototype);o.prototype.constructor=o;o.prototype._super$constructor=s;o.prototype.destroy=function(){this.manyArray.destroy()};o.prototype.notifyRecordRelationshipAdded=function(e,r){this.record.notifyHasManyAdded(this.key,e,r)};o.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyHasManyRemoved(this.key,e)};o.prototype.reload=function(){var e=this;if(this.link){return this.fetchLink()}else{return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function(){e.manyArray.set("isLoaded",true);return e.manyArray})}};o.prototype.computeChanges=function(e){var r=this.members;var t=[];var i;var a;var n;e=d(e);r.forEach(function(r){if(e.has(r))return;t.push(r)});this.removeRecords(t);var s=this.manyArray;e=e.toArray();i=e.length;for(n=0;n<i;n++){a=e[n];if(s.objectAt(n)===a){continue}this.removeRecord(a);this.addRecord(a,n)}};o.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(r){e.updateRecordsFromAdapter(r);return e.manyArray})};o.prototype.findRecords=function(){var e=this.manyArray;return this.store.findMany(e.toArray()).then(function(){e.set("isLoaded",true);return e})};o.prototype.getRecords=function(){if(this.isAsync){var e=this;var r;
3
- if(this.link){r=this.findLink().then(function(){return e.findRecords()})}else{r=this.findRecords()}return i.create({content:this.manyArray,promise:r})}else{this.manyArray.set("isLoaded",true);return this.manyArray}};var u=function(e,r,t,i){this._super$constructor(e,r,t,i);this.record=r;this.key=i.key;this.inverseRecord=null};u.prototype=Object.create(s.prototype);u.prototype.constructor=u;u.prototype._super$constructor=s;u.prototype.setRecord=function(e){if(e){this.addRecord(e)}else if(this.inverseRecord){this.removeRecord(this.inverseRecord)}};u.prototype._super$addRecord=s.prototype.addRecord;u.prototype.addRecord=function(e){if(this.members.has(e)){return}var r=this.relationshipMeta.type;if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.inverseRecord=e;this._super$addRecord(e)};u.prototype.setRecordPromise=function(e){var r=e.get&&e.get("content");this.setRecord(r)};u.prototype.notifyRecordRelationshipAdded=function(e){this.record.notifyBelongsToAdded(this.key,this)};u.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyBelongsToRemoved(this.key,this)};u.prototype._super$removeRecordFromOwn=s.prototype.removeRecordFromOwn;u.prototype.removeRecordFromOwn=function(e){if(!this.members.has(e)){return}this._super$removeRecordFromOwn(e);this.inverseRecord=null};u.prototype.findRecord=function(){if(this.inverseRecord){return this.store._findByRecord(this.inverseRecord)}else{return Ember.RSVP.Promise.resolve(null)}};u.prototype.fetchLink=function(){var e=this;return this.store.findBelongsTo(this.record,this.link,this.relationshipMeta).then(function(r){e.addRecord(r);return r})};u.prototype.getRecord=function(){if(this.isAsync){var e;if(this.link){var r=this;e=this.findLink().then(function(){return r.findRecord()})}else{e=this.findRecord()}return a.create({promise:e,content:this.inverseRecord})}else{return this.inverseRecord}};function d(e){var r=new n;if(e){for(var t=0,i=e.length;t<i;t++){r.add(e[t])}}return r}var c=function(e,r,t){var i;var a=e.constructor.inverseFor(r.key);if(a){i=a.name}if(r.kind==="hasMany"){return new o(t,e,i,r)}else{return new u(t,e,i,r)}};t.Relationship=s;t.ManyRelationship=o;t.BelongsToRelationship=u;t.createRelationshipFor=c});r("ember-data/system/store",["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/map","ember-data/system/promise_proxies","exports"],function(e,r,i,a,n){"use strict";var s=e.InvalidError;var o=e.Adapter;var u=r.singularize;var d=i.Map;var c=a.promiseArray;var l=a.promiseObject;var f=Ember.get;var h=Ember.set;var p=Ember.run.once;var m=Ember.isNone;var y=Ember.EnumerableUtils.forEach;var v=Ember.EnumerableUtils.indexOf;var b=Ember.EnumerableUtils.map;var g=Ember.RSVP.Promise;var R=Ember.copy;var E,_,A;var F=Ember.String.camelize;function z(e){return e==null?null:e+""}E=Ember.Object.extend({init:function(){if(!_){_=t("ember-data/system/record_array_manager")["default"]}this.typeMaps={};this.recordArrayManager=_.create({store:this});this._pendingSave=[];this._pendingFetch=d.create()},adapter:"-rest",serialize:function(e,r){return this.serializerFor(e.constructor.typeKey).serialize(e,r)},defaultAdapter:Ember.computed("adapter",function(){var e=f(this,"adapter");if(typeof e==="string"){e=this.container.lookup("adapter:"+e)||this.container.lookup("adapter:application")||this.container.lookup("adapter:-rest")}if(DS.Adapter.detect(e)){e=e.create({container:this.container})}return e}),createRecord:function(e,r){var t=this.modelFor(e);var i=R(r)||{};if(m(i.id)){i.id=this._generateId(t)}i.id=z(i.id);var a=this.buildRecord(t,i.id);a.loadedData();a.setProperties(i);return a},_generateId:function(e){var r=this.adapterFor(e);if(r&&r.generateIdForRecord){return r.generateIdForRecord(this)}return null},deleteRecord:function(e){e.deleteRecord()},unloadRecord:function(e){e.unloadRecord()},find:function(e,r,t){if(arguments.length===1){return this.findAll(e)}if(Ember.typeOf(r)==="object"){return this.findQuery(e,r)}return this.findById(e,z(r),t)},findById:function(e,r,t){var i=this.modelFor(e);var a=this.recordForId(i,r);return this._findByRecord(a,t)},_findByRecord:function(e,r){var t;if(r){e._preloadData(r)}if(f(e,"isEmpty")){t=this.scheduleFetch(e)}else if(f(e,"isLoading")){t=e._loadingPromise}return l(t||e,"DS: Store#findByRecord "+e.typeKey+" with id: "+f(e,"id"))},findByIds:function(e,r){var t=this;return c(Ember.RSVP.all(b(r,function(r){return t.findById(e,r)})).then(Ember.A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e){var r=e.constructor;var t=f(e,"id");var i=this.adapterFor(r);var a=$(i,this,r,t,e);return a},scheduleFetchMany:function(e){return Ember.RSVP.all(b(e,this.scheduleFetch,this))},scheduleFetch:function(e){var r=e.constructor;if(m(e)){return null}if(e._loadingPromise){return e._loadingPromise}var t=Ember.RSVP.defer("Fetching "+r+"with id: "+e.get("id"));var i={record:e,resolver:t};var a=t.promise;e.loadingData(a);if(!this._pendingFetch.get(r)){this._pendingFetch.set(r,[i])}else{this._pendingFetch.get(r).push(i)}Ember.run.scheduleOnce("afterRender",this,this.flushAllPendingFetches);return a},flushAllPendingFetches:function(){if(this.isDestroyed||this.isDestroying){return}this._pendingFetch.forEach(this._flushPendingFetchForType,this);this._pendingFetch=d.create()},_flushPendingFetchForType:function(e,r){var t=this;var i=t.adapterFor(r);var a=!!i.findMany&&i.coalesceFindRequests;var n=Ember.A(e).mapBy("record");function s(e){e.resolver.resolve(t.fetchRecord(e.record))}function o(r){y(r,function(r){var t=Ember.A(e).findBy("record",r);if(t){var i=t.resolver;i.resolve(r)}})}function u(e){return function r(t){var i=e.without(t);c(i)}}function d(e){return function(r){c(e,r)}}function c(r,t){y(r,function(r){var i=Ember.A(e).findBy("record",r);if(i){var a=i.resolver;a.reject(t)}})}if(e.length===1){s(e[0])}else if(a){var l=i.groupRecordsForFindMany(this,n);y(l,function(a){var n=Ember.A(a);var c=n.mapBy("id");if(c.length>1){I(i,t,r,c,n).then(o).then(u(n)).then(null,d(n))}else if(c.length===1){var l=Ember.A(e).findBy("record",a[0]);s(l)}else{}})}else{y(e,s)}},getById:function(e,r){if(this.hasRecordForId(e,r)){return this.recordForId(e,r)}else{return null}},reloadRecord:function(e){var r=e.constructor;var t=this.adapterFor(r);var i=f(e,"id");return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=z(r);return!!this.typeMapFor(t).idToRecord[i]},recordForId:function(e,r){var t=this.modelFor(e);var i=z(r);var a=this.typeMapFor(t).idToRecord;var n=a[i];if(!n||!a[i]){n=this.buildRecord(t,i)}return n},findMany:function(e){var r=this;return g.all(b(e,function(e){return r._findByRecord(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.constructor);return L(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.constructor);return j(i,this,e,r,t)},findQuery:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var a=this.adapterFor(t);return c(U(a,this,t,r,i))},findAll:function(e){var r=this.modelFor(e);return this.fetchAll(r,this.all(r))},fetchAll:function(e,r){var t=this.adapterFor(e);var i=this.typeMapFor(e).metadata.since;h(r,"isUpdating",true);return c(K(t,this,e,i))},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;h(r,"isUpdating",false)},all:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.findAllCache;if(i){return i}var a=this.recordArrayManager.createRecordArray(r);t.findAllCache=a;return a},unloadAll:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.records.slice();var a;for(var n=0;n<i.length;n++){a=i[n];a.unloadRecord();a.destroy()}t.findAllCache=null},filter:function(e,r,t){var i;var a=arguments.length;var n;var s=a===3;if(s){i=this.findQuery(e,r)}else if(arguments.length===2){t=r}e=this.modelFor(e);if(s){n=this.recordArrayManager.createFilteredRecordArray(e,t,r)}else{n=this.recordArrayManager.createFilteredRecordArray(e,t)}i=i||g.cast(n);return c(i.then(function(){return n},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,r){if(!this.hasRecordForId(e,r)){return false}return!f(this.recordForId(e,r),"isEmpty")},metadataFor:function(e){e=this.modelFor(e);return this.typeMapFor(e).metadata},dataWasUpdated:function(e,r){this.recordArrayManager.recordDidChange(r)},scheduleSave:function(e,r){e.adapterWillCommit();this._pendingSave.push([e,r]);p(this,"flushPendingSave")},flushPendingSave:function(){var e=this._pendingSave.slice();this._pendingSave=[];y(e,function(e){var r=e[0],t=e[1];var i=this.adapterFor(r.constructor);var a;if(f(r,"currentState.stateName")==="root.deleted.saved"){return t.resolve(r)}else if(f(r,"isNew")){a="createRecord"}else if(f(r,"isDeleted")){a="deleteRecord"}else{a="updateRecord"}t.resolve(B(i,this,a,r))},this)},didSaveRecord:function(e,r){if(r){r=x(this,e.constructor,r,e);N(this,e,r);this.updateId(e,r)}e.adapterDidCommit(r)},recordWasInvalid:function(e,r){e.adapterDidInvalidate(r)},recordWasError:function(e){e.adapterDidError()},updateId:function(e,r){var t=f(e,"id");var i=z(r.id);this.typeMapFor(e.constructor).idToRecord[i]=e;h(e,"id",i)},typeMapFor:function(e){var r=f(this,"typeMaps");var t=Ember.guidFor(e);var i;i=r[t];if(i){return i}i={idToRecord:Object.create(null),records:[],metadata:Object.create(null),type:e};r[t]=i;return i},_load:function(e,r,t){var i=z(r.id);var a=this.recordForId(e,i);a.setupData(r,t);this.recordArrayManager.recordDidChange(a);return a},modelFor:function(e){var r;if(typeof e==="string"){r=this.modelFactoryFor(e);if(!r){throw new Ember.Error("No model was found for '"+e+"'")}r.typeKey=r.typeKey||this._normalizeTypeKey(e)}else{r=e;if(r.typeKey){r.typeKey=this._normalizeTypeKey(r.typeKey)}}r.store=this;return r},modelFactoryFor:function(e){return this.container.lookupFactory("model:"+e)},push:function(e,r,t){var i=this.modelFor(e);r=x(this,i,r);this._load(i,r,t);var a=this.recordForId(i,r.id);N(this,a,r);return a},pushPayload:function(e,r){var t;var i;if(!r){i=e;t=D(this.container)}else{i=r;t=this.serializerFor(e)}t.pushPayload(this,i)},normalize:function(e,r){var t=this.serializerFor(e);var i=this.modelFor(e);return t.normalize(i,r)},update:function(e,r){return this.push(e,r,true)},pushMany:function(e,r){var t=r.length;var i=new Array(t);for(var a=0;a<t;a++){i[a]=this.push(e,r[a])}return i},metaForType:function(e,r){var t=this.modelFor(e);Ember.merge(this.typeMapFor(t).metadata,r)},buildRecord:function(e,r,t){var i=this.typeMapFor(e);var a=i.idToRecord;var n=e._create({id:r,store:this,container:this.container});if(t){n.setupData(t)}if(r){a[r]=n}i.records.push(n);return n},dematerializeRecord:function(e){var r=e.constructor;var t=this.typeMapFor(r);var i=f(e,"id");e.updateRecordArrays();if(i){delete t.idToRecord[i]}var a=v(t.records,e);t.records.splice(a,1)},adapterFor:function(e){var r=this.container,t;if(r){t=r.lookup("adapter:"+e.typeKey)||r.lookup("adapter:application")}return t||f(this,"defaultAdapter")},serializerFor:function(e){e=this.modelFor(e);var r=this.adapterFor(e);return M(this.container,e.typeKey,r&&r.defaultSerializer)},willDestroy:function(){var e=this.typeMaps;var r=Ember.keys(e);var t=b(r,i);this.recordArrayManager.destroy();y(t,this.unloadAll,this);function i(r){return e[r]["type"]}},_normalizeTypeKey:function(e){return F(u(e))}});function x(e,r,t,i){r.eachRelationship(function(r,i){var a=i.kind;var n=t[r];if(a==="belongsTo"){T(e,t,r,i,n)}else if(a==="hasMany"){k(e,t,r,i,n)}});return t}function T(e,r,i,a,n){if(!A){A=t("ember-data/system/model")["Model"]}if(m(n)||n instanceof A){return}var s;if(typeof n==="number"||typeof n==="string"){s=S(a,i,r);r[i]=e.recordForId(s,n)}else if(typeof n==="object"){r[i]=e.recordForId(n.type,n.id)}}function S(e,r,t){if(e.options.polymorphic){return t[r+"Type"]}else{return e.type}}function k(e,r,t,i,a){if(!Ember.isArray(a)){return}for(var n=0,s=a.length;n<s;n++){T(e,a,n,i,a[n])}}function M(e,r,t){return e.lookup("serializer:"+r)||e.lookup("serializer:application")||e.lookup("serializer:"+t)||e.lookup("serializer:-default")}function D(e){return e.lookup("serializer:application")||e.lookup("serializer:-default")}function P(e,r){var t=e.serializer;var i=e.defaultSerializer;var a=e.container;if(a&&t===undefined){t=M(a,r.typeKey,i)}if(t===null||t===undefined){t={extract:function(e,r,t){return t}}}return t}function O(e){return!(f(e,"isDestroyed")||f(e,"isDestroying"))}function C(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function w(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function $(e,r,t,i,a){var n=e.find(r,t,i,a);var s=P(e,t);var o="DS: Handle Adapter#find of "+t+" with id: "+i;n=g.cast(n,o);n=C(n,w(O,r));return n.then(function(e){var a=s.extract(r,t,e,i,"find");return r.push(t,a)},function(e){var a=r.getById(t,i);if(a){a.notFound()}throw e},"DS: Extract payload of '"+t+"'")}function I(e,r,t,i,a){var n=e.findMany(r,t,i,a);var s=P(e,t);var o="DS: Handle Adapter#findMany of "+t;if(n===undefined){throw new Error("adapter.findMany returned undefined, this was very likely a mistake")}n=g.cast(n,o);n=C(n,w(O,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findMany");return r.pushMany(t,i)},null,"DS: Extract payload of "+t)}function L(e,r,t,i,a){var n=e.findHasMany(r,t,i,a);var s=P(e,a.type);var o="DS: Handle Adapter#findHasMany of "+t+" : "+a.type;n=g.cast(n,o);n=C(n,w(O,r));n=C(n,w(O,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findHasMany");var i=r.pushMany(a.type,t);return i},null,"DS: Extract payload of "+t+" : hasMany "+a.type)}function j(e,r,t,i,a){var n=e.findBelongsTo(r,t,i,a);var s=P(e,a.type);var o="DS: Handle Adapter#findBelongsTo of "+t+" : "+a.type;n=g.cast(n,o);n=C(n,w(O,r));n=C(n,w(O,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findBelongsTo");var i=r.push(a.type,t);return i},null,"DS: Extract payload of "+t+" : "+a.type)}function K(e,r,t,i){var a=e.findAll(r,t,i);var n=P(e,t);var s="DS: Handle Adapter#findAll of "+t;a=g.cast(a,s);a=C(a,w(O,r));return a.then(function(e){var i=n.extract(r,t,e,null,"findAll");r.pushMany(t,i);r.didUpdateAll(t);return r.all(t)},null,"DS: Extract payload of findAll "+t)}function U(e,r,t,i,a){var n=e.findQuery(r,t,i,a);var s=P(e,t);var o="DS: Handle Adapter#findQuery of "+t;n=g.cast(n,o);n=C(n,w(O,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findQuery");a.load(i);return a},null,"DS: Extract payload of findQuery "+t)}function B(e,r,t,i){var a=i.constructor;var n=e[t](r,a,i);var o=P(e,a);var u="DS: Extract and notify about "+t+" completion of "+i;n=g.cast(n,u);n=C(n,w(O,r));n=C(n,w(O,i));return n.then(function(e){var n;if(e){n=o.extract(r,a,e,f(i,"id"),t)}else{n=e}r.didSaveRecord(i,n);return i},function(e){if(e instanceof s){r.recordWasInvalid(i,e.errors)}else{r.recordWasError(i,e)}throw e},u)}function N(e,r,t){var i=r.constructor;i.eachRelationship(function(e,i){var a=i.kind;var n=t[e];var s=r._relationships[e];if(t.links&&t.links[e]){s.updateLink(t.links[e])}if(a==="belongsTo"){if(n===undefined){return}s.setRecord(n)}else if(a==="hasMany"&&n){s.updateRecordsFromAdapter(n)}})}n.Store=E;n["default"]=E});r("ember-data/transforms",["ember-data/transforms/base","ember-data/transforms/number","ember-data/transforms/date","ember-data/transforms/string","ember-data/transforms/boolean","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=t["default"];var d=i["default"];var c=a["default"];n.Transform=s;n.NumberTransform=o;n.DateTransform=u;n.StringTransform=d;n.BooleanTransform=c});r("ember-data/transforms/base",["exports"],function(e){"use strict";e["default"]=Ember.Object.extend({serialize:Ember.required(),deserialize:Ember.required()})});r("ember-data/transforms/boolean",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="boolean"){return e}else if(r==="string"){return e.match(/^true$|^t$|^1$/i)!==null}else if(r==="number"){return e===1}else{return false}},serialize:function(e){return Boolean(e)}})});r("ember-data/transforms/date",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Date.prototype.toISOString||function(){function e(e){if(e<10){return"0"+e}return e}return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};if(Ember.SHIM_ES5){if(!Date.prototype.toISOString){Date.prototype.toISOString=i}}r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="string"){return new Date(Ember.Date.parse(e))}else if(r==="number"){return new Date(e)}else if(e===null||e===undefined){return e}else{return null}},serialize:function(e){if(e instanceof Date){return i.call(e)}else{return null}}})});r("ember-data/transforms/number",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isEmpty;r["default"]=t.extend({deserialize:function(e){return i(e)?null:Number(e)},serialize:function(e){return i(e)?null:Number(e)}})});r("ember-data/transforms/string",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isNone;r["default"]=t.extend({deserialize:function(e){return i(e)?null:String(e)},serialize:function(e){return i(e)?null:String(e)}})});r("ember-inflector",["./system","./helpers","./ext/string","exports"],function(e,r,t,i){"use strict";var a=e.Inflector;var n=e.defaultRules;var s=e.pluralize;var o=e.singularize;a.defaultRules=n;Ember.Inflector=a;Ember.String.pluralize=s;Ember.String.singularize=o;i["default"]=a;i.pluralize=s;i.singularize=o});r("ember-inflector/ext/string",["../system/string"],function(e){"use strict";var r=e.pluralize;var t=e.singularize;if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.String){String.prototype.pluralize=function(){return r(this)};String.prototype.singularize=function(){return t(this)}}});r("ember-inflector/helpers",["./system/string"],function(e){"use strict";var r=e.singularize;var t=e.pluralize;Ember.Handlebars.helper("singularize",r);Ember.Handlebars.helper("pluralize",t)});r("ember-inflector/system",["./system/inflector","./system/string","./system/inflections","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r.pluralize;var s=r.singularize;var o=t["default"];a.inflector=new a(o);i.Inflector=a;i.singularize=s;i.pluralize=n;i.defaultRules=o});r("ember-inflector/system/inflections",["exports"],function(e){"use strict";e["default"]={plurals:[[/$/,"s"],[/s$/i,"s"],[/^(ax|test)is$/i,"$1es"],[/(octop|vir)us$/i,"$1i"],[/(octop|vir)i$/i,"$1i"],[/(alias|status)$/i,"$1es"],[/(bu)s$/i,"$1ses"],[/(buffal|tomat)o$/i,"$1oes"],[/([ti])um$/i,"$1a"],[/([ti])a$/i,"$1a"],[/sis$/i,"ses"],[/(?:([^f])fe|([lr])f)$/i,"$1$2ves"],[/(hive)$/i,"$1s"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/(x|ch|ss|sh)$/i,"$1es"],[/(matr|vert|ind)(?:ix|ex)$/i,"$1ices"],[/^(m|l)ouse$/i,"$1ice"],[/^(m|l)ice$/i,"$1ice"],[/^(ox)$/i,"$1en"],[/^(oxen)$/i,"$1"],[/(quiz)$/i,"$1zes"]],singular:[[/s$/i,""],[/(ss)$/i,"$1"],[/(n)ews$/i,"$1ews"],[/([ti])a$/i,"$1um"],[/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i,"$1sis"],[/(^analy)(sis|ses)$/i,"$1sis"],[/([^f])ves$/i,"$1fe"],[/(hive)s$/i,"$1"],[/(tive)s$/i,"$1"],[/([lr])ves$/i,"$1f"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/(s)eries$/i,"$1eries"],[/(m)ovies$/i,"$1ovie"],[/(x|ch|ss|sh)es$/i,"$1"],[/^(m|l)ice$/i,"$1ouse"],[/(bus)(es)?$/i,"$1"],[/(o)es$/i,"$1"],[/(shoe)s$/i,"$1"],[/(cris|test)(is|es)$/i,"$1is"],[/^(a)x[ie]s$/i,"$1xis"],[/(octop|vir)(us|i)$/i,"$1us"],[/(alias|status)(es)?$/i,"$1"],[/^(ox)en/i,"$1"],[/(vert|ind)ices$/i,"$1ex"],[/(matr)ices$/i,"$1ix"],[/(quiz)zes$/i,"$1"],[/(database)s$/i,"$1"]],irregularPairs:[["person","people"],["man","men"],["child","children"],["sex","sexes"],["move","moves"],["cow","kine"],["zombie","zombies"]],uncountable:["equipment","information","rice","money","species","series","fish","sheep","jeans","police"]}});r("ember-inflector/system/inflector",["exports"],function(e){"use strict";var r=/^\s*$/;var t=/(\w+[_-])([a-z\d]+$)/;var i=/(\w+)([A-Z][a-z\d]*$)/;var a=/[A-Z][a-z\d]*$/;function n(e,r){for(var t=0,i=r.length;t<i;t++){e.uncountable[r[t].toLowerCase()]=true}}function s(e,r){var t;for(var i=0,a=r.length;i<a;i++){t=r[i];e.irregular[t[0].toLowerCase()]=t[1];e.irregular[t[1].toLowerCase()]=t[1];e.irregularInverse[t[1].toLowerCase()]=t[0];e.irregularInverse[t[0].toLowerCase()]=t[0]}}function o(e){e=e||{};e.uncountable=e.uncountable||u();e.irregularPairs=e.irregularPairs||u();var r=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:u(),irregularInverse:u(),uncountable:u()};n(r,e.uncountable);s(r,e.irregularPairs);this.enableCache()}if(!Object.create&&!Object.create(null).hasOwnProperty){throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg")}function u(){var e=Object.create(null);e["_dict"]=null;delete e["_dict"];return e}o.prototype={enableCache:function(){this.purgeCache();this.singularize=function(e){this._cacheUsed=true;return this._sCache[e]||(this._sCache[e]=this._singularize(e))};this.pluralize=function(e){this._cacheUsed=true;return this._pCache[e]||(this._pCache[e]=this._pluralize(e))}},purgeCache:function(){this._cacheUsed=false;this._sCache=u();this._pCache=u()},disableCache:function(){this._sCache=null;this._pCache=null;this.singularize=function(e){return this._singularize(e)};this.pluralize=function(e){return this._pluralize(e)}},plural:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.plurals.push([e,r.toLowerCase()])},singular:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.singular.push([e,r.toLowerCase()])},uncountable:function(e){if(this._cacheUsed){this.purgeCache()}n(this.rules,[e.toLowerCase()])},irregular:function(e,r){if(this._cacheUsed){this.purgeCache()}s(this.rules,[[e,r]])},pluralize:function(e){return this._pluralize(e)},_pluralize:function(e){return this.inflect(e,this.rules.plurals,this.rules.irregular)},singularize:function(e){return this._singularize(e)},_singularize:function(e){return this.inflect(e,this.rules.singular,this.rules.irregularInverse)},inflect:function(e,n,s){var o,u,d,c,l,f,h,p,m,y,v,b,g;p=r.test(e);m=a.test(e);f="";if(p){return e}c=e.toLowerCase();l=t.exec(e)||i.exec(e);if(l){f=l[1];h=l[2].toLowerCase()}y=this.rules.uncountable[c]||this.rules.uncountable[h];if(y){return e}v=s&&(s[c]||s[h]);if(v){if(s[c]){return v}else{v=m?v.capitalize():v;return f+v}}for(var R=n.length,E=0;R>E;R--){o=n[R-1];g=o[0];if(g.test(e)){break}}o=o||[];g=o[0];u=o[1];d=e.replace(g,u);return d}};e["default"]=o});r("ember-inflector/system/string",["./inflector","exports"],function(e,r){"use strict";var t=e["default"];function i(e){return t.inflector.pluralize(e)}function a(e){return t.inflector.singularize(e)}r.pluralize=i;r.singularize=a});e.DS=t("ember-data")["default"]})(this);
1
+ (function(e){var r,t,i,a;(function(){var e;if(!Array.isArray){e=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}else{e=Array.isArray}var n={},s={},o={};var u=false;r=function(r,t,i){if(!e(t)){i=t;t=[]}n[r]={deps:t,callback:i}};function d(e,r,t){var a=e.length;var n=new Array(a);var s;var o;for(var u=0,d=a;u<d;u++){s=e[u];if(s==="exports"){o=n[u]=t}else{n[u]=i(c(s,r))}}return{deps:n,exports:o}}a=i=t=function(e){if(o[e]!==u&&s.hasOwnProperty(e)){return s[e]}if(!n[e]){throw new Error("Could not find module "+e)}var r=n[e];var t;var i;var a=false;s[e]={};try{t=d(r.deps,e,s[e]);i=r.callback.apply(this,t.deps);a=true}finally{if(!a){o[e]=u}}return t.exports?s[e]:s[e]=i};function c(e,r){if(e.charAt(0)!=="."){return e}var t=e.split("/");var i=r.split("/");var a;if(i.length===1){a=i}else{a=i.slice(0,-1)}for(var n=0,s=t.length;n<s;n++){var o=t[n];if(o===".."){a.pop()}else if(o==="."){continue}else{a.push(o)}}return a.join("/")}a.entries=a._eak_seen=n;a.clear=function(){a.entries=a._eak_seen=n={};s=o={}}})();r("activemodel-adapter",["activemodel-adapter/system","exports"],function(e,r){"use strict";var t=e.ActiveModelAdapter;var i=e.ActiveModelSerializer;r.ActiveModelAdapter=t;r.ActiveModelSerializer=i});r("activemodel-adapter/setup-container",["ember-data/system/container_proxy","activemodel-adapter/system/active_model_serializer","activemodel-adapter/system/active_model_adapter","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];var s=t["default"];i["default"]=function o(e,r){var t=new a(e);t.registerDeprecations([{deprecated:"serializer:_ams",valid:"serializer:-active-model"},{deprecated:"adapter:_ams",valid:"adapter:-active-model"}]);e.register("serializer:-active-model",n);e.register("adapter:-active-model",s)}});r("activemodel-adapter/system",["activemodel-adapter/system/active_model_adapter","activemodel-adapter/system/active_model_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.ActiveModelAdapter=i;t.ActiveModelSerializer=a});r("activemodel-adapter/system/active_model_adapter",["ember-data/adapters","ember-data/system/adapter","ember-inflector","exports"],function(e,r,t,i){"use strict";var a=e.RESTAdapter;var n=r.InvalidError;var s=t.pluralize;var o=Ember.String.decamelize,u=Ember.String.underscore;var d=a.extend({defaultSerializer:"-active-model",pathForType:function(e){var r=o(e);var t=u(r);return s(t)},ajaxError:function(e){var r=this._super(e);if(e&&e.status===422){return new n(Ember.$.parseJSON(e.responseText))}else{return r}}});i["default"]=d});r("activemodel-adapter/system/active_model_serializer",["ember-inflector","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e.singularize;var a=r["default"];var n=Ember.get,s=Ember.EnumerableUtils.forEach,o=Ember.String.camelize,u=Ember.String.capitalize,d=Ember.String.decamelize,c=Ember.String.underscore;var l=a.extend({keyForAttribute:function(e){return d(e)},keyForRelationship:function(e,r){var t=d(e);if(r==="belongsTo"){return t+"_id"}else if(r==="hasMany"){return i(t)+"_ids"}else{return t}},serializeHasMany:Ember.K,serializeIntoHash:function(e,r,t,i){var a=c(d(r.typeKey));e[a]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var a=n(e,i);var s=c(i+"_type");if(Ember.isNone(a)){r[s]=null}else{r[s]=u(o(a.constructor.typeKey))}},normalize:function(e,r,t){this.normalizeLinks(r);return this._super(e,r,t)},normalizeLinks:function(e){if(e.links){var r=e.links;for(var t in r){var i=o(t);if(i!==t){r[i]=r[t];delete r[t]}}}},normalizeRelationships:function(e,r){if(this.keyForRelationship){e.eachRelationship(function(e,t){var i,a;if(t.options.polymorphic){i=this.keyForAttribute(e);a=r[i];if(a&&a.type){a.type=this.typeForRoot(a.type)}else if(a&&t.kind==="hasMany"){var n=this;s(a,function(e){e.type=n.typeForRoot(e.type)})}}else{i=this.keyForRelationship(e,t.kind);if(!r.hasOwnProperty(i)){return}a=r[i]}r[e]=a;if(e!==i){delete r[i]}},this)}}});t["default"]=l});r("ember-data",["ember-data/system/create","ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],function(e,r,t,i,a,n,s,o,u,d,c,l,f,h,p,m,y,v,b,g,E,R,_){"use strict";Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;var A=r["default"];var F=i.PromiseArray;var z=i.PromiseObject;var x=a.Store;var T=n.Model;var S=n.Errors;var k=n.RootState;var M=n.attr;var D=s.InvalidError;var P=s.Adapter;var w=o["default"];var O=u.RecordArray;var C=u.FilteredRecordArray;var I=u.AdapterPopulatedRecordArray;var $=u.ManyArray;var L=d["default"];var K=c.RESTAdapter;var j=c.FixtureAdapter;var U=l["default"];var B=f["default"];var N=p["default"];var H=m.ActiveModelAdapter;var V=m.ActiveModelSerializer;var W=y.Transform;var q=y.DateTransform;var Q=y.NumberTransform;var X=y.StringTransform;var J=y.BooleanTransform;var G=v.hasMany;var Y=v.belongsTo;var Z=g["default"];var er=E["default"];var rr=R.Relationship;A.Store=x;A.PromiseArray=F;A.PromiseObject=z;A.Model=T;A.RootState=k;A.attr=M;A.Errors=S;A.Adapter=P;A.InvalidError=D;A.DebugAdapter=w;A.RecordArray=O;A.FilteredRecordArray=C;A.AdapterPopulatedRecordArray=I;A.ManyArray=$;A.RecordArrayManager=L;A.RESTAdapter=K;A.FixtureAdapter=j;A.RESTSerializer=B;A.JSONSerializer=U;A.Transform=W;A.DateTransform=q;A.StringTransform=X;A.NumberTransform=Q;A.BooleanTransform=J;A.ActiveModelAdapter=H;A.ActiveModelSerializer=V;A.EmbeddedRecordsMixin=N;A.belongsTo=Y;A.hasMany=G;A.Relationship=rr;A.ContainerProxy=er;A._setupContainer=Z;Ember.lookup.DS=A;_["default"]=A});r("ember-data/adapters",["ember-data/adapters/fixture_adapter","ember-data/adapters/rest_adapter","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.RESTAdapter=a;t.FixtureAdapter=i});r("ember-data/adapters/fixture_adapter",["ember-data/system/adapter","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.String.fmt;var a=Ember.EnumerableUtils.indexOf;var n=0;var s=e["default"];r["default"]=s.extend({serializer:null,simulateRemoteResponse:true,latency:50,fixturesForType:function(e){if(e.FIXTURES){var r=Ember.A(e.FIXTURES);return r.map(function(e){var r=typeof e.id;if(r!=="number"&&r!=="string"){throw new Error(i("the id property must be defined as a number or string for fixture %@",[e]))}e.id=e.id+"";return e})}return null},queryFixtures:function(e,r,t){},updateFixtures:function(e,r){if(!e.FIXTURES){e.FIXTURES=[]}var t=e.FIXTURES;this.deleteLoadedFixture(e,r);t.push(r)},mockJSON:function(e,r,t){return e.serializerFor(r).serialize(t,{includeId:true})},generateIdForRecord:function(e){return"fixture-"+n++},find:function(e,r,t){var i=this.fixturesForType(r);var a;if(i){a=Ember.A(i).findBy("id",t)}if(a){return this.simulateRemoteCall(function(){return a},this)}},findMany:function(e,r,t){var i=this.fixturesForType(r);if(i){i=i.filter(function(e){return a(t,e.id)!==-1})}if(i){return this.simulateRemoteCall(function(){return i},this)}},findAll:function(e,r){var t=this.fixturesForType(r);return this.simulateRemoteCall(function(){return t},this)},findQuery:function(e,r,t,i){var a=this.fixturesForType(r);a=this.queryFixtures(a,t,r);if(a){return this.simulateRemoteCall(function(){return a},this)}},createRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},updateRecord:function(e,r,t){var i=this.mockJSON(e,r,t);this.updateFixtures(r,i);return this.simulateRemoteCall(function(){return i},this)},deleteRecord:function(e,r,t){this.deleteLoadedFixture(r,t);return this.simulateRemoteCall(function(){return null})},deleteLoadedFixture:function(e,r){var t=this.findExistingFixture(e,r);if(t){var i=a(e.FIXTURES,t);e.FIXTURES.splice(i,1);return true}},findExistingFixture:function(e,r){var i=this.fixturesForType(e);var a=t(r,"id");return this.findFixtureById(i,a)},findFixtureById:function(e,r){return Ember.A(e).find(function(e){if(""+t(e,"id")===""+r){return true}else{return false}})},simulateRemoteCall:function(e,r){var i=this;return new Ember.RSVP.Promise(function(a){var n=Ember.copy(e.call(r),true);if(t(i,"simulateRemoteResponse")){Ember.run.later(function(){a(n)},t(i,"latency"))}else{Ember.run.schedule("actions",null,function(){a(n)})}},"DS: FixtureAdapter#simulateRemoteCall")}})});r("ember-data/adapters/rest_adapter",["ember-data/system/adapter","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.Adapter;var a=e.InvalidError;var n=r.MapWithDefault;var s=Ember.get;var o=Ember.ArrayPolyfills.forEach;t["default"]=i.extend({defaultSerializer:"-rest",coalesceFindRequests:false,find:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET")},findAll:function(e,r,t){var i;if(t){i={since:t}}return this.ajax(this.buildURL(r.typeKey),"GET",{data:i})},findQuery:function(e,r,t){return this.ajax(this.buildURL(r.typeKey),"GET",{data:t})},findMany:function(e,r,t,i){return this.ajax(this.buildURL(r.typeKey,t,i),"GET",{data:{ids:t}})},findHasMany:function(e,r,t,i){var a=s(this,"host");var n=s(r,"id");var o=r.constructor.typeKey;if(a&&t.charAt(0)==="/"&&t.charAt(1)!=="/"){t=a+t}return this.ajax(this.urlPrefix(t,this.buildURL(o,n)),"GET")},findBelongsTo:function(e,r,t,i){var a=s(r,"id");var n=r.constructor.typeKey;return this.ajax(this.urlPrefix(t,this.buildURL(n,a)),"GET")},createRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t,{includeId:true});return this.ajax(this.buildURL(r.typeKey,null,t),"POST",{data:i})},updateRecord:function(e,r,t){var i={};var a=e.serializerFor(r.typeKey);a.serializeIntoHash(i,r,t);var n=s(t,"id");return this.ajax(this.buildURL(r.typeKey,n,t),"PUT",{data:i})},deleteRecord:function(e,r,t){var i=s(t,"id");return this.ajax(this.buildURL(r.typeKey,i,t),"DELETE")},buildURL:function(e,r,t){var i=[],a=s(this,"host"),n=this.urlPrefix();if(e){i.push(this.pathForType(e))}if(r&&!Ember.isArray(r)){i.push(encodeURIComponent(r))}if(n){i.unshift(n)}i=i.join("/");if(!a&&i){i="/"+i}return i},urlPrefix:function(e,r){var t=s(this,"host");var i=s(this,"namespace");var a=[];if(e){if(e.charAt(0)==="/"){if(t){e=e.slice(1);a.push(t)}}else if(!/^http(s)?:\/\//.test(e)){a.push(r)}}else{if(t){a.push(t)}if(i){a.push(i)}}if(e){a.push(e)}return a.join("/")},_stripIDFromURL:function(e,r){var t=r.constructor;var i=this.buildURL(t.typeKey,r.get("id"),r);var a=i.split("/");var n=a[a.length-1];var s=r.get("id");if(n===s){a[a.length-1]=""}else if(u(n,"?id="+s)){a[a.length-1]=n.substring(0,n.length-s.length-1)}return a.join("/")},maxUrlLength:2048,groupRecordsForFindMany:function(e,r){var t=n.create({defaultValue:function(){return[]}});var i=this;var a=this.maxUrlLength;o.call(r,function(r){var a=i._stripIDFromURL(e,r);t.get(a).push(r)});function s(r,t,a){var n=i._stripIDFromURL(e,r[0]);var s=0;var u=[[]];o.call(r,function(e){var r=encodeURIComponent(e.get("id")).length+a;if(n.length+s+r>=t){s=0;u.push([])}s+=r;var i=u.length-1;u[i].push(e)});return u}var u=[];t.forEach(function(e,r){var t="&ids%5B%5D=".length;var i=s(e,a,t);o.call(i,function(e){u.push(e)})});return u},pathForType:function(e){var r=Ember.String.camelize(e);return Ember.String.pluralize(r)},ajaxError:function(e,r){if(e&&typeof e==="object"){e.then=null}return e},ajaxSuccess:function(e,r){return r},ajax:function(e,r,t){var i=this;return new Ember.RSVP.Promise(function(n,s){var o=i.ajaxOptions(e,r,t);o.success=function(e,r,t){e=i.ajaxSuccess(t,e);if(e instanceof a){Ember.run(null,s,e)}else{Ember.run(null,n,e)}};o.error=function(e,r,t){Ember.run(null,s,i.ajaxError(e,e.responseText))};Ember.$.ajax(o)},"DS: RESTAdapter#ajax "+r+" to "+e)},ajaxOptions:function(e,r,t){var i=t||{};i.url=e;i.type=r;i.dataType="json";i.context=this;if(i.data&&r!=="GET"){i.contentType="application/json; charset=utf-8";i.data=JSON.stringify(i.data)}var a=s(this,"headers");if(a!==undefined){i.beforeSend=function(e){o.call(Ember.keys(a),function(r){e.setRequestHeader(r,a[r])})}}return i}});function u(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}});r("ember-data/core",["exports"],function(e){"use strict";var r;if("undefined"===typeof r){r=Ember.Namespace.create({VERSION:"1.0.0-beta.12"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",r.VERSION)}}e["default"]=r});r("ember-data/ember-initializer",["ember-data/setup-container"],function(e){"use strict";var r=e["default"];var t=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:r});e.initializer({name:"store",after:"ember-data",initialize:t});e.initializer({name:"activeModelAdapter",before:"store",initialize:t});e.initializer({name:"transforms",before:"store",initialize:t});e.initializer({name:"data-adapter",before:"store",initialize:t});e.initializer({name:"injectStore",before:"store",initialize:t})})});r("ember-data/ext/date",[],function(){"use strict";Ember.Date=Ember.Date||{};var e=Date.parse,r=[1,4,5,6,7,10,11];Ember.Date.parse=function(t){var i,a,n=0;if(a=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(t)){for(var s=0,o;o=r[s];++s){a[o]=+a[o]||0}a[2]=(+a[2]||1)-1;a[3]=+a[3]||1;if(a[8]!=="Z"&&a[9]!==undefined){n=a[10]*60+a[11];if(a[9]==="+"){n=0-n}}i=Date.UTC(a[1],a[2],a[3],a[4],a[5]+n,a[6],a[7])}else{i=e?e(t):NaN}return i};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}});r("ember-data/initializers/data_adapter",["ember-data/system/debug/debug_adapter","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=function i(e){e.register("data-adapter:main",t)}});r("ember-data/initializers/store",["ember-data/serializers","ember-data/adapters","ember-data/system/container_proxy","ember-data/system/store","exports"],function(e,r,t,i,a){"use strict";var n=e.JSONSerializer;var s=e.RESTSerializer;var o=r.RESTAdapter;var u=t["default"];var d=i["default"];a["default"]=function c(e,r){e.register("store:main",e.lookupFactory("store:application")||r&&r.Store||d);var t=new u(e);t.registerDeprecations([{deprecated:"serializer:_default",valid:"serializer:-default"},{deprecated:"serializer:_rest",valid:"serializer:-rest"},{deprecated:"adapter:_rest",valid:"adapter:-rest"}]);e.register("serializer:-default",n);e.register("serializer:-rest",s);e.register("adapter:-rest",o);e.lookup("store:main")}});r("ember-data/initializers/store_injections",["exports"],function(e){"use strict";e["default"]=function r(e){e.injection("controller","store","store:main");e.injection("route","store","store:main");e.injection("serializer","store","store:main");e.injection("data-adapter","store","store:main")}});r("ember-data/initializers/transforms",["ember-data/transforms","exports"],function(e,r){"use strict";var t=e.BooleanTransform;var i=e.DateTransform;var a=e.StringTransform;var n=e.NumberTransform;r["default"]=function s(e){e.register("transform:boolean",t);e.register("transform:date",i);e.register("transform:number",n);e.register("transform:string",a)}});r("ember-data/serializers",["ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r["default"];t.JSONSerializer=i;t.RESTSerializer=a});r("ember-data/serializers/embedded_records_mixin",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.EnumerableUtils.forEach;var i=Ember.String.camelize;var a=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return n(this,this.store,e,i)},keyForRelationship:function(e,r){if(this.hasDeserializeRecordsOption(e)){return this.keyForAttribute(e)}else{return this._super(e,r)||e}},serializeBelongsTo:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o=e.get(a);var u;if(n){u=this.keyForRelationship(a,i.kind);if(!o){t[u]=null}else{t[u]=r(o,"id")}}else if(s){u=this.keyForAttribute(a);if(!o){t[u]=null}else{t[u]=o.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,i,t[u])}}},serializeHasMany:function(e,t,i){var a=i.key;if(this.noSerializeOptionSpecified(a)){this._super(e,t,i);return}var n=this.hasSerializeIdsOption(a);var s=this.hasSerializeRecordsOption(a);var o;if(n){o=this.keyForRelationship(a,i.kind);t[o]=r(e,a).mapBy("id")}else if(s){o=this.keyForAttribute(a);t[o]=r(e,a).map(function(r){var t=r.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,i,t);return t},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var a=e.constructor.inverseFor(t.key);if(a){var n=a.name;var s=this.store.serializerFor(r.constructor);var o=s.keyForRelationship(n,a.kind);if(o){delete i[o]}}}},hasEmbeddedAlwaysOption:function(e){var r=this.attrsOption(e);return r&&r.embedded==="always"},hasSerializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.serialize==="records"},hasSerializeIdsOption:function(e){var r=this.attrsOption(e);return r&&(r.serialize==="ids"||r.serialize==="id")},noSerializeOptionSpecified:function(e){var r=this.attrsOption(e);return!(r&&(r.serialize||r.embedded))},hasDeserializeRecordsOption:function(e){var r=this.hasEmbeddedAlwaysOption(e);var t=this.attrsOption(e);return r||t&&t.deserialize==="records"},attrsOption:function(e){var r=this.get("attrs");return r&&(r[i(e)]||r[e])}});function n(e,r,t,i){t.eachRelationship(function(t,a){if(e.hasDeserializeRecordsOption(t)){var n=r.modelFor(a.type.typeKey);if(a.kind==="hasMany"){if(a.options.polymorphic){o(r,t,i)}else{s(r,t,n,i)}}if(a.kind==="belongsTo"){u(r,t,n,i)}}});return i}function s(e,r,i,a){if(!a[r]){return a}var n=[];var s=e.serializerFor(i.typeKey);t(a[r],function(r){var t=s.normalize(i,r,null);e.push(i,t);n.push(t.id)});a[r]=n;return a}function o(e,i,a){if(!a[i]){return a}var n=[];t(a[i],function(t){var i=t.type;var a=e.serializerFor(i);var s=e.modelFor(i);var o=r(a,"primaryKey");var u=a.normalize(s,t,null);e.push(s,u);n.push({id:u[o],type:i})});a[i]=n;return a}function u(e,r,t,i){if(!i[r]){return i}var a=e.serializerFor(t.typeKey);var n=a.normalize(t,i[r],null);e.push(t,n);i[r]=n.id;return i}e["default"]=a});r("ember-data/serializers/json_serializer",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.isNone;var i=Ember.ArrayPolyfills.map;var a=Ember.merge;e["default"]=Ember.Object.extend({primaryKey:"id",applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var a=this.transformFor(i);r[e]=a.deserialize(r[e])},this);return r},normalize:function(e,r){if(!r){return r}this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);this.applyTransforms(e,r);return r},normalizePayload:function(e){return e},normalizeAttributes:function(e,r){var t;if(this.keyForAttribute){e.eachAttribute(function(e){t=this.keyForAttribute(e);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeRelationships:function(e,r){var t;if(this.keyForRelationship){e.eachRelationship(function(e,i){t=this.keyForRelationship(e,i.kind);if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeUsingDeclaredMapping:function(e,t){var i=r(this,"attrs"),a,n;if(i){for(n in i){a=this._getMappedKey(n);if(!t.hasOwnProperty(a)){continue}if(a!==n){t[n]=t[a];delete t[a]}}}},normalizeId:function(e){var t=r(this,"primaryKey");if(t==="id"){return}e.id=e[t];delete e[t]},normalizeErrors:function(e,r){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r)},_getMappedKey:function(e){var t=r(this,"attrs");var i;if(t&&t[e]){i=t[e];if(i.key){i=i.key}if(typeof i==="string"){e=i}}return e},_canSerialize:function(e){var t=r(this,"attrs");return!t||!t[e]||t[e].serialize!==false},serialize:function(e,t){var i={};if(t&&t.includeId){var a=r(e,"id");if(a){i[r(this,"primaryKey")]=a}}e.eachAttribute(function(r,t){this.serializeAttribute(e,i,r,t)},this);e.eachRelationship(function(r,t){if(t.kind==="belongsTo"){this.serializeBelongsTo(e,i,t)}else if(t.kind==="hasMany"){this.serializeHasMany(e,i,t)}},this);return i},serializeIntoHash:function(e,r,t,i){a(e,this.serialize(t,i))},serializeAttribute:function(e,t,i,a){var n=a.type;if(this._canSerialize(i)){var s=r(e,i);if(n){var o=this.transformFor(n);s=o.serialize(s)}var u=this._getMappedKey(i);if(u===i&&this.keyForAttribute){u=this.keyForAttribute(i)}t[u]=s}},serializeBelongsTo:function(e,i,a){var n=a.key;if(this._canSerialize(n)){var s=r(e,n);var o=this._getMappedKey(n);if(o===n&&this.keyForRelationship){o=this.keyForRelationship(n,"belongsTo")}if(t(s)||t(r(s,"id"))){i[o]=null}else{i[o]=r(s,"id")}if(a.options.polymorphic){this.serializePolymorphicType(e,i,a)}}},serializeHasMany:function(e,t,i){var a=i.key;if(this._canSerialize(a)){var n;n=this._getMappedKey(a);if(n===a&&this.keyForRelationship){n=this.keyForRelationship(a,"hasMany")}var s=e.constructor.determineRelationshipType(i);if(s==="manyToNone"||s==="manyToMany"){t[n]=r(e,a).mapBy("id")}}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,a){this.extractMeta(e,r,t);var n="extract"+a.charAt(0).toUpperCase()+a.substr(1);return this[n](e,r,t,i,a)},extractFindAll:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindQuery:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractFindHasMany:function(e,r,t,i,a){return this.extractArray(e,r,t,i,a)},extractCreateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractUpdateRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractDeleteRecord:function(e,r,t,i,a){return this.extractSave(e,r,t,i,a)},extractFind:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractFindBelongsTo:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSave:function(e,r,t,i,a){return this.extractSingle(e,r,t,i,a)},extractSingle:function(e,r,t,i,a){t=this.normalizePayload(t);return this.normalize(r,t)},extractArray:function(e,r,t,a,n){var s=this.normalizePayload(t);var o=this;return i.call(s,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(t&&t.meta){e.metaForType(r,t.meta);delete t.meta}},extractErrors:function(e,r,t,i){if(t&&typeof t==="object"&&t.errors){t=t.errors;this.normalizeErrors(r,t)}return t},keyForAttribute:function(e){return e},keyForRelationship:function(e,r){return e},transformFor:function(e,r){var t=this.container.lookup("transform:"+e);return t}})});r("ember-data/serializers/rest_serializer",["ember-data/serializers/json_serializer","ember-inflector/system/string","exports"],function(e,r,t){"use strict";var i=e["default"];var a=Ember.get;var n=Ember.ArrayPolyfills.forEach;var s=Ember.ArrayPolyfills.map;var o=Ember.String.camelize;var u=r.singularize;function d(e){return e==null?null:e+""}var c=i.extend({normalize:function(e,r,t){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r);if(this.normalizeHash&&this.normalizeHash[t]){this.normalizeHash[t](r)}this.applyTransforms(e,r);return r},extractSingle:function(e,r,t,i){var a=this.normalizePayload(t);var s=r.typeKey;var o;for(var u in a){var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=l.typeKey===s;var h=a[u];if(h===null){continue}if(f&&Ember.typeOf(h)!=="array"){o=this.normalize(r,h,u);continue}n.call(h,function(r){var t=this.typeForRoot(u);var a=e.modelFor(t);var n=e.serializerFor(a);r=n.normalize(a,r,u);var s=f&&!i&&!o;var c=f&&d(r.id)===i;if(s||c){o=r}else{e.push(t,r)}},this)}return o},extractArray:function(e,r,t){var i=this.normalizePayload(t);var a=r.typeKey;var n;for(var o in i){var u=o;var d=false;if(o.charAt(0)==="_"){d=true;u=o.substr(1)}var c=this.typeForRoot(u);if(!e.modelFactoryFor(c)){continue}var l=e.modelFor(c);var f=e.serializerFor(l);var h=!d&&l.typeKey===a;var p=s.call(i[o],function(e){return f.normalize(l,e,o)},this);if(h){n=p}else{e.pushMany(c,p)}}return n},pushPayload:function(e,r){var t=this.normalizePayload(r);for(var i in t){var a=this.typeForRoot(i);if(!e.modelFactoryFor(a,i)){continue}var n=e.modelFor(a);var o=e.serializerFor(n);var u=s.call(Ember.makeArray(t[i]),function(e){return o.normalize(n,e,i)},this);e.pushMany(a,u)}},typeForRoot:function(e){return o(u(e))},serialize:function(e,r){return this._super.apply(this,arguments)},serializeIntoHash:function(e,r,t,i){e[r.typeKey]=this.serialize(t,i)},serializePolymorphicType:function(e,r,t){var i=t.key;var n=a(e,i);i=this.keyForAttribute?this.keyForAttribute(i):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.constructor.typeKey)}}});t["default"]=c});r("ember-data/setup-container",["ember-data/initializers/store","ember-data/initializers/transforms","ember-data/initializers/store_injections","ember-data/initializers/data_adapter","activemodel-adapter/setup-container","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=t["default"];var d=i["default"];var c=a["default"];n["default"]=function l(e,r){d(e,r);o(e,r);u(e,r);s(e,r);c(e,r)}});r("ember-data/system/adapter",["exports"],function(e){"use strict";var r=Ember.get;var t=["description","fileName","lineNumber","message","name","number","stack"];function i(e){var r=Error.prototype.constructor.call(this,"The backend rejected the commit because it was invalid: "+Ember.inspect(e));this.errors=e;for(var i=0,a=t.length;i<a;i++){this[t[i]]=r[t[i]]}}i.prototype=Ember.create(Error.prototype);var a=Ember.Object.extend({find:Ember.required(Function),findAll:null,findQuery:null,generateIdForRecord:null,serialize:function(e,t){return r(e,"store").serializerFor(e.constructor.typeKey).serialize(e,t)},createRecord:Ember.required(Function),updateRecord:Ember.required(Function),deleteRecord:Ember.required(Function),coalesceFindRequests:true,groupRecordsForFindMany:function(e,r){return[r]}});e.InvalidError=i;e.Adapter=a;e["default"]=a});r("ember-data/system/container_proxy",["exports"],function(e){"use strict";function r(e){this.container=e}r.prototype.aliasedFactory=function(e,r){var t=this;return{create:function(){if(r){r()}return t.container.lookup(e)}}};r.prototype.registerAlias=function(e,r,t){var i=this.aliasedFactory(r,t);return this.container.register(e,i)};r.prototype.registerDeprecation=function(e,r){var t=function(){};return this.registerAlias(e,r,t)};r.prototype.registerDeprecations=function(e){var r,t,i,a;for(r=e.length;r>0;r--){t=e[r-1];i=t["deprecated"];a=t["valid"];this.registerDeprecation(i,a)}};e["default"]=r});r("ember-data/system/create",[],function(){"use strict";var e=Ember.create(null);if(e.toString!==undefined&&Ember.keys(Ember.create({}))[0]==="__proto__"){throw new Error("Ember Data requires a correct Object.create shim. You should upgrade to Ember >= 1.8 which provides one for you. If you are using ES5-shim, you should try removing that after upgrading Ember.")}});r("ember-data/system/debug",["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],function(e,r,t){"use strict";var i=r["default"];t["default"]=i});r("ember-data/system/debug/debug_adapter",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;var i=Ember.get;var a=Ember.String.capitalize;var n=Ember.String.underscore;r["default"]=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==t&&t.detect(e)},columnsForType:function(e){var r=[{name:"id",desc:"Id"}];var t=0;var s=this;i(e,"attributes").forEach(function(e,i){if(t++>s.attributeLimit){return false}var o=a(n(i).replace("_"," "));r.push({name:i,desc:o})});return r},getRecords:function(e){return this.get("store").all(e)},getRecordColumnValues:function(e){var r=this,t=0;var a={id:i(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var s=i(e,n);a[n]=s});return a},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(i(e,t))});return r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("isDirty")&&!e.get("isNew"),isClean:!e.get("isDirty")}},getRecordColor:function(e){var r="black";if(e.get("isNew")){r="green"}else if(e.get("isDirty")){r="blue"}return r},observeRecord:function(e,r){var t=Ember.A(),i=this;var a=Ember.A(["id","isNew","isDirty"]);e.eachAttribute(function(e){a.push(e)});a.forEach(function(a){var n=function(){r(i.wrapRecord(e))};Ember.addObserver(e,a,n);t.push(function(){Ember.removeObserver(e,a,n)})});var n=function(){t.forEach(function(e){e()})};return n}})});r("ember-data/system/debug/debug_info",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;t.reopen({_debugInfo:function(){var e=["id"],r={belongsTo:[],hasMany:[]},t=[];this.eachAttribute(function(r,t){e.push(r)},this);this.eachRelationship(function(e,i){r[i.kind].push(e);t.push(e)});var i=[{name:"Attributes",properties:e,expand:true},{name:"Belongs To",properties:r.belongsTo,expand:true},{name:"Has Many",properties:r.hasMany,expand:true},{name:"Flags",properties:["isLoaded","isDirty","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:true,groups:i,expensiveProperties:t}}}});r["default"]=t});r("ember-data/system/map",["exports"],function(e){"use strict";var r,t;function i(){Ember.OrderedSet.apply(this,arguments)}function a(){Ember.Map.apply(this,arguments)}function n(){Ember.MapWithDefault.apply(this,arguments)}var s=Ember.Map.create();s.set("key","value");var o=false;s.forEach(function(e,r){o=e==="key"&&r==="value"});a.prototype=Ember.create(Ember.Map.prototype);n.prototype=Ember.create(Ember.MapWithDefault.prototype);i.prototype=Ember.create(Ember.OrderedSet.prototype);i.create=function(){return new i};function u(e){return function(r,t){e.call(this,t,r)}}if(o){r=function(e,r){this.__super$forEach(u(e),r)};t=function(e){this.remove(e)};a.prototype.__super$forEach=Ember.Map.prototype.forEach;a.prototype.forEach=r;a.prototype["delete"]=t;n.prototype.forEach=r;n.prototype.__super$forEach=Ember.MapWithDefault.prototype.forEach;n.prototype["delete"]=t;i.prototype["delete"]=t}n.constructor=n;a.constructor=a;n.create=function(e){if(e){return new n(e)}else{return new a}};a.create=function(){return new this.constructor};e["default"]=a;e.Map=a;e.MapWithDefault=n;e.OrderedSet=i});r("ember-data/system/model",["ember-data/system/model/model","ember-data/system/model/attributes","ember-data/system/model/states","ember-data/system/model/errors","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var u=i["default"];a.Model=n;a.RootState=o;a.attr=s;a.Errors=u});r("ember-data/system/model/attributes",["ember-data/system/model/model","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e["default"];var a=r.Map;var n=Ember.get;i.reopenClass({attributes:Ember.computed(function(){var e=a.create();this.eachComputedProperty(function(r,t){if(t.isAttribute){t.name=r;e.set(r,t)}});return e}).readOnly(),transformedAttributes:Ember.computed(function(){var e=a.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)
2
+ }});return e}).readOnly(),eachAttribute:function(e,r){n(this,"attributes").forEach(function(t,i){e.call(r,i,t)},r)},eachTransformedAttribute:function(e,r){n(this,"transformedAttributes").forEach(function(t,i){e.call(r,i,t)})}});i.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function s(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function o(e,r){return e._attributes.hasOwnProperty(r)||e._inFlightAttributes.hasOwnProperty(r)||e._data.hasOwnProperty(r)}function u(e,r){if(e._attributes.hasOwnProperty(r)){return e._attributes[r]}else if(e._inFlightAttributes.hasOwnProperty(r)){return e._inFlightAttributes[r]}else{return e._data[r]}}t["default"]=function d(e,r){r=r||{};var t={type:e,isAttribute:true,options:r};return Ember.computed(function(e,t){if(arguments.length>1){var i=u(this,e);if(t!==i){this._attributes[e]=t;this.send("didSetProperty",{name:e,oldValue:i,originalValue:this._data[e],value:t})}return t}else if(o(this,e)){return u(this,e)}else{return s(this,r,e)}}).meta(t)}});r("ember-data/system/model/errors",["ember-data/system/map","exports"],function(e,r){"use strict";var t=Ember.get;var i=Ember.isEmpty;var a=Ember.EnumerableUtils.map;var n=e.MapWithDefault;r["default"]=Ember.Object.extend(Ember.Enumerable,Ember.Evented,{registerHandlers:function(e,r,t){this.on("becameInvalid",e,r);this.on("becameValid",e,t)},errorsByAttributeName:Ember.reduceComputed("content",{initialValue:function(){return n.create({defaultValue:function(){return Ember.A()}})},addedItem:function(e,r){e.get(r.attribute).pushObject(r);return e},removedItem:function(e,r){e.get(r.attribute).removeObject(r);return e}}),errorsFor:function(e){return t(this,"errorsByAttributeName").get(e)},messages:Ember.computed.mapBy("content","message"),content:Ember.computed(function(){return Ember.A()}),unknownProperty:function(e){var r=this.errorsFor(e);if(i(r)){return null}return r},nextObject:function(e,r,i){return t(this,"content").objectAt(e)},length:Ember.computed.oneWay("content.length").readOnly(),isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var i=t(this,"isEmpty");r=this._findOrCreateMessages(e,r);t(this,"content").addObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(i&&!t(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return a(Ember.makeArray(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(t(this,"isEmpty")){return}var r=t(this,"content").rejectBy("attribute",e);t(this,"content").setObjects(r);this.notifyPropertyChange(e);this.enumerableContentDidChange();if(t(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(t(this,"isEmpty")){return}t(this,"content").clear();this.enumerableContentDidChange();this.trigger("becameValid")},has:function(e){return!i(this.errorsFor(e))}})});r("ember-data/system/model/model",["ember-data/system/model/states","ember-data/system/model/errors","ember-data/system/promise_proxies","ember-data/system/relationships/relationship","exports"],function(e,r,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=i.PromiseObject;var d=a.createRelationshipFor;var c=Ember.get;var l=Ember.set;var f=Ember.merge;var h=Ember.RSVP.Promise;var p=Ember.ArrayPolyfills.forEach;var m=Ember.ArrayPolyfills.map;var y;var v=Ember.computed("currentState",function(e,r){return c(c(this,"currentState"),e)}).readOnly();var b=Ember.create(null);var g=Ember.create(null);function E(e){return g[e]||(g[e]=e.split("."))}function R(e){return b[e]||(b[e]=E(e)[0])}var _=Ember.Object.extend(Ember.Evented,{_recordArrays:undefined,_relationships:undefined,_loadingRecordArrays:undefined,isEmpty:v,isLoading:v,isLoaded:v,isDirty:v,isSaving:v,isDeleted:v,isNew:v,isValid:v,dirtyType:v,isError:false,isReloading:false,clientId:null,id:null,currentState:s.empty,errors:Ember.computed(function(){var e=o.create();e.registerHandlers(this,function(){this.send("becameInvalid")},function(){this.send("becameValid")});return e}).readOnly(),serialize:function(e){var r=c(this,"store");return r.serialize(this,e)},toJSON:function(e){if(!y){y=t("ember-data/serializers/json_serializer")["default"]}var r=y.create({container:this.container});return r.serialize(this,e)},didLoad:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,data:Ember.computed(function(){this._data=this._data||{};return this._data}).readOnly(),_data:null,init:function(){this._super();this._setup()},_setup:function(){this._changesToSync={};this._deferredTriggers=[];this._data={};this._attributes={};this._inFlightAttributes={};this._relationships={};this._implicitRelationships=Ember.create(null);var e=this;this.constructor.eachRelationship(function(r,t){e._relationships[r]=d(e,t,e.store)})},send:function(e,r){var t=c(this,"currentState");if(!t[e]){this._unhandledEvent(t,e,r)}return t[e](this,r)},transitionTo:function(e){var r=R(e);var t=c(this,"currentState");var i=t;do{if(i.exit){i.exit(this)}i=i.parentState}while(!i.hasOwnProperty(r));var a=E(e);var n=[],s=[],o,u;for(o=0,u=a.length;o<u;o++){i=i[a[o]];if(i.enter){s.push(i)}if(i.setup){n.push(i)}}for(o=0,u=s.length;o<u;o++){s[o].enter(this)}l(this,"currentState",i);for(o=0,u=n.length;o<u;o++){n[o].setup(this)}this.updateRecordArraysLater()},_unhandledEvent:function(e,r,t){var i="Attempted to handle event `"+r+"` ";i+="on "+String(this)+" while in state ";i+=e.stateName+". ";if(t!==undefined){i+="Called with "+Ember.inspect(t)+"."}throw new Ember.Error(i)},withTransaction:function(e){var r=c(this,"transaction");if(r){e(r)}},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData")},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},deleteRecord:function(){this.send("deleteRecord")},destroyRecord:function(){this.deleteRecord();return this.save()},unloadRecord:function(){if(this.isDestroyed){return}this.send("unloadRecord")},clearRelationships:function(){this.eachRelationship(function(e,r){var t=this._relationships[e];if(t){t.clear();t.destroy()}},this)},disconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].disconnect()},this);var e=this;p.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].disconnect()})},reconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships[e].reconnect()},this);var e=this;p.call(Ember.keys(this._implicitRelationships),function(r){e._implicitRelationships[r].reconnect()})},updateRecordArrays:function(){this._updatingRecordArraysLater=false;c(this,"store").dataWasUpdated(this.constructor,this)},_preloadData:function(e){var r=this;p.call(Ember.keys(e),function(t){var i=c(e,t);var a=r.constructor.metaForProperty(t);if(a.isRelationship){r._preloadRelationship(t,i)}else{c(r,"_data")[t]=i}})},_preloadRelationship:function(e,r){var t=this.constructor.metaForProperty(e);var i=t.type;if(t.kind==="hasMany"){this._preloadHasMany(e,r,i)}else{this._preloadBelongsTo(e,r,i)}},_preloadHasMany:function(e,r,t){var i=this;var a=m.call(r,function(e){return i._convertStringOrNumberIntoRecord(e,t)});this._relationships[e].updateRecordsFromAdapter(a)},_preloadBelongsTo:function(e,r,t){var i=this._convertStringOrNumberIntoRecord(r,t);this._relationships[e].setRecord(i)},_convertStringOrNumberIntoRecord:function(e,r){if(Ember.typeOf(e)==="string"||Ember.typeOf(e)==="number"){return this.store.recordForId(r,e)}return e},_notifyProperties:function(e){Ember.beginPropertyChanges();var r;for(var t=0,i=e.length;t<i;t++){r=e[t];this.notifyPropertyChange(r)}Ember.endPropertyChanges()},changedAttributes:function(){var e=c(this,"_data");var r=c(this,"_attributes");var t={};var i;for(i in r){t[i]=[e[i],r[i]]}return t},adapterWillCommit:function(){this.send("willCommit")},adapterDidCommit:function(e){l(this,"isError",false);if(e){this._data=e}else{Ember.mixin(this._data,this._inFlightAttributes)}this._inFlightAttributes={};this.send("didCommit");this.updateRecordArraysLater();if(!e){return}this._notifyProperties(Ember.keys(e))},adapterDidDirty:function(){this.send("becomeDirty");this.updateRecordArraysLater()},updateRecordArraysLater:function(){if(this._updatingRecordArraysLater){return}this._updatingRecordArraysLater=true;Ember.run.schedule("actions",this,this.updateRecordArrays)},setupData:function(e,r){if(r){Ember.merge(this._data,e)}else{this._data=e}this.pushedData();this._notifyProperties(Ember.keys(e))},materializeId:function(e){l(this,"id",e)},materializeAttributes:function(e){f(this._data,e)},materializeAttribute:function(e,r){this._data[e]=r},rollback:function(){this._attributes={};if(c(this,"isError")){this._inFlightAttributes={};l(this,"isError",false)}if(c(this,"isDeleted")){this.reconnectRelationships()}if(c(this,"isNew")){this.clearRelationships()}if(!c(this,"isValid")){this._inFlightAttributes={}}this.send("rolledBack");this._notifyProperties(Ember.keys(this._data))},toStringExtension:function(){return c(this,"id")},save:function(){var e="DS: Model#save "+this;var r=Ember.RSVP.defer(e);this.get("store").scheduleSave(this,r);this._inFlightAttributes=this._attributes;this._attributes={};return u.create({promise:r.promise})},reload:function(){l(this,"isReloading",true);var e=this;var r="DS: Model#reload of "+this;var t=new h(function(r){e.send("reloadRecord",r)},r).then(function(){e.set("isReloading",false);e.set("isError",false);return e},function(r){e.set("isError",true);throw r},"DS: Model#reload complete, update flags")["finally"](function(){e.updateRecordArrays()});return u.create({promise:t})},adapterDidUpdateAttribute:function(e,r){if(r!==undefined){this._data[e]=r;this.notifyPropertyChange(e)}else{this._data[e]=this._inFlightAttributes[e]}this.updateRecordArraysLater()},adapterDidInvalidate:function(e){var r=c(this,"errors");function t(t){if(e[t]){r.add(t,e[t])}}this.eachAttribute(t);this.eachRelationship(t)},adapterDidError:function(){this.send("becameError");l(this,"isError",true)},trigger:function(){var e=arguments.length;var r=new Array(e-1);var t=arguments[0];for(var i=1;i<e;i++){r[i-1]=arguments[i]}Ember.tryInvoke(this,t,r);this._super.apply(this,arguments)},triggerLater:function(){var e=arguments.length;var r=new Array(e);for(var t=0;t<e;t++){r[t]=arguments[t]}if(this._deferredTriggers.push(r)!==1){return}Ember.run.schedule("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){for(var e=0,r=this._deferredTriggers.length;e<r;e++){this.trigger.apply(this,this._deferredTriggers[e])}this._deferredTriggers.length=0},willDestroy:function(){this._super();this.clearRelationships()},willMergeMixin:function(e){}});_.reopenClass({_create:_.create,create:function(){throw new Ember.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.")}});n["default"]=_});r("ember-data/system/model/states",["exports"],function(e){"use strict";var r=Ember.get;var t=Ember.set;function i(e,r){if(r.value===r.originalValue){delete e._attributes[r.name];e.send("propertyWasReset",r.name)}else if(r.value!==r.oldValue){e.send("becomeDirty")}e.updateRecordArraysLater()}var a={initialState:"uncommitted",isDirty:true,uncommitted:{didSetProperty:i,loadingData:Ember.K,propertyWasReset:function(e,r){var t=Ember.keys(e._attributes);var i=t>0;if(!i){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollback()}},inFlight:{isSaving:true,didSetProperty:i,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:function(e){},willCommit:Ember.K,didCommit:function(e){var t=r(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",t)},becameInvalid:function(e){e.transitionTo("invalid");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},invalid:{isValid:false,deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},didSetProperty:function(e,t){r(e,"errors").remove(t.name);i(e,t)},becomeDirty:Ember.K,willCommit:function(e){r(e,"errors").clear();e.transitionTo("inFlight")},rolledBack:function(e){r(e,"errors").clear()},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes={}}}};function n(e){var r={},t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=n(t)}else{r[i]=t}}return r}function s(e,r){for(var t in r){e[t]=r[t]}return e}function o(e){var r=n(a);return s(r,e)}var u=o({dirtyType:"created",isNew:true});u.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var d=o({dirtyType:"updated"});u.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved")};u.uncommitted.rollback=function(e){a.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};u.uncommitted.propertyWasReset=Ember.K;function c(e){}d.inFlight.unloadRecord=c;d.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var l={isEmpty:false,isLoading:false,isLoaded:false,isDirty:false,isSaving:false,isDeleted:false,isNew:false,isValid:true,rolledBack:Ember.K,unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},propertyWasReset:Ember.K,empty:{isEmpty:true,loadingData:function(e,r){e._loadingPromise=r;e.transitionTo("loading")},loadedData:function(e){e.transitionTo("loaded.created.uncommitted");e.notifyPropertyChange("data")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");t(e,"isError",false)},becameError:function(e){e.triggerLater("becameError",e)},notFound:function(e){e.transitionTo("empty")}},loaded:{initialState:"saved",isLoaded:true,loadingData:Ember.K,saved:{setup:function(e){var r=e._attributes;var t=false;for(var i in r){if(r.hasOwnProperty(i)){t=true;break}}if(t){e.adapterDidDirty()}},didSetProperty:i,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,t){t(r(e,"store").reloadRecord(e))},deleteRecord:function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()},unloadRecord:function(e){e.clearRelationships();e.transitionTo("deleted.saved")},didCommit:function(e){e.send("invokeLifecycleCallbacks",r(e,"lastDirtyType"))},notFound:Ember.K},created:u,updated:d},deleted:{initialState:"uncommitted",dirtyType:"deleted",isDeleted:true,isLoaded:true,isDirty:true,setup:function(e){e.updateRecordArrays()},uncommitted:{willCommit:function(e){e.transitionTo("inFlight")},rollback:function(e){e.rollback()},becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved")}},inFlight:{isSaving:true,unloadRecord:c,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)}},saved:{isDirty:false,setup:function(e){var t=r(e,"store");t.dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function f(e,r,t){e=s(r?Ember.create(r):{},e);e.parentState=r;e.stateName=t;for(var i in e){if(!e.hasOwnProperty(i)||i==="parentState"||i==="stateName"){continue}if(typeof e[i]==="object"){e[i]=f(e[i],e,t+"."+i)}}return e}l=f(l,null,"root");e["default"]=l});r("ember-data/system/promise_proxies",["exports"],function(e){"use strict";var r=Ember.RSVP.Promise;var t=Ember.get;var i=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var a=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var n=function(e,t){return a.create({promise:r.resolve(e,t)})};var s=function(e,t){return i.create({promise:r.resolve(e,t)})};function o(e){return function(){var r=t(this,"content");return r[e].apply(r,arguments)}}var u=i.extend({reload:function(){return t(this,"content").reload()},createRecord:o("createRecord"),on:o("on"),one:o("one"),trigger:o("trigger"),off:o("off"),has:o("has")});var d=function(e,t){return u.create({promise:r.resolve(e,t)})};e.PromiseArray=i;e.PromiseObject=a;e.PromiseManyArray=u;e.promiseArray=s;e.promiseObject=n;e.promiseManyArray=d});r("ember-data/system/record_array_manager",["ember-data/system/record_arrays","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.RecordArray;var a=e.FilteredRecordArray;var n=e.AdapterPopulatedRecordArray;var s=e.ManyArray;var o=r.MapWithDefault;var u=r.OrderedSet;var d=Ember.get;var c=Ember.EnumerableUtils.forEach;var l=Ember.EnumerableUtils.indexOf;t["default"]=Ember.Object.extend({init:function(){this.filteredRecordArrays=o.create({defaultValue:function(){return[]}});this.changedRecords=[];this._adapterPopulatedRecordArrays=[]},recordDidChange:function(e){if(this.changedRecords.push(e)!==1){return}Ember.run.schedule("actions",this,this.updateRecordArrays)},recordArraysForRecord:function(e){e._recordArrays=e._recordArrays||u.create();return e._recordArrays},updateRecordArrays:function(){c(this.changedRecords,function(e){if(d(e,"isDeleted")){this._recordWasDeleted(e)}else{this._recordWasChanged(e)}},this);this.changedRecords.length=0},_recordWasDeleted:function(e){var r=e._recordArrays;if(!r){return}r.forEach(function(r){r.removeRecord(e)});e._recordArrays=null},_recordWasChanged:function(e){var r=e.constructor;var t=this.filteredRecordArrays.get(r);var i;c(t,function(t){i=d(t,"filterFunction");this.updateRecordArray(t,i,r,e)},this);var a=e._loadingRecordArrays;if(a){for(var n=0,s=a.length;n<s;n++){a[n].loadedRecord()}e._loadingRecordArrays=[]}},updateRecordArray:function(e,r,t,i){var a;if(!r){a=true}else{a=r(i)}var n=this.recordArraysForRecord(i);if(a){if(!n.has(e)){e.pushRecord(i);n.add(e)}}else if(!a){n["delete"](e);e.removeRecord(i)}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var a=i.records,n;for(var s=0,o=a.length;s<o;s++){n=a[s];if(!d(n,"isDeleted")&&!d(n,"isEmpty")){this.updateRecordArray(e,t,r,n)}}},createManyArray:function(e,r){var t=s.create({type:e,content:r,store:this.store});c(r,function(e){var r=this.recordArraysForRecord(e);r.add(t)},this);return t},createRecordArray:function(e){var r=i.create({type:e,content:Ember.A(),store:this.store,isLoaded:true});this.registerFilteredRecordArray(r,e);return r},createFilteredRecordArray:function(e,r,t){var i=a.create({query:t,type:e,content:Ember.A(),store:this.store,manager:this,filterFunction:r});this.registerFilteredRecordArray(i,e,r);return i},createAdapterPopulatedRecordArray:function(e,r){var t=n.create({type:e,query:r,content:Ember.A(),store:this.store,manager:this});this._adapterPopulatedRecordArrays.push(t);return t},registerFilteredRecordArray:function(e,r,t){var i=this.filteredRecordArrays.get(r);i.push(e);this.updateFilter(e,r,t)},unregisterFilteredRecordArray:function(e){var r=this.filteredRecordArrays.get(e.type);var t=l(r,e);r.splice(t,1)},registerWaitingRecordArray:function(e,r){var t=e._loadingRecordArrays||[];t.push(r);e._loadingRecordArrays=t},willDestroy:function(){this._super();c(p(f(this.filteredRecordArrays.values)),h);c(this._adapterPopulatedRecordArrays,h)}});function f(e){var r=[];var t=Ember.keys(e);for(var i=0;i<t.length;i++){r.push(e[t[i]])}return r}function h(e){e.destroy()}function p(e){var r=e.length;var t=Ember.A();for(var i=0;i<r;i++){t=t.concat(e[i])}return t}});r("ember-data/system/record_arrays",["ember-data/system/record_arrays/record_array","ember-data/system/record_arrays/filtered_record_array","ember-data/system/record_arrays/adapter_populated_record_array","ember-data/system/record_arrays/many_array","exports"],function(e,r,t,i,a){"use strict";var n=e["default"];var s=r["default"];var o=t["default"];var u=i["default"];a.RecordArray=n;a.FilteredRecordArray=s;a.AdapterPopulatedRecordArray=o;a.ManyArray=u});r("ember-data/system/record_arrays/adapter_populated_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;function a(e){var r=Ember.create(null);for(var t in e){r[t]=e[t]}return r}r["default"]=t.extend({query:null,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},load:function(e){var r=i(this,"store");var t=i(this,"type");var n=r.pushMany(t,e);var s=r.metadataFor(t);this.setProperties({content:Ember.A(n),isLoaded:true,meta:a(s)});n.forEach(function(e){this.manager.recordArraysForRecord(e).add(this)},this);Ember.run.once(this,"trigger","didLoad")}})});r("ember-data/system/record_arrays/filtered_record_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get;r["default"]=t.extend({filterFunction:null,isLoaded:true,replace:function(){var e=i(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=i(this,"manager");e.updateFilter(this,i(this,"type"),i(this,"filterFunction"))},updateFilter:Ember.observer(function(){Ember.run.once(this,this._updateFilter)},"filterFunction"),_unregisterFromManager:function(){this.manager.unregisterFilteredRecordArray(this)},willDestroy:function(){this._unregisterFromManager();this._super()}})});r("ember-data/system/record_arrays/many_array",["ember-data/system/record_arrays/record_array","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.get,a=Ember.set;r["default"]=t.extend({init:function(){this._super.apply(this,arguments)},isPolymorphic:false,isLoaded:false,relationship:null,promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--;if(this.loadingRecordsCount===0){a(this,"isLoaded",true);this.trigger("didLoad")}},replaceContent:function(e,r,t){var a;if(r>0){a=i(this,"content").slice(e,e+r);this.get("relationship").removeRecords(a)}if(t){this.get("relationship").addRecords(t,e)}},reload:function(){return this.relationship.reload()},createRecord:function(e){var r=i(this,"store");var t=i(this,"type");var a;a=r.createRecord(t,e);this.pushObject(a);return a}})});r("ember-data/system/record_arrays/record_array",["ember-data/system/promise_proxies","exports"],function(e,r){"use strict";var t=e.PromiseArray;var i=Ember.get;r["default"]=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=i(this,"content");return r.objectAt(e)},update:function(){if(i(this,"isUpdating")){return}var e=i(this,"store");var r=i(this,"type");return e.fetchAll(r,this)},addRecord:function(e,r){var t=i(this,"content");if(r===undefined){t.addObject(e)}else{if(!t.contains(e)){t.insertAt(r,e)}}},pushRecord:function(e){i(this,"content").pushObject(e)},removeRecord:function(e){i(this,"content").removeObject(e)},save:function(){var e="DS: RecordArray#save "+i(this,"type");var r=Ember.RSVP.all(this.invoke("save"),e).then(function(e){return Ember.A(e)},null,"DS: RecordArray#save apply Ember.NativeArray");return t.create({promise:r})},_dissociateFromOwnRecords:function(){var e=this;this.forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},willDestroy:function(){this._dissociateFromOwnRecords();this._super()}})});r("ember-data/system/relationship-meta",["ember-inflector/system","exports"],function(e,r){"use strict";var t=e.singularize;function i(e,r){var i,a;i=r.type||r.key;if(typeof i==="string"){if(r.kind==="hasMany"){i=t(i)}a=e.modelFor(i)}else{a=r.type}return a}r.typeForRelationshipMeta=i;function a(e,r){return{key:r.key,kind:r.kind,type:i(e,r),options:r.options,parentType:r.parentType,isRelationship:true}}r.relationshipFromMeta=a});r("ember-data/system/relationships",["./relationships/belongs_to","./relationships/has_many","ember-data/system/relationships/ext","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r["default"];i.belongsTo=a;i.hasMany=n});r("ember-data/system/relationships/belongs_to",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}else{}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"belongsTo",key:null};return Ember.computed(function(e,r){if(arguments.length>1){if(r===undefined){r=null}if(r&&r.then){this._relationships[e].setRecordPromise(r)}else{this._relationships[e].setRecord(r)}}return this._relationships[e].getRecord()}).meta(t)}t.reopen({notifyBelongsToAdded:function(e,r){this.notifyPropertyChange(e)},notifyBelongsToRemoved:function(e){this.notifyPropertyChange(e)}});r["default"]=i});r("ember-data/system/relationships/ext",["ember-data/system/relationship-meta","ember-data/system/model","ember-data/system/map"],function(e,r,t){"use strict";var i=e.typeForRelationshipMeta;var a=e.relationshipFromMeta;var n=r.Model;var s=t.Map;var o=t.MapWithDefault;var u=Ember.get;var d=Ember.ArrayPolyfills.filter;n.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});n.reopenClass({typeForRelationship:function(e){var r=u(this,"relationshipsByName").get(e);return r&&r.type},inverseMap:Ember.computed(function(){return Ember.create(null)}),inverseFor:function(e){var r=u(this,"inverseMap");if(r[e]){return r[e]}else{var t=this._findInverseFor(e);r[e]=t;return t}},_findInverseFor:function(e){var r=this.typeForRelationship(e);if(!r){return null}var t=this.metaForProperty(e).options;if(t.inverse===null){return null}var i,a,n;if(t.inverse){i=t.inverse;n=Ember.get(r,"relationshipsByName").get(i);a=n.kind}else{var s=c(this,r);if(s.length===0){return null}var o=d.call(s,function(t){var i=r.metaForProperty(t.name).options;return e===i.inverse});if(o.length===1){s=o}i=s[0].name;a=s[0].kind}function c(r,t,i){var a=i||[];var n=u(t,"relationships");if(!n){return}var s=n.get(r);s=d.call(s,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(s){a.push.apply(a,s)}if(r.superclass){c(r.superclass,t,a)}return a}return{type:r,name:i,kind:a}},relationships:Ember.computed(function(){var e=new o({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var a=e.get(i(this.store,t));a.push({name:r,kind:t.kind})}});return e}).cacheable(false).readOnly(),relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Ember.computed(function(){var e;var r=Ember.A();this.eachComputedProperty(function(t,a){if(a.isRelationship){a.key=t;e=i(this.store,a);if(!r.contains(e)){r.push(e)}}});return r}).cacheable(false).readOnly(),relationshipsByName:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var n=a(this.store,t);n.type=i(this.store,t);e.set(r,n)}});return e}).cacheable(false).readOnly(),fields:Ember.computed(function(){var e=s.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){e.set(r,t.kind)}else if(t.isAttribute){e.set(r,"attribute")}});return e}).readOnly(),eachRelationship:function(e,r){u(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){u(this,"relatedTypes").forEach(function(t){e.call(r,t)})},determineRelationshipType:function(e){var r=e.key;var t=e.kind;var i=this.inverseFor(r);var a,n;if(!i){return t==="belongsTo"?"oneToNone":"manyToNone"}a=i.name;n=i.kind;if(n==="belongsTo"){return t==="belongsTo"?"oneToOne":"manyToOne"}else{return t==="belongsTo"?"oneToMany":"manyToMany"}}});n.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return u(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e)}})});r("ember-data/system/relationships/has_many",["ember-data/system/model","exports"],function(e,r){"use strict";var t=e.Model;function i(e,r){if(typeof e==="object"){r=e;e=undefined}r=r||{};var t={type:e,isRelationship:true,options:r,kind:"hasMany",key:null};return Ember.computed(function(e){var r=this._relationships[e];return r.getRecords()}).meta(t).readOnly()}t.reopen({notifyHasManyAdded:function(e,r,t){var i=this._relationships[e];var a=i.manyArray;a.addRecord(r,t);this.notifyPropertyChange(e)},notifyHasManyRemoved:function(e,r){var t=this._relationships[e];var i=t.manyArray;i.removeRecord(r)}});r["default"]=i});r("ember-data/system/relationships/relationship",["ember-data/system/promise_proxies","ember-data/system/map","exports"],function(e,r,t){"use strict";var i=e.PromiseManyArray;var a=e.PromiseObject;var n=r.OrderedSet;var s=function(e,r,t,i){this.members=new n;this.store=e;this.key=i.key;this.inverseKey=t;this.record=r;this.isAsync=i.options.async;this.relationshipMeta=i;this.inverseKeyForImplicit=this.store.modelFor(this.record.constructor).typeKey+this.key;this.linkPromise=null};s.prototype={constructor:s,destroy:Ember.K,clear:function(){this.members.forEach(function(e){this.removeRecord(e)},this)},disconnect:function(){this.members.forEach(function(e){this.removeRecordFromInverse(e)},this)},reconnect:function(){this.members.forEach(function(e){this.addRecordToInverse(e)},this)},removeRecords:function(e){var r=Ember.get(e,"length");var t;for(var i=0;i<r;i++){t=e[i];this.removeRecord(t)}},addRecords:function(e,r){var t=Ember.get(e,"length");var i;for(var a=0;a<t;a++){i=e[a];this.addRecord(i,r);if(r!==undefined){r++}}},addRecord:function(e,r){if(!this.members.has(e)){this.members.add(e);this.notifyRecordRelationshipAdded(e,r);if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new s(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)}this.record.updateRecordArrays()}},removeRecord:function(e){if(this.members.has(e)){this.removeRecordFromOwn(e);if(this.inverseKey){this.removeRecordFromInverse(e)}else{if(e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record)}}}},addRecordToInverse:function(e){if(this.inverseKey){e._relationships[this.inverseKey].addRecord(this.record)}},removeRecordFromInverse:function(e){var r=e._relationships[this.inverseKey];if(r){r.removeRecordFromOwn(this.record)}},removeRecordFromOwn:function(e){this.members["delete"](e);this.notifyRecordRelationshipRemoved(e);this.record.updateRecordArrays()},updateLink:function(e){if(e!==this.link){this.link=e;this.linkPromise=null;this.record.notifyPropertyChange(this.key)}},findLink:function(){if(this.linkPromise){return this.linkPromise}else{var e=this.fetchLink();this.linkPromise=e;return e.then(function(e){return e})}},updateRecordsFromAdapter:function(e){this.computeChanges(e)},notifyRecordRelationshipAdded:Ember.K,notifyRecordRelationshipRemoved:Ember.K};var o=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.manyArray=e.recordArrayManager.createManyArray(this.belongsToType,Ember.A());this.manyArray.relationship=this;this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic
3
+ };o.prototype=Ember.create(s.prototype);o.prototype.constructor=o;o.prototype._super$constructor=s;o.prototype.destroy=function(){this.manyArray.destroy()};o.prototype.notifyRecordRelationshipAdded=function(e,r){this.record.notifyHasManyAdded(this.key,e,r)};o.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyHasManyRemoved(this.key,e)};o.prototype.reload=function(){var e=this;if(this.link){return this.fetchLink()}else{return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function(){e.manyArray.set("isLoaded",true);return e.manyArray})}};o.prototype.computeChanges=function(e){var r=this.members;var t=[];var i;var a;var n;e=d(e);r.forEach(function(r){if(e.has(r))return;t.push(r)});this.removeRecords(t);var s=this.manyArray;e=e.toArray();i=e.length;for(n=0;n<i;n++){a=e[n];if(s.objectAt(n)===a){continue}this.removeRecord(a);this.addRecord(a,n)}};o.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(r){e.updateRecordsFromAdapter(r);return e.manyArray})};o.prototype.findRecords=function(){var e=this.manyArray;return this.store.findMany(e.toArray()).then(function(){e.set("isLoaded",true);return e})};o.prototype.getRecords=function(){if(this.isAsync){var e=this;var r;if(this.link){r=this.findLink().then(function(){return e.findRecords()})}else{r=this.findRecords()}return i.create({content:this.manyArray,promise:r})}else{if(!this.manyArray.get("isDestroyed")){this.manyArray.set("isLoaded",true)}return this.manyArray}};var u=function(e,r,t,i){this._super$constructor(e,r,t,i);this.record=r;this.key=i.key;this.inverseRecord=null};u.prototype=Ember.create(s.prototype);u.prototype.constructor=u;u.prototype._super$constructor=s;u.prototype.setRecord=function(e){if(e){this.addRecord(e)}else if(this.inverseRecord){this.removeRecord(this.inverseRecord)}};u.prototype._super$addRecord=s.prototype.addRecord;u.prototype.addRecord=function(e){if(this.members.has(e)){return}var r=this.relationshipMeta.type;if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.inverseRecord=e;this._super$addRecord(e)};u.prototype.setRecordPromise=function(e){var r=e.get&&e.get("content");this.setRecord(r)};u.prototype.notifyRecordRelationshipAdded=function(e){this.record.notifyBelongsToAdded(this.key,this)};u.prototype.notifyRecordRelationshipRemoved=function(e){this.record.notifyBelongsToRemoved(this.key,this)};u.prototype._super$removeRecordFromOwn=s.prototype.removeRecordFromOwn;u.prototype.removeRecordFromOwn=function(e){if(!this.members.has(e)){return}this.inverseRecord=null;this._super$removeRecordFromOwn(e)};u.prototype.findRecord=function(){if(this.inverseRecord){return this.store._findByRecord(this.inverseRecord)}else{return Ember.RSVP.Promise.resolve(null)}};u.prototype.fetchLink=function(){var e=this;return this.store.findBelongsTo(this.record,this.link,this.relationshipMeta).then(function(r){if(r){e.addRecord(r)}return r})};u.prototype.getRecord=function(){if(this.isAsync){var e;if(this.link){var r=this;e=this.findLink().then(function(){return r.findRecord()})}else{e=this.findRecord()}return a.create({promise:e,content:this.inverseRecord})}else{return this.inverseRecord}};function d(e){var r=new n;if(e){for(var t=0,i=e.length;t<i;t++){r.add(e[t])}}return r}var c=function(e,r,t){var i;var a=e.constructor.inverseFor(r.key);if(a){i=a.name}if(r.kind==="hasMany"){return new o(t,e,i,r)}else{return new u(t,e,i,r)}};t.Relationship=s;t.ManyRelationship=o;t.BelongsToRelationship=u;t.createRelationshipFor=c});r("ember-data/system/store",["ember-data/system/adapter","ember-inflector/system/string","ember-data/system/map","ember-data/system/promise_proxies","exports"],function(e,r,i,a,n){"use strict";var s=e.InvalidError;var o=e.Adapter;var u=r.singularize;var d=i.Map;var c=a.promiseArray;var l=a.promiseObject;var f=Ember.get;var h=Ember.set;var p=Ember.run.once;var m=Ember.isNone;var y=Ember.EnumerableUtils.forEach;var v=Ember.EnumerableUtils.indexOf;var b=Ember.EnumerableUtils.map;var g=Ember.RSVP.Promise;var E=Ember.copy;var R,_,A;var F=Ember.String.camelize;function z(e){return e==null?null:e+""}R=Ember.Object.extend({init:function(){if(!_){_=t("ember-data/system/record_array_manager")["default"]}this.typeMaps={};this.recordArrayManager=_.create({store:this});this._pendingSave=[];this._pendingFetch=d.create()},adapter:"-rest",serialize:function(e,r){return this.serializerFor(e.constructor.typeKey).serialize(e,r)},defaultAdapter:Ember.computed("adapter",function(){var e=f(this,"adapter");if(typeof e==="string"){e=this.container.lookup("adapter:"+e)||this.container.lookup("adapter:application")||this.container.lookup("adapter:-rest")}if(DS.Adapter.detect(e)){e=e.create({container:this.container})}return e}),createRecord:function(e,r){var t=this.modelFor(e);var i=E(r)||{};if(m(i.id)){i.id=this._generateId(t)}i.id=z(i.id);var a=this.buildRecord(t,i.id);a.loadedData();a.setProperties(i);return a},_generateId:function(e){var r=this.adapterFor(e);if(r&&r.generateIdForRecord){return r.generateIdForRecord(this)}return null},deleteRecord:function(e){e.deleteRecord()},unloadRecord:function(e){e.unloadRecord()},find:function(e,r,t){if(arguments.length===1){return this.findAll(e)}if(Ember.typeOf(r)==="object"){return this.findQuery(e,r)}return this.findById(e,z(r),t)},fetch:function(e,r,t){if(this.hasRecordForId(e,r)){return this.getById(e,r).reload()}else{return this.find(e,r,t)}},findById:function(e,r,t){var i=this.modelFor(e);var a=this.recordForId(i,r);return this._findByRecord(a,t)},_findByRecord:function(e,r){var t;if(r){e._preloadData(r)}if(f(e,"isEmpty")){t=this.scheduleFetch(e)}else if(f(e,"isLoading")){t=e._loadingPromise}return l(t||e,"DS: Store#findByRecord "+e.typeKey+" with id: "+f(e,"id"))},findByIds:function(e,r){var t=this;return c(Ember.RSVP.all(b(r,function(r){return t.findById(e,r)})).then(Ember.A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e){var r=e.constructor;var t=f(e,"id");var i=this.adapterFor(r);var a=I(i,this,r,t,e);return a},scheduleFetchMany:function(e){return g.all(b(e,this.scheduleFetch,this))},scheduleFetch:function(e){var r=e.constructor;if(m(e)){return null}if(e._loadingPromise){return e._loadingPromise}var t=Ember.RSVP.defer("Fetching "+r+"with id: "+e.get("id"));var i={record:e,resolver:t};var a=t.promise;e.loadingData(a);if(!this._pendingFetch.get(r)){this._pendingFetch.set(r,[i])}else{this._pendingFetch.get(r).push(i)}Ember.run.scheduleOnce("afterRender",this,this.flushAllPendingFetches);return a},flushAllPendingFetches:function(){if(this.isDestroyed||this.isDestroying){return}this._pendingFetch.forEach(this._flushPendingFetchForType,this);this._pendingFetch=d.create()},_flushPendingFetchForType:function(e,r){var t=this;var i=t.adapterFor(r);var a=!!i.findMany&&i.coalesceFindRequests;var n=Ember.A(e).mapBy("record");function s(e){e.resolver.resolve(t.fetchRecord(e.record))}function o(r){y(r,function(r){var t=Ember.A(e).findBy("record",r);if(t){var i=t.resolver;i.resolve(r)}})}function u(e){return function r(t){var i=e.without(t);c(i)}}function d(e){return function(r){c(e,r)}}function c(r,t){y(r,function(r){var i=Ember.A(e).findBy("record",r);if(i){var a=i.resolver;a.reject(t)}})}if(e.length===1){s(e[0])}else if(a){var l=i.groupRecordsForFindMany(this,n);y(l,function(a){var n=Ember.A(a);var c=n.mapBy("id");if(c.length>1){$(i,t,r,c,n).then(o).then(u(n)).then(null,d(n))}else if(c.length===1){var l=Ember.A(e).findBy("record",a[0]);s(l)}else{}})}else{y(e,s)}},getById:function(e,r){if(this.hasRecordForId(e,r)){return this.recordForId(e,r)}else{return null}},reloadRecord:function(e){var r=e.constructor;var t=this.adapterFor(r);var i=f(e,"id");return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=z(r);return!!this.typeMapFor(t).idToRecord[i]},recordForId:function(e,r){var t=this.modelFor(e);var i=z(r);var a=this.typeMapFor(t).idToRecord;var n=a[i];if(!n||!a[i]){n=this.buildRecord(t,i)}return n},findMany:function(e){var r=this;return g.all(b(e,function(e){return r._findByRecord(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.constructor);return L(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.constructor);return K(i,this,e,r,t)},findQuery:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var a=this.adapterFor(t);return c(U(a,this,t,r,i))},findAll:function(e){var r=this.modelFor(e);return this.fetchAll(r,this.all(r))},fetchAll:function(e,r){var t=this.adapterFor(e);var i=this.typeMapFor(e).metadata.since;h(r,"isUpdating",true);return c(j(t,this,e,i))},didUpdateAll:function(e){var r=this.typeMapFor(e).findAllCache;h(r,"isUpdating",false)},all:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.findAllCache;if(i){return i}var a=this.recordArrayManager.createRecordArray(r);t.findAllCache=a;return a},unloadAll:function(e){var r=this.modelFor(e);var t=this.typeMapFor(r);var i=t.records.slice();var a;for(var n=0;n<i.length;n++){a=i[n];a.unloadRecord();a.destroy()}t.findAllCache=null},filter:function(e,r,t){var i;var a=arguments.length;var n;var s=a===3;if(s){i=this.findQuery(e,r)}else if(arguments.length===2){t=r}e=this.modelFor(e);if(s){n=this.recordArrayManager.createFilteredRecordArray(e,t,r)}else{n=this.recordArrayManager.createFilteredRecordArray(e,t)}i=i||g.cast(n);return c(i.then(function(){return n},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,r){if(!this.hasRecordForId(e,r)){return false}return!f(this.recordForId(e,r),"isEmpty")},metadataFor:function(e){e=this.modelFor(e);return this.typeMapFor(e).metadata},dataWasUpdated:function(e,r){this.recordArrayManager.recordDidChange(r)},scheduleSave:function(e,r){e.adapterWillCommit();this._pendingSave.push([e,r]);p(this,"flushPendingSave")},flushPendingSave:function(){var e=this._pendingSave.slice();this._pendingSave=[];y(e,function(e){var r=e[0],t=e[1];var i=this.adapterFor(r.constructor);var a;if(f(r,"currentState.stateName")==="root.deleted.saved"){return t.resolve(r)}else if(f(r,"isNew")){a="createRecord"}else if(f(r,"isDeleted")){a="deleteRecord"}else{a="updateRecord"}t.resolve(B(i,this,a,r))},this)},didSaveRecord:function(e,r){if(r){r=x(this,e.constructor,r,e);N(this,e,r);this.updateId(e,r)}e.adapterDidCommit(r)},recordWasInvalid:function(e,r){e.adapterDidInvalidate(r)},recordWasError:function(e){e.adapterDidError()},updateId:function(e,r){var t=f(e,"id");var i=z(r.id);this.typeMapFor(e.constructor).idToRecord[i]=e;h(e,"id",i)},typeMapFor:function(e){var r=f(this,"typeMaps");var t=Ember.guidFor(e);var i;i=r[t];if(i){return i}i={idToRecord:Ember.create(null),records:[],metadata:Ember.create(null),type:e};r[t]=i;return i},_load:function(e,r,t){var i=z(r.id);var a=this.recordForId(e,i);a.setupData(r,t);this.recordArrayManager.recordDidChange(a);return a},modelFor:function(e){var r;if(typeof e==="string"){r=this.modelFactoryFor(e);if(!r){throw new Ember.Error("No model was found for '"+e+"'")}r.typeKey=r.typeKey||this._normalizeTypeKey(e)}else{r=e;if(r.typeKey){r.typeKey=this._normalizeTypeKey(r.typeKey)}}r.store=this;return r},modelFactoryFor:function(e){return this.container.lookupFactory("model:"+e)},push:function(e,r,t){var i=this.modelFor(e);var a=Ember.EnumerableUtils.filter;r=x(this,i,r);this._load(i,r,t);var n=this.recordForId(i,r.id);N(this,n,r);return n},pushPayload:function(e,r){var t;var i;if(!r){i=e;t=D(this.container)}else{i=r;t=this.serializerFor(e)}t.pushPayload(this,i)},normalize:function(e,r){var t=this.serializerFor(e);var i=this.modelFor(e);return t.normalize(i,r)},update:function(e,r){return this.push(e,r,true)},pushMany:function(e,r){var t=r.length;var i=new Array(t);for(var a=0;a<t;a++){i[a]=this.push(e,r[a])}return i},metaForType:function(e,r){var t=this.modelFor(e);Ember.merge(this.typeMapFor(t).metadata,r)},buildRecord:function(e,r,t){var i=this.typeMapFor(e);var a=i.idToRecord;var n=e._create({id:r,store:this,container:this.container});if(t){n.setupData(t)}if(r){a[r]=n}i.records.push(n);return n},dematerializeRecord:function(e){var r=e.constructor;var t=this.typeMapFor(r);var i=f(e,"id");e.updateRecordArrays();if(i){delete t.idToRecord[i]}var a=v(t.records,e);t.records.splice(a,1)},adapterFor:function(e){var r=this.container,t;if(r){t=r.lookup("adapter:"+e.typeKey)||r.lookup("adapter:application")}return t||f(this,"defaultAdapter")},serializerFor:function(e){e=this.modelFor(e);var r=this.adapterFor(e);return M(this.container,e.typeKey,r&&r.defaultSerializer)},willDestroy:function(){var e=this.typeMaps;var r=Ember.keys(e);var t=b(r,i);this.recordArrayManager.destroy();y(t,this.unloadAll,this);function i(r){return e[r]["type"]}},_normalizeTypeKey:function(e){return F(u(e))}});function x(e,r,t,i){r.eachRelationship(function(r,i){var a=i.kind;var n=t[r];if(a==="belongsTo"){T(e,t,r,i,n)}else if(a==="hasMany"){k(e,t,r,i,n)}});return t}function T(e,r,i,a,n){if(!A){A=t("ember-data/system/model")["Model"]}if(m(n)||n instanceof A){return}var s;if(typeof n==="number"||typeof n==="string"){s=S(a,i,r);r[i]=e.recordForId(s,n)}else if(typeof n==="object"){r[i]=e.recordForId(n.type,n.id)}}function S(e,r,t){if(e.options.polymorphic){return t[r+"Type"]}else{return e.type}}function k(e,r,t,i,a){if(m(a)){return}for(var n=0,s=a.length;n<s;n++){T(e,a,n,i,a[n])}}function M(e,r,t){return e.lookup("serializer:"+r)||e.lookup("serializer:application")||e.lookup("serializer:"+t)||e.lookup("serializer:-default")}function D(e){return e.lookup("serializer:application")||e.lookup("serializer:-default")}function P(e,r){var t=e.serializer;var i=e.defaultSerializer;var a=e.container;if(a&&t===undefined){t=M(a,r.typeKey,i)}if(t===null||t===undefined){t={extract:function(e,r,t){return t}}}return t}function w(e){return!(f(e,"isDestroyed")||f(e,"isDestroying"))}function O(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function C(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function I(e,r,t,i,a){var n=e.find(r,t,i,a);var s=P(e,t);var o="DS: Handle Adapter#find of "+t+" with id: "+i;n=g.cast(n,o);n=O(n,C(w,r));return n.then(function(e){var a=s.extract(r,t,e,i,"find");return r.push(t,a)},function(e){var a=r.getById(t,i);if(a){a.notFound()}throw e},"DS: Extract payload of '"+t+"'")}function $(e,r,t,i,a){var n=e.findMany(r,t,i,a);var s=P(e,t);var o="DS: Handle Adapter#findMany of "+t;if(n===undefined){throw new Error("adapter.findMany returned undefined, this was very likely a mistake")}n=g.cast(n,o);n=O(n,C(w,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findMany");return r.pushMany(t,i)},null,"DS: Extract payload of "+t)}function L(e,r,t,i,a){var n=e.findHasMany(r,t,i,a);var s=P(e,a.type);var o="DS: Handle Adapter#findHasMany of "+t+" : "+a.type;n=g.cast(n,o);n=O(n,C(w,r));n=O(n,C(w,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findHasMany");var i=r.pushMany(a.type,t);return i},null,"DS: Extract payload of "+t+" : hasMany "+a.type)}function K(e,r,t,i,a){var n=e.findBelongsTo(r,t,i,a);var s=P(e,a.type);var o="DS: Handle Adapter#findBelongsTo of "+t+" : "+a.type;n=g.cast(n,o);n=O(n,C(w,r));n=O(n,C(w,t));return n.then(function(e){var t=s.extract(r,a.type,e,null,"findBelongsTo");if(!t){return null}var i=r.push(a.type,t);return i},null,"DS: Extract payload of "+t+" : "+a.type)}function j(e,r,t,i){var a=e.findAll(r,t,i);var n=P(e,t);var s="DS: Handle Adapter#findAll of "+t;a=g.cast(a,s);a=O(a,C(w,r));return a.then(function(e){var i=n.extract(r,t,e,null,"findAll");r.pushMany(t,i);r.didUpdateAll(t);return r.all(t)},null,"DS: Extract payload of findAll "+t)}function U(e,r,t,i,a){var n=e.findQuery(r,t,i,a);var s=P(e,t);var o="DS: Handle Adapter#findQuery of "+t;n=g.cast(n,o);n=O(n,C(w,r));return n.then(function(e){var i=s.extract(r,t,e,null,"findQuery");a.load(i);return a},null,"DS: Extract payload of findQuery "+t)}function B(e,r,t,i){var a=i.constructor;var n=e[t](r,a,i);var o=P(e,a);var u="DS: Extract and notify about "+t+" completion of "+i;n=g.cast(n,u);n=O(n,C(w,r));n=O(n,C(w,i));return n.then(function(e){var n;if(e){n=o.extract(r,a,e,f(i,"id"),t)}else{n=e}r.didSaveRecord(i,n);return i},function(e){if(e instanceof s){var t=o.extractErrors(r,a,e.errors,f(i,"id"));r.recordWasInvalid(i,t);e=new s(t)}else{r.recordWasError(i,e)}throw e},u)}function N(e,r,t){var i=r.constructor;i.eachRelationship(function(e,i){var a=i.kind;var n=t[e];var s=r._relationships[e];if(t.links&&t.links[e]){s.updateLink(t.links[e])}if(a==="belongsTo"){if(n===undefined){return}s.setRecord(n)}else if(a==="hasMany"&&n){s.updateRecordsFromAdapter(n)}})}n.Store=R;n["default"]=R});r("ember-data/transforms",["ember-data/transforms/base","ember-data/transforms/number","ember-data/transforms/date","ember-data/transforms/string","ember-data/transforms/boolean","exports"],function(e,r,t,i,a,n){"use strict";var s=e["default"];var o=r["default"];var u=t["default"];var d=i["default"];var c=a["default"];n.Transform=s;n.NumberTransform=o;n.DateTransform=u;n.StringTransform=d;n.BooleanTransform=c});r("ember-data/transforms/base",["exports"],function(e){"use strict";e["default"]=Ember.Object.extend({serialize:Ember.required(),deserialize:Ember.required()})});r("ember-data/transforms/boolean",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="boolean"){return e}else if(r==="string"){return e.match(/^true$|^t$|^1$/i)!==null}else if(r==="number"){return e===1}else{return false}},serialize:function(e){return Boolean(e)}})});r("ember-data/transforms/date",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Date.prototype.toISOString||function(){function e(e){if(e<10){return"0"+e}return e}return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};if(Ember.SHIM_ES5){if(!Date.prototype.toISOString){Date.prototype.toISOString=i}}r["default"]=t.extend({deserialize:function(e){var r=typeof e;if(r==="string"){return new Date(Ember.Date.parse(e))}else if(r==="number"){return new Date(e)}else if(e===null||e===undefined){return e}else{return null}},serialize:function(e){if(e instanceof Date){return i.call(e)}else{return null}}})});r("ember-data/transforms/number",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isEmpty;r["default"]=t.extend({deserialize:function(e){return i(e)?null:Number(e)},serialize:function(e){return i(e)?null:Number(e)}})});r("ember-data/transforms/string",["ember-data/transforms/base","exports"],function(e,r){"use strict";var t=e["default"];var i=Ember.isNone;r["default"]=t.extend({deserialize:function(e){return i(e)?null:String(e)},serialize:function(e){return i(e)?null:String(e)}})});r("ember-inflector",["./system","./helpers","./ext/string","exports"],function(e,r,t,i){"use strict";var a=e.Inflector;var n=e.defaultRules;var s=e.pluralize;var o=e.singularize;a.defaultRules=n;Ember.Inflector=a;Ember.String.pluralize=s;Ember.String.singularize=o;i["default"]=a;i.pluralize=s;i.singularize=o});r("ember-inflector/ext/string",["../system/string"],function(e){"use strict";var r=e.pluralize;var t=e.singularize;if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.String){String.prototype.pluralize=function(){return r(this)};String.prototype.singularize=function(){return t(this)}}});r("ember-inflector/helpers",["./system/string"],function(e){"use strict";var r=e.singularize;var t=e.pluralize;Ember.Handlebars.helper("singularize",r);Ember.Handlebars.helper("pluralize",t)});r("ember-inflector/system",["./system/inflector","./system/string","./system/inflections","exports"],function(e,r,t,i){"use strict";var a=e["default"];var n=r.pluralize;var s=r.singularize;var o=t["default"];a.inflector=new a(o);i.Inflector=a;i.singularize=s;i.pluralize=n;i.defaultRules=o});r("ember-inflector/system/inflections",["exports"],function(e){"use strict";e["default"]={plurals:[[/$/,"s"],[/s$/i,"s"],[/^(ax|test)is$/i,"$1es"],[/(octop|vir)us$/i,"$1i"],[/(octop|vir)i$/i,"$1i"],[/(alias|status)$/i,"$1es"],[/(bu)s$/i,"$1ses"],[/(buffal|tomat)o$/i,"$1oes"],[/([ti])um$/i,"$1a"],[/([ti])a$/i,"$1a"],[/sis$/i,"ses"],[/(?:([^f])fe|([lr])f)$/i,"$1$2ves"],[/(hive)$/i,"$1s"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/(x|ch|ss|sh)$/i,"$1es"],[/(matr|vert|ind)(?:ix|ex)$/i,"$1ices"],[/^(m|l)ouse$/i,"$1ice"],[/^(m|l)ice$/i,"$1ice"],[/^(ox)$/i,"$1en"],[/^(oxen)$/i,"$1"],[/(quiz)$/i,"$1zes"]],singular:[[/s$/i,""],[/(ss)$/i,"$1"],[/(n)ews$/i,"$1ews"],[/([ti])a$/i,"$1um"],[/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i,"$1sis"],[/(^analy)(sis|ses)$/i,"$1sis"],[/([^f])ves$/i,"$1fe"],[/(hive)s$/i,"$1"],[/(tive)s$/i,"$1"],[/([lr])ves$/i,"$1f"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/(s)eries$/i,"$1eries"],[/(m)ovies$/i,"$1ovie"],[/(x|ch|ss|sh)es$/i,"$1"],[/^(m|l)ice$/i,"$1ouse"],[/(bus)(es)?$/i,"$1"],[/(o)es$/i,"$1"],[/(shoe)s$/i,"$1"],[/(cris|test)(is|es)$/i,"$1is"],[/^(a)x[ie]s$/i,"$1xis"],[/(octop|vir)(us|i)$/i,"$1us"],[/(alias|status)(es)?$/i,"$1"],[/^(ox)en/i,"$1"],[/(vert|ind)ices$/i,"$1ex"],[/(matr)ices$/i,"$1ix"],[/(quiz)zes$/i,"$1"],[/(database)s$/i,"$1"]],irregularPairs:[["person","people"],["man","men"],["child","children"],["sex","sexes"],["move","moves"],["cow","kine"],["zombie","zombies"]],uncountable:["equipment","information","rice","money","species","series","fish","sheep","jeans","police"]}});r("ember-inflector/system/inflector",["exports"],function(e){"use strict";var r=/^\s*$/;var t=/(\w+[_-])([a-z\d]+$)/;var i=/(\w+)([A-Z][a-z\d]*$)/;var a=/[A-Z][a-z\d]*$/;function n(e,r){for(var t=0,i=r.length;t<i;t++){e.uncountable[r[t].toLowerCase()]=true}}function s(e,r){var t;for(var i=0,a=r.length;i<a;i++){t=r[i];e.irregular[t[0].toLowerCase()]=t[1];e.irregular[t[1].toLowerCase()]=t[1];e.irregularInverse[t[1].toLowerCase()]=t[0];e.irregularInverse[t[0].toLowerCase()]=t[0]}}function o(e){e=e||{};e.uncountable=e.uncountable||u();e.irregularPairs=e.irregularPairs||u();var r=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:u(),irregularInverse:u(),uncountable:u()};n(r,e.uncountable);s(r,e.irregularPairs);this.enableCache()}if(!Object.create&&!Object.create(null).hasOwnProperty){throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg")}function u(){var e=Object.create(null);e["_dict"]=null;delete e["_dict"];return e}o.prototype={enableCache:function(){this.purgeCache();this.singularize=function(e){this._cacheUsed=true;return this._sCache[e]||(this._sCache[e]=this._singularize(e))};this.pluralize=function(e){this._cacheUsed=true;return this._pCache[e]||(this._pCache[e]=this._pluralize(e))}},purgeCache:function(){this._cacheUsed=false;this._sCache=u();this._pCache=u()},disableCache:function(){this._sCache=null;this._pCache=null;this.singularize=function(e){return this._singularize(e)};this.pluralize=function(e){return this._pluralize(e)}},plural:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.plurals.push([e,r.toLowerCase()])},singular:function(e,r){if(this._cacheUsed){this.purgeCache()}this.rules.singular.push([e,r.toLowerCase()])},uncountable:function(e){if(this._cacheUsed){this.purgeCache()}n(this.rules,[e.toLowerCase()])},irregular:function(e,r){if(this._cacheUsed){this.purgeCache()}s(this.rules,[[e,r]])},pluralize:function(e){return this._pluralize(e)},_pluralize:function(e){return this.inflect(e,this.rules.plurals,this.rules.irregular)},singularize:function(e){return this._singularize(e)},_singularize:function(e){return this.inflect(e,this.rules.singular,this.rules.irregularInverse)},inflect:function(e,n,s){var o,u,d,c,l,f,h,p,m,y,v,b,g;p=r.test(e);m=a.test(e);f="";if(p){return e}c=e.toLowerCase();l=t.exec(e)||i.exec(e);if(l){f=l[1];h=l[2].toLowerCase()}y=this.rules.uncountable[c]||this.rules.uncountable[h];if(y){return e}v=s&&(s[c]||s[h]);if(v){if(s[c]){return v}else{v=m?v.capitalize():v;return f+v}}for(var E=n.length,R=0;E>R;E--){o=n[E-1];g=o[0];if(g.test(e)){break}}o=o||[];g=o[0];u=o[1];d=e.replace(g,u);return d}};e["default"]=o});r("ember-inflector/system/string",["./inflector","exports"],function(e,r){"use strict";var t=e["default"];function i(e){return t.inflector.pluralize(e)}function a(e){return t.inflector.singularize(e)}r.pluralize=i;r.singularize=a});e.DS=t("ember-data")["default"]})(this);
@@ -49,7 +49,6 @@ define("activemodel-adapter/system/active_model_adapter",
49
49
  @module ember-data
50
50
  */
51
51
 
52
- var forEach = Ember.EnumerableUtils.forEach;
53
52
  var decamelize = Ember.String.decamelize,
54
53
  underscore = Ember.String.underscore;
55
54
 
@@ -59,7 +58,7 @@ define("activemodel-adapter/system/active_model_adapter",
59
58
  It has been designed to work out of the box with the
60
59
  [active_model_serializers](http://github.com/rails-api/active_model_serializers)
61
60
  Ruby gem. This Adapter expects specific settings using ActiveModel::Serializers,
62
- `embed :ids, include: true` which sideloads the records.
61
+ `embed :ids, embed_in_root: true` which sideloads the records.
63
62
 
64
63
  This adapter extends the DS.RESTAdapter by making consistent use of the camelization,
65
64
  decamelization and pluralization methods to normalize the serialized JSON into a
@@ -185,18 +184,7 @@ define("activemodel-adapter/system/active_model_adapter",
185
184
  var error = this._super(jqXHR);
186
185
 
187
186
  if (jqXHR && jqXHR.status === 422) {
188
- var response = Ember.$.parseJSON(jqXHR.responseText),
189
- errors = {};
190
-
191
- if (response.errors !== undefined) {
192
- var jsonErrors = response.errors;
193
-
194
- forEach(Ember.keys(jsonErrors), function(key) {
195
- errors[Ember.String.camelize(key)] = jsonErrors[key];
196
- });
197
- }
198
-
199
- return new InvalidError(errors);
187
+ return new InvalidError(Ember.$.parseJSON(jqXHR.responseText));
200
188
  } else {
201
189
  return error;
202
190
  }
@@ -227,7 +215,7 @@ define("activemodel-adapter/system/active_model_serializer",
227
215
  It has been designed to work out of the box with the
228
216
  [active_model_serializers](http://github.com/rails-api/active_model_serializers)
229
217
  Ruby gem. This Serializer expects specific settings using ActiveModel::Serializers,
230
- `embed :ids, include: true` which sideloads the records.
218
+ `embed :ids, embed_in_root: true` which sideloads the records.
231
219
 
232
220
  This serializer extends the DS.RESTSerializer by making consistent
233
221
  use of the camelization, decamelization and pluralization methods to
@@ -502,8 +490,8 @@ define("activemodel-adapter/system/active_model_serializer",
502
490
  __exports__["default"] = ActiveModelSerializer;
503
491
  });
504
492
  define("ember-data",
505
- ["ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],
506
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __exports__) {
493
+ ["ember-data/system/create","ember-data/core","ember-data/ext/date","ember-data/system/promise_proxies","ember-data/system/store","ember-data/system/model","ember-data/system/adapter","ember-data/system/debug","ember-data/system/record_arrays","ember-data/system/record_array_manager","ember-data/adapters","ember-data/serializers/json_serializer","ember-data/serializers/rest_serializer","ember-inflector","ember-data/serializers/embedded_records_mixin","activemodel-adapter","ember-data/transforms","ember-data/system/relationships","ember-data/ember-initializer","ember-data/setup-container","ember-data/system/container_proxy","ember-data/system/relationships/relationship","exports"],
494
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __dependency22__, __exports__) {
507
495
  "use strict";
508
496
  /**
509
497
  Ember Data
@@ -515,43 +503,43 @@ define("ember-data",
515
503
  // support RSVP 2.x via resolve, but prefer RSVP 3.x's Promise.cast
516
504
  Ember.RSVP.Promise.cast = Ember.RSVP.Promise.cast || Ember.RSVP.resolve;
517
505
 
518
- var DS = __dependency1__["default"];
519
-
520
- var PromiseArray = __dependency3__.PromiseArray;
521
- var PromiseObject = __dependency3__.PromiseObject;
522
- var Store = __dependency4__.Store;
523
- var Model = __dependency5__.Model;
524
- var Errors = __dependency5__.Errors;
525
- var RootState = __dependency5__.RootState;
526
- var attr = __dependency5__.attr;
527
- var InvalidError = __dependency6__.InvalidError;
528
- var Adapter = __dependency6__.Adapter;
529
- var DebugAdapter = __dependency7__["default"];
530
- var RecordArray = __dependency8__.RecordArray;
531
- var FilteredRecordArray = __dependency8__.FilteredRecordArray;
532
- var AdapterPopulatedRecordArray = __dependency8__.AdapterPopulatedRecordArray;
533
- var ManyArray = __dependency8__.ManyArray;
534
- var RecordArrayManager = __dependency9__["default"];
535
- var RESTAdapter = __dependency10__.RESTAdapter;
536
- var FixtureAdapter = __dependency10__.FixtureAdapter;
537
- var JSONSerializer = __dependency11__["default"];
538
- var RESTSerializer = __dependency12__["default"];
539
- var EmbeddedRecordsMixin = __dependency14__["default"];
540
- var ActiveModelAdapter = __dependency15__.ActiveModelAdapter;
541
- var ActiveModelSerializer = __dependency15__.ActiveModelSerializer;
542
-
543
- var Transform = __dependency16__.Transform;
544
- var DateTransform = __dependency16__.DateTransform;
545
- var NumberTransform = __dependency16__.NumberTransform;
546
- var StringTransform = __dependency16__.StringTransform;
547
- var BooleanTransform = __dependency16__.BooleanTransform;
548
-
549
- var hasMany = __dependency17__.hasMany;
550
- var belongsTo = __dependency17__.belongsTo;
551
- var setupContainer = __dependency19__["default"];
552
-
553
- var ContainerProxy = __dependency20__["default"];
554
- var Relationship = __dependency21__.Relationship;
506
+ var DS = __dependency2__["default"];
507
+
508
+ var PromiseArray = __dependency4__.PromiseArray;
509
+ var PromiseObject = __dependency4__.PromiseObject;
510
+ var Store = __dependency5__.Store;
511
+ var Model = __dependency6__.Model;
512
+ var Errors = __dependency6__.Errors;
513
+ var RootState = __dependency6__.RootState;
514
+ var attr = __dependency6__.attr;
515
+ var InvalidError = __dependency7__.InvalidError;
516
+ var Adapter = __dependency7__.Adapter;
517
+ var DebugAdapter = __dependency8__["default"];
518
+ var RecordArray = __dependency9__.RecordArray;
519
+ var FilteredRecordArray = __dependency9__.FilteredRecordArray;
520
+ var AdapterPopulatedRecordArray = __dependency9__.AdapterPopulatedRecordArray;
521
+ var ManyArray = __dependency9__.ManyArray;
522
+ var RecordArrayManager = __dependency10__["default"];
523
+ var RESTAdapter = __dependency11__.RESTAdapter;
524
+ var FixtureAdapter = __dependency11__.FixtureAdapter;
525
+ var JSONSerializer = __dependency12__["default"];
526
+ var RESTSerializer = __dependency13__["default"];
527
+ var EmbeddedRecordsMixin = __dependency15__["default"];
528
+ var ActiveModelAdapter = __dependency16__.ActiveModelAdapter;
529
+ var ActiveModelSerializer = __dependency16__.ActiveModelSerializer;
530
+
531
+ var Transform = __dependency17__.Transform;
532
+ var DateTransform = __dependency17__.DateTransform;
533
+ var NumberTransform = __dependency17__.NumberTransform;
534
+ var StringTransform = __dependency17__.StringTransform;
535
+ var BooleanTransform = __dependency17__.BooleanTransform;
536
+
537
+ var hasMany = __dependency18__.hasMany;
538
+ var belongsTo = __dependency18__.belongsTo;
539
+ var setupContainer = __dependency20__["default"];
540
+
541
+ var ContainerProxy = __dependency21__["default"];
542
+ var Relationship = __dependency22__.Relationship;
555
543
 
556
544
  DS.Store = Store;
557
545
  DS.PromiseArray = PromiseArray;
@@ -1549,7 +1537,7 @@ define("ember-data/adapters/rest_adapter",
1549
1537
  },
1550
1538
 
1551
1539
  _stripIDFromURL: function(store, record) {
1552
- var type = store.modelFor(record);
1540
+ var type = record.constructor;
1553
1541
  var url = this.buildURL(type.typeKey, record.get('id'), record);
1554
1542
 
1555
1543
  var expandedURL = url.split('/');
@@ -1566,6 +1554,11 @@ define("ember-data/adapters/rest_adapter",
1566
1554
  return expandedURL.join('/');
1567
1555
  },
1568
1556
 
1557
+ /**
1558
+ http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
1559
+ */
1560
+ maxUrlLength: 2048,
1561
+
1569
1562
  /**
1570
1563
  Organize records into groups, each of which is to be passed to separate
1571
1564
  calls to `findMany`.
@@ -1583,6 +1576,7 @@ define("ember-data/adapters/rest_adapter",
1583
1576
  and `/posts/2/comments/3`
1584
1577
 
1585
1578
  @method groupRecordsForFindMany
1579
+ @param {DS.Store} store
1586
1580
  @param {Array} records
1587
1581
  @return {Array} an array of arrays of records, each of which is to be
1588
1582
  loaded separately by `findMany`.
@@ -1590,19 +1584,20 @@ define("ember-data/adapters/rest_adapter",
1590
1584
  groupRecordsForFindMany: function (store, records) {
1591
1585
  var groups = MapWithDefault.create({defaultValue: function(){return [];}});
1592
1586
  var adapter = this;
1587
+ var maxUrlLength = this.maxUrlLength;
1593
1588
 
1594
1589
  forEach.call(records, function(record){
1595
1590
  var baseUrl = adapter._stripIDFromURL(store, record);
1596
1591
  groups.get(baseUrl).push(record);
1597
1592
  });
1598
1593
 
1599
- function splitGroupToFitInUrl(group, maxUrlLength) {
1594
+ function splitGroupToFitInUrl(group, maxUrlLength, paramNameLength) {
1600
1595
  var baseUrl = adapter._stripIDFromURL(store, group[0]);
1601
1596
  var idsSize = 0;
1602
1597
  var splitGroups = [[]];
1603
1598
 
1604
1599
  forEach.call(group, function(record) {
1605
- var additionalLength = '&ids[]='.length + record.get('id.length');
1600
+ var additionalLength = encodeURIComponent(record.get('id')).length + paramNameLength;
1606
1601
  if (baseUrl.length + idsSize + additionalLength >= maxUrlLength) {
1607
1602
  idsSize = 0;
1608
1603
  splitGroups.push([]);
@@ -1619,9 +1614,8 @@ define("ember-data/adapters/rest_adapter",
1619
1614
 
1620
1615
  var groupsArray = [];
1621
1616
  groups.forEach(function(group, key){
1622
- // http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
1623
- var maxUrlLength = 2048;
1624
- var splitGroups = splitGroupToFitInUrl(group, maxUrlLength);
1617
+ var paramNameLength = '&ids%5B%5D='.length;
1618
+ var splitGroups = splitGroupToFitInUrl(group, maxUrlLength, paramNameLength);
1625
1619
 
1626
1620
  forEach.call(splitGroups, function(splitGroup) {
1627
1621
  groupsArray.push(splitGroup);
@@ -1661,19 +1655,25 @@ define("ember-data/adapters/rest_adapter",
1661
1655
  },
1662
1656
 
1663
1657
  /**
1664
- Takes an ajax response, and returns a relevant error.
1658
+ Takes an ajax response, and returns an error payload.
1665
1659
 
1666
1660
  Returning a `DS.InvalidError` from this method will cause the
1667
1661
  record to transition into the `invalid` state and make the
1668
1662
  `errors` object available on the record.
1669
1663
 
1664
+ This function should return the entire payload as received from the
1665
+ server. Error object extraction and normalization of model errors
1666
+ should be performed by `extractErrors` on the serializer.
1667
+
1668
+ Example
1669
+
1670
1670
  ```javascript
1671
1671
  App.ApplicationAdapter = DS.RESTAdapter.extend({
1672
1672
  ajaxError: function(jqXHR) {
1673
1673
  var error = this._super(jqXHR);
1674
1674
 
1675
1675
  if (jqXHR && jqXHR.status === 422) {
1676
- var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"];
1676
+ var jsonErrors = Ember.$.parseJSON(jqXHR.responseText);
1677
1677
 
1678
1678
  return new DS.InvalidError(jsonErrors);
1679
1679
  } else {
@@ -1717,12 +1717,12 @@ define("ember-data/adapters/rest_adapter",
1717
1717
  2. Your API might return errors as successful responses with status code
1718
1718
  200 and an Errors text or object. You can return a DS.InvalidError from
1719
1719
  this hook and it will automatically reject the promise and put your record
1720
- into the invald state.
1720
+ into the invalid state.
1721
1721
 
1722
- @method ajaxError
1722
+ @method ajaxSuccess
1723
1723
  @param {Object} jqXHR
1724
1724
  @param {Object} jsonPayload
1725
- @return {Object} jqXHR
1725
+ @return {Object} jsonPayload
1726
1726
  */
1727
1727
 
1728
1728
  ajaxSuccess: function(jqXHR, jsonPayload) {
@@ -1837,11 +1837,11 @@ define("ember-data/core",
1837
1837
  /**
1838
1838
  @property VERSION
1839
1839
  @type String
1840
- @default '1.0.0-beta.11'
1840
+ @default '1.0.0-beta.12'
1841
1841
  @static
1842
1842
  */
1843
1843
  DS = Ember.Namespace.create({
1844
- VERSION: '1.0.0-beta.11'
1844
+ VERSION: '1.0.0-beta.12'
1845
1845
  });
1846
1846
 
1847
1847
  if (Ember.libraries) {
@@ -2848,6 +2848,16 @@ define("ember-data/serializers/json_serializer",
2848
2848
  delete hash[primaryKey];
2849
2849
  },
2850
2850
 
2851
+ /**
2852
+ @method normalizeErrors
2853
+ @private
2854
+ */
2855
+ normalizeErrors: function(type, hash) {
2856
+ this.normalizeId(hash);
2857
+ this.normalizeAttributes(type, hash);
2858
+ this.normalizeRelationships(type, hash);
2859
+ },
2860
+
2851
2861
  /**
2852
2862
  Looks up the property key that was set by the custom `attr` mapping
2853
2863
  passed to the serializer.
@@ -3558,6 +3568,41 @@ define("ember-data/serializers/json_serializer",
3558
3568
  }
3559
3569
  },
3560
3570
 
3571
+ /**
3572
+ `extractErrors` is used to extract model errors when a call is made
3573
+ to `DS.Model#save` which fails with an InvalidError`. By default
3574
+ Ember Data expects error information to be located on the `errors`
3575
+ property of the payload object.
3576
+
3577
+ Example
3578
+
3579
+ ```javascript
3580
+ App.PostSerializer = DS.JSONSerializer.extend({
3581
+ extractErrors: function(store, type, payload, id) {
3582
+ if (payload && typeof payload === 'object' && payload._problems) {
3583
+ payload = payload._problems;
3584
+ this.normalizeErrors(type, payload);
3585
+ }
3586
+ return payload;
3587
+ }
3588
+ });
3589
+ ```
3590
+
3591
+ @method extractErrors
3592
+ @param {DS.Store} store
3593
+ @param {subclass of DS.Model} type
3594
+ @param {Object} payload
3595
+ @param {String or Number} id
3596
+ @return {Object} json The deserialized errors
3597
+ */
3598
+ extractErrors: function(store, type, payload, id) {
3599
+ if (payload && typeof payload === 'object' && payload.errors) {
3600
+ payload = payload.errors;
3601
+ this.normalizeErrors(type, payload);
3602
+ }
3603
+ return payload;
3604
+ },
3605
+
3561
3606
  /**
3562
3607
  `keyForAttribute` can be used to define rules for how to convert an
3563
3608
  attribute name in your model to a key in your JSON.
@@ -3894,6 +3939,7 @@ define("ember-data/serializers/rest_serializer",
3894
3939
 
3895
3940
  for (var prop in payload) {
3896
3941
  var typeName = this.typeForRoot(prop);
3942
+
3897
3943
  if (!store.modelFactoryFor(typeName)){
3898
3944
  Ember.warn(this.warnMessageNoModelForKey(prop, typeName), false);
3899
3945
  continue;
@@ -3902,6 +3948,10 @@ define("ember-data/serializers/rest_serializer",
3902
3948
  var isPrimary = type.typeKey === primaryTypeName;
3903
3949
  var value = payload[prop];
3904
3950
 
3951
+ if (value === null) {
3952
+ continue;
3953
+ }
3954
+
3905
3955
  // legacy support for singular resources
3906
3956
  if (isPrimary && Ember.typeOf(value) !== "array" ) {
3907
3957
  primaryRecord = this.normalize(primaryType, value, prop);
@@ -4431,6 +4481,10 @@ define("ember-data/system/adapter",
4431
4481
  transition to the `invalid` state and the errors will be set to the
4432
4482
  `errors` property on the record.
4433
4483
 
4484
+ This function should return the entire payload as received from the
4485
+ server. Error object extraction and normalization of model errors
4486
+ should be performed by `extractErrors` on the serializer.
4487
+
4434
4488
  Example
4435
4489
 
4436
4490
  ```javascript
@@ -4439,7 +4493,7 @@ define("ember-data/system/adapter",
4439
4493
  var error = this._super(jqXHR);
4440
4494
 
4441
4495
  if (jqXHR && jqXHR.status === 422) {
4442
- var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"];
4496
+ var jsonErrors = Ember.$.parseJSON(jqXHR.responseText);
4443
4497
  return new DS.InvalidError(jsonErrors);
4444
4498
  } else {
4445
4499
  return error;
@@ -4455,7 +4509,7 @@ define("ember-data/system/adapter",
4455
4509
  ```javascript
4456
4510
  return new DS.InvalidError({
4457
4511
  length: 'Must be less than 15',
4458
- name: 'Must not be blank
4512
+ name: 'Must not be blank'
4459
4513
  });
4460
4514
  ```
4461
4515
 
@@ -4854,6 +4908,7 @@ define("ember-data/system/adapter",
4854
4908
  The default implementation returns the records as a single group.
4855
4909
 
4856
4910
  @method groupRecordsForFindMany
4911
+ @param {DS.Store} store
4857
4912
  @param {Array} records
4858
4913
  @return {Array} an array of arrays of records, each of which is to be
4859
4914
  loaded separately by `findMany`.
@@ -4922,6 +4977,20 @@ define("ember-data/system/container_proxy",
4922
4977
 
4923
4978
  __exports__["default"] = ContainerProxy;
4924
4979
  });
4980
+ define("ember-data/system/create",
4981
+ [],
4982
+ function() {
4983
+ "use strict";
4984
+ /*
4985
+ Detect if the user has a correct Object.create shim.
4986
+ Ember has provided this for a long time but has had an incorrect shim before 1.8
4987
+ TODO: Remove for Ember Data 1.0.
4988
+ */
4989
+ var object = Ember.create(null);
4990
+ if (object.toString !== undefined && Ember.keys(Ember.create({}))[0] === '__proto__'){
4991
+ throw new Error("Ember Data requires a correct Object.create shim. You should upgrade to Ember >= 1.8 which provides one for you. If you are using ES5-shim, you should try removing that after upgrading Ember.");
4992
+ }
4993
+ });
4925
4994
  define("ember-data/system/debug",
4926
4995
  ["ember-data/system/debug/debug_info","ember-data/system/debug/debug_adapter","exports"],
4927
4996
  function(__dependency1__, __dependency2__, __exports__) {
@@ -5162,9 +5231,9 @@ define("ember-data/system/map",
5162
5231
  usesOldBehavior = value === 'key' && key === 'value';
5163
5232
  });
5164
5233
 
5165
- Map.prototype = Object.create(Ember.Map.prototype);
5166
- MapWithDefault.prototype = Object.create(Ember.MapWithDefault.prototype);
5167
- OrderedSet.prototype = Object.create(Ember.OrderedSet.prototype);
5234
+ Map.prototype = Ember.create(Ember.Map.prototype);
5235
+ MapWithDefault.prototype = Ember.create(Ember.MapWithDefault.prototype);
5236
+ OrderedSet.prototype = Ember.create(Ember.OrderedSet.prototype);
5168
5237
 
5169
5238
  OrderedSet.create = function(){
5170
5239
  return new OrderedSet();
@@ -5524,7 +5593,7 @@ define("ember-data/system/model/attributes",
5524
5593
  options: options
5525
5594
  };
5526
5595
 
5527
- return Ember.computed('data', function(key, value) {
5596
+ return Ember.computed(function(key, value) {
5528
5597
  if (arguments.length > 1) {
5529
5598
  Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.constructor.toString(), key !== 'id');
5530
5599
  var oldValue = getValue(this, key);
@@ -5576,7 +5645,7 @@ define("ember-data/system/model/errors",
5576
5645
  `DS.Errors`. This can be used to display validation error
5577
5646
  messages returned from the server when a `record.save()` rejects.
5578
5647
  This works automatically with `DS.ActiveModelAdapter`, but you
5579
- can implement [ajaxError](api/data/classes/DS.RESTAdapter.html#method_ajaxError)
5648
+ can implement [ajaxError](/api/data/classes/DS.RESTAdapter.html#method_ajaxError)
5580
5649
  in other adapters as well.
5581
5650
 
5582
5651
  For Example, if you had an `User` model that looked like this:
@@ -5927,8 +5996,8 @@ define("ember-data/system/model/model",
5927
5996
  return get(get(this, 'currentState'), key);
5928
5997
  }).readOnly();
5929
5998
 
5930
- var _extractPivotNameCache = Object.create(null);
5931
- var _splitOnDotCache = Object.create(null);
5999
+ var _extractPivotNameCache = Ember.create(null);
6000
+ var _splitOnDotCache = Ember.create(null);
5932
6001
 
5933
6002
  function splitOnDot(name) {
5934
6003
  return _splitOnDotCache[name] || (
@@ -6373,7 +6442,7 @@ define("ember-data/system/model/model",
6373
6442
  would have a implicit post relationship in order to be do things like remove ourselves from the post
6374
6443
  when we are deleted
6375
6444
  */
6376
- this._implicitRelationships = Object.create(null);
6445
+ this._implicitRelationships = Ember.create(null);
6377
6446
  var model = this;
6378
6447
  //TODO Move into a getter for better perf
6379
6448
  this.constructor.eachRelationship(function(key, descriptor) {
@@ -6667,6 +6736,20 @@ define("ember-data/system/model/model",
6667
6736
  return value;
6668
6737
  },
6669
6738
 
6739
+ /**
6740
+ @method _notifyProperties
6741
+ @private
6742
+ */
6743
+ _notifyProperties: function(keys) {
6744
+ Ember.beginPropertyChanges();
6745
+ var key;
6746
+ for (var i = 0, length = keys.length; i < length; i++){
6747
+ key = keys[i];
6748
+ this.notifyPropertyChange(key);
6749
+ }
6750
+ Ember.endPropertyChanges();
6751
+ },
6752
+
6670
6753
  /**
6671
6754
  Returns an object, whose keys are changed properties, and value is
6672
6755
  an [oldProp, newProp] array.
@@ -6732,7 +6815,7 @@ define("ember-data/system/model/model",
6732
6815
 
6733
6816
  if (!data) { return; }
6734
6817
 
6735
- this.notifyPropertyChange('data');
6818
+ this._notifyProperties(Ember.keys(data));
6736
6819
  },
6737
6820
 
6738
6821
  /**
@@ -6765,15 +6848,17 @@ define("ember-data/system/model/model",
6765
6848
  the existing data, not replace it.
6766
6849
  */
6767
6850
  setupData: function(data, partial) {
6851
+ Ember.assert("Expected an object as `data` in `setupData`", Ember.typeOf(data) === 'object');
6852
+
6768
6853
  if (partial) {
6769
6854
  Ember.merge(this._data, data);
6770
6855
  } else {
6771
6856
  this._data = data;
6772
6857
  }
6773
6858
 
6774
- if (data) { this.pushedData(); }
6859
+ this.pushedData();
6775
6860
 
6776
- this.notifyPropertyChange('data');
6861
+ this._notifyProperties(Ember.keys(data));
6777
6862
  },
6778
6863
 
6779
6864
  materializeId: function(id) {
@@ -6820,13 +6905,18 @@ define("ember-data/system/model/model",
6820
6905
  this.reconnectRelationships();
6821
6906
  }
6822
6907
 
6908
+ if (get(this, 'isNew')) {
6909
+ this.clearRelationships();
6910
+ }
6911
+
6823
6912
  if (!get(this, 'isValid')) {
6824
6913
  this._inFlightAttributes = {};
6825
6914
  }
6826
6915
 
6827
6916
  this.send('rolledBack');
6828
6917
 
6829
- this.notifyPropertyChange('data');
6918
+ this._notifyProperties(Ember.keys(this._data));
6919
+
6830
6920
  },
6831
6921
 
6832
6922
  toStringExtension: function() {
@@ -6877,7 +6967,9 @@ define("ember-data/system/model/model",
6877
6967
  App.ModelViewRoute = Ember.Route.extend({
6878
6968
  actions: {
6879
6969
  reload: function() {
6880
- this.controller.get('model').reload();
6970
+ this.controller.get('model').reload().then(function(model) {
6971
+ // do something with the reloaded model
6972
+ });
6881
6973
  }
6882
6974
  }
6883
6975
  });
@@ -7848,14 +7940,39 @@ define("ember-data/system/promise_proxies",
7848
7940
  to the underlying manyArray.
7849
7941
  Right now we proxy:
7850
7942
  `reload()`
7943
+ `createRecord()`
7944
+ `on()`
7945
+ `one()`
7946
+ `trigger()`
7947
+ `off()`
7948
+ `has()`
7851
7949
  */
7852
7950
 
7951
+ function proxyToContent(method) {
7952
+ return function() {
7953
+ var content = get(this, 'content');
7954
+ return content[method].apply(content, arguments);
7955
+ };
7956
+ }
7957
+
7853
7958
  var PromiseManyArray = PromiseArray.extend({
7854
7959
  reload: function() {
7855
7960
  //I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
7856
7961
  Ember.assert('You are trying to reload an async manyArray before it has been created', get(this, 'content'));
7857
7962
  return get(this, 'content').reload();
7858
- }
7963
+ },
7964
+
7965
+ createRecord: proxyToContent('createRecord'),
7966
+
7967
+ on: proxyToContent('on'),
7968
+
7969
+ one: proxyToContent('one'),
7970
+
7971
+ trigger: proxyToContent('trigger'),
7972
+
7973
+ off: proxyToContent('off'),
7974
+
7975
+ has: proxyToContent('has')
7859
7976
  });
7860
7977
 
7861
7978
  var promiseManyArray = function(promise, label) {
@@ -7888,6 +8005,7 @@ define("ember-data/system/record_array_manager",
7888
8005
  var OrderedSet = __dependency2__.OrderedSet;
7889
8006
  var get = Ember.get;
7890
8007
  var forEach = Ember.EnumerableUtils.forEach;
8008
+ var indexOf = Ember.EnumerableUtils.indexOf;
7891
8009
 
7892
8010
  /**
7893
8011
  @class RecordArrayManager
@@ -8140,6 +8258,19 @@ define("ember-data/system/record_array_manager",
8140
8258
  this.updateFilter(array, type, filter);
8141
8259
  },
8142
8260
 
8261
+ /**
8262
+ Unregister a FilteredRecordArray.
8263
+ So manager will not update this array.
8264
+
8265
+ @method unregisterFilteredRecordArray
8266
+ @param {DS.RecordArray} array
8267
+ */
8268
+ unregisterFilteredRecordArray: function(array) {
8269
+ var recordArrays = this.filteredRecordArrays.get(array.type);
8270
+ var index = indexOf(recordArrays, array);
8271
+ recordArrays.splice(index, 1);
8272
+ },
8273
+
8143
8274
  // Internally, we maintain a map of all unloaded IDs requested by
8144
8275
  // a ManyArray. As the adapter loads data into the store, the
8145
8276
  // store notifies any interested ManyArrays. When the ManyArray's
@@ -8215,7 +8346,7 @@ define("ember-data/system/record_arrays/adapter_populated_record_array",
8215
8346
  var get = Ember.get;
8216
8347
 
8217
8348
  function cloneNull(source) {
8218
- var clone = Object.create(null);
8349
+ var clone = Ember.create(null);
8219
8350
  for (var key in source) {
8220
8351
  clone[key] = source[key];
8221
8352
  }
@@ -8334,7 +8465,20 @@ define("ember-data/system/record_arrays/filtered_record_array",
8334
8465
 
8335
8466
  updateFilter: Ember.observer(function() {
8336
8467
  Ember.run.once(this, this._updateFilter);
8337
- }, 'filterFunction')
8468
+ }, 'filterFunction'),
8469
+
8470
+ /**
8471
+ @method _unregisterFromManager
8472
+ @private
8473
+ */
8474
+ _unregisterFromManager: function(){
8475
+ this.manager.unregisterFilteredRecordArray(this);
8476
+ },
8477
+
8478
+ willDestroy: function(){
8479
+ this._unregisterFromManager();
8480
+ this._super();
8481
+ }
8338
8482
  });
8339
8483
  });
8340
8484
  define("ember-data/system/record_arrays/many_array",
@@ -8398,17 +8542,19 @@ define("ember-data/system/record_arrays/many_array",
8398
8542
  */
8399
8543
  isPolymorphic: false,
8400
8544
 
8401
- // LOADING STATE
8545
+ /**
8546
+ The loading state of this array
8402
8547
 
8548
+ @property {Boolean} isLoaded
8549
+ */
8403
8550
  isLoaded: false,
8404
8551
 
8405
8552
  /**
8406
8553
  The relationship which manages this array.
8407
8554
 
8408
- @property {DS.Model} owner
8555
+ @property {ManyRelationship} relationship
8409
8556
  @private
8410
8557
  */
8411
-
8412
8558
  relationship: null,
8413
8559
 
8414
8560
 
@@ -8475,7 +8621,7 @@ define("ember-data/system/record_arrays/many_array",
8475
8621
 
8476
8622
  Ember.assert("You cannot add '" + type.typeKey + "' records to this polymorphic relationship.", !get(this, 'isPolymorphic'));
8477
8623
 
8478
- record = store.createRecord.call(store, type, hash);
8624
+ record = store.createRecord(type, hash);
8479
8625
  this.pushObject(record);
8480
8626
 
8481
8627
  return record;
@@ -8958,10 +9104,10 @@ define("ember-data/system/relationships/ext",
8958
9104
  },
8959
9105
 
8960
9106
  inverseMap: Ember.computed(function() {
8961
- return Object.create(null);
9107
+ return Ember.create(null);
8962
9108
  }),
8963
9109
 
8964
- /*
9110
+ /**
8965
9111
  Find the relationship which is the inverse of the one asked for.
8966
9112
 
8967
9113
  For example, if you define models like this:
@@ -9299,7 +9445,7 @@ define("ember-data/system/relationships/ext",
9299
9445
  });
9300
9446
 
9301
9447
  var fields = Ember.get(App.Blog, 'fields');
9302
- fields.forEach(function(field, kind) {
9448
+ fields.forEach(function(kind, field) {
9303
9449
  console.log(field, kind);
9304
9450
  });
9305
9451
 
@@ -9557,7 +9703,6 @@ define("ember-data/system/relationships/relationship",
9557
9703
  this.key = relationshipMeta.key;
9558
9704
  this.inverseKey = inverseKey;
9559
9705
  this.record = record;
9560
- this.key = relationshipMeta.key;
9561
9706
  this.isAsync = relationshipMeta.options.async;
9562
9707
  this.relationshipMeta = relationshipMeta;
9563
9708
  //This probably breaks for polymorphic relationship in complex scenarios, due to
@@ -9591,20 +9736,24 @@ define("ember-data/system/relationships/relationship",
9591
9736
  },
9592
9737
 
9593
9738
  removeRecords: function(records){
9594
- var that = this;
9595
- records.forEach(function(record){
9596
- that.removeRecord(record);
9597
- });
9739
+ var length = Ember.get(records, 'length');
9740
+ var record;
9741
+ for (var i = 0; i < length; i++){
9742
+ record = records[i];
9743
+ this.removeRecord(record);
9744
+ }
9598
9745
  },
9599
9746
 
9600
9747
  addRecords: function(records, idx){
9601
- var that = this;
9602
- records.forEach(function(record){
9603
- that.addRecord(record, idx);
9748
+ var length = Ember.get(records, 'length');
9749
+ var record;
9750
+ for (var i = 0; i < length; i++){
9751
+ record = records[i];
9752
+ this.addRecord(record, idx);
9604
9753
  if (idx !== undefined) {
9605
9754
  idx++;
9606
9755
  }
9607
- });
9756
+ }
9608
9757
  },
9609
9758
 
9610
9759
  addRecord: function(record, idx) {
@@ -9657,6 +9806,7 @@ define("ember-data/system/relationships/relationship",
9657
9806
  },
9658
9807
 
9659
9808
  updateLink: function(link) {
9809
+ Ember.assert("You have pushed a record of type '" + this.record.constructor.typeKey + "' with '" + this.key + "' as a link, but the value of that link is not a string.", typeof link === 'string' || link === null);
9660
9810
  if (link !== this.link) {
9661
9811
  this.link = link;
9662
9812
  this.linkPromise = null;
@@ -9694,7 +9844,7 @@ define("ember-data/system/relationships/relationship",
9694
9844
  this.manyArray.isPolymorphic = this.isPolymorphic;
9695
9845
  };
9696
9846
 
9697
- ManyRelationship.prototype = Object.create(Relationship.prototype);
9847
+ ManyRelationship.prototype = Ember.create(Relationship.prototype);
9698
9848
  ManyRelationship.prototype.constructor = ManyRelationship;
9699
9849
  ManyRelationship.prototype._super$constructor = Relationship;
9700
9850
 
@@ -9794,7 +9944,9 @@ define("ember-data/system/relationships/relationship",
9794
9944
  } else {
9795
9945
  Ember.assert("You looked up the '" + this.key + "' relationship on a '" + this.record.constructor.typeKey + "' with id " + this.record.get('id') + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.hasMany({ async: true })`)", this.manyArray.isEvery('isEmpty', false));
9796
9946
 
9797
- this.manyArray.set('isLoaded', true);
9947
+ if (!this.manyArray.get('isDestroyed')) {
9948
+ this.manyArray.set('isLoaded', true);
9949
+ }
9798
9950
  return this.manyArray;
9799
9951
  }
9800
9952
  };
@@ -9806,7 +9958,7 @@ define("ember-data/system/relationships/relationship",
9806
9958
  this.inverseRecord = null;
9807
9959
  };
9808
9960
 
9809
- BelongsToRelationship.prototype = Object.create(Relationship.prototype);
9961
+ BelongsToRelationship.prototype = Ember.create(Relationship.prototype);
9810
9962
  BelongsToRelationship.prototype.constructor = BelongsToRelationship;
9811
9963
  BelongsToRelationship.prototype._super$constructor = Relationship;
9812
9964
 
@@ -9848,9 +10000,9 @@ define("ember-data/system/relationships/relationship",
9848
10000
 
9849
10001
  BelongsToRelationship.prototype._super$removeRecordFromOwn = Relationship.prototype.removeRecordFromOwn;
9850
10002
  BelongsToRelationship.prototype.removeRecordFromOwn = function(record) {
9851
- if (!this.members.has(record)){ return;}
9852
- this._super$removeRecordFromOwn(record);
10003
+ if (!this.members.has(record)) { return; }
9853
10004
  this.inverseRecord = null;
10005
+ this._super$removeRecordFromOwn(record);
9854
10006
  };
9855
10007
 
9856
10008
  BelongsToRelationship.prototype.findRecord = function() {
@@ -9864,7 +10016,9 @@ define("ember-data/system/relationships/relationship",
9864
10016
  BelongsToRelationship.prototype.fetchLink = function() {
9865
10017
  var self = this;
9866
10018
  return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function(record){
9867
- self.addRecord(record);
10019
+ if (record) {
10020
+ self.addRecord(record);
10021
+ }
9868
10022
  return record;
9869
10023
  });
9870
10024
  };
@@ -10006,14 +10160,6 @@ define("ember-data/system/store",
10006
10160
  });
10007
10161
  ```
10008
10162
 
10009
- If your application has multiple `DS.Store` instances (an unusual case), you can
10010
- specify which store should be used:
10011
-
10012
- ```javascript
10013
- store.find('person', 123).then(function (person) {
10014
- });
10015
- ```
10016
-
10017
10163
  By default, the store will talk to your backend using a standard
10018
10164
  REST mechanism. You can customize how the store talks to your
10019
10165
  backend by specifying a custom adapter:
@@ -10356,6 +10502,25 @@ define("ember-data/system/store",
10356
10502
  return this.findById(type, coerceId(id), preload);
10357
10503
  },
10358
10504
 
10505
+ /**
10506
+ This method returns a fresh record for a given type and id combination.
10507
+
10508
+ If a record is available for the given type/id combination, then it will fetch this record from the store then reload it. If there's no record corresponding in the store it will simply call store.find.
10509
+
10510
+ @method fetch
10511
+ @param {String or subclass of DS.Model} type
10512
+ @param {Object|String|Integer|null} id
10513
+ @param {Object} preload - optional set of attributes and relationships passed in either as IDs or as actual models
10514
+ @return {Promise} promise
10515
+ */
10516
+ fetch: function(type, id, preload) {
10517
+ if (this.hasRecordForId(type, id)) {
10518
+ return this.getById(type, id).reload();
10519
+ } else {
10520
+ return this.find(type, id, preload);
10521
+ }
10522
+ },
10523
+
10359
10524
  /**
10360
10525
  This method returns a record for a given type and id combination.
10361
10526
 
@@ -10425,14 +10590,14 @@ define("ember-data/system/store",
10425
10590
  var adapter = this.adapterFor(type);
10426
10591
 
10427
10592
  Ember.assert("You tried to find a record but you have no adapter (for " + type + ")", adapter);
10428
- Ember.assert("You tried to find a record but your adapter (for " + type + ") does not implement 'find'", adapter.find);
10593
+ Ember.assert("You tried to find a record but your adapter (for " + type + ") does not implement 'find'", typeof adapter.find === 'function');
10429
10594
 
10430
10595
  var promise = _find(adapter, this, type, id, record);
10431
10596
  return promise;
10432
10597
  },
10433
10598
 
10434
10599
  scheduleFetchMany: function(records) {
10435
- return Ember.RSVP.all(map(records, this.scheduleFetch, this));
10600
+ return Promise.all(map(records, this.scheduleFetch, this));
10436
10601
  },
10437
10602
 
10438
10603
  scheduleFetch: function(record) {
@@ -10582,7 +10747,7 @@ define("ember-data/system/store",
10582
10747
 
10583
10748
  Ember.assert("You cannot reload a record without an ID", id);
10584
10749
  Ember.assert("You tried to reload a record but you have no adapter (for " + type + ")", adapter);
10585
- Ember.assert("You tried to reload a record but your adapter does not implement `find`", adapter.find);
10750
+ Ember.assert("You tried to reload a record but your adapter does not implement `find`", typeof adapter.find === 'function');
10586
10751
 
10587
10752
  return this.scheduleFetch(record);
10588
10753
  },
@@ -10635,7 +10800,7 @@ define("ember-data/system/store",
10635
10800
  */
10636
10801
  findMany: function(records) {
10637
10802
  var store = this;
10638
- return Promise.all( map(records, function(record) {
10803
+ return Promise.all(map(records, function(record) {
10639
10804
  return store._findByRecord(record);
10640
10805
  }));
10641
10806
  },
@@ -10663,7 +10828,7 @@ define("ember-data/system/store",
10663
10828
  var adapter = this.adapterFor(owner.constructor);
10664
10829
 
10665
10830
  Ember.assert("You tried to load a hasMany relationship but you have no adapter (for " + owner.constructor + ")", adapter);
10666
- Ember.assert("You tried to load a hasMany relationship from a specified `link` in the original payload but your adapter does not implement `findHasMany`", adapter.findHasMany);
10831
+ Ember.assert("You tried to load a hasMany relationship from a specified `link` in the original payload but your adapter does not implement `findHasMany`", typeof adapter.findHasMany === 'function');
10667
10832
 
10668
10833
  return _findHasMany(adapter, this, owner, link, type);
10669
10834
  },
@@ -10680,7 +10845,7 @@ define("ember-data/system/store",
10680
10845
  var adapter = this.adapterFor(owner.constructor);
10681
10846
 
10682
10847
  Ember.assert("You tried to load a belongsTo relationship but you have no adapter (for " + owner.constructor + ")", adapter);
10683
- Ember.assert("You tried to load a belongsTo relationship from a specified `link` in the original payload but your adapter does not implement `findBelongsTo`", adapter.findBelongsTo);
10848
+ Ember.assert("You tried to load a belongsTo relationship from a specified `link` in the original payload but your adapter does not implement `findBelongsTo`", typeof adapter.findBelongsTo === 'function');
10684
10849
 
10685
10850
  return _findBelongsTo(adapter, this, owner, link, relationship);
10686
10851
  },
@@ -10710,7 +10875,7 @@ define("ember-data/system/store",
10710
10875
  var adapter = this.adapterFor(type);
10711
10876
 
10712
10877
  Ember.assert("You tried to load a query but you have no adapter (for " + type + ")", adapter);
10713
- Ember.assert("You tried to load a query but your adapter does not implement `findQuery`", adapter.findQuery);
10878
+ Ember.assert("You tried to load a query but your adapter does not implement `findQuery`", typeof adapter.findQuery === 'function');
10714
10879
 
10715
10880
  return promiseArray(_findQuery(adapter, this, type, query, array));
10716
10881
  },
@@ -10745,7 +10910,7 @@ define("ember-data/system/store",
10745
10910
  set(array, 'isUpdating', true);
10746
10911
 
10747
10912
  Ember.assert("You tried to load all records but you have no adapter (for " + type + ")", adapter);
10748
- Ember.assert("You tried to load all records but your adapter does not implement `findAll`", adapter.findAll);
10913
+ Ember.assert("You tried to load all records but your adapter does not implement `findAll`", typeof adapter.findAll === 'function');
10749
10914
 
10750
10915
  return promiseArray(_findAll(adapter, this, type, sinceToken));
10751
10916
  },
@@ -10760,14 +10925,17 @@ define("ember-data/system/store",
10760
10925
  },
10761
10926
 
10762
10927
  /**
10763
- This method returns a filtered array that contains all of the known records
10764
- for a given type.
10928
+ This method returns a filtered array that contains all of the
10929
+ known records for a given type in the store.
10765
10930
 
10766
- Note that because it's just a filter, it will have any locally
10767
- created records of the type.
10931
+ Note that because it's just a filter, the result will contain any
10932
+ locally created records of the type, however, it will not make a
10933
+ request to the backend to retrieve additional records. If you
10934
+ would like to request all the records from the backend please use
10935
+ [store.find](#method_find).
10768
10936
 
10769
10937
  Also note that multiple calls to `all` for a given type will always
10770
- return the same RecordArray.
10938
+ return the same `RecordArray`.
10771
10939
 
10772
10940
  Example
10773
10941
 
@@ -10823,10 +10991,18 @@ define("ember-data/system/store",
10823
10991
  remains up to date as new records are loaded into the store or created
10824
10992
  locally.
10825
10993
 
10826
- The callback function takes a materialized record, and returns true
10994
+ The filter function takes a materialized record, and returns true
10827
10995
  if the record should be included in the filter and false if it should
10828
10996
  not.
10829
10997
 
10998
+ Example
10999
+
11000
+ ```javascript
11001
+ store.filter('post', function(post) {
11002
+ return post.get('unread');
11003
+ });
11004
+ ```
11005
+
10830
11006
  The filter function is called once on all records for the type when
10831
11007
  it is created, and then once on each newly loaded or created record.
10832
11008
 
@@ -10834,14 +11010,19 @@ define("ember-data/system/store",
10834
11010
  filter function will be invoked again to determine whether it should
10835
11011
  still be in the array.
10836
11012
 
10837
- Optionally you can pass a query which will be triggered at first. The
10838
- results returned by the server could then appear in the filter if they
10839
- match the filter function.
11013
+ Optionally you can pass a query, which is the equivalent of calling
11014
+ [find](#method_find) with that same query, to fetch additional records
11015
+ from the server. The results returned by the server could then appear
11016
+ in the filter if they match the filter function.
11017
+
11018
+ The query itself is not used to filter records, it's only sent to your
11019
+ server for you to be able to do server-side filtering. The filter
11020
+ function will be applied on the returned results regardless.
10840
11021
 
10841
11022
  Example
10842
11023
 
10843
11024
  ```javascript
10844
- store.filter('post', {unread: true}, function(post) {
11025
+ store.filter('post', { unread: true }, function(post) {
10845
11026
  return post.get('unread');
10846
11027
  }).then(function(unreadPosts) {
10847
11028
  unreadPosts.get('length'); // 5
@@ -11085,9 +11266,9 @@ define("ember-data/system/store",
11085
11266
  if (typeMap) { return typeMap; }
11086
11267
 
11087
11268
  typeMap = {
11088
- idToRecord: Object.create(null),
11269
+ idToRecord: Ember.create(null),
11089
11270
  records: [],
11090
- metadata: Object.create(null),
11271
+ metadata: Ember.create(null),
11091
11272
  type: type
11092
11273
  };
11093
11274
 
@@ -11219,10 +11400,11 @@ define("ember-data/system/store",
11219
11400
  // _partial is an internal param used by `update`.
11220
11401
  // If passed, it means that the data should be
11221
11402
  // merged into the existing data, not replace it.
11222
- Ember.assert("Expected an object as `data` in a call to push for " + typeName + " , but was " + data, Ember.typeOf(data) === 'object');
11223
- Ember.assert("You must include an `id` for " + typeName + " in an object passed to `push`", data.id != null);
11403
+ Ember.assert("Expected an object as `data` in a call to `push`/`update` for " + typeName + " , but was " + data, Ember.typeOf(data) === 'object');
11404
+ Ember.assert("You must include an `id` for " + typeName + " in an object passed to `push`/`update`", data.id != null && data.id !== '');
11224
11405
 
11225
11406
  var type = this.modelFor(typeName);
11407
+ var filter = Ember.EnumerableUtils.filter;
11226
11408
 
11227
11409
  // If the payload contains relationships that are specified as
11228
11410
  // IDs, normalizeRelationships will convert them into DS.Model instances
@@ -11231,6 +11413,15 @@ define("ember-data/system/store",
11231
11413
 
11232
11414
  data = normalizeRelationships(this, type, data);
11233
11415
 
11416
+ Ember.warn("The payload for '" + typeName + "' contains these unknown keys: " +
11417
+ Ember.inspect(filter(Ember.keys(data), function(key) {
11418
+ return !get(type, 'fields').has(key) && key !== 'id' && key !== 'links';
11419
+ })) + ". Make sure they've been defined in your model.",
11420
+ filter(Ember.keys(data), function(key) {
11421
+ return !get(type, 'fields').has(key) && key !== 'id' && key !== 'links';
11422
+ }).length === 0
11423
+ );
11424
+
11234
11425
  // Actually load the record into the store.
11235
11426
 
11236
11427
  this._load(type, data, _partial);
@@ -11295,7 +11486,7 @@ define("ember-data/system/store",
11295
11486
  if (!inputPayload) {
11296
11487
  payload = type;
11297
11488
  serializer = defaultSerializer(this.container);
11298
- Ember.assert("You cannot use `store#pushPayload` without a type unless your default serializer defines `pushPayload`", serializer.pushPayload);
11489
+ Ember.assert("You cannot use `store#pushPayload` without a type unless your default serializer defines `pushPayload`", typeof serializer.pushPayload === 'function');
11299
11490
  } else {
11300
11491
  payload = inputPayload;
11301
11492
  serializer = this.serializerFor(type);
@@ -11361,8 +11552,6 @@ define("ember-data/system/store",
11361
11552
  @return {DS.Model} the record that was updated.
11362
11553
  */
11363
11554
  update: function(type, data) {
11364
- Ember.assert("You must include an `id` for " + type + " in a hash passed to `update`", data.id != null);
11365
-
11366
11555
  return this.push(type, data, true);
11367
11556
  },
11368
11557
 
@@ -11569,6 +11758,7 @@ define("ember-data/system/store",
11569
11758
  if (isNone(id) || id instanceof Model) {
11570
11759
  return;
11571
11760
  }
11761
+ Ember.assert("A " + relationship.parentType + " record was pushed into the store with the value of " + key + " being " + Ember.inspect(id) + ", but " + key + " is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.", !Ember.isArray(id));
11572
11762
 
11573
11763
  var type;
11574
11764
 
@@ -11590,9 +11780,11 @@ define("ember-data/system/store",
11590
11780
  }
11591
11781
 
11592
11782
  function deserializeRecordIds(store, data, key, relationship, ids) {
11593
- if (!Ember.isArray(ids)) {
11783
+ if (isNone(ids)) {
11594
11784
  return;
11595
11785
  }
11786
+
11787
+ Ember.assert("A " + relationship.parentType + " record was pushed into the store with the value of " + key + " being '" + Ember.inspect(ids) + "', but " + key + " is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.", Ember.isArray(ids));
11596
11788
  for (var i=0, l=ids.length; i<l; i++) {
11597
11789
  deserializeRecordId(store, ids, i, relationship, ids[i]);
11598
11790
  }
@@ -11727,6 +11919,11 @@ define("ember-data/system/store",
11727
11919
 
11728
11920
  return promise.then(function(adapterPayload) {
11729
11921
  var payload = serializer.extract(store, relationship.type, adapterPayload, null, 'findBelongsTo');
11922
+
11923
+ if (!payload) {
11924
+ return null;
11925
+ }
11926
+
11730
11927
  var record = store.push(relationship.type, payload);
11731
11928
  return record;
11732
11929
  }, null, "DS: Extract payload of " + record + " : " + relationship.type);
@@ -11794,7 +11991,9 @@ define("ember-data/system/store",
11794
11991
  return record;
11795
11992
  }, function(reason) {
11796
11993
  if (reason instanceof InvalidError) {
11797
- store.recordWasInvalid(record, reason.errors);
11994
+ var errors = serializer.extractErrors(store, type, reason.errors, get(record, 'id'));
11995
+ store.recordWasInvalid(record, errors);
11996
+ reason = new InvalidError(errors);
11798
11997
  } else {
11799
11998
  store.recordWasError(record, reason);
11800
11999
  }
@@ -12020,7 +12219,6 @@ define("ember-data/transforms/date",
12020
12219
  }
12021
12220
 
12022
12221
  __exports__["default"] = Transform.extend({
12023
-
12024
12222
  deserialize: function(serialized) {
12025
12223
  var type = typeof serialized;
12026
12224