ember-data-source 1.13.9 → 1.13.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- (function(){"use strict";var e=Ember;var r=Object.keys||Ember.keys;var t=Object.create||Ember.create;var i=Ember.Error;var n=Ember.ArrayPolyfills.forEach;var a=/^\/?data\/(attributes|relationships)\/(.*)/;function o(e,r){r=r||"Adapter operation failed";i.call(this,r);this.errors=e||[{title:"Adapter Error",detail:r}]}o.prototype=t(i.prototype);function s(e){if(!Ember.isArray(e)){e=d(e)}o.call(this,e,"The adapter rejected the commit because it was invalid")}s.prototype=t(o.prototype);function l(){o.call(this,null,"The adapter operation timed out")}l.prototype=t(o.prototype);function u(){o.call(this,null,"The adapter operation was aborted")}u.prototype=t(o.prototype);function d(e){var t=[];if(Ember.isPresent(e)){n.call(r(e),function(r){var i=Ember.makeArray(e[r]);for(var n=0;n<i.length;n++){t.push({title:"Invalid Attribute",detail:i[n],source:{pointer:"/data/attributes/"+r}})}})}return t}function c(e){var r={};if(Ember.isPresent(e)){n.call(e,function(e){if(e.source&&e.source.pointer){var t=e.source.pointer.match(a);if(t){t=t[2];r[t]=r[t]||[];r[t].push(e.detail||e.title)}}})}return r}var h=Ember.get;var f=Ember.Object.extend({defaultSerializer:"-default",findRecord:null,findAll:null,query:null,queryRecord:null,generateIdForRecord:null,serialize:function(e,r){return h(e.record,"store").serializerFor(e.modelName).serialize(e,r)},createRecord:null,updateRecord:null,deleteRecord:null,coalesceFindRequests:true,groupRecordsForFindMany:function(e,r){return[r]},shouldReloadRecord:function(e,r){return false},shouldReloadAll:function(e,r){var t=r.type.modelName;return true},shouldBackgroundReloadRecord:function(e,r){return false},shouldBackgroundReloadAll:function(e,r){return true}});var p=f;var m=Ember.Map;var v=Ember.MapWithDefault;var y=m;var g=Ember.get;var b=Ember.Mixin.create({buildURL:function(e,r,t,i,n){switch(i){case"find":return this.urlForFind(r,e,t);case"findRecord":return this.urlForFindRecord(r,e,t);case"findAll":return this.urlForFindAll(e);case"findQuery":return this.urlForFindQuery(n,e);case"query":return this.urlForQuery(n,e);case"queryRecord":return this.urlForQueryRecord(n,e);case"findMany":return this.urlForFindMany(r,e,t);case"findHasMany":return this.urlForFindHasMany(r,e);case"findBelongsTo":return this.urlForFindBelongsTo(r,e);case"createRecord":return this.urlForCreateRecord(e,t);case"updateRecord":return this.urlForUpdateRecord(r,e,t);case"deleteRecord":return this.urlForDeleteRecord(r,e,t);default:return this._buildURL(e,r)}},_buildURL:function(e,r){var t=[];var i=g(this,"host");var n=this.urlPrefix();var a;if(e){a=this.pathForType(e);if(a){t.push(a)}}if(r){t.push(encodeURIComponent(r))}if(n){t.unshift(n)}t=t.join("/");if(!i&&t&&t.charAt(0)!=="/"){t="/"+t}return t},urlForFind:R,urlForFindRecord:function(e,r,t){if(this.urlForFind!==R){return this.urlForFind(e,r,t)}return this._buildURL(r,e)},urlForFindAll:function(e){return this._buildURL(e)},urlForFindQuery:E,urlForQuery:function(e,r){if(this.urlForFindQuery!==E){return this.urlForFindQuery(e,r)}return this._buildURL(r)},urlForQueryRecord:function(e,r){return this._buildURL(r)},urlForFindMany:function(e,r,t){return this._buildURL(r)},urlForFindHasMany:function(e,r){return this._buildURL(r,e)},urlForFindBelongsTo:function(e,r){return this._buildURL(r,e)},urlForCreateRecord:function(e,r){return this._buildURL(e)},urlForUpdateRecord:function(e,r,t){return this._buildURL(r,e)},urlForDeleteRecord:function(e,r,t){return this._buildURL(r,e)},urlPrefix:function(e,r){var t=g(this,"host");var i=g(this,"namespace");var n=[];if(e){if(/^\/\//.test(e)){}else if(e.charAt(0)==="/"){if(t){e=e.slice(1);n.push(t)}}else if(!/^http(s)?:\/\//.test(e)){n.push(r)}}else{if(t){n.push(t)}if(i){n.push(i)}}if(e){n.push(e)}return n.join("/")},pathForType:function(e){var r=Ember.String.camelize(e);return Ember.String.pluralize(r)}});function R(e,r,t){return this._buildURL(r,e)}function E(e,r){return this._buildURL(r)}var _=b;var F=Ember.get;var A=Ember.set;var z=Ember.ArrayPolyfills.forEach;var M=p.extend(_,{defaultSerializer:"-rest",sortQueryParams:function(e){var t=r(e);var i=t.length;if(i<2){return e}var n={};var a=t.sort();for(var o=0;o<i;o++){n[a[o]]=e[a[o]]}return n},coalesceFindRequests:false,find:function(e,r,t,i){return this.ajax(this.buildURL(r.modelName,t,i,"find"),"GET")},findRecord:function(e,r,t,i){var n=M.prototype.find;if(n!==this.find){return this.find(e,r,t,i)}return this.ajax(this.buildURL(r.modelName,t,i,"findRecord"),"GET")},findAll:function(e,r,t){var i,n;if(t){i={since:t}}n=this.buildURL(r.modelName,null,null,"findAll");return this.ajax(n,"GET",{data:i})},findQuery:function(e,r,t){var i=this.buildURL(r.modelName,null,null,"findQuery",t);if(this.sortQueryParams){t=this.sortQueryParams(t)}return this.ajax(i,"GET",{data:t})},query:function(e,r,t){var i=M.prototype.findQuery;if(i!==this.findQuery){return this.findQuery(e,r,t)}var n=this.buildURL(r.modelName,null,null,"query",t);if(this.sortQueryParams){t=this.sortQueryParams(t)}return this.ajax(n,"GET",{data:t})},queryRecord:function(e,r,t){var i=this.buildURL(r.modelName,null,null,"queryRecord",t);if(this.sortQueryParams){t=this.sortQueryParams(t)}return this.ajax(i,"GET",{data:t})},findMany:function(e,r,t,i){var n=this.buildURL(r.modelName,t,i,"findMany");return this.ajax(n,"GET",{data:{ids:t}})},findHasMany:function(e,r,t,i){var n=r.id;var a=r.modelName;t=this.urlPrefix(t,this.buildURL(a,n,null,"findHasMany"));return this.ajax(t,"GET")},findBelongsTo:function(e,r,t,i){var n=r.id;var a=r.modelName;t=this.urlPrefix(t,this.buildURL(a,n,null,"findBelongsTo"));return this.ajax(t,"GET")},createRecord:function(e,r,t){var i={};var n=e.serializerFor(r.modelName);var a=this.buildURL(r.modelName,null,t,"createRecord");n.serializeIntoHash(i,r,t,{includeId:true});return this.ajax(a,"POST",{data:i})},updateRecord:function(e,r,t){var i={};var n=e.serializerFor(r.modelName);n.serializeIntoHash(i,r,t);var a=t.id;var o=this.buildURL(r.modelName,a,t,"updateRecord");return this.ajax(o,"PUT",{data:i})},deleteRecord:function(e,r,t){var i=t.id;return this.ajax(this.buildURL(r.modelName,i,t,"deleteRecord"),"DELETE")},_stripIDFromURL:function(e,r){var t=this.buildURL(r.modelName,r.id,r);var i=t.split("/");var n=i[i.length-1];var a=r.id;if(n===a){i[i.length-1]=""}else if(k(n,"?id="+a)){i[i.length-1]=n.substring(0,n.length-a.length-1)}return i.join("/")},maxURLLength:2048,groupRecordsForFindMany:function(e,r){var t=v.create({defaultValue:function(){return[]}});var i=this;var n=this.maxURLLength;z.call(r,function(r){var n=i._stripIDFromURL(e,r);t.get(n).push(r)});function a(r,t,n){var a=i._stripIDFromURL(e,r[0]);var o=0;var s=[[]];z.call(r,function(e){var r=encodeURIComponent(e.id).length+n;if(a.length+o+r>=t){o=0;s.push([])}o+=r;var i=s.length-1;s[i].push(e)});return s}var o=[];t.forEach(function(e,r){var t="&ids%5B%5D=".length;var i=a(e,n,t);z.call(i,function(e){o.push(e)})});return o},handleResponse:function(e,r,t){if(this.isSuccess(e,r,t)){return t}else if(this.isInvalid(e,r,t)){return new s(t.errors)}var i=this.normalizeErrorResponse(e,r,t);return new o(i)},isSuccess:function(e,r,t){return e>=200&&e<300||e===304},isInvalid:function(e,r,t){return e===422},ajax:function(e,r,t){var i=this;return new Ember.RSVP.Promise(function(n,a){var s=i.ajaxOptions(e,r,t);s.success=function(e,r,t){var s=undefined;if(i.ajaxSuccess){s=i.ajaxSuccess(t,e)}if(!(s instanceof o)){s=i.handleResponse(t.status,S(t.getAllResponseHeaders()),s||e)}if(s instanceof o){Ember.run(null,a,s)}else{Ember.run(null,n,s)}};s.error=function(e,r,t){var n=undefined;if(i.ajaxError){n=i.ajaxError(e,r,t)}if(!(n instanceof Error)){if(t instanceof Error){n=t}else if(r==="timeout"){n=new l}else if(r==="abort"){n=new u}else{n=i.handleResponse(e.status,S(e.getAllResponseHeaders()),i.parseErrorResponse(e.responseText)||t)}}Ember.run(null,a,n)};Ember.$.ajax(s)},"DS: RESTAdapter#ajax "+r+" to "+e)},ajaxOptions:function(e,t,i){var n=i||{};n.url=e;n.type=t;n.dataType="json";n.context=this;if(n.data&&t!=="GET"){n.contentType="application/json; charset=utf-8";n.data=JSON.stringify(n.data)}var a=F(this,"headers");if(a!==undefined){n.beforeSend=function(e){z.call(r(a),function(r){e.setRequestHeader(r,a[r])})}}return n},parseErrorResponse:function(e){var r=e;try{r=Ember.$.parseJSON(e)}catch(t){}return r},normalizeErrorResponse:function(e,r,t){if(t&&typeof t==="object"&&t.errors){return t.errors}else{return[{status:""+e,title:"The backend responded with an error",detail:""+t}]}}});function S(e){var r=t(null);if(!e){return r}var i=e.split("\r\n");for(var n=0;n<i.length;n++){var a=i[n];var o=a.indexOf(": ");if(o>0){var s=a.substring(0,o);var l=a.substring(o+2);r[s]=l}}return r}function k(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}if(Ember.platform.hasPropertyAccessors){Ember.defineProperty(M.prototype,"maxUrlLength",{enumerable:false,get:function(){return this.maxURLLength},set:function(e){A(this,"maxURLLength",e)}})}var T=M;var P=e.String.capitalize;var x=/^\s*$/;var C=/([\w/-]+[_/-])([a-z\d]+$)/;var D=/([\w/-]+)([A-Z][a-z\d]*$)/;var N=/[A-Z][a-z\d]*$/;function w(e,r){for(var t=0,i=r.length;t<i;t++){e.uncountable[r[t].toLowerCase()]=true}}function I(e,r){var t;for(var i=0,n=r.length;i<n;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||L();e.irregularPairs=e.irregularPairs||L();var r=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:L(),irregularInverse:L(),uncountable:L()};w(r,e.uncountable);I(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 L(){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=L();this._pCache=L()},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()}w(this.rules,[e.toLowerCase()])},irregular:function(e,r){if(this._cacheUsed){this.purgeCache()}I(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,r,t){var i,n,a,o,s,l,u,d,c,h;d=!e||x.test(e);c=N.test(e);l="";if(d){return e}o=e.toLowerCase();s=C.exec(e)||D.exec(e);if(s){l=s[1];u=s[2].toLowerCase()}for(h in this.rules.uncountable){if(o.match(h+"$")){return e}}for(h in this.rules.irregular){if(o.match(h+"$")){n=t[h];if(c&&t[u]){n=P(n);h=P(h)}return e.replace(h,n)}}for(var f=r.length,p=0;f>p;f--){i=r[f-1];h=i[0];if(h.test(e)){break}}i=i||[];h=i[0];n=i[1];a=e.replace(h,n);return a}};var $=O;function j(e){return $.inflector.pluralize(e)}function K(e){return $.inflector.singularize(e)}var H={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"]};$.inflector=new $(H);if(e.EXTEND_PROTOTYPES===true||e.EXTEND_PROTOTYPES.String){String.prototype.pluralize=function(){return j(this)};String.prototype.singularize=function(){return K(this)}}$.defaultRules=H;e.Inflector=$;e.String.pluralize=j;e.String.singularize=K;var B=$;if(typeof define!=="undefined"&&define.amd){define("ember-inflector",["exports"],function(e){e["default"]=$;return $})}else if(typeof module!=="undefined"&&module["exports"]){module["exports"]=$}var U=e.String;var V=U.decamelize;var q=U.underscore;var W=T.extend({defaultSerializer:"-active-model",pathForType:function(e){var r=V(e);var t=q(r);return j(t)},handleResponse:function(e,r,t){if(this.isInvalid(e,r,t)){var i=d(t.errors);return new s(i)}else{return this._super.apply(this,arguments)}}});var Q=W;var J=Ember.Object.extend({isNewSerializerAPI:false,extract:null,serialize:null,normalize:function(e,r){return r}});var G=J;var X=Y;function Y(e){return e==null||e===""?null:e+""}var Z=ee;function ee(e){return Ember.String.dasherize(e)}var re=Ember.get;var te=Ember.isNone;var ie=Ember.ArrayPolyfills.map;var ne=Ember.merge;var ae=G.extend({primaryKey:"id",mergedProperties:["attrs"],applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var n=this.transformFor(i);r[e]=n.deserialize(r[e])},this);return r},normalizeResponse:function(e,r,t,i,n){switch(n){case"findRecord":return this.normalizeFindRecordResponse.apply(this,arguments);case"queryRecord":return this.normalizeQueryRecordResponse.apply(this,arguments);case"findAll":return this.normalizeFindAllResponse.apply(this,arguments);case"findBelongsTo":return this.normalizeFindBelongsToResponse.apply(this,arguments);case"findHasMany":return this.normalizeFindHasManyResponse.apply(this,arguments);case"findMany":return this.normalizeFindManyResponse.apply(this,arguments);case"query":return this.normalizeQueryResponse.apply(this,arguments);case"createRecord":return this.normalizeCreateRecordResponse.apply(this,arguments);case"deleteRecord":return this.normalizeDeleteRecordResponse.apply(this,arguments);case"updateRecord":return this.normalizeUpdateRecordResponse.apply(this,arguments)}},normalizeFindRecordResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeQueryRecordResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindAllResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindBelongsToResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindHasManyResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindManyResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeQueryResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeCreateRecordResponse:function(e,r,t,i,n){return this.normalizeSaveResponse.apply(this,arguments)},normalizeDeleteRecordResponse:function(e,r,t,i,n){return this.normalizeSaveResponse.apply(this,arguments)},normalizeUpdateRecordResponse:function(e,r,t,i,n){return this.normalizeSaveResponse.apply(this,arguments)},normalizeSaveResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeSingleResponse:function(e,r,t,i,n){return this._normalizeResponse(e,r,t,i,n,true)},normalizeArrayResponse:function(e,r,t,i,n){return this._normalizeResponse(e,r,t,i,n,false)},_normalizeResponse:function(e,r,t,i,n,a){var o=this;var s={data:null,included:[]};var l=this.extractMeta(e,r,t);if(l){s.meta=l}if(a){var u=this.normalize(r,t);var d=u.data;var c=u.included;s.data=d;if(c){s.included=c}}else{s.data=t.map(function(e){var t=o.normalize(r,e);var i=t.data;var n=t.included;if(n){var a;(a=s.included).push.apply(a,n)}return i})}return s},normalize:function(e,r){if(this.get("isNewSerializerAPI")){return oe.apply(this,arguments)}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},extractId:function(e,r){var t=re(this,"primaryKey");var i=r[t];return X(i)},extractAttributes:function(e,r){var t;var i={};e.eachAttribute(function(e){t=this.keyForAttribute(e,"deserialize");if(r.hasOwnProperty(t)){i[e]=r[t]}},this);return i},extractRelationship:function(e,r){if(Ember.isNone(r)){return null}if(Ember.typeOf(r)==="object"){if(r.id){r.id=X(r.id)}if(r.type){r.type=this.modelNameFromPayloadKey(r.type)}return r}return{id:X(r),type:e}},extractRelationships:function(e,r){var t={};e.eachRelationship(function(e,i){var n=null;var a=this.keyForRelationship(e,i.kind,"deserialize");if(r.hasOwnProperty(a)){var o=null;var s=r[a];if(i.kind==="belongsTo"){o=this.extractRelationship(i.type,s)}else if(i.kind==="hasMany"){o=Ember.A(s).map(function(e){return this.extractRelationship(i.type,e)},this)}n={data:o}}var l=this.keyForLink(e,i.kind);if(r.links&&r.links.hasOwnProperty(l)){var u=r.links[l];n=n||{};n.links={related:u}}if(n){t[e]=n}},this);return t},modelNameFromPayloadKey:function(e){return Z(e)},normalizePayload:function(e){return e},normalizeAttributes:function(e,r){var t;if(this.keyForAttribute){e.eachAttribute(function(e){t=this.keyForAttribute(e,"deserialize");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,"deserialize");if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeUsingDeclaredMapping:function(e,r){var t=re(this,"attrs");var i,n;if(t){for(n in t){i=this._getMappedKey(n);if(!r.hasOwnProperty(i)){continue}if(i!==n){r[n]=r[i];delete r[i]}}}},normalizeId:function(e){var r=re(this,"primaryKey");if(r==="id"){return}e.id=e[r];delete e[r]},normalizeErrors:function(e,r){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r)},_getMappedKey:function(e){var r=re(this,"attrs");var t;if(r&&r[e]){t=r[e];if(t.key){t=t.key}if(typeof t==="string"){e=t}}return e},_canSerialize:function(e){var r=re(this,"attrs");return!r||!r[e]||r[e].serialize!==false},_mustSerialize:function(e){var r=re(this,"attrs");return r&&r[e]&&r[e].serialize===true},_shouldSerializeHasMany:function(e,r,t){var i=e.type.determineRelationshipType(t,this.store);if(this._mustSerialize(r)){return true}return this._canSerialize(r)&&(i==="manyToNone"||i==="manyToMany")},serialize:function(e,r){var t={};if(r&&r.includeId){var i=e.id;if(i){t[re(this,"primaryKey")]=i}}e.eachAttribute(function(r,i){this.serializeAttribute(e,t,r,i)},this);e.eachRelationship(function(r,i){if(i.kind==="belongsTo"){this.serializeBelongsTo(e,t,i)}else if(i.kind==="hasMany"){this.serializeHasMany(e,t,i)}},this);return t},serializeIntoHash:function(e,r,t,i){ne(e,this.serialize(t,i))},serializeAttribute:function(e,r,t,i){var n=i.type;if(this._canSerialize(t)){var a=e.attr(t);if(n){var o=this.transformFor(n);a=o.serialize(a)}var s=this._getMappedKey(t);if(s===t&&this.keyForAttribute){s=this.keyForAttribute(t,"serialize")}r[s]=a}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this._canSerialize(i)){var n=e.belongsTo(i,{id:true});var a=this._getMappedKey(i);if(a===i&&this.keyForRelationship){a=this.keyForRelationship(i,"belongsTo","serialize")}if(te(n)){r[a]=null}else{r[a]=n}if(t.options.polymorphic){this.serializePolymorphicType(e,r,t)}}},serializeHasMany:function(e,r,t){var i=t.key;if(this._shouldSerializeHasMany(e,i,t)){var n;n=this._getMappedKey(i);if(n===i&&this.keyForRelationship){n=this.keyForRelationship(i,"hasMany","serialize")}r[n]=e.hasMany(i,{ids:true})}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,n){this.extractMeta(e,r.modelName,t);var a="extract"+n.charAt(0).toUpperCase()+n.substr(1);return this[a](e,r,t,i,n)},extractFindAll:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractFindQuery:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractQueryRecord:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractFindMany:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractFindHasMany:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractCreateRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractUpdateRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractDeleteRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractFind:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractFindBelongsTo:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractSave:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractSingle:function(e,r,t,i,n){if(!this.get("didDeprecateNormalizePayload")){this.set("didDeprecateNormalizePayload",true)}var a=this.normalizePayload(t);return this.normalize(r,a)},extractArray:function(e,r,t,i,n){if(!this.get("didDeprecateNormalizePayload")){this.set("didDeprecateNormalizePayload",true)}var a=this.normalizePayload(t);var o=this;return ie.call(a,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(this.get("isNewSerializerAPI")){return se.apply(this,arguments)}if(t&&t.meta){e._setMetadataFor(r,t.meta);delete t.meta}},extractErrors:function(e,r,t,i){if(t&&typeof t==="object"&&t.errors){t=c(t.errors);this.normalizeErrors(r,t)}return t},keyForAttribute:function(e,r){return e},keyForRelationship:function(e,r,t){return e},keyForLink:function(e,r){return e},transformFor:function(e,r){var t=this.container.lookup("transform:"+e);return t}});function oe(e,r){var t=null;if(r){this.normalizeUsingDeclaredMapping(e,r);t={id:this.extractId(e,r),type:e.modelName,attributes:this.extractAttributes(e,r),relationships:this.extractRelationships(e,r)};this.applyTransforms(e,t.attributes)}return{data:t}}function se(e,r,t){if(t&&t.hasOwnProperty("meta")){var i=t.meta;delete t.meta;return i}}var le=ae;var ue=Ember.RSVP.Promise;var de=Ember.get;var ce=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var he=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var fe=function(e,r){return he.create({promise:ue.resolve(e,r)})};var pe=function(e,r){return ce.create({promise:ue.resolve(e,r)})};function me(e){return function(){var r=de(this,"content");return r[e].apply(r,arguments)}}var ve=ce.extend({reload:function(){return ve.create({promise:de(this,"content").reload()})},createRecord:me("createRecord"),on:me("on"),one:me("one"),trigger:me("trigger"),off:me("off"),has:me("has")});var ye=function(e,r){return ve.create({promise:ue.resolve(e,r)})};var ge=Ember.get;var be=Ember.set;var Re=Ember.isEmpty;var Ee=Ember.ArrayPolyfills.map;var _e=Ember.makeArray;var Fe=Ember.ArrayProxy.extend(Ember.Evented,{registerHandlers:function(e,r,t){this.on("becameInvalid",e,r);this.on("becameValid",e,t)},errorsByAttributeName:Ember.computed(function(){return v.create({defaultValue:function(){return Ember.A()}})}),errorsFor:function(e){return ge(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(Re(r)){return null}return r},isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var t=ge(this,"isEmpty");r=this._findOrCreateMessages(e,r);this.addObjects(r);ge(this,"errorsByAttributeName").get(e).addObjects(r);this.notifyPropertyChange(e);if(t&&!ge(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return Ee.call(_e(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(ge(this,"isEmpty")){return}var r=this.rejectBy("attribute",e);be(this,"content",r);ge(this,"errorsByAttributeName")["delete"](e);this.notifyPropertyChange(e);if(ge(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(ge(this,"isEmpty")){return}var e=ge(this,"errorsByAttributeName");var r=Ember.A();e.forEach(function(e,t){r.push(t)});e.clear();r.forEach(function(e){this.notifyPropertyChange(e)},this);this._super();this.trigger("becameValid")},has:function(e){return!Re(this.errorsFor(e))}});var Ae;try{e.computed({set:function(){},get:function(){}});Ae=true}catch(ze){Ae=false}var Me=Ae;var Se=Te;var ke=e.computed;function Te(){var e=[];var r=arguments[arguments.length-1];if(typeof r==="function"||Me){return ke.apply(undefined,arguments)}for(var t=0,i=arguments.length-1;t<i;t++){e.push(arguments[t])}var n;if(r.set){n=function(e,t){if(arguments.length>1){return r.set.call(this,e,t)}else{return r.get.call(this,e)}}}else{n=function(e){return r.get.call(this,e)}}e.push(n);return ke.apply(undefined,e)}var Pe=Object.keys||e.keys;var xe=Pe(ke);for(var Ce=0,De=xe.length;Ce<De;Ce++){Te[xe[Ce]]=ke[xe[Ce]]}var Ne=false;var we=Ember.get;var Ie=Ember.ArrayPolyfills.forEach;var Oe=Ember.ArrayPolyfills.indexOf;var Le=Ember.merge;var $e=Ember.copy;function je(e,r){var t=[];Ie.call(e,function(e){if(Oe.call(r,e)>=0){t.push(e)}});return t}var Ke=["currentState","data","store"];var He=Ember.computed("currentState",function(e){return we(this._internalModel.currentState,e)}).readOnly();var Be=Ember.Object.extend(Ember.Evented,{_recordArrays:undefined,_relationships:undefined,_internalModel:null,store:null,isEmpty:He,isLoading:He,isLoaded:He,isDirty:Ember.computed("currentState.isDirty",function(){return this.get("currentState.isDirty")}),error:Se("adapterError",{get:function(){if(!Ne){Ne=true}return Ember.get(this,"adapterError")}}),hasDirtyAttributes:Ember.computed("currentState.isDirty",function(){return this.get("currentState.isDirty")}),isSaving:He,isDeleted:He,isNew:He,isValid:He,dirtyType:He,isError:false,isReloading:false,id:null,errors:Ember.computed(function(){var e=Fe.create();e.registerHandlers(this._internalModel,function(){this.send("becameInvalid")},function(){this.send("becameValid")});return e}).readOnly(),adapterError:null,serialize:function(e){return this.store.serialize(this,e)},toJSON:function(e){var r=this.store.serializerFor("-default");var t=this._internalModel.createSnapshot();return r.serialize(t,e)},ready:Ember.K,didLoad:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,rolledBack:Ember.K,data:Ember.computed.readOnly("_internalModel._data"),send:function(e,r){return this._internalModel.send(e,r)},transitionTo:function(e){return this._internalModel.transitionTo(e)},deleteRecord:function(){this._internalModel.deleteRecord()},destroyRecord:function(e){this.deleteRecord();return this.save(e)},unloadRecord:function(){if(this.isDestroyed){return}this._internalModel.unloadRecord()},_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=we(this._internalModel,"_data");var i=we(this._internalModel,"_attributes");var n=we(this._internalModel,"_inFlightAttributes");var a=Le($e(n),i);var o=t(null);var s=r(a);for(var l=0,u=s.length;l<u;l++){var d=s[l];o[d]=[e[d],a[d]]}return o},rollback:function(){this.rollbackAttributes()},rollbackAttributes:function(){this._internalModel.rollbackAttributes()},_createSnapshot:function(){return this._internalModel.createSnapshot()},toStringExtension:function(){return we(this,"id")},save:function(e){var r=this;return he.create({promise:this._internalModel.save(e).then(function(){return r})})},reload:function(){var e=this;return he.create({promise:this._internalModel.reload().then(function(){return e})})},trigger:function(e){var r=arguments.length;var t=new Array(r-1);for(var i=1;i<r;i++){t[i-1]=arguments[i]}Ember.tryInvoke(this,e,t);this._super.apply(this,arguments)},willDestroy:function(){this._internalModel.clearRelationships();this._internalModel.recordObjectWillDestroy();this._super.apply(this,arguments)},willMergeMixin:function(e){var r=this.constructor},attr:function(){},belongsTo:function(){},hasMany:function(){}});Be.reopenClass({_create:Be.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.")},modelName:null});var Ue=Be;var Ve=Ember.ArrayPolyfills.forEach;var qe=Ember.ArrayPolyfills.map;var We=Ember.get;function Qe(e){var r=[];if(!e||typeof e!=="object"){r.push("Top level of a JSON API document must be an object")}else{if(!("data"in e)&&!("errors"in e)&&!("meta"in e)){r.push('One or more of the following keys must be present: "data", "errors", "meta".')}else{if("data"in e&&"errors"in e){r.push('Top level keys "errors" and "data" cannot both be present in a JSON API document')}}if("data"in e){if(!(e.data===null||Ember.isArray(e.data)||typeof e.data==="object")){r.push("data must be null, an object, or an array")}}if("meta"in e){if(typeof e.meta!=="object"){r.push("meta must be an object")}}if("errors"in e){if(!Ember.isArray(e.errors)){r.push("errors must be an array")}}if("links"in e){if(typeof e.links!=="object"){r.push("links must be an object")}}if("jsonapi"in e){if(typeof e.jsonapi!=="object"){r.push("jsonapi must be an object")}}if("included"in e){if(typeof e.included!=="object"){r.push("included must be an array")}}}return r}function Je(e,r,t,i,n,a){if(We(e,"isNewSerializerAPI")){var o=function(){var o=e.normalizeResponse(r,t,i,n,a);var s=[];if(o.meta){r._setMetadataFor(t.modelName,o.meta)}return{v:o}}();if(typeof o==="object")return o.v}else{var s=e.extract(r,t,i,n,a);return Ge(t,s)}}function Ge(e,r){var t=null;if(r){if(Ember.typeOf(r)==="array"){t=qe.call(r,function(r){return Xe(e,r)})}else{t=Xe(e,r)}}return{data:t}}function Xe(e,r){var t={};t.id=""+r.id;t.type=e.modelName;t.attributes={};t.relationships={};e.eachAttribute(function(e){if(r.hasOwnProperty(e)){t.attributes[e]=r[e]}});e.eachRelationship(function(e,i){var n,a;if(r.hasOwnProperty(e)){var o;(function(){n={};a=r[e];var t=function(e,r){if(Ember.isNone(e)){return null}if(e instanceof Ue){e={id:e.id,type:e.constructor.modelName}}if(Ember.typeOf(e)==="object"){if(e.id){e.id=""+e.id}return e}return{id:""+e,type:r.type}};if(i.kind==="belongsTo"){n.data=t(a,i);if(i.options&&i.options.polymorphic&&r[e+"Type"]){n.data.type=r[e+"Type"]}}else if(i.kind==="hasMany"){o=Ember.A(a||[]);n.data=qe.call(o,function(e){return t(e,i)})}})()}if(r.links&&r.links.hasOwnProperty(e)){n=n||{};a=r.links[e];n.links={related:a}}if(n){n.meta=We(r,"meta."+e);t.relationships[e]=n}});return t}function Ye(e,r){var t=Ze(e,r);er(e,r);return t}function Ze(e,r){var t;if(r&&r.data){if(Ember.isArray(r.data)){t=qe.call(r.data,function(r){return rr(e,r)})}else{t=rr(e,r.data)}}return t}function er(e,r){var t;if(r&&r.included&&Ember.isArray(r.included)){t=qe.call(r.included,function(r){
2
- return rr(e,r)})}return t}function rr(e,r){return e.push({data:r})}function tr(e){if(!e){return e}var t={id:e.id,type:e.type,links:{}};if(e.attributes){var i=r(e.attributes);Ve.call(i,function(r){var i=e.attributes[r];t[r]=i})}if(e.relationships){var n=r(e.relationships);Ve.call(n,function(r){var i=e.relationships[r];if(i.hasOwnProperty("data")){t[r]=i.data}else if(i.links&&i.links.related){t.links[r]=i.links.related}})}return t}var ir=Ember.ArrayPolyfills.forEach;var nr=Ember.ArrayPolyfills.map;var ar=Ember.String.camelize;var or=Ember.get;var sr=le.extend({normalize:function(e,r,t){if(this.get("isNewSerializerAPI")){ur.apply(this,arguments);return this._super.apply(this,arguments)}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},normalizeArray:function(e,r,t,i){var n={data:[],included:[]};var a=e.modelFor(r);var o=e.serializerFor(r);ir.call(t,function(e){var r=o.normalize(a,e,i);var t=r.data;var s=r.included;n.data.push(t);if(s){var l;(l=n.included).push.apply(l,s)}},this);return n},_normalizeResponse:function(e,t,i,n,a,o){var s={data:null,included:[]};var l=this.extractMeta(e,t,i);if(l){s.meta=l}var u=r(i);for(var d=0,c=u.length;d<c;d++){var h=u[d];var f=h;var p=false;if(h.charAt(0)==="_"){p=true;f=h.substr(1)}var m=this.modelNameFromPayloadKey(f);if(!e.modelFactoryFor(m)){continue}var v=!p&&this.isPrimaryType(e,m,t);var y=i[h];if(y===null){continue}if(v&&Ember.typeOf(y)!=="array"){var g=this.normalize(t,y,h);var b=g.data;var R=g.included;s.data=b;if(R){var E;(E=s.included).push.apply(E,R)}continue}var _=this.normalizeArray(e,m,y,h);var F=_.data;var A=_.included;if(A){var z;(z=s.included).push.apply(z,A)}if(o){ir.call(F,function(e){var r=v&&X(e.id)===n;var t=v&&!n&&!s.data;if(t||r){s.data=e}else{s.included.push(e)}})}else{if(v){s.data=F}else{if(F){var M;(M=s.included).push.apply(M,F)}}}}return s},extractSingle:function(e,r,t,i){var n=this.normalizePayload(t);var a;for(var o in n){var s=this.modelNameFromPayloadKey(o);if(!e.modelFactoryFor(s)){continue}var l=this.isPrimaryType(e,s,r);var u=n[o];if(u===null){continue}if(l&&Ember.typeOf(u)!=="array"){a=this.normalize(r,u,o);continue}ir.call(u,function(r){var t=this.modelNameFromPayloadKey(o);var n=e.modelFor(t);var u=e.serializerFor(n.modelName);r=u.normalize(n,r,o);var d=l&&!i&&!a;var c=l&&X(r.id)===i;if(d||c){a=r}else{e.push(s,r)}},this)}return a},extractArray:function(e,r,t){var i=this.normalizePayload(t);var n;for(var a in i){var o=a;var s=false;if(a.charAt(0)==="_"){s=true;o=a.substr(1)}var l=this.modelNameFromPayloadKey(o);if(!e.modelFactoryFor(l)){continue}var u=e.modelFor(l);var d=e.serializerFor(u.modelName);var c=!s&&this.isPrimaryType(e,l,r);var h=nr.call(i[a],function(e){return d.normalize(u,e,a)},this);if(c){n=h}else{e.pushMany(l,h)}}return n},isPrimaryType:function(e,r,t){var i=e.modelFor(r);return i.modelName===t.modelName},pushPayload:function(e,r){if(this.get("isNewSerializerAPI")){dr.apply(this,arguments);return}var t=this.normalizePayload(r);for(var i in t){var n=this.modelNameFromPayloadKey(i);if(!e.modelFactoryFor(n)){continue}var a=e.modelFor(n);var o=e.serializerFor(n);var s=nr.call(Ember.makeArray(t[i]),function(e){return o.normalize(a,e,i)},this);e.pushMany(n,s)}},modelNameFromPayloadKey:function(e){return K(Z(e))},serialize:function(e,r){return this._super.apply(this,arguments)},serializeIntoHash:function(e,r,t,i){var n=this.payloadKeyFromModelName(r.modelName);e[n]=this.serialize(t,i)},payloadKeyFromModelName:function(e){return ar(e)},typeForRoot:function(e){return this.modelNameFromPayloadKey(e)},serializePolymorphicType:function(e,r,t){var i=t.key;var n=e.belongsTo(i);i=this.keyForAttribute?this.keyForAttribute(i,"serialize"):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.modelName)}}});var lr=sr;function ur(e,r,t){if(this.normalizeHash&&this.normalizeHash[t]){this.normalizeHash[t](r)}}function dr(e,r){var t={data:[],included:[]};var i=this.normalizePayload(r);for(var n in i){var a=this.modelNameFromPayloadKey(n);if(!e.modelFactoryFor(a)){continue}var o=e.modelFor(a);var s=e.serializerFor(o.modelName);ir.call(Ember.makeArray(i[n]),function(e){var r=s.normalize(o,e,n);var i=r.data;var a=r.included;t.data.push(i);if(a){var l;(l=t.included).push.apply(l,a)}},this)}Ye(e,t)}var cr=e.String;var hr=cr.singularize;var fr=cr.classify;var pr=cr.decamelize;var mr=cr.camelize;var vr=cr.underscore;var yr=lr.extend({keyForAttribute:function(e){return pr(e)},keyForRelationship:function(e,r){var t=pr(e);if(r==="belongsTo"){return t+"_id"}else if(r==="hasMany"){return hr(t)+"_ids"}else{return t}},keyForLink:function(e,r){return mr(e)},serializeHasMany:e.K,payloadKeyFromModelName:function(e){return vr(pr(e))},serializePolymorphicType:function(r,t,i){var n=i.key;var a=r.belongsTo(n);var o=vr(n+"_type");if(e.isNone(a)){t[o]=null}else{t[o]=fr(a.modelName).replace("/","::")}},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=mr(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,n;if(t.options.polymorphic){i=this.keyForAttribute(e,"deserialize");n=r[i];if(n&&n.type){n.type=this.modelNameFromPayloadKey(n.type)}else if(n&&t.kind==="hasMany"){for(var a=0,o=n.length;a<o;a++){var s=n[a];s.type=this.modelNameFromPayloadKey(s.type)}}}else{i=this.keyForRelationship(e,t.kind,"deserialize");if(!r.hasOwnProperty(i)){return}n=r[i]}r[e]=n;if(e!==i){delete r[i]}},this)}},extractRelationships:function(e,r){e.eachRelationship(function(e,t){var i=this.keyForRelationship(e,t.kind,"deserialize");if(t.options.polymorphic){gr(e,t,r,i)}if(r.hasOwnProperty(i)&&typeof r[i]!=="object"){var n=this.keyForRelationship(e)+"_type";if(r[n]&&t.options.polymorphic){var a=r[i];var o=r[n];delete r[n];delete r[i];r[i]={id:a,type:o}}}},this);return this._super.apply(this,arguments)},modelNameFromPayloadKey:function(e){var r=hr(e.replace("::","/"));return Z(r)}});function gr(e,r,t,i){var n=pr(e);if(n in t&&typeof t[n]==="object"){if(r.kind==="belongsTo"){var a=t[n];var o=a.id;var s=a.type;t[i]={id:o,type:s}}else{var l=t[n];if(!l){return}var u=[];for(var d=0,c=l.length;d<c;d++){var a=l[d];var o=a.id;var s=a.type;u.push({id:o,type:s})}t[i]=u}}}var br=yr;function Rr(e){this.container=e}Rr.prototype.aliasedFactory=function(e,r){var t=this;return{create:function(){if(r){r()}return t.container.lookup(e)}}};Rr.prototype.registerAlias=function(e,r,t){var i=this.aliasedFactory(r,t);return this.container.register(e,i)};Rr.prototype.registerDeprecation=function(e,r){var t=function(){};return this.registerAlias(e,r,t)};Rr.prototype.registerDeprecations=function(e){var r,t,i,n;for(r=e.length;r>0;r--){t=e[r-1];i=t["deprecated"];n=t["valid"];this.registerDeprecation(i,n)}};var Er=Rr;var _r=Fr;function Fr(e,r){var t=new Er(e);t.registerDeprecations([{deprecated:"serializer:_ams",valid:"serializer:-active-model"},{deprecated:"adapter:_ams",valid:"adapter:-active-model"}]);e.register("serializer:-active-model",br.extend({isNewSerializerAPI:true}));e.register("adapter:-active-model",Q)}var Ar=Ember.get;var zr=Ember.String.fmt;var Mr=Ember.ArrayPolyfills.indexOf;var Sr=0;var kr=p.extend({serializer:null,coalesceFindRequests:false,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(zr("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(t.modelName).serialize(t,{includeId:true})},generateIdForRecord:function(e){return"fixture-"+Sr++},find:function(e,r,t,i){var n=this.fixturesForType(r);var a;if(n){a=Ember.A(n).findBy("id",t)}if(a){return this.simulateRemoteCall(function(){return a},this)}},findMany:function(e,r,t,i){var n=this.fixturesForType(r);if(n){n=n.filter(function(e){return Mr.call(t,e.id)!==-1})}if(n){return this.simulateRemoteCall(function(){return n},this)}},findAll:function(e,r){var t=this.fixturesForType(r);return this.simulateRemoteCall(function(){return t},this)},findQuery:function(e,r,t,i){var n=this.fixturesForType(r);n=this.queryFixtures(n,t,r);if(n){return this.simulateRemoteCall(function(){return n},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=Mr.call(e.FIXTURES,t);e.FIXTURES.splice(i,1);return true}},findExistingFixture:function(e,r){var t=this.fixturesForType(e);var i=r.id;return this.findFixtureById(t,i)},findFixtureById:function(e,r){return Ember.A(e).find(function(e){if(""+Ar(e,"id")===""+r){return true}else{return false}})},simulateRemoteCall:function(e,r){var t=this;return new Ember.RSVP.Promise(function(i){var n=Ember.copy(e.call(r),true);if(Ar(t,"simulateRemoteResponse")){Ember.run.later(function(){i(n)},Ar(t,"latency"))}else{Ember.run.schedule("actions",null,function(){i(n)})}},"DS: FixtureAdapter#simulateRemoteCall")}});var Tr=T.extend({defaultSerializer:"-json-api",ajaxOptions:function(e,r,t){var i=this._super.apply(this,arguments);if(i.contentType){i.contentType="application/vnd.api+json"}var n=i.beforeSend;i.beforeSend=function(e){e.setRequestHeader("Accept","application/vnd.api+json");if(n){n(e)}};return i},findMany:function(e,r,t,i){var n=this.buildURL(r.modelName,t,i,"findMany");return this.ajax(n,"GET",{data:{filter:{id:t.join(",")}}})},pathForType:function(e){var r=Ember.String.dasherize(e);return Ember.String.pluralize(r)},updateRecord:function(e,r,t){var i={};var n=e.serializerFor(r.modelName);n.serializeIntoHash(i,r,t,{includeId:true});var a=t.id;var o=this.buildURL(r.modelName,a,t,"updateRecord");return this.ajax(o,"PATCH",{data:i})}});var Pr=Ember.Namespace.create({VERSION:"1.13.9"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",Pr.VERSION)}var xr={};Ember.merge(Ember.FEATURES,xr);var Cr=Pr;var Dr=Ember.get;function Nr(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function wr(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function Ir(e){return!(Dr(e,"isDestroyed")||Dr(e,"isDestroying"))}function Or(e,r,t){var i=r.serializer;if(i===undefined){i=e.serializerFor(t)}if(i===null||i===undefined){i={extract:function(e,r,t){return t}}}return i}var Lr=Ember.RSVP.Promise;var $r=Ember.ArrayPolyfills.map;var jr=Ember.get;function Kr(e,r,t,i,n,a){var o=n.createSnapshot(a);var s;if(!e.findRecord){s=e.find(r,t,i,o)}else{s=e.findRecord(r,t,i,o)}var l=Or(r,e,n.type.modelName);var u="DS: Handle Adapter#find of "+t+" with id: "+i;s=Lr.cast(s,u);s=wr(s,Nr(Ir,r));return s.then(function(e){return r._adapterRun(function(){var n=jr(l,"isNewSerializerAPI")?"findRecord":"find";var a=Je(l,r,t,e,i,n);var o=Ye(r,a);return o._internalModel})},function(e){n.notFound();if(n.isEmpty()){n.unloadRecord()}throw e},"DS: Extract payload of '"+t+"'")}function Hr(e,r,t,i,n){var a=Ember.A(n).invoke("createSnapshot");var o=e.findMany(r,t,i,a);var s=Or(r,e,t.modelName);var l="DS: Handle Adapter#findMany of "+t;if(o===undefined){throw new Error("adapter.findMany returned undefined, this was very likely a mistake")}o=Lr.cast(o,l);o=wr(o,Nr(Ir,r));return o.then(function(e){return r._adapterRun(function(){var i=Je(s,r,t,e,null,"findMany");var n=Ye(r,i);return $r.call(n,function(e){return e._internalModel})})},null,"DS: Extract payload of "+t)}function Br(e,r,t,i,n){var a=t.createSnapshot();var o=r.modelFor(n.type);var s=e.findHasMany(r,a,i,n);var l=Or(r,e,n.type);var u="DS: Handle Adapter#findHasMany of "+t+" : "+n.type;s=Lr.cast(s,u);s=wr(s,Nr(Ir,r));s=wr(s,Nr(Ir,t));return s.then(function(e){return r._adapterRun(function(){var t=Je(l,r,o,e,null,"findHasMany");var i=Ye(r,t);var n=$r.call(i,function(e){return e._internalModel});if(jr(l,"isNewSerializerAPI")){n.meta=t.meta}return n})},null,"DS: Extract payload of "+t+" : hasMany "+n.type)}function Ur(e,r,t,i,n){var a=t.createSnapshot();var o=r.modelFor(n.type);var s=e.findBelongsTo(r,a,i,n);var l=Or(r,e,n.type);var u="DS: Handle Adapter#findBelongsTo of "+t+" : "+n.type;s=Lr.cast(s,u);s=wr(s,Nr(Ir,r));s=wr(s,Nr(Ir,t));return s.then(function(e){return r._adapterRun(function(){var t=Je(l,r,o,e,null,"findBelongsTo");if(!t.data){return null}var i=Ye(r,t);return i._internalModel})},null,"DS: Extract payload of "+t+" : "+n.type)}function Vr(e,r,t,i,n){var a=t.modelName;var o=r.peekAll(a);var s=o.createSnapshot(n);var l=e.findAll(r,t,i,s);var u=Or(r,e,a);var d="DS: Handle Adapter#findAll of "+t;l=Lr.cast(l,d);l=wr(l,Nr(Ir,r));return l.then(function(e){r._adapterRun(function(){var i=Je(u,r,t,e,null,"findAll");Ye(r,i)});r.didUpdateAll(t);return r.peekAll(a)},null,"DS: Extract payload of findAll "+t)}function qr(e,r,t,i,n){var a=t.modelName;var o;if(!e.query){o=e.findQuery(r,t,i,n)}else{o=e.query(r,t,i,n)}var s=Or(r,e,a);var l="DS: Handle Adapter#findQuery of "+t;o=Lr.cast(o,l);o=wr(o,Nr(Ir,r));return o.then(function(e){var i;r._adapterRun(function(){var n=jr(s,"isNewSerializerAPI")?"query":"findQuery";var a=Je(s,r,t,e,null,n);i=Ye(r,a)});n.loadRecords(i);return n},null,"DS: Extract payload of findQuery "+t)}function Wr(e,r,t,i){var n=t.modelName;var a=e.queryRecord(r,t,i);var o=Or(r,e,n);var s="DS: Handle Adapter#queryRecord of "+t;a=Lr.cast(a,s);a=wr(a,Nr(Ir,r));return a.then(function(e){var i;r._adapterRun(function(){var n=Je(o,r,t,e,null,"queryRecord");i=Ye(r,n)});return i},null,"DS: Extract payload of queryRecord "+t)}function Qr(e,r,t){this._snapshots=null;this._recordArray=e;this.length=e.get("length");this.type=e.get("type");this.meta=r;this.adapterOptions=t}Qr.prototype.snapshots=function(){if(this._snapshots){return this._snapshots}var e=this._recordArray;this._snapshots=e.invoke("createSnapshot");return this._snapshots};var Jr=Qr;var Gr=Ember.get;var Xr=Ember.set;var Yr=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=Gr(this,"content");var t=r.objectAt(e);return t&&t.getRecord()},update:function(){if(Gr(this,"isUpdating")){return}var e=Gr(this,"store");var r=Gr(this,"type.modelName");return e.findAll(r,{reload:true})},addInternalModel:function(e,r){var t=Gr(this,"content");if(r===undefined){t.addObject(e)}else if(!t.contains(e)){t.insertAt(r,e)}},removeInternalModel:function(e){Gr(this,"content").removeObject(e)},save:function(){var e=this;var r="DS: RecordArray#save "+Gr(this,"type");var t=Ember.RSVP.all(this.invoke("save"),r).then(function(r){return e},null,"DS: RecordArray#save return RecordArray");return ce.create({promise:t})},_dissociateFromOwnRecords:function(){var e=this;this.get("content").forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},_unregisterFromManager:function(){var e=Gr(this,"manager");e.unregisterRecordArray(this)},willDestroy:function(){this._unregisterFromManager();this._dissociateFromOwnRecords();Xr(this,"content",undefined);this._super.apply(this,arguments)},createSnapshot:function(e){var r=e&&e.adapterOptions;var t=this.get("meta");return new Jr(this,t,r)}});var Zr=Ember.get;var et=Yr.extend({filterFunction:null,isLoaded:true,replace:function(){var e=Zr(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=Zr(this,"manager");e.updateFilter(this,Zr(this,"type"),Zr(this,"filterFunction"))},updateFilter:Ember.observer("filterFunction",function(){Ember.run.once(this,this._updateFilter)})});var rt=tt;function tt(e){var r=t(null);for(var i in e){r[i]=e[i]}return r}var it=Ember.get;var nt=Yr.extend({query:null,replace:function(){var e=it(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},load:function(e){var r=it(this,"store");var t=it(this,"type");var i=t.modelName;var n=r.pushMany(i,e);this.loadRecords(n)},loadRecords:function(e){var r=it(this,"store");var t=it(this,"type");var i=t.modelName;var n=r._metadataFor(i);var a=Ember.A(e).mapBy("_internalModel");this.setProperties({content:Ember.A(a),isLoaded:true,meta:rt(n)});a.forEach(function(e){this.manager.recordArraysForRecord(e).add(this)},this);Ember.run.once(this,"trigger","didLoad")}});var at=Ember.OrderedSet;var ot=Ember.guidFor;var st=function(){this._super$constructor()};st.create=function(){var e=this;return new e};st.prototype=t(at.prototype);st.prototype.constructor=st;st.prototype._super$constructor=at;st.prototype.addWithIndex=function(e,r){var t=ot(e);var i=this.presenceSet;var n=this.list;if(i[t]===true){return}i[t]=true;if(r===undefined||r==null){n.push(e)}else{n.splice(r,0,e)}this.size+=1;return this};var lt=st;var ut=Ember.get;var dt=Ember.ArrayPolyfills.forEach;var ct=Ember.ArrayPolyfills.indexOf;var ht=Ember.Object.extend({init:function(){var e=this;this.filteredRecordArrays=v.create({defaultValue:function(){return[]}});this.liveRecordArrays=v.create({defaultValue:function(r){return e.createRecordArray(r)}});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||lt.create();return e._recordArrays},updateRecordArrays:function(){dt.call(this.changedRecords,function(e){if(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.removeInternalModel(e)});e._recordArrays=null},_recordWasChanged:function(e){var r=e.type;var t=this.filteredRecordArrays.get(r);var i;dt.call(t,function(t){i=ut(t,"filterFunction");this.updateFilterRecordArray(t,i,r,e)},this)},recordWasLoaded:function(e){var r=e.type;var t=this.filteredRecordArrays.get(r);var i;dt.call(t,function(t){i=ut(t,"filterFunction");this.updateFilterRecordArray(t,i,r,e)},this);if(this.liveRecordArrays.has(r)){var n=this.liveRecordArrays.get(r);this._addRecordToRecordArray(n,e)}},updateFilterRecordArray:function(e,r,t,i){var n=r(i.getRecord());var a=this.recordArraysForRecord(i);if(n){this._addRecordToRecordArray(e,i)}else{a["delete"](e);e.removeInternalModel(i)}},_addRecordToRecordArray:function(e,r){var t=this.recordArraysForRecord(r);if(!t.has(e)){e.addInternalModel(r);t.add(e)}},populateLiveRecordArray:function(e,r){var t=this.store.typeMapFor(r);var i=t.records;var n;for(var a=0,o=i.length;a<o;a++){n=i[a];if(!n.isDeleted()&&!n.isEmpty()){this._addRecordToRecordArray(e,n)}}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var n=i.records;var a;for(var o=0,s=n.length;o<s;o++){a=n[o];if(!a.isDeleted()&&!a.isEmpty()){this.updateFilterRecordArray(e,t,r,a)}}},liveRecordArrayFor:function(e){return this.liveRecordArrays.get(e)},createRecordArray:function(e){var r=Yr.create({type:e,content:Ember.A(),store:this.store,isLoaded:true,manager:this});return r},createFilteredRecordArray:function(e,r,t){var i=et.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=nt.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)},unregisterRecordArray:function(e){var r=e.type;var t=this.filteredRecordArrays.get(r);var i=ct.call(t,e);if(i!==-1){t.splice(i,1)}else if(this.liveRecordArrays.has(r)){var n=this.liveRecordArrayFor(r);if(e===n){this.liveRecordArrays["delete"](r)}}},willDestroy:function(){this._super.apply(this,arguments);this.filteredRecordArrays.forEach(function(e){dt.call(pt(e),ft)});this.liveRecordArrays.forEach(ft);dt.call(this._adapterPopulatedRecordArrays,ft)}});function ft(e){e.destroy()}function pt(e){var r=e.length;var t=Ember.A();for(var i=0;i<r;i++){t=t.concat(e[i])}return t}function mt(e){this._container=e;this._cache=t(null)}mt.prototype=t(null);e.merge(mt.prototype,{get:function(e,r,t){var i=this._cache;var n=e+":"+r;if(!(n in i)){var a=this.instanceFor(n)||this._findInstance(e,t);if(a){i[n]=a}}return i[n]},_findInstance:function(e,r){for(var t=0,i=r.length;t<i;t++){var n=r[t];var a=e+":"+n;var o=this.instanceFor(a);if(o){return o}}},instanceFor:function(r){if(r==="adapter:-rest"){e.deprecate("You are currently using the default DS.RESTAdapter adapter. For Ember 2.0 the default adapter will be DS.JSONAPIAdapter. If you would like to continue using DS.RESTAdapter please create an application adapter that extends DS.RESTAdapter.",false,{id:"ds.adapter.default-adapter-changing-to-json-api",until:"2.0.0"})}var t=this._cache;if(!t[r]){var i=this._container.lookup(r);if(i){t[r]=i}}return t[r]},destroy:function(){var e=this._cache;var t=r(e);for(var i=0,n=t.length;i<n;i++){var a=t[i];var o=e[a];if(o){o.destroy()}}this._container=null},constructor:mt,toString:function(){return"ContainerInstanceCache"}});var vt=mt;function yt(e,t){if(!t||typeof t!=="object"){return e}var i=r(t);var n;var a=i.length;for(var o=0;o<a;o++){n=i[o];e[n]=t[n]}return e}var gt=yt;var bt=Ember.get;function Rt(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 Et={initialState:"uncommitted",isDirty:true,uncommitted:{didSetProperty:Rt,loadingData:Ember.K,propertyWasReset:function(e,t){var i=r(e._attributes).length;var n=i>0;if(!n){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,r){r(e.store.reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollbackAttributes();e.triggerLater("ready")}},inFlight:{isSaving:true,didSetProperty:Rt,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:St,willCommit:Ember.K,didCommit:function(e){var r=bt(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",r)},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,r){e.removeErrorMessageFromAttribute(r.name);Rt(e,r)},becomeDirty:Ember.K,pushedData:Ember.K,willCommit:function(e){e.clearErrorMessages();e.transitionTo("inFlight")},rolledBack:function(e){e.clearErrorMessages();e.transitionTo("loaded.saved");e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes=t(null)}}};function _t(e){var r={};var t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=_t(t)}else{r[i]=t}}return r}function Ft(e,r){for(var t in r){e[t]=r[t]}return e}function At(e){var r=_t(Et);return Ft(r,e)}var zt=At({dirtyType:"created",isNew:true});zt.invalid.rolledBack=function(e){e.transitionTo("deleted.saved")};zt.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var Mt=At({dirtyType:"updated"});zt.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved");e.send("invokeLifecycleCallbacks")};zt.uncommitted.rollback=function(e){Et.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};zt.uncommitted.pushedData=function(e){e.transitionTo("loaded.updated.uncommitted");e.triggerLater("didLoad")};zt.uncommitted.propertyWasReset=Ember.K;function St(e){}Mt.inFlight.unloadRecord=St;Mt.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var kt={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.triggerLater("ready")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");e.triggerLater("ready")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");e.triggerLater("ready");e.didCleanError()},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 t=e._attributes;var i=r(t).length>0;if(i){e.adapterDidDirty()}},didSetProperty:Rt,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,r){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",bt(e,"lastDirtyType"))},notFound:Ember.K},created:zt,updated:Mt},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.rollbackAttributes();e.triggerLater("ready")},pushedData:Ember.K,becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved");e.triggerLater("ready")}},inFlight:{isSaving:true,unloadRecord:St,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)},becameInvalid:function(e){e.transitionTo("invalid");e.triggerLater("becameInvalid",e)}},saved:{isDirty:false,setup:function(e){var r=e.store;r._dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K},invalid:{isValid:false,didSetProperty:function(e,r){e.removeErrorMessageFromAttribute(r.name);Rt(e,r)},deleteRecord:Ember.K,becomeDirty:Ember.K,willCommit:Ember.K,rolledBack:function(e){e.clearErrorMessages();e.transitionTo("loaded.saved");e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")}}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function Tt(e,r,i){e=Ft(r?t(r):{},e);e.parentState=r;e.stateName=i;for(var n in e){if(!e.hasOwnProperty(n)||n==="parentState"||n==="stateName"){continue}if(typeof e[n]==="object"){e[n]=Tt(e[n],e,i+"."+n)}}return e}kt=Tt(kt,null,"root");var Pt=kt;var xt=Ember.ArrayPolyfills.forEach;function Ct(e,r,t,i){this.members=new lt;this.canonicalMembers=new lt;this.store=e;this.key=i.key;this.inverseKey=t;this.record=r;this.isAsync=i.options.async;this.relationshipMeta=i;this.inverseKeyForImplicit=this.record.constructor.modelName+this.key;this.linkPromise=null;this.meta=null;this.hasData=false}Ct.prototype={constructor:Ct,destroy:Ember.K,updateMeta:function(e){this.meta=e},clear:function(){var e=this.members.list;var r;while(e.length>0){r=e[0];this.removeRecord(r)}},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;xt.call(e,function(e){r.removeRecord(e)})},addRecords:function(e,r){var t=this;xt.call(e,function(e){t.addRecord(e,r);if(r!==undefined){r++}})},addCanonicalRecords:function(e,r){for(var t=0;t<e.length;t++){if(r!==undefined){this.addCanonicalRecord(e[t],t+r)}else{this.addCanonicalRecord(e[t])}}},addCanonicalRecord:function(e,r){if(!this.canonicalMembers.has(e)){this.canonicalMembers.add(e);if(this.inverseKey){e._relationships.get(this.inverseKey).addCanonicalRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new Ct(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addCanonicalRecord(this.record)}}this.flushCanonicalLater();this.setHasData(true)},removeCanonicalRecords:function(e,r){for(var t=0;t<e.length;t++){if(r!==undefined){this.removeCanonicalRecord(e[t],t+r)}else{this.removeCanonicalRecord(e[t])}}},removeCanonicalRecord:function(e,r){if(this.canonicalMembers.has(e)){this.removeCanonicalRecordFromOwn(e);if(this.inverseKey){this.removeCanonicalRecordFromInverse(e)}else{if(e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit].removeCanonicalRecord(this.record)}}}this.flushCanonicalLater()},addRecord:function(e,r){if(!this.members.has(e)){this.members.addWithIndex(e,r);this.notifyRecordRelationshipAdded(e,r);if(this.inverseKey){e._relationships.get(this.inverseKey).addRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new Ct(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)}this.record.updateRecordArraysLater()}this.setHasData(true)},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.get(this.inverseKey).addRecord(this.record)}},removeRecordFromInverse:function(e){var r=e._relationships.get(this.inverseKey);if(r){r.removeRecordFromOwn(this.record)}},removeRecordFromOwn:function(e){this.members["delete"](e);this.notifyRecordRelationshipRemoved(e);this.record.updateRecordArrays()},removeCanonicalRecordFromInverse:function(e){var r=e._relationships.get(this.inverseKey);if(r){r.removeCanonicalRecordFromOwn(this.record)}},removeCanonicalRecordFromOwn:function(e){this.canonicalMembers["delete"](e);this.flushCanonicalLater()},flushCanonical:function(){this.willSync=false;var e=[];for(var r=0;r<this.members.list.length;r++){if(this.members.list[r].isNew()){e.push(this.members.list[r])}}this.members=this.canonicalMembers.copy();for(r=0;r<e.length;r++){this.members.add(e[r])}},flushCanonicalLater:function(){if(this.willSync){return}this.willSync=true;var e=this;this.store._backburner.join(function(){e.store._backburner.schedule("syncRelationships",e,e.flushCanonical)})},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){
3
- var r=this;r.computeChanges(e);r.setHasData(true)},notifyRecordRelationshipAdded:Ember.K,notifyRecordRelationshipRemoved:Ember.K,setHasData:function(e){this.hasData=e}};var Dt=Ct;var Nt=Ember.get;var wt=Ember.set;var It=Ember.ArrayPolyfills.filter;var Ot=Ember.Object.extend(Ember.MutableArray,Ember.Evented,{init:function(){this.currentState=Ember.A([])},record:null,canonicalState:null,currentState:null,length:0,objectAt:function(e){if(!this.currentState[e]){return undefined}return this.currentState[e].getRecord()},flushCanonical:function(){var e=It.call(this.canonicalState,function(e){return!e.isDeleted()});var r=this.currentState.filter(function(e){return e.isNew()});e=e.concat(r);var t=this.length;this.arrayContentWillChange(0,this.length,e.length);this.set("length",e.length);this.currentState=e;this.arrayContentDidChange(0,t,this.length);this.relationship.notifyHasManyChanged();this.record.updateRecordArrays()},isPolymorphic:false,isLoaded:false,relationship:null,meta:null,internalReplace:function(e,r,t){if(!t){t=[]}this.arrayContentWillChange(e,r,t.length);this.currentState.splice.apply(this.currentState,[e,r].concat(t));this.set("length",this.currentState.length);this.arrayContentDidChange(e,r,t.length);if(t){this.relationship.notifyHasManyChanged()}this.record.updateRecordArrays()},internalRemoveRecords:function(e){var r;for(var t=0;t<e.length;t++){r=this.currentState.indexOf(e[t]);this.internalReplace(r,1)}},internalAddRecords:function(e,r){if(r===undefined){r=this.currentState.length}this.internalReplace(r,0,e)},replace:function(e,r,t){var i;if(r>0){i=this.currentState.slice(e,e+r);this.get("relationship").removeRecords(i)}var n=t.map||Ember.ArrayPolyfills.map;if(t){this.get("relationship").addRecords(n.call(t,function(e){return e._internalModel}),e)}},promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--;if(this.loadingRecordsCount===0){wt(this,"isLoaded",true);this.trigger("didLoad")}},reload:function(){return this.relationship.reload()},save:function(){var e=this;var r="DS: ManyArray#save "+Nt(this,"type");var t=Ember.RSVP.all(this.invoke("save"),r).then(function(r){return e},null,"DS: ManyArray#save return ManyArray");return ce.create({promise:t})},createRecord:function(e){var r=Nt(this,"store");var t=Nt(this,"type");var i;i=r.createRecord(t.modelName,e);this.pushObject(i);return i},addRecord:function(e){this.addObject(e)},removeRecord:function(e){this.removeObject(e)}});var Lt=function(r,t,i){var n=i.type.modelName;var a=r.type.modelName;var o=t.key;var s=r.store.modelFor(t.type);var l="You cannot add a record of type '"+n+"' to the '"+a+"."+o+"' relationship (only '"+s.modelName+"' allowed)";e.assert(l,$t(s,i))};function $t(r,t){if(r.__isMixin){return r.__mixin.detect(t.type.PrototypeMixin)}if(e.MODEL_FACTORY_INJECTIONS){r=r.superclass}return r.detect(t.type)}var jt=Ember.ArrayPolyfills.map;var Kt=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.canonicalState=[];this.manyArray=Ot.create({canonicalState:this.canonicalState,store:this.store,relationship:this,type:this.store.modelFor(this.belongsToType),record:r});this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic};Kt.prototype=t(Dt.prototype);Kt.prototype.constructor=Kt;Kt.prototype._super$constructor=Dt;Kt.prototype.destroy=function(){this.manyArray.destroy()};Kt.prototype._super$updateMeta=Dt.prototype.updateMeta;Kt.prototype.updateMeta=function(e){this._super$updateMeta(e);this.manyArray.set("meta",e)};Kt.prototype._super$addCanonicalRecord=Dt.prototype.addCanonicalRecord;Kt.prototype.addCanonicalRecord=function(e,r){if(this.canonicalMembers.has(e)){return}if(r!==undefined){this.canonicalState.splice(r,0,e)}else{this.canonicalState.push(e)}this._super$addCanonicalRecord(e,r)};Kt.prototype._super$addRecord=Dt.prototype.addRecord;Kt.prototype.addRecord=function(e,r){if(this.members.has(e)){return}this._super$addRecord(e,r);this.manyArray.internalAddRecords([e],r)};Kt.prototype._super$removeCanonicalRecordFromOwn=Dt.prototype.removeCanonicalRecordFromOwn;Kt.prototype.removeCanonicalRecordFromOwn=function(e,r){var t=r;if(!this.canonicalMembers.has(e)){return}if(t===undefined){t=this.canonicalState.indexOf(e)}if(t>-1){this.canonicalState.splice(t,1)}this._super$removeCanonicalRecordFromOwn(e,r)};Kt.prototype._super$flushCanonical=Dt.prototype.flushCanonical;Kt.prototype.flushCanonical=function(){this.manyArray.flushCanonical();this._super$flushCanonical()};Kt.prototype._super$removeRecordFromOwn=Dt.prototype.removeRecordFromOwn;Kt.prototype.removeRecordFromOwn=function(e,r){if(!this.members.has(e)){return}this._super$removeRecordFromOwn(e,r);if(r!==undefined){this.manyArray.currentState.removeAt(r)}else{this.manyArray.internalRemoveRecords([e])}};Kt.prototype.notifyRecordRelationshipAdded=function(e,r){Lt(this.record,this.relationshipMeta,e);this.record.notifyHasManyAdded(this.key,e,r)};Kt.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})}};Kt.prototype.computeChanges=function(e){var r=this.canonicalMembers;var t=[];var i;var n;var a;e=Ht(e);r.forEach(function(r){if(e.has(r)){return}t.push(r)});this.removeCanonicalRecords(t);e=e.toArray();i=e.length;for(a=0;a<i;a++){n=e[a];this.removeCanonicalRecord(n);this.addCanonicalRecord(n,a)}};Kt.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(r){if(r.hasOwnProperty("meta")){e.updateMeta(r.meta)}e.store._backburner.join(function(){e.updateRecordsFromAdapter(r)});return e.manyArray})};Kt.prototype.findRecords=function(){var e=this.manyArray;return this.store.findMany(jt.call(e.toArray(),function(e){return e._internalModel})).then(function(){e.set("isLoaded",true);return e})};Kt.prototype.notifyHasManyChanged=function(){this.record.notifyHasManyAdded(this.key)};Kt.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 ve.create({content:this.manyArray,promise:r})}else{if(!this.manyArray.get("isDestroyed")){this.manyArray.set("isLoaded",true)}return this.manyArray}};function Ht(e){var r=new lt;if(e){for(var t=0,i=e.length;t<i;t++){r.add(e[t])}}return r}var Bt=Kt;var Ut=function(e,r,t,i){this._super$constructor(e,r,t,i);this.record=r;this.key=i.key;this.inverseRecord=null;this.canonicalState=null};Ut.prototype=t(Dt.prototype);Ut.prototype.constructor=Ut;Ut.prototype._super$constructor=Dt;Ut.prototype.setRecord=function(e){if(e){this.addRecord(e)}else if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.setHasData(true)};Ut.prototype.setCanonicalRecord=function(e){if(e){this.addCanonicalRecord(e)}else if(this.inverseRecord){this.removeCanonicalRecord(this.inverseRecord)}this.setHasData(true)};Ut.prototype._super$addCanonicalRecord=Dt.prototype.addCanonicalRecord;Ut.prototype.addCanonicalRecord=function(e){if(this.canonicalMembers.has(e)){return}if(this.canonicalState){this.removeCanonicalRecord(this.canonicalState)}this.canonicalState=e;this._super$addCanonicalRecord(e)};Ut.prototype._super$flushCanonical=Dt.prototype.flushCanonical;Ut.prototype.flushCanonical=function(){if(this.inverseRecord&&this.inverseRecord.isNew()&&!this.canonicalState){return}this.inverseRecord=this.canonicalState;this.record.notifyBelongsToChanged(this.key);this._super$flushCanonical()};Ut.prototype._super$addRecord=Dt.prototype.addRecord;Ut.prototype.addRecord=function(e){if(this.members.has(e)){return}Lt(this.record,this.relationshipMeta,e);if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.inverseRecord=e;this._super$addRecord(e);this.record.notifyBelongsToChanged(this.key)};Ut.prototype.setRecordPromise=function(e){var r=e.get&&e.get("content");this.setRecord(r?r._internalModel:r)};Ut.prototype._super$removeRecordFromOwn=Dt.prototype.removeRecordFromOwn;Ut.prototype.removeRecordFromOwn=function(e){if(!this.members.has(e)){return}this.inverseRecord=null;this._super$removeRecordFromOwn(e);this.record.notifyBelongsToChanged(this.key)};Ut.prototype._super$removeCanonicalRecordFromOwn=Dt.prototype.removeCanonicalRecordFromOwn;Ut.prototype.removeCanonicalRecordFromOwn=function(e){if(!this.canonicalMembers.has(e)){return}this.canonicalState=null;this._super$removeCanonicalRecordFromOwn(e)};Ut.prototype.findRecord=function(){if(this.inverseRecord){return this.store._findByInternalModel(this.inverseRecord)}else{return Ember.RSVP.Promise.resolve(null)}};Ut.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})};Ut.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 he.create({promise:e,content:this.inverseRecord?this.inverseRecord.getRecord():null})}else{if(this.inverseRecord===null){return null}var t=this.inverseRecord.getRecord();return t}};var Vt=Ut;var qt=Ember.get;var Wt=function(e,r,t){var i;var n=e.type.inverseFor(r.key,t);if(n){i=n.name}if(r.kind==="hasMany"){return new Bt(t,e,i,r)}else{return new Vt(t,e,i,r)}};var Qt=function(e){this.record=e;this.initializedRelationships=t(null)};Qt.prototype.has=function(e){return!!this.initializedRelationships[e]};Qt.prototype.get=function(e){var r=this.initializedRelationships;var t=qt(this.record.type,"relationshipsByName");if(!r[e]&&t.get(e)){r[e]=Wt(this.record,t.get(e),this.record.store)}return r[e]};var Jt=Qt;var Gt=Ember.get;function Xt(e){this._attributes=t(null);this._belongsToRelationships=t(null);this._belongsToIds=t(null);this._hasManyRelationships=t(null);this._hasManyIds=t(null);var r=e.getRecord();this.record=r;r.eachAttribute(function(e){this._attributes[e]=Gt(r,e)},this);this.id=e.id;this._internalModel=e;this.type=e.type;this.modelName=e.type.modelName;this._changedAttributes=r.changedAttributes();if(Ember.platform.hasPropertyAccessors){var i=true;Ember.defineProperty(this,"constructor",{get:function(){if(i){i=false;i=true}return this.type}})}else{this.constructor=this.type}}Xt.prototype={constructor:Xt,id:null,record:null,type:null,modelName:null,attr:function(e){if(e in this._attributes){return this._attributes[e]}throw new Ember.Error("Model '"+Ember.inspect(this.record)+"' has no attribute named '"+e+"' defined.")},attributes:function(){return Ember.copy(this._attributes)},changedAttributes:function(){var e=t(null);var i=r(this._changedAttributes);for(var n=0,a=i.length;n<a;n++){var o=i[n];e[o]=Ember.copy(this._changedAttributes[o])}return e},belongsTo:function(e,r){var t=r&&r.id;var i,n,a;var o;if(t&&e in this._belongsToIds){return this._belongsToIds[e]}if(!t&&e in this._belongsToRelationships){return this._belongsToRelationships[e]}i=this._internalModel._relationships.get(e);if(!(i&&i.relationshipMeta.kind==="belongsTo")){throw new Ember.Error("Model '"+Ember.inspect(this.record)+"' has no belongsTo relationship named '"+e+"' defined.")}a=Gt(i,"hasData");n=Gt(i,"inverseRecord");if(a){if(n&&!n.isDeleted()){if(t){o=Gt(n,"id")}else{o=n.createSnapshot()}}else{o=null}}if(t){this._belongsToIds[e]=o}else{this._belongsToRelationships[e]=o}return o},hasMany:function(e,r){var t=r&&r.ids;var i,n,a;var o;if(t&&e in this._hasManyIds){return this._hasManyIds[e]}if(!t&&e in this._hasManyRelationships){return this._hasManyRelationships[e]}i=this._internalModel._relationships.get(e);if(!(i&&i.relationshipMeta.kind==="hasMany")){throw new Ember.Error("Model '"+Ember.inspect(this.record)+"' has no hasMany relationship named '"+e+"' defined.")}a=Gt(i,"hasData");n=Gt(i,"members");if(a){o=[];n.forEach(function(e){if(!e.isDeleted()){if(t){o.push(e.id)}else{o.push(e.createSnapshot())}}})}if(t){this._hasManyIds[e]=o}else{this._hasManyRelationships[e]=o}return o},eachAttribute:function(e,r){this.record.eachAttribute(e,r)},eachRelationship:function(e,r){this.record.eachRelationship(e,r)},get:function(e){if(e==="id"){return this.id}if(e in this._attributes){return this.attr(e)}var r=this._internalModel._relationships.get(e);if(r&&r.relationshipMeta.kind==="belongsTo"){return this.belongsTo(e)}if(r&&r.relationshipMeta.kind==="hasMany"){return this.hasMany(e)}return Gt(this.record,e)},serialize:function(e){return this.record.store.serializerFor(this.modelName).serialize(this,e)},unknownProperty:function(e){return this.get(e)},_createSnapshot:function(){return this}};Ember.defineProperty(Xt.prototype,"typeKey",{enumerable:false,get:function(){return this.modelName},set:function(){}});var Yt=Xt;var Zt=Ember.RSVP.Promise;var ei=Ember.get;var ri=Ember.set;var ti=Ember.ArrayPolyfills.forEach;var ii=Ember.ArrayPolyfills.map;var ni=t(null);var ai=t(null);function oi(e){return ai[e]||(ai[e]=e.split("."))}function si(e){return ni[e]||(ni[e]=oi(e)[0])}function li(e){return function(){return ei(this.currentState,e)}}var ui=function Yn(e,r,i,n,a){this.type=e;this.id=r;this.store=i;this.container=n;this._data=a||t(null);this.modelName=e.modelName;this.dataHasInitialized=false;this._deferredTriggers=[];this._attributes=t(null);this._inFlightAttributes=t(null);this._relationships=new Jt(this);this.currentState=Pt.empty;this.isReloading=false;this.isError=false;this.error=null;this._implicitRelationships=t(null)};ui.prototype={isEmpty:li("isEmpty"),isLoading:li("isLoading"),isLoaded:li("isLoaded"),hasDirtyAttributes:li("hasDirtyAttributes"),isSaving:li("isSaving"),isDeleted:li("isDeleted"),isNew:li("isNew"),isValid:li("isValid"),dirtyType:li("dirtyType"),constructor:ui,materializeRecord:function(){this.record=this.type._create({id:this.id,store:this.store,container:this.container,_internalModel:this,currentState:ei(this,"currentState"),isError:this.isError,adapterError:this.error});this._triggerDeferredTriggers()},recordObjectWillDestroy:function(){this.record=null},deleteRecord:function(){this.send("deleteRecord")},save:function(e){var r="DS: Model#save "+this;var t=Ember.RSVP.defer(r);this.store.scheduleSave(this,t,e);return t.promise},startedReloading:function(){this.isReloading=true;if(this.record){ri(this.record,"isReloading",true)}},finishedReloading:function(){this.isReloading=false;if(this.record){ri(this.record,"isReloading",false)}},reload:function(){this.startedReloading();var e=this;var r="DS: Model#reload of "+this;return new Zt(function(r){e.send("reloadRecord",r)},r).then(function(){e.didCleanError();return e},function(r){e.didError(r);throw r},"DS: Model#reload complete, update flags")["finally"](function(){e.finishedReloading();e.updateRecordArrays()})},getRecord:function(){if(!this.record){this.materializeRecord()}return this.record},unloadRecord:function(){this.send("unloadRecord")},eachRelationship:function(e,r){return this.type.eachRelationship(e,r)},eachAttribute:function(e,r){return this.type.eachAttribute(e,r)},inverseFor:function(e){return this.type.inverseFor(e)},setupData:function(e){var r=this._changedKeys(e.attributes);gt(this._data,e.attributes);this.pushedData();if(this.record){this.record._notifyProperties(r)}this.didInitalizeData()},becameReady:function(){Ember.run.schedule("actions",this.store.recordArrayManager,this.store.recordArrayManager.recordWasLoaded,this)},didInitalizeData:function(){if(!this.dataHasInitialized){this.becameReady();this.dataHasInitialized=true}},destroy:function(){if(this.record){return this.record.destroy()}},createSnapshot:function(e){var r=e&&e.adapterOptions;var t=new Yt(this);t.adapterOptions=r;return t},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData");this.didInitalizeData()},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},flushChangedAttributes:function(){this._inFlightAttributes=this._attributes;this._attributes=t(null)},adapterWillCommit:function(){this.send("willCommit")},adapterDidDirty:function(){this.send("becomeDirty");this.updateRecordArraysLater()},send:function(e,r){var t=ei(this,"currentState");if(!t[e]){this._unhandledEvent(t,e,r)}return t[e](this,r)},notifyHasManyAdded:function(e,r,t){if(this.record){this.record.notifyHasManyAdded(e,r,t)}},notifyHasManyRemoved:function(e,r,t){if(this.record){this.record.notifyHasManyRemoved(e,r,t)}},notifyBelongsToChanged:function(e,r){if(this.record){this.record.notifyBelongsToChanged(e,r)}},notifyPropertyChange:function(e){if(this.record){this.record.notifyPropertyChange(e)}},rollbackAttributes:function(){var e=r(this._attributes);this._attributes=t(null);if(ei(this,"isError")){this._inFlightAttributes=t(null);this.didCleanError()}if(this.isDeleted()){this.becameReady();this.reconnectRelationships()}if(this.isNew()){this.clearRelationships()}if(this.isValid()){this._inFlightAttributes=t(null)}this.send("rolledBack");this.record._notifyProperties(e)},transitionTo:function(e){var r=si(e);var t=ei(this,"currentState");var i=t;do{if(i.exit){i.exit(this)}i=i.parentState}while(!i.hasOwnProperty(r));var n=oi(e);var a=[];var o=[];var s,l;for(s=0,l=n.length;s<l;s++){i=i[n[s]];if(i.enter){o.push(i)}if(i.setup){a.push(i)}}for(s=0,l=o.length;s<l;s++){o[s].enter(this)}ri(this,"currentState",i);if(this.record){ri(this.record,"currentState",i)}for(s=0,l=a.length;s<l;s++){a[s].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)},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.scheduleOnce("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){if(!this.record){return}for(var e=0,r=this._deferredTriggers.length;e<r;e++){this.record.trigger.apply(this.record,this._deferredTriggers[e])}this._deferredTriggers.length=0},clearRelationships:function(){this.eachRelationship(function(e,r){if(this._relationships.has(e)){var t=this._relationships.get(e);t.clear();t.destroy()}},this);var e=this;ti.call(r(this._implicitRelationships),function(r){e._implicitRelationships[r].clear();e._implicitRelationships[r].destroy()})},disconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships.get(e).disconnect()},this);var e=this;ti.call(r(this._implicitRelationships),function(r){e._implicitRelationships[r].disconnect()})},reconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships.get(e).reconnect()},this);var e=this;ti.call(r(this._implicitRelationships),function(r){e._implicitRelationships[r].reconnect()})},_preloadData:function(e){var t=this;ti.call(r(e),function(r){var i=ei(e,r);var n=t.type.metaForProperty(r);if(n.isRelationship){t._preloadRelationship(r,i)}else{t._data[r]=i}})},_preloadRelationship:function(e,r){var t=this.type.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 n=ii.call(r,function(e){return i._convertStringOrNumberIntoInternalModel(e,t)});this._relationships.get(e).updateRecordsFromAdapter(n)},_preloadBelongsTo:function(e,r,t){var i=this._convertStringOrNumberIntoInternalModel(r,t);this._relationships.get(e).setRecord(i)},_convertStringOrNumberIntoInternalModel:function(e,r){if(typeof e==="string"||typeof e==="number"){return this.store._internalModelForId(r,e)}if(e._internalModel){return e._internalModel}return e},updateRecordArrays:function(){this._updatingRecordArraysLater=false;this.store.dataWasUpdated(this.type,this)},setId:function(e){this.id=e;ri(this.record,"id",e)},didError:function(e){this.error=e;this.isError=true;if(this.record){this.record.setProperties({isError:true,adapterError:e})}},didCleanError:function(){this.error=null;this.isError=false;if(this.record){this.record.setProperties({isError:false,adapterError:null})}},adapterDidCommit:function(e){if(e){e=e.attributes}this.didCleanError();var r=this._changedKeys(e);gt(this._data,this._inFlightAttributes);if(e){gt(this._data,e)}this._inFlightAttributes=t(null);this.send("didCommit");this.updateRecordArraysLater();if(!e){return}this.record._notifyProperties(r)},updateRecordArraysLater:function(){if(this._updatingRecordArraysLater){return}this._updatingRecordArraysLater=true;Ember.run.schedule("actions",this,this.updateRecordArrays)},addErrorMessageToAttribute:function(e,r){var t=this.getRecord();ei(t,"errors").add(e,r)},removeErrorMessageFromAttribute:function(e){var r=this.getRecord();ei(r,"errors").remove(e)},clearErrorMessages:function(){var e=this.getRecord();ei(e,"errors").clear()},adapterDidInvalidate:function(e){var r;for(r in e){if(e.hasOwnProperty(r)){this.addErrorMessageToAttribute(r,e[r])}}this._saveWasRejected()},adapterDidError:function(e){this.send("becameError");this.didError(e);this._saveWasRejected()},_saveWasRejected:function(){var e=r(this._inFlightAttributes);for(var i=0;i<e.length;i++){if(this._attributes[e[i]]===undefined){this._attributes[e[i]]=this._inFlightAttributes[e[i]]}}this._inFlightAttributes=t(null)},_changedKeys:function(e){var i=[];if(e){var n,a,o,s;var l=r(e);var u=l.length;n=gt(t(null),this._data);n=gt(n,this._inFlightAttributes);for(a=0;a<u;a++){s=l[a];o=e[s];if(this._attributes[s]!==undefined){continue}if(!Ember.isEqual(n[s],o)){i.push(s)}}}return i},toString:function(){if(this.record){return this.record.toString()}else{return"<"+this.modelName+":"+this.id+">"}}};var di=ui;var ci=Ember._Backburner||Ember.Backburner||Ember.__loader.require("backburner")["default"]||Ember.__loader.require("backburner")["Backburner"];if(!ci.prototype.join){var hi=function(e){return typeof e==="string"};ci.prototype.join=function(){var e,r;if(this.currentInstance){var t=arguments.length;if(t===1){e=arguments[0];r=null}else{r=arguments[0];e=arguments[1]}if(hi(e)){e=r[e]}if(t===1){return e()}else if(t===2){return e.call(r)}else{var i=new Array(t-2);for(var n=0,a=t-2;n<a;n++){i[n]=arguments[n+2]}return e.apply(r,i)}}else{return this.run.apply(this,arguments)}}}function fi(e,r){var t=e.then(function(e){return e.getRecord()});return fe(t,r)}var pi=Ember.get;var mi=Ember.set;var vi=Ember.run.once;var yi=Ember.isNone;var gi=Ember.ArrayPolyfills.forEach;var bi=Ember.ArrayPolyfills.indexOf;var Ri=Ember.ArrayPolyfills.map;var Ei=Ember.RSVP.Promise;var _i=Ember.copy;var Fi;var Ai=Ember.Service;if(!Ai){Ai=Ember.Object}Fi=Ai.extend({init:function(){this._backburner=new ci(["normalizeRelationships","syncRelationships","finished"]);this.typeMaps={};this.recordArrayManager=ht.create({store:this});this._pendingSave=[];this._instanceCache=new vt(this.container);this._pendingFetch=m.create()},adapter:"-rest",serialize:function(e,r){var t=e._internalModel.createSnapshot();return t.serialize(r)},defaultAdapter:Ember.computed("adapter",function(){var e=pi(this,"adapter");e=this.retrieveManagedInstance("adapter",e);return e}),createRecord:function(e,r){var i=this.modelFor(e);var n=_i(r)||t(null);if(yi(n.id)){n.id=this._generateId(e,n)}n.id=X(n.id);var a=this.buildInternalModel(i,n.id);var o=a.getRecord();a.loadedData();o.setProperties(n);a.eachRelationship(function(e,r){a._relationships.get(e).setHasData(true)});return o},_generateId:function(e,r){var t=this.adapterFor(e);if(t&&t.generateIdForRecord){return t.generateIdForRecord(this,e,r)}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.query(e,r)}var i=xi(t,this.modelFor(e),"find");return this.findRecord(e,X(r),i)},fetchById:function(e,r,t){var i=xi(t,this.modelFor(e),"fetchById");if(this.hasRecordForId(e,r)){return this.peekRecord(e,r).reload()}else{return this.findRecord(e,r,i)}},fetchAll:function(e){return this.findAll(e,{reload:true})},fetch:function(e,r,t){return this.findRecord(e,r,{reload:true,preload:t})},findById:function(e,r,t){var i=xi(t,this.modelFor(e),"findById");return this.findRecord(e,r,i)},findRecord:function(e,r,t){var i=this._internalModelForId(e,r);t=t||{};if(!this.hasRecordForId(e,r)){return this._findByInternalModel(i,t)}var n=this._findRecord(i,t);return fi(n,"DS: Store#findRecord "+i.typeKey+" with id: "+pi(i,"id"))},_findRecord:function(e,r){if(r.reload){return this.scheduleFetch(e,r)}var t=e.createSnapshot();t.adapterOptions=r&&r.adapterOptions;var i=e.type;var n=this.adapterFor(i.modelName);if(n.shouldReloadRecord(this,t)){return this.scheduleFetch(e,r)}if(n.shouldBackgroundReloadRecord(this,t)){this.scheduleFetch(e,r)}return Ei.resolve(e)},_findByInternalModel:function(e,r){r=r||{};if(r.preload){e._preloadData(r.preload)}var t=this._findEmptyInternalModel(e,r);return fi(t,"DS: Store#findRecord "+e.typeKey+" with id: "+pi(e,"id"))},_findEmptyInternalModel:function(e,r){if(e.isEmpty()){return this.scheduleFetch(e,r)}if(e.isLoading()){return e._loadingPromise}return Ei.resolve(e)},findByIds:function(e,r){var t=this;return pe(Ember.RSVP.all(Ri.call(r,function(r){return t.findRecord(e,r)})).then(Ember.A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e,r){var t=e.type;var i=e.id;var n=this.adapterFor(t.modelName);var a=Kr(n,this,t,i,e,r);return a},scheduleFetchMany:function(e){var r=Ri.call(e,function(e){return e._internalModel});return Ei.all(Ri.call(r,this.scheduleFetch,this))},scheduleFetch:function(e,r){var t=e.type;if(e._loadingPromise){return e._loadingPromise}var i=Ember.RSVP.defer("Fetching "+t+"with id: "+e.id);var n={record:e,resolver:i,options:r};var a=i.promise;e.loadingData(a);if(!this._pendingFetch.get(t)){this._pendingFetch.set(t,[n])}else{this._pendingFetch.get(t).push(n)}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=m.create()},_flushPendingFetchForType:function(e,r){var t=this;var i=t.adapterFor(r.modelName);var n=!!i.findMany&&i.coalesceFindRequests;var a=Ember.A(e).mapBy("record");function o(e){e.resolver.resolve(t.fetchRecord(e.record,e.options))}function s(r){gi.call(r,function(r){var t=Ember.A(e).findBy("record",r);if(t){var i=t.resolver;i.resolve(r)}});return r}function l(e){return function r(t){t=Ember.A(t);var i=e.reject(function(e){return t.contains(e)});if(i.length){}d(i)}}function u(e){return function(r){d(e,r)}}function d(r,t){gi.call(r,function(r){var i=Ember.A(e).findBy("record",r);if(i){var n=i.resolver;n.reject(t)}})}if(e.length===1){o(e[0])}else if(n){var c=Ember.A(a).invoke("createSnapshot");var h=i.groupRecordsForFindMany(this,c);gi.call(h,function(n){var a=Ember.A(n).mapBy("_internalModel");var d=Ember.A(a);var c=d.mapBy("id");if(c.length>1){Hr(i,t,r,c,d).then(s).then(l(d)).then(null,u(d))}else if(c.length===1){var h=Ember.A(e).findBy("record",a[0]);o(h)}else{}})}else{gi.call(e,o)}},getById:function(e,r){return this.peekRecord(e,r)},peekRecord:function(e,r){if(this.hasRecordForId(e,r)){return this._internalModelForId(e,r).getRecord()}else{return null}},reloadRecord:function(e){var r=e.type.modelName;var t=this.adapterFor(r);var i=e.id;return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=X(r);var n=this.typeMapFor(t).idToRecord[i];return!!n&&n.isLoaded()},recordForId:function(e,r){return this._internalModelForId(e,r).getRecord()},_internalModelForId:function(e,r){var t=this.modelFor(e);var i=X(r);var n=this.typeMapFor(t).idToRecord;var a=n[i];if(!a||!n[i]){a=this.buildInternalModel(t,i)}return a},findMany:function(e){var r=this;return Ei.all(Ri.call(e,function(e){return r._findByInternalModel(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.type.modelName);return Br(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.type.modelName);return Ur(i,this,e,r,t)},query:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var n=this.adapterFor(e);return pe(qr(n,this,t,r,i))},queryRecord:function(e,r){var t=this.modelFor(e);var i=this.adapterFor(e);return fe(Wr(i,this,t,r))},findQuery:function(e,r){return this.query(e,r)},findAll:function(e,r){var t=this.modelFor(e);return this._fetchAll(t,this.peekAll(e),r)},_fetchAll:function(e,r,t){t=t||{};var i=this.adapterFor(e.modelName);var n=this.typeMapFor(e).metadata.since;mi(r,"isUpdating",true);if(t.reload){return pe(Vr(i,this,e,n,t))}var a=r.createSnapshot(t);if(i.shouldReloadAll(this,a)){return pe(Vr(i,this,e,n,t))}if(i.shouldBackgroundReloadAll(this,a)){pe(Vr(i,this,e,n,t))}return pe(Ei.resolve(r))},didUpdateAll:function(e){var r=this.recordArrayManager.liveRecordArrayFor(e);mi(r,"isUpdating",false)},all:function(e){return this.peekAll(e)},peekAll:function(e){var r=this.modelFor(e);var t=this.recordArrayManager.liveRecordArrayFor(r);this.recordArrayManager.populateLiveRecordArray(t,r);return t},unloadAll:function(e){if(arguments.length===0){var i=this.typeMaps;var n=r(i);var a=Ri.call(n,c);gi.call(a,this.unloadAll,this)}else{var o=this.modelFor(e);var s=this.typeMapFor(o);var l=s.records.slice();var u;for(var d=0;d<l.length;d++){u=l[d];u.unloadRecord();u.destroy()}s.metadata=t(null)}function c(e){return i[e]["type"].modelName}},filter:function(e,r,t){if(!Ember.ENV.ENABLE_DS_FILTER){}var i;var n=arguments.length;var a;var o=n===3;if(o){i=this.query(e,r)}else if(arguments.length===2){t=r}e=this.modelFor(e);if(o){a=this.recordArrayManager.createFilteredRecordArray(e,t,r)}else{a=this.recordArrayManager.createFilteredRecordArray(e,t)}i=i||Ei.cast(a);return pe(i.then(function(){return a},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,r){return this.hasRecordForId(e,r)},metadataFor:function(e){return this._metadataFor(e)},_metadataFor:function(e){var r=this.modelFor(e);return this.typeMapFor(r).metadata},setMetadataFor:function(e,r){this._setMetadataFor(e,r)},_setMetadataFor:function(e,r){var t=this.modelFor(e);Ember.merge(this.typeMapFor(t).metadata,r)},dataWasUpdated:function(e,r){this.recordArrayManager.recordDidChange(r)},scheduleSave:function(e,r,t){var i=e.createSnapshot(t);e.flushChangedAttributes();e.adapterWillCommit();this._pendingSave.push({snapshot:i,resolver:r});vi(this,"flushPendingSave")},flushPendingSave:function(){var e=this._pendingSave.slice();this._pendingSave=[];gi.call(e,function(e){var r=e.snapshot;var t=e.resolver;var i=r._internalModel;var n=this.adapterFor(i.type.modelName);var a;if(pi(i,"currentState.stateName")==="root.deleted.saved"){return t.resolve()}else if(i.isNew()){a="createRecord"}else if(i.isDeleted()){a="deleteRecord"}else{a="updateRecord"}t.resolve(Ti(n,this,a,r))},this)},didSaveRecord:function(e,r){var t;if(r){t=r.data}if(t){this._backburner.schedule("normalizeRelationships",this,"_setupRelationships",e,e.type,t);this.updateId(e,t)}e.adapterDidCommit(t)},recordWasInvalid:function(e,r){e.adapterDidInvalidate(r)},recordWasError:function(e,r){e.adapterDidError(r)},updateId:function(e,r){var t=e.id;var i=X(r.id);this.typeMapFor(e.type).idToRecord[i]=e;e.setId(i)},typeMapFor:function(e){var r=pi(this,"typeMaps");var i=Ember.guidFor(e);var n=r[i];if(n){return n}n={idToRecord:t(null),records:[],metadata:t(null),type:e};r[i]=n;return n},_load:function(e){var r=X(e.id);var t=this._internalModelForId(e.type,r);t.setupData(e);this.recordArrayManager.recordDidChange(t);return t},_modelForMixin:function(e){var r=Z(e);var t=this.container._registry?this.container._registry:this.container;var i=t.resolve("mixin:"+r);if(i){t.register("model:"+r,DS.Model.extend(i))}var n=this.modelFactoryFor(r);if(n){n.__isMixin=true;n.__mixin=i}return n},modelFor:function(e){var r=this.modelFactoryFor(e);if(!r){r=this._modelForMixin(e)}
4
- if(!r){throw new Ember.Error("No model was found for '"+e+"'")}r.modelName=r.modelName||Z(e);if(!("typeKey"in r)){Ember.defineProperty(r,"typeKey",{enumerable:true,configurable:false,get:function(){var e=this.modelName;if(e){e=Ember.String.camelize(this.modelName)}return e},set:function(){}})}return r},modelFactoryFor:function(e){var r=Z(e);return this.container.lookupFactory("model:"+r)},push:function(e,r){var t=this;var i,n;if(Ember.typeOf(e)==="object"&&Ember.typeOf(r)==="undefined"){i=e}else{i=Ge(this.modelFor(e),r);n=e}if(i.included){gi.call(i.included,function(e){return t._pushInternalModel(e)})}if(Ember.typeOf(i.data)==="array"){var a=Ri.call(i.data,function(e){return t._pushInternalModel(e)});return Ri.call(a,function(e){return e.getRecord()})}var o=this._pushInternalModel(i.data||i);return o.getRecord()},_hasModelFor:function(e){return this.container.lookupFactory("model:"+e)},_pushInternalModel:function(e){var r=e.type;var t=this.modelFor(r);var i=Ember.ArrayPolyfills.filter;if(Ember.ENV.DS_WARN_ON_UNKNOWN_KEYS){}var n=this._load(e);var a=this;this._backburner.join(function(){a._backburner.schedule("normalizeRelationships",a,"_setupRelationships",n,t,e)});return n},_setupRelationships:function(e,r,t){t=zi(this,r,t);Pi(this,e,t)},pushPayload:function(e,r){var t;var i;if(!r){i=e;t=ki(this)}else{i=r;t=this.serializerFor(e)}var n=this;this._adapterRun(function(){t.pushPayload(n,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)},pushMany:function(e,r){var t=r.length;var i=new Array(t);for(var n=0;n<t;n++){i[n]=this.push(e,r[n])}return i},metaForType:function(e,r){this.setMetadataFor(e,r)},buildInternalModel:function(e,r,t){var i=this.typeMapFor(e);var n=i.idToRecord;var a=new di(e,r,this,this.container,t);if(r){n[r]=a}i.records.push(a);return a},recordWasLoaded:function(e){this.recordArrayManager.recordWasLoaded(e)},dematerializeRecord:function(e){this._dematerializeRecord(e)},_dematerializeRecord:function(e){var r=e.type;var t=this.typeMapFor(r);var i=e.id;e.updateRecordArrays();if(i){delete t.idToRecord[i]}var n=bi.call(t.records,e);t.records.splice(n,1)},adapterFor:function(e){var r;if(typeof e==="string"){r=e}else{r=e.modelName}return this.lookupAdapter(r)},_adapterRun:function(e){return this._backburner.run(e)},serializerFor:function(e){var r;if(typeof e==="string"){r=e}else{r=e.modelName}var t=["application",this.adapterFor(r).get("defaultSerializer"),"-default"];var i=this.lookupSerializer(r,t);return i},retrieveManagedInstance:function(e,r,t){var i=Z(r);var n=this._instanceCache.get(e,i,t);mi(n,"store",this);return n},lookupAdapter:function(e){return this.retrieveManagedInstance("adapter",e,this.get("_adapterFallbacks"))},_adapterFallbacks:Ember.computed("adapter",function(){var e=this.get("adapter");return["application",e,"-rest"]}),lookupSerializer:function(e,r){return this.retrieveManagedInstance("serializer",e,r)},willDestroy:function(){this.recordArrayManager.destroy();this.unloadAll();for(var e in this._containerCache){this._containerCache[e].destroy();delete this._containerCache[e]}delete this._containerCache}});function zi(e,r,t,i){t.relationships=t.relationships||{};r.eachRelationship(function(r,i){var n=i.kind;var a;if(t.relationships[r]&&t.relationships[r].data){a=t.relationships[r].data;if(n==="belongsTo"){t.relationships[r].data=Mi(e,r,i,a)}else if(n==="hasMany"){t.relationships[r].data=Si(e,r,i,a)}}});return t}function Mi(e,r,t,i){if(yi(i)){return}return e._internalModelForId(i.type,i.id)}function Si(e,r,t,i){if(yi(i)){return}return Ri.call(i,function(i){return Mi(e,r,t,i)})}function ki(e){return e.serializerFor("application")}function Ti(e,r,t,i){var n=i._internalModel;var a=i.modelName;var o=r.modelFor(a);var l=e[t](r,o,i);var u=Or(r,e,a);var d="DS: Extract and notify about "+t+" completion of "+n;l=Ei.cast(l,d);l=wr(l,Nr(Ir,r));l=wr(l,Nr(Ir,n));return l.then(function(e){r._adapterRun(function(){var a,s;if(e){a=Je(u,r,o,e,i.id,t);if(a.included){r.push({data:a.included})}s=tr(a.data)}r.didSaveRecord(n,Ge(n.type,s))});return n},function(e){if(e instanceof s){var t=u.extractErrors(r,o,e,i.id);r.recordWasInvalid(n,t)}else{r.recordWasError(n,e)}throw e},d)}function Pi(e,r,t){var i=r.type;if(!t.relationships){return}i.eachRelationship(function(e,i){var n=i.kind;if(!t.relationships[e]){return}var a;if(t.relationships[e].links&&t.relationships[e].links.related){a=r._relationships.get(e);a.updateLink(t.relationships[e].links.related)}if(t.relationships[e].meta){a=r._relationships.get(e);a.updateMeta(t.relationships[e].meta)}var o=t.relationships[e].data;if(o!==undefined){if(n==="belongsTo"){a=r._relationships.get(e);a.setCanonicalRecord(o)}else if(n==="hasMany"){a=r._relationships.get(e);a.updateRecordsFromAdapter(o)}}})}function xi(e,r,t){if(e){var i=[];var n=Ember.get(r,"fields");n.forEach(function(e,r){i.push(r)});var a=false;for(var o=0,s=i.length;o<s;o++){var l=i[o];if(typeof e[l]!=="undefined"){a=true;break}}if(a){var u=e;return{preload:u}}}return e}var Ci=Fi;var Di=Ember.String.dasherize;var Ni=Ember.get;var wi=Ember.ArrayPolyfills.map;var Ii=le.extend({isNewSerializerAPI:true,_normalizeDocumentHelper:function(e){if(Ember.typeOf(e.data)==="object"){e.data=this._normalizeResourceHelper(e.data)}else if(Ember.typeOf(e.data)==="array"){e.data=wi.call(e.data,this._normalizeResourceHelper,this)}if(Ember.typeOf(e.included)==="array"){e.included=wi.call(e.included,this._normalizeResourceHelper,this)}return e},_normalizeRelationshipDataHelper:function(e){var r=this.modelNameFromPayloadKey(e.type);e.type=r;return e},_normalizeResourceHelper:function(e){var r=this.modelNameFromPayloadKey(e.type);var t=this.store.modelFor(r);var i=this.store.serializerFor(r);var n=i.normalize(t,e);var a=n.data;return a},pushPayload:function(e,r){var t=this._normalizeDocumentHelper(r);e.push(t)},_normalizeResponse:function(e,r,t,i,n,a){var o=this._normalizeDocumentHelper(t);return o},extractAttributes:function(e,r){var t=this;var i={};if(r.attributes){e.eachAttribute(function(e){var n=t.keyForAttribute(e,"deserialize");if(r.attributes.hasOwnProperty(n)){i[e]=r.attributes[n]}})}return i},extractRelationship:function(e){if(Ember.typeOf(e.data)==="object"){e.data=this._normalizeRelationshipDataHelper(e.data)}if(Ember.typeOf(e.data)==="array"){e.data=wi.call(e.data,this._normalizeRelationshipDataHelper,this)}return e},extractRelationships:function(e,r){var t=this;var i={};if(r.relationships){e.eachRelationship(function(e,n){var a=t.keyForRelationship(e,n.kind,"deserialize");if(r.relationships.hasOwnProperty(a)){var o=r.relationships[a];i[e]=t.extractRelationship(o)}})}return i},_extractType:function(e,r){return this.modelNameFromPayloadKey(r.type)},modelNameFromPayloadKey:function(e){return K(Z(e))},payloadKeyFromModelName:function(e){return j(e)},normalize:function(e,r){this.normalizeUsingDeclaredMapping(e,r);var t={id:this.extractId(e,r),type:this._extractType(e,r),attributes:this.extractAttributes(e,r),relationships:this.extractRelationships(e,r)};this.applyTransforms(e,t.attributes);return{data:t}},keyForAttribute:function(e,r){return Di(e)},keyForRelationship:function(e,r,t){return Di(e)},serialize:function(e,r){var t=this._super.apply(this,arguments);t.type=this.payloadKeyFromModelName(e.modelName);return{data:t}},serializeAttribute:function(e,r,t,i){var n=i.type;if(this._canSerialize(t)){r.attributes=r.attributes||{};var a=e.attr(t);if(n){var o=this.transformFor(n);a=o.serialize(a)}var s=this._getMappedKey(t);if(s===t){s=this.keyForAttribute(t,"serialize")}r.attributes[s]=a}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this._canSerialize(i)){var n=e.belongsTo(i);if(n!==undefined){r.relationships=r.relationships||{};var a=this._getMappedKey(i);if(a===i){a=this.keyForRelationship(i,"belongsTo","serialize")}var o=null;if(n){o={type:this.payloadKeyFromModelName(n.modelName),id:n.id}}r.relationships[a]={data:o}}}},serializeHasMany:function(e,r,t){var i=this;var n=t.key;if(this._shouldSerializeHasMany(e,n,t)){var a=e.hasMany(n);if(a!==undefined){r.relationships=r.relationships||{};var o=this._getMappedKey(n);if(o===n&&this.keyForRelationship){o=this.keyForRelationship(n,"hasMany","serialize")}var s=wi.call(a,function(e){return{type:i.payloadKeyFromModelName(e.modelName),id:e.id}});r.relationships[o]={data:s}}}}});var Oi=Li;function Li(e,r){e.optionsForType("serializer",{singleton:false});e.optionsForType("adapter",{singleton:false});var t=new Er(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",le.extend({isNewSerializerAPI:true}));e.register("serializer:-rest",lr.extend({isNewSerializerAPI:true}));e.register("adapter:-rest",T);e.register("adapter:-json-api",Tr);e.register("serializer:-json-api",Ii);var i;if(e.has("store:main")){i=e.lookup("store:main")}else{var n=new Er(e);n.registerDeprecations([{deprecated:"store:main",valid:"service:store"}])}if(e.has("store:application")){i=e.lookup("store:application")}else{var a=new Er(e);a.registerDeprecations([{deprecated:"store:application",valid:"service:store"}])}if(i){e.register("service:store",i,{instantiate:false})}else if(!e.has("service:store")){e.register("service:store",r&&r.Store||Ci)}}var $i=Ember.Object.extend({serialize:null,deserialize:null});var ji=Ember.isEmpty;function Ki(e){return e===e&&e!==Infinity&&e!==-Infinity}var Hi=$i.extend({deserialize:function(e){var r;if(ji(e)){return null}else{r=Number(e);return Ki(r)?r:null}},serialize:function(e){var r;if(ji(e)){return null}else{r=Number(e);return Ki(r)?r:null}}});var Bi=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=Bi}}var Ui=$i.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 Bi.call(e)}else{return null}}});var Vi=Ember.isNone;var qi=$i.extend({deserialize:function(e){return Vi(e)?null:String(e)},serialize:function(e){return Vi(e)?null:String(e)}});var Wi=$i.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)}});var Qi=Ji;function Ji(e){e.register("transform:boolean",Wi);e.register("transform:date",Ui);e.register("transform:number",Hi);e.register("transform:string",qi)}var Gi=Xi;function Xi(e){e.injection("controller","store","service:store");e.injection("route","store","service:store");e.injection("data-adapter","store","service:store")}var Yi=nn;var Zi=Ember.get;Ue.reopenClass({attributes:Ember.computed(function(){var e=m.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=m.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)}});return e}).readOnly(),eachAttribute:function(e,r){Zi(this,"attributes").forEach(function(t,i){e.call(r,i,t)},r)},eachTransformedAttribute:function(e,r){Zi(this,"transformedAttributes").forEach(function(t,i){e.call(r,i,t)})}});Ue.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function en(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function rn(e,r){return r in e._attributes||r in e._inFlightAttributes||r in e._data}function tn(e,r){if(r in e._attributes){return e._attributes[r]}else if(r in e._inFlightAttributes){return e._inFlightAttributes[r]}else{return e._data[r]}}function nn(e,r){if(typeof e==="object"){r=e;e=undefined}else{r=r||{}}var t={type:e,isAttribute:true,options:r};return Se({get:function(e){var t=this._internalModel;if(rn(t,e)){return tn(t,e)}else{return en(this,r,e)}},set:function(e,r){var t=this._internalModel;var i=tn(t,e);if(r!==i){t._attributes[e]=r;this._internalModel.send("didSetProperty",{name:e,oldValue:i,originalValue:t._data[e],value:r})}return r}}).meta(t)}var an=Ue;var on=Ember.get;var sn=Ember.String.capitalize;var ln=Ember.String.underscore;var un=Ember;var dn=un.assert;var cn=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==an&&an.detect(e)},columnsForType:function(e){var r=[{name:"id",desc:"Id"}];var t=0;var i=this;on(e,"attributes").forEach(function(e,n){if(t++>i.attributeLimit){return false}var a=sn(ln(n).replace("_"," "));r.push({name:n,desc:a})});return r},getRecords:function(e,r){if(arguments.length<2){var t=e._debugContainerKey;if(t){var i=t.match(/model:(.*)/);if(i){r=i[1]}}}dn("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support",!!r);return this.get("store").peekAll(r)},getRecordColumnValues:function(e){var r=this;var t=0;var i={id:on(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var a=on(e,n);i[n]=a});return i},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(on(e,t))});return r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("hasDirtyAttributes")&&!e.get("isNew"),isClean:!e.get("hasDirtyAttributes")}},getRecordColor:function(e){var r="black";if(e.get("isNew")){r="green"}else if(e.get("hasDirtyAttributes")){r="blue"}return r},observeRecord:function(e,r){var t=Ember.A();var i=this;var n=Ember.A(["id","isNew","hasDirtyAttributes"]);e.eachAttribute(function(e){n.push(e)});n.forEach(function(n){var a=function(){r(i.wrapRecord(e))};Ember.addObserver(e,n,a);t.push(function(){Ember.removeObserver(e,n,a)})});var a=function(){t.forEach(function(e){e()})};return a}});var hn=fn;function fn(e){e.register("data-adapter:main",cn)}var pn=mn;function mn(e){var r,t;if(e.registry&&e.container){r=e.registry;t=e.container}else{r=e;if(r.container){t=r.container()}else{t=r}}t.lookup("service:store")}var vn=yn;function yn(e,r){gn(e,r);pn(e)}function gn(e,r){hn(e,r);Qi(e,r);Gi(e,r);_r(e,r);Oi(e,r)}var bn=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:gn});if(e.instanceInitializer){e.instanceInitializer({name:"ember-data",initialize:pn})}else{e.initializer({name:"ember-data-store-service",after:"ember-data",initialize:pn})}e.initializer({name:"store",after:"ember-data",initialize:bn});e.initializer({name:"activeModelAdapter",before:"store",initialize:bn});e.initializer({name:"transforms",before:"store",initialize:bn});e.initializer({name:"data-adapter",before:"store",initialize:bn});e.initializer({name:"injectStore",before:"store",initialize:bn})});Ember.Date=Ember.Date||{};var Rn=Date.parse;var En=[1,4,5,6,7,10,11];Ember.Date.parse=function(e){var r,t;var i=0;if(t=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(e)){for(var n=0,a;a=En[n];++n){t[a]=+t[a]||0}t[2]=(+t[2]||1)-1;t[3]=+t[3]||1;if(t[8]!=="Z"&&t[9]!==undefined){i=t[10]*60+t[11];if(t[9]==="+"){i=0-i}}r=Date.UTC(t[1],t[2],t[3],t[4],t[5]+i,t[6],t[7])}else{r=Rn?Rn(e):NaN}return r};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}an.reopen({_debugInfo:function(){var e=["id"];var r={belongsTo:[],hasMany:[]};var 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","hasDirtyAttributes","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:true,groups:i,expensiveProperties:t}}}});var _n=an;var Fn=cn;var An=Ember.get;var zn=Ember.set;var Mn=Ember.ArrayPolyfills.forEach;var Sn=Ember.String.camelize;var kn=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return this._extractEmbeddedRecords(this,this.store,e,i)},keyForRelationship:function(e,r,t){if(t==="serialize"&&this.hasSerializeRecordsOption(e)||t==="deserialize"&&this.hasDeserializeRecordsOption(e)){return this.keyForAttribute(e,t)}else{return this._super(e,r,t)||e}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this.noSerializeOptionSpecified(i)){this._super(e,r,t);return}var n=this.hasSerializeIdsOption(i);var a=this.hasSerializeRecordsOption(i);var o=e.belongsTo(i);var s;if(n){s=this.keyForRelationship(i,t.kind,"serialize");if(!o){r[s]=null}else{r[s]=o.id}}else if(a){s=this.keyForAttribute(i,"serialize");if(!o){r[s]=null}else{r[s]=o.record.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,t,r[s])}}},serializeHasMany:function(e,r,t){var i=t.key;if(this.noSerializeOptionSpecified(i)){this._super(e,r,t);return}var n=this.hasSerializeIdsOption(i);var a=this.hasSerializeRecordsOption(i);var o,s;if(n){o=this.keyForRelationship(i,t.kind,"serialize");r[o]=e.hasMany(i,{ids:true})}else if(a){o=this.keyForAttribute(i,"serialize");s=e.hasMany(i);r[o]=Ember.A(s).map(function(r){var i=r.record.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,t,i);return i},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var n=e.type.inverseFor(t.key,this.store);if(n){var a=n.name;var o=this.store.serializerFor(r.modelName);var s=o.keyForRelationship(a,n.kind,"deserialize");if(s){delete i[s]}}}},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[Sn(e)]||r[e])},_extractEmbeddedRecords:function(e,r,t,i){if(this.get("isNewSerializerAPI")){return Pn.apply(this,arguments)}t.eachRelationship(function(t,n){if(e.hasDeserializeRecordsOption(t)){var a=r.modelFor(n.type);if(n.kind==="hasMany"){if(n.options.polymorphic){this._extractEmbeddedHasManyPolymorphic(r,t,i)}else{this._extractEmbeddedHasMany(r,t,a,i)}}if(n.kind==="belongsTo"){if(n.options.polymorphic){this._extractEmbeddedBelongsToPolymorphic(r,t,i)}else{this._extractEmbeddedBelongsTo(r,t,a,i)}}}},this);return i},_extractEmbeddedHasMany:function(e,r,t,i){if(this.get("isNewSerializerAPI")){return xn.apply(this,arguments)}if(!i[r]){return i}var n=[];var a=e.serializerFor(t.modelName);Mn.call(i[r],function(r){var i=a.normalize(t,r,null);e.push(t.modelName,i);n.push(i.id)});i[r]=n;return i},_extractEmbeddedHasManyPolymorphic:function(e,r,t){var i=this;if(!t[r]){return t}var n=[];Mn.call(t[r],function(r){var t=r.type;var i=e.serializerFor(t);var a=e.modelFor(t);var o=i.normalize(a,r,null);e.push(a.modelName,o);n.push({id:o.id,type:t})});t[r]=n;return t},_extractEmbeddedBelongsTo:function(e,r,t,i){if(this.get("isNewSerializerAPI")){return Cn.apply(this,arguments)}if(!i[r]){return i}var n=e.serializerFor(t.modelName);var a=n.normalize(t,i[r],null);e.push(t.modelName,a);i[r]=a.id;return i},_extractEmbeddedBelongsToPolymorphic:function(e,r,t){if(!t[r]){return t}var i=t[r];var n=i.type;var a=e.serializerFor(n);var o=e.modelFor(n);var s=a.normalize(o,i,null);e.push(o.modelName,s);t[r]=s.id;t[r+"Type"]=n;return t},_normalizeEmbeddedRelationship:function(e,r,t){var i=r.type;if(r.options.polymorphic){i=t.type}var n=e.modelFor(i);var a=e.serializerFor(i);return a.normalize(n,t,null)}});var Tn=kn;function Pn(e,r,t,i){var n=this;t.eachRelationship(function(t,a){if(e.hasDeserializeRecordsOption(t)){if(a.kind==="hasMany"){n._extractEmbeddedHasMany(r,t,i,a)}if(a.kind==="belongsTo"){n._extractEmbeddedBelongsTo(r,t,i,a)}}},this);return i}function xn(e,r,t,i){var n=this;var a=An(t,"data.relationships."+r+".data");if(!a){return}var o=a.map(function(r){var a=n._normalizeEmbeddedRelationship(e,i,r);var o=a.data;var s=a.included;t.included=t.included||[];t.included.push(o);if(s){var l;(l=t.included).push.apply(l,s)}return{id:o.id,type:o.type}});var s={data:o};zn(t,"data.relationships."+r,s)}function Cn(e,r,t,i){var n=An(t,"data.relationships."+r+".data");if(!n){return}var a=this._normalizeEmbeddedRelationship(e,i,n);var o=a.data;var s=a.included;t.included=t.included||[];t.included.push(o);if(s){var l;(l=t.included).push.apply(l,s)}var u={id:o.id,type:o.type};var d={data:u};zn(t,"data.relationships."+r,d)}function Dn(e,r){var t,i;if(typeof e==="object"){t=e;i=undefined}else{t=r;i=e}if(typeof i==="string"){i=Z(i)}t=t||{};var n=false;if(typeof t.async==="undefined"){n=true}var a={type:i,isRelationship:true,options:t,kind:"belongsTo",key:null,shouldWarnAsync:n};return Se({get:function(e){if(t.hasOwnProperty("serialize")){}if(t.hasOwnProperty("embedded")){}if(a.shouldWarnAsync){a.shouldWarnAsync=false}return this._internalModel._relationships.get(e).getRecord()},set:function(e,r){if(r===undefined){r=null}if(r&&r.then){this._internalModel._relationships.get(e).setRecordPromise(r)}else if(r){this._internalModel._relationships.get(e).setRecord(r._internalModel)}else{this._internalModel._relationships.get(e).setRecord(r)}return this._internalModel._relationships.get(e).getRecord()}}).meta(a)}an.reopen({notifyBelongsToChanged:function(e){this.notifyPropertyChange(e)}});var Nn=Dn;function wn(e,r){if(typeof e==="object"){r=e;e=undefined}r=r||{};var t=false;if(typeof r.async==="undefined"){t=true}if(typeof e==="string"){e=Z(e)}var i={type:e,isRelationship:true,options:r,kind:"hasMany",key:null,shouldWarnAsync:t};return Se({get:function(e){if(i.shouldWarnAsync){i.shouldWarnAsync=false}var r=this._internalModel._relationships.get(e);return r.getRecords()},set:function(e,r){var t=this._internalModel._relationships.get(e);t.clear();t.addRecords(Ember.A(r).mapBy("_internalModel"));return t.getRecords()}}).meta(i)}an.reopen({notifyHasManyAdded:function(e){this.notifyPropertyChange(e)}});var In=wn;function On(e){var r;r=e.type||e.key;if(e.kind==="hasMany"){r=K(Z(r))}return r}function Ln(e){return{key:e.key,kind:e.kind,type:On(e),options:e.options,parentType:e.parentType,isRelationship:true}}var $n=Ember.get;var jn=Ember.ArrayPolyfills.filter;var Kn=Ember.computed(function(){if(Ember.testing===true&&Kn._cacheable===true){Kn._cacheable=false}var e=new v({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var i=e.get(On(t));i.push({name:r,kind:t.kind})}});return e}).readOnly();var Hn=Ember.computed(function(){if(Ember.testing===true&&Hn._cacheable===true){Hn._cacheable=false}var e;var r=Ember.A();this.eachComputedProperty(function(t,i){if(i.isRelationship){i.key=t;e=On(i);if(!r.contains(e)){r.push(e)}}});return r}).readOnly();var Bn=Ember.computed(function(){if(Ember.testing===true&&Bn._cacheable===true){Bn._cacheable=false}var e=m.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var i=Ln(t);i.type=On(t);e.set(r,i)}});return e}).readOnly();an.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});an.reopenClass({typeForRelationship:function(e,r){var t=$n(this,"relationshipsByName").get(e);return t&&r.modelFor(t.type)},inverseMap:Ember.computed(function(){return t(null)}),inverseFor:function(e,r){var t=$n(this,"inverseMap");if(t[e]){return t[e]}else{var i=this._findInverseFor(e,r);t[e]=i;return i}},_findInverseFor:function(e,r){var t=this.typeForRelationship(e,r);if(!t){return null}var i=this.metaForProperty(e);var n=i.options;if(n.inverse===null){return null}var a,o,s;if(n.inverse){a=n.inverse;s=Ember.get(t,"relationshipsByName").get(a);o=s.kind}else{if(i.type===i.parentType.modelName){}var l=d(this,t);if(l.length===0){return null}var u=jn.call(l,function(r){var i=t.metaForProperty(r.name).options;return e===i.inverse});if(u.length===1){l=u}a=l[0].name;o=l[0].kind}function d(r,t,i){var n=i||[];var a=$n(t,"relationships");if(!a){return n}var o=a.get(r.modelName);o=jn.call(o,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(o){n.push.apply(n,o)}if(r.superclass){d(r.superclass,t,n)}return n}return{type:t,name:a,kind:o}},relationships:Kn,relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Hn,relationshipsByName:Bn,fields:Ember.computed(function(){var e=m.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){$n(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){$n(this,"relatedTypes").forEach(function(t){e.call(r,t)})},determineRelationshipType:function(e,r){var t=e.key;var i=e.kind;var n=this.inverseFor(t,r);var a,o;if(!n){return i==="belongsTo"?"oneToNone":"manyToNone"}a=n.name;o=n.kind;if(o==="belongsTo"){return i==="belongsTo"?"oneToOne":"manyToOne"}else{return i==="belongsTo"?"oneToMany":"manyToMany"}}});an.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return $n(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e,this.store)}});if(Ember.VERSION.match(/^1\.[0-7]\./)){throw new Ember.Error("Ember Data requires at least Ember 1.8.0, but you have "+Ember.VERSION+". Please upgrade your version of Ember, then upgrade Ember Data")}if(Ember.VERSION.match(/^1\.12\.0/)){throw new Ember.Error("Ember Data does not work with Ember 1.12.0. Please upgrade to Ember 1.12.1 or higher.")}Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;Cr.Store=Fi;Cr.PromiseArray=ce;Cr.PromiseObject=he;Cr.PromiseManyArray=ve;Cr.Model=an;Cr.RootState=Pt;Cr.attr=Yi;Cr.Errors=Fe;Cr.InternalModel=di;Cr.Snapshot=Yt;Cr.Adapter=p;Cr.AdapterError=o;Cr.InvalidError=s;Cr.TimeoutError=l;Cr.AbortError=u;Cr.errorsHashToArray=d;Cr.errorsArrayToHash=c;Cr.Serializer=G;Cr.DebugAdapter=Fn;Cr.RecordArray=Yr;Cr.FilteredRecordArray=et;Cr.AdapterPopulatedRecordArray=nt;Cr.ManyArray=Ot;Cr.RecordArrayManager=ht;Cr.RESTAdapter=T;Cr.BuildURLMixin=_;Cr.RESTSerializer=lr;Cr.JSONSerializer=le;Cr.JSONAPIAdapter=Tr;Cr.JSONAPISerializer=Ii;Cr.Transform=$i;Cr.DateTransform=Ui;Cr.StringTransform=qi;Cr.NumberTransform=Hi;Cr.BooleanTransform=Wi;var Un=Q;var Vn=br;if(Ember.platform.hasPropertyAccessors){Ember.defineProperty(Cr,"ActiveModelAdapter",{get:function(){if(Vn===Q){}return Un},set:function(e){Un=e}});Ember.defineProperty(Cr,"ActiveModelSerializer",{get:function(){if(Vn===br){}return Vn},set:function(e){Vn=e}})}else{Cr.ActiveModelAdapter=Q;Cr.ActiveModelSerializer=br}Cr.EmbeddedRecordsMixin=Tn;Cr.belongsTo=Nn;Cr.hasMany=In;Cr.Relationship=Dt;Cr.ContainerProxy=Er;Cr._setupContainer=vn;Ember.defineProperty(Cr,"normalizeModelName",{enumerable:true,writable:false,configurable:false,value:Z});var qn=kr;if(Ember.platform.hasPropertyAccessors){Ember.defineProperty(Cr,"FixtureAdapter",{get:function(){if(qn===kr){}return qn},set:function(e){qn=e}})}else{Cr.FixtureAdapter=kr}Ember.lookup.DS=Cr;var Wn=Cr;var Qn=Jn;function Jn(r){if(e.Helper){return e.Helper.helper(r)}if(e.HTMLBars){return e.HTMLBars.makeBoundHelper(r)}return e.Handlebars.makeBoundHelper(r)}var Gn=Qn(function(e){var r,t;if(e.length===1){t=e[0];return j(t)}else{r=e[0];t=e[1];if((r|0)!==1){t=j(t)}return r+" "+t}});var Xn=Qn(function(e){return K(e[0])})}).call(this);
1
+ (function(){"use strict";var e=Ember;var r=Array.prorotype||e.ArrayPolyfills;var t=Object.keys||Ember.keys;var i=Object.create||Ember.create;var n=r.forEach;var a=Ember.Error;var o=/^\/?data\/(attributes|relationships)\/(.*)/;function s(e,r){r=r||"Adapter operation failed";a.call(this,r);this.errors=e||[{title:"Adapter Error",detail:r}]}s.prototype=i(a.prototype);function l(e){if(!Ember.isArray(e)){e=c(e)}s.call(this,e,"The adapter rejected the commit because it was invalid")}l.prototype=i(s.prototype);function u(){s.call(this,null,"The adapter operation timed out")}u.prototype=i(s.prototype);function d(){s.call(this,null,"The adapter operation was aborted")}d.prototype=i(s.prototype);function c(e){var r=[];if(Ember.isPresent(e)){n.call(t(e),function(t){var i=Ember.makeArray(e[t]);for(var n=0;n<i.length;n++){r.push({title:"Invalid Attribute",detail:i[n],source:{pointer:"/data/attributes/"+t}})}})}return r}function h(e){var r={};if(Ember.isPresent(e)){n.call(e,function(e){if(e.source&&e.source.pointer){var t=e.source.pointer.match(o);if(t){t=t[2];r[t]=r[t]||[];r[t].push(e.detail||e.title)}}})}return r}var f=Ember.get;var p=Ember.Object.extend({defaultSerializer:"-default",findRecord:null,findAll:null,query:null,queryRecord:null,generateIdForRecord:null,serialize:function(e,r){return f(e.record,"store").serializerFor(e.modelName).serialize(e,r)},createRecord:null,updateRecord:null,deleteRecord:null,coalesceFindRequests:true,groupRecordsForFindMany:function(e,r){return[r]},shouldReloadRecord:function(e,r){return false},shouldReloadAll:function(e,r){var t=r.type.modelName;return true},shouldBackgroundReloadRecord:function(e,r){return false},shouldBackgroundReloadAll:function(e,r){return true}});var m=p;var v=Ember.Map;var y=Ember.MapWithDefault;var g=v;var b=Ember.get;var R=Ember.Mixin.create({buildURL:function(e,r,t,i,n){switch(i){case"find":return this.urlForFind(r,e,t);case"findRecord":return this.urlForFindRecord(r,e,t);case"findAll":return this.urlForFindAll(e);case"findQuery":return this.urlForFindQuery(n,e);case"query":return this.urlForQuery(n,e);case"queryRecord":return this.urlForQueryRecord(n,e);case"findMany":return this.urlForFindMany(r,e,t);case"findHasMany":return this.urlForFindHasMany(r,e);case"findBelongsTo":return this.urlForFindBelongsTo(r,e);case"createRecord":return this.urlForCreateRecord(e,t);case"updateRecord":return this.urlForUpdateRecord(r,e,t);case"deleteRecord":return this.urlForDeleteRecord(r,e,t);default:return this._buildURL(e,r)}},_buildURL:function(e,r){var t=[];var i=b(this,"host");var n=this.urlPrefix();var a;if(e){a=this.pathForType(e);if(a){t.push(a)}}if(r){t.push(encodeURIComponent(r))}if(n){t.unshift(n)}t=t.join("/");if(!i&&t&&t.charAt(0)!=="/"){t="/"+t}return t},urlForFind:E,urlForFindRecord:function(e,r,t){if(this.urlForFind!==E){return this.urlForFind(e,r,t)}return this._buildURL(r,e)},urlForFindAll:function(e){return this._buildURL(e)},urlForFindQuery:_,urlForQuery:function(e,r){if(this.urlForFindQuery!==_){return this.urlForFindQuery(e,r)}return this._buildURL(r)},urlForQueryRecord:function(e,r){return this._buildURL(r)},urlForFindMany:function(e,r,t){return this._buildURL(r)},urlForFindHasMany:function(e,r){return this._buildURL(r,e)},urlForFindBelongsTo:function(e,r){return this._buildURL(r,e)},urlForCreateRecord:function(e,r){return this._buildURL(e)},urlForUpdateRecord:function(e,r,t){return this._buildURL(r,e)},urlForDeleteRecord:function(e,r,t){return this._buildURL(r,e)},urlPrefix:function(e,r){var t=b(this,"host");var i=b(this,"namespace");var n=[];if(e){if(/^\/\//.test(e)){}else if(e.charAt(0)==="/"){if(t){e=e.slice(1);n.push(t)}}else if(!/^http(s)?:\/\//.test(e)){n.push(r)}}else{if(t){n.push(t)}if(i){n.push(i)}}if(e){n.push(e)}return n.join("/")},pathForType:function(e){var r=Ember.String.camelize(e);return Ember.String.pluralize(r)}});function E(e,r,t){return this._buildURL(r,e)}function _(e,r){return this._buildURL(r)}var F=R;var A=Ember.get;var z=Ember.set;var M=r.forEach;var S=m.extend(F,{defaultSerializer:"-rest",sortQueryParams:function(e){var r=t(e);var i=r.length;if(i<2){return e}var n={};var a=r.sort();for(var o=0;o<i;o++){n[a[o]]=e[a[o]]}return n},coalesceFindRequests:false,find:function(e,r,t,i){return this.ajax(this.buildURL(r.modelName,t,i,"find"),"GET")},findRecord:function(e,r,t,i){var n=S.prototype.find;if(n!==this.find){return this.find(e,r,t,i)}return this.ajax(this.buildURL(r.modelName,t,i,"findRecord"),"GET")},findAll:function(e,r,t){var i,n;if(t){i={since:t}}n=this.buildURL(r.modelName,null,null,"findAll");return this.ajax(n,"GET",{data:i})},findQuery:function(e,r,t){var i=this.buildURL(r.modelName,null,null,"findQuery",t);if(this.sortQueryParams){t=this.sortQueryParams(t)}return this.ajax(i,"GET",{data:t})},query:function(e,r,t){var i=S.prototype.findQuery;if(i!==this.findQuery){return this.findQuery(e,r,t)}var n=this.buildURL(r.modelName,null,null,"query",t);if(this.sortQueryParams){t=this.sortQueryParams(t)}return this.ajax(n,"GET",{data:t})},queryRecord:function(e,r,t){var i=this.buildURL(r.modelName,null,null,"queryRecord",t);if(this.sortQueryParams){t=this.sortQueryParams(t)}return this.ajax(i,"GET",{data:t})},findMany:function(e,r,t,i){var n=this.buildURL(r.modelName,t,i,"findMany");return this.ajax(n,"GET",{data:{ids:t}})},findHasMany:function(e,r,t,i){var n=r.id;var a=r.modelName;t=this.urlPrefix(t,this.buildURL(a,n,null,"findHasMany"));return this.ajax(t,"GET")},findBelongsTo:function(e,r,t,i){var n=r.id;var a=r.modelName;t=this.urlPrefix(t,this.buildURL(a,n,null,"findBelongsTo"));return this.ajax(t,"GET")},createRecord:function(e,r,t){var i={};var n=e.serializerFor(r.modelName);var a=this.buildURL(r.modelName,null,t,"createRecord");n.serializeIntoHash(i,r,t,{includeId:true});return this.ajax(a,"POST",{data:i})},updateRecord:function(e,r,t){var i={};var n=e.serializerFor(r.modelName);n.serializeIntoHash(i,r,t);var a=t.id;var o=this.buildURL(r.modelName,a,t,"updateRecord");return this.ajax(o,"PUT",{data:i})},deleteRecord:function(e,r,t){var i=t.id;return this.ajax(this.buildURL(r.modelName,i,t,"deleteRecord"),"DELETE")},_stripIDFromURL:function(e,r){var t=this.buildURL(r.modelName,r.id,r);var i=t.split("/");var n=i[i.length-1];var a=r.id;if(n===a){i[i.length-1]=""}else if(T(n,"?id="+a)){i[i.length-1]=n.substring(0,n.length-a.length-1)}return i.join("/")},maxURLLength:2048,groupRecordsForFindMany:function(e,r){var t=y.create({defaultValue:function(){return[]}});var i=this;var n=this.maxURLLength;M.call(r,function(r){var n=i._stripIDFromURL(e,r);t.get(n).push(r)});function a(r,t,n){var a=i._stripIDFromURL(e,r[0]);var o=0;var s=[[]];M.call(r,function(e){var r=encodeURIComponent(e.id).length+n;if(a.length+o+r>=t){o=0;s.push([])}o+=r;var i=s.length-1;s[i].push(e)});return s}var o=[];t.forEach(function(e,r){var t="&ids%5B%5D=".length;var i=a(e,n,t);M.call(i,function(e){o.push(e)})});return o},handleResponse:function(e,r,t){if(this.isSuccess(e,r,t)){return t}else if(this.isInvalid(e,r,t)){return new l(t.errors)}var i=this.normalizeErrorResponse(e,r,t);return new s(i)},isSuccess:function(e,r,t){return e>=200&&e<300||e===304},isInvalid:function(e,r,t){return e===422},ajax:function(e,r,t){var i=this;return new Ember.RSVP.Promise(function(n,a){var o=i.ajaxOptions(e,r,t);o.success=function(e,r,t){var o=undefined;if(i.ajaxSuccess){o=i.ajaxSuccess(t,e)}if(!(o instanceof s)){o=i.handleResponse(t.status,k(t.getAllResponseHeaders()),o||e)}if(o instanceof s){Ember.run(null,a,o)}else{Ember.run(null,n,o)}};o.error=function(e,r,t){var n=undefined;if(i.ajaxError){n=i.ajaxError(e,r,t)}if(!(n instanceof Error)){if(t instanceof Error){n=t}else if(r==="timeout"){n=new u}else if(r==="abort"){n=new d}else{n=i.handleResponse(e.status,k(e.getAllResponseHeaders()),i.parseErrorResponse(e.responseText)||t)}}Ember.run(null,a,n)};Ember.$.ajax(o)},"DS: RESTAdapter#ajax "+r+" to "+e)},ajaxOptions:function(e,r,i){var n=i||{};n.url=e;n.type=r;n.dataType="json";n.context=this;if(n.data&&r!=="GET"){n.contentType="application/json; charset=utf-8";n.data=JSON.stringify(n.data)}var a=A(this,"headers");if(a!==undefined){n.beforeSend=function(e){M.call(t(a),function(r){e.setRequestHeader(r,a[r])})}}return n},parseErrorResponse:function(e){var r=e;try{r=Ember.$.parseJSON(e)}catch(t){}return r},normalizeErrorResponse:function(e,r,t){if(t&&typeof t==="object"&&t.errors){return t.errors}else{return[{status:""+e,title:"The backend responded with an error",detail:""+t}]}}});function k(e){var r=i(null);if(!e){return r}var t=e.split("\r\n");for(var n=0;n<t.length;n++){var a=t[n];var o=a.indexOf(": ");if(o>0){var s=a.substring(0,o);var l=a.substring(o+2);r[s]=l}}return r}function T(e,r){if(typeof String.prototype.endsWith!=="function"){return e.indexOf(r,e.length-r.length)!==-1}else{return e.endsWith(r)}}if(Ember.platform.hasPropertyAccessors){Ember.defineProperty(S.prototype,"maxUrlLength",{enumerable:false,get:function(){return this.maxURLLength},set:function(e){z(this,"maxURLLength",e)}})}var P=S;var x=e.String.capitalize;var C=/^\s*$/;var N=/([\w/-]+[_/-\s])([a-z\d]+$)/;var w=/([\w/-\s]+)([A-Z][a-z\d]*$)/;var D=/[A-Z][a-z\d]*$/;function I(e,r){for(var t=0,i=r.length;t<i;t++){e.uncountable[r[t].toLowerCase()]=true}}function O(e,r){var t;for(var i=0,n=r.length;i<n;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 L(e){e=e||{};e.uncountable=e.uncountable||$();e.irregularPairs=e.irregularPairs||$();var r=this.rules={plurals:e.plurals||[],singular:e.singular||[],irregular:$(),irregularInverse:$(),uncountable:$()};I(r,e.uncountable);O(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 $(){var e=Object.create(null);e["_dict"]=null;delete e["_dict"];return e}L.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=$();this._pCache=$()},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()}I(this.rules,[e.toLowerCase()])},irregular:function(e,r){if(this._cacheUsed){this.purgeCache()}O(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,r,t){var i,n,a,o,s,l,u,d,c,h,f;d=!e||C.test(e);c=D.test(e);l="";if(d){return e}o=e.toLowerCase();s=N.exec(e)||w.exec(e);if(s){l=s[1];u=s[2].toLowerCase()}f=this.rules.uncountable[o]||this.rules.uncountable[u];if(f){return e}for(h in this.rules.irregular){if(o.match(h+"$")){n=t[h];if(c&&t[u]){n=x(n);h=x(h)}return e.replace(h,n)}}for(var p=r.length,m=0;p>m;p--){i=r[p-1];h=i[0];if(h.test(e)){break}}i=i||[];h=i[0];n=i[1];a=e.replace(h,n);return a}};var j=L;function K(e){return j.inflector.pluralize(e)}function H(e){return j.inflector.singularize(e)}var B={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"]};j.inflector=new j(B);if(e.EXTEND_PROTOTYPES===true||e.EXTEND_PROTOTYPES.String){String.prototype.pluralize=function(){return K(this)};String.prototype.singularize=function(){return H(this)}}j.defaultRules=B;e.Inflector=j;e.String.pluralize=K;e.String.singularize=H;var U=j;if(typeof define!=="undefined"&&define.amd){define("ember-inflector",["exports"],function(e){e["default"]=j;return j})}else if(typeof module!=="undefined"&&module["exports"]){module["exports"]=j}var V=e.String;var q=V.decamelize;var W=V.underscore;var Q=P.extend({defaultSerializer:"-active-model",pathForType:function(e){var r=q(e);var t=W(r);return K(t)},handleResponse:function(e,r,t){if(this.isInvalid(e,r,t)){var i=c(t.errors);return new l(i)}else{return this._super.apply(this,arguments)}}});var J=Q;var G=Ember.Object.extend({isNewSerializerAPI:false,extract:null,serialize:null,normalize:function(e,r){return r}});var X=G;var Y=Z;function Z(e){return e==null||e===""?null:e+""}var ee=re;function re(e){return Ember.String.dasherize(e)}var te=Ember.get;var ie=Ember.isNone;var ne=r.map;var ae=Ember.merge;var oe=X.extend({primaryKey:"id",mergedProperties:["attrs"],applyTransforms:function(e,r){e.eachTransformedAttribute(function t(e,i){if(!r.hasOwnProperty(e)){return}var n=this.transformFor(i);r[e]=n.deserialize(r[e])},this);return r},normalizeResponse:function(e,r,t,i,n){switch(n){case"findRecord":return this.normalizeFindRecordResponse.apply(this,arguments);case"queryRecord":return this.normalizeQueryRecordResponse.apply(this,arguments);case"findAll":return this.normalizeFindAllResponse.apply(this,arguments);case"findBelongsTo":return this.normalizeFindBelongsToResponse.apply(this,arguments);case"findHasMany":return this.normalizeFindHasManyResponse.apply(this,arguments);case"findMany":return this.normalizeFindManyResponse.apply(this,arguments);case"query":return this.normalizeQueryResponse.apply(this,arguments);case"createRecord":return this.normalizeCreateRecordResponse.apply(this,arguments);case"deleteRecord":return this.normalizeDeleteRecordResponse.apply(this,arguments);case"updateRecord":return this.normalizeUpdateRecordResponse.apply(this,arguments)}},normalizeFindRecordResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeQueryRecordResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindAllResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindBelongsToResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeFindHasManyResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeFindManyResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeQueryResponse:function(e,r,t,i,n){return this.normalizeArrayResponse.apply(this,arguments)},normalizeCreateRecordResponse:function(e,r,t,i,n){return this.normalizeSaveResponse.apply(this,arguments)},normalizeDeleteRecordResponse:function(e,r,t,i,n){return this.normalizeSaveResponse.apply(this,arguments)},normalizeUpdateRecordResponse:function(e,r,t,i,n){return this.normalizeSaveResponse.apply(this,arguments)},normalizeSaveResponse:function(e,r,t,i,n){return this.normalizeSingleResponse.apply(this,arguments)},normalizeSingleResponse:function(e,r,t,i,n){return this._normalizeResponse(e,r,t,i,n,true)},normalizeArrayResponse:function(e,r,t,i,n){return this._normalizeResponse(e,r,t,i,n,false)},_normalizeResponse:function(e,r,t,i,n,a){var o=this;var s={data:null,included:[]};var l=this.extractMeta(e,r,t);if(l){s.meta=l}if(a){var u=this.normalize(r,t);var d=u.data;var c=u.included;s.data=d;if(c){s.included=c}}else{s.data=t.map(function(e){var t=o.normalize(r,e);var i=t.data;var n=t.included;if(n){var a;(a=s.included).push.apply(a,n)}return i})}return s},normalize:function(e,r){if(this.get("isNewSerializerAPI")){return se.apply(this,arguments)}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},extractId:function(e,r){var t=te(this,"primaryKey");var i=r[t];return Y(i)},extractAttributes:function(e,r){var t;var i={};e.eachAttribute(function(e){t=this.keyForAttribute(e,"deserialize");if(r.hasOwnProperty(t)){i[e]=r[t]}},this);return i},extractRelationship:function(e,r){if(Ember.isNone(r)){return null}if(Ember.typeOf(r)==="object"){if(r.id){r.id=Y(r.id)}if(r.type){r.type=this.modelNameFromPayloadKey(r.type)}return r}return{id:Y(r),type:e}},extractRelationships:function(e,r){var t={};e.eachRelationship(function(e,i){var n=null;var a=this.keyForRelationship(e,i.kind,"deserialize");if(r.hasOwnProperty(a)){var o=null;var s=r[a];if(i.kind==="belongsTo"){o=this.extractRelationship(i.type,s)}else if(i.kind==="hasMany"){o=Ember.A(s).map(function(e){return this.extractRelationship(i.type,e)},this)}n={data:o}}var l=this.keyForLink(e,i.kind);if(r.links&&r.links.hasOwnProperty(l)){var u=r.links[l];n=n||{};n.links={related:u}}if(n){t[e]=n}},this);return t},modelNameFromPayloadKey:function(e){return ee(e)},normalizePayload:function(e){return e},normalizeAttributes:function(e,r){var t;if(this.keyForAttribute){e.eachAttribute(function(e){t=this.keyForAttribute(e,"deserialize");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,"deserialize");if(e===t){return}if(!r.hasOwnProperty(t)){return}r[e]=r[t];delete r[t]},this)}},normalizeUsingDeclaredMapping:function(e,r){var t=te(this,"attrs");var i,n;if(t){for(n in t){i=this._getMappedKey(n);if(!r.hasOwnProperty(i)){continue}if(i!==n){r[n]=r[i];delete r[i]}}}},normalizeId:function(e){var r=te(this,"primaryKey");if(r==="id"){return}e.id=e[r];delete e[r]},normalizeErrors:function(e,r){this.normalizeId(r);this.normalizeAttributes(e,r);this.normalizeRelationships(e,r);this.normalizeUsingDeclaredMapping(e,r)},_getMappedKey:function(e){var r=te(this,"attrs");var t;if(r&&r[e]){t=r[e];if(t.key){t=t.key}if(typeof t==="string"){e=t}}return e},_canSerialize:function(e){var r=te(this,"attrs");return!r||!r[e]||r[e].serialize!==false},_mustSerialize:function(e){var r=te(this,"attrs");return r&&r[e]&&r[e].serialize===true},_shouldSerializeHasMany:function(e,r,t){var i=e.type.determineRelationshipType(t,this.store);if(this._mustSerialize(r)){return true}return this._canSerialize(r)&&(i==="manyToNone"||i==="manyToMany")},serialize:function(e,r){var t={};if(r&&r.includeId){var i=e.id;if(i){t[te(this,"primaryKey")]=i}}e.eachAttribute(function(r,i){this.serializeAttribute(e,t,r,i)},this);e.eachRelationship(function(r,i){if(i.kind==="belongsTo"){this.serializeBelongsTo(e,t,i)}else if(i.kind==="hasMany"){this.serializeHasMany(e,t,i)}},this);return t},serializeIntoHash:function(e,r,t,i){ae(e,this.serialize(t,i))},serializeAttribute:function(e,r,t,i){var n=i.type;if(this._canSerialize(t)){var a=e.attr(t);if(n){var o=this.transformFor(n);a=o.serialize(a)}var s=this._getMappedKey(t);if(s===t&&this.keyForAttribute){s=this.keyForAttribute(t,"serialize")}r[s]=a}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this._canSerialize(i)){var n=e.belongsTo(i,{id:true});var a=this._getMappedKey(i);if(a===i&&this.keyForRelationship){a=this.keyForRelationship(i,"belongsTo","serialize")}if(ie(n)){r[a]=null}else{r[a]=n}if(t.options.polymorphic){this.serializePolymorphicType(e,r,t)}}},serializeHasMany:function(e,r,t){var i=t.key;if(this._shouldSerializeHasMany(e,i,t)){var n;n=this._getMappedKey(i);if(n===i&&this.keyForRelationship){n=this.keyForRelationship(i,"hasMany","serialize")}r[n]=e.hasMany(i,{ids:true})}},serializePolymorphicType:Ember.K,extract:function(e,r,t,i,n){this.extractMeta(e,r.modelName,t);var a="extract"+n.charAt(0).toUpperCase()+n.substr(1);return this[a](e,r,t,i,n)},extractFindAll:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractFindQuery:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractQueryRecord:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractFindMany:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractFindHasMany:function(e,r,t,i,n){return this.extractArray(e,r,t,i,n)},extractCreateRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractUpdateRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractDeleteRecord:function(e,r,t,i,n){return this.extractSave(e,r,t,i,n)},extractFind:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractFindBelongsTo:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractSave:function(e,r,t,i,n){return this.extractSingle(e,r,t,i,n)},extractSingle:function(e,r,t,i,n){if(!this.get("didDeprecateNormalizePayload")){this.set("didDeprecateNormalizePayload",true)}var a=this.normalizePayload(t);return this.normalize(r,a)},extractArray:function(e,r,t,i,n){if(!this.get("didDeprecateNormalizePayload")){this.set("didDeprecateNormalizePayload",true)}var a=this.normalizePayload(t);var o=this;return ne.call(a,function(e){return o.normalize(r,e)})},extractMeta:function(e,r,t){if(this.get("isNewSerializerAPI")){return le.apply(this,arguments)}if(t&&t.meta){e._setMetadataFor(r,t.meta);delete t.meta}},extractErrors:function(e,r,t,i){if(t&&typeof t==="object"&&t.errors){t=h(t.errors);this.normalizeErrors(r,t)}return t},keyForAttribute:function(e,r){return e},keyForRelationship:function(e,r,t){return e},keyForLink:function(e,r){return e},transformFor:function(e,r){var t=this.container.lookup("transform:"+e);return t}});function se(e,r){var t=null;if(r){this.normalizeUsingDeclaredMapping(e,r);t={id:this.extractId(e,r),type:e.modelName,attributes:this.extractAttributes(e,r),relationships:this.extractRelationships(e,r)};this.applyTransforms(e,t.attributes)}return{data:t}}function le(e,r,t){if(t&&t.hasOwnProperty("meta")){var i=t.meta;delete t.meta;return i}}var ue=oe;var de=Ember.RSVP.Promise;var ce=Ember.get;var he=Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);var fe=Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);var pe=function(e,r){return fe.create({promise:de.resolve(e,r)})};var me=function(e,r){return he.create({promise:de.resolve(e,r)})};function ve(e){return function(){var r=ce(this,"content");return r[e].apply(r,arguments)}}var ye=he.extend({reload:function(){return ye.create({promise:ce(this,"content").reload()})},createRecord:ve("createRecord"),on:ve("on"),one:ve("one"),trigger:ve("trigger"),off:ve("off"),has:ve("has")});var ge=function(e,r){return ye.create({promise:de.resolve(e,r)})};var be=Ember.get;var Re=Ember.set;var Ee=Ember.isEmpty;var _e=Ember.makeArray;var Fe=r.map;var Ae=Ember.ArrayProxy.extend(Ember.Evented,{registerHandlers:function(e,r,t){this.on("becameInvalid",e,r);this.on("becameValid",e,t)},errorsByAttributeName:Ember.computed(function(){return y.create({defaultValue:function(){return Ember.A()}})}),errorsFor:function(e){return be(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(Ee(r)){return null}return r},isEmpty:Ember.computed.not("length").readOnly(),add:function(e,r){var t=be(this,"isEmpty");r=this._findOrCreateMessages(e,r);this.addObjects(r);be(this,"errorsByAttributeName").get(e).addObjects(r);this.notifyPropertyChange(e);if(t&&!be(this,"isEmpty")){this.trigger("becameInvalid")}},_findOrCreateMessages:function(e,r){var t=this.errorsFor(e);return Fe.call(_e(r),function(r){return t.findBy("message",r)||{attribute:e,message:r}})},remove:function(e){if(be(this,"isEmpty")){return}var r=this.rejectBy("attribute",e);Re(this,"content",r);be(this,"errorsByAttributeName")["delete"](e);this.notifyPropertyChange(e);if(be(this,"isEmpty")){this.trigger("becameValid")}},clear:function(){if(be(this,"isEmpty")){return}var e=be(this,"errorsByAttributeName");var r=Ember.A();e.forEach(function(e,t){r.push(t)});e.clear();r.forEach(function(e){this.notifyPropertyChange(e)},this);this._super();this.trigger("becameValid")},has:function(e){return!Ee(this.errorsFor(e))}});var ze;try{e.computed({set:function(){},get:function(){}});ze=true}catch(Me){ze=false}var Se=ze;var ke=Pe;var Te=e.computed;function Pe(){var e=[];var r=arguments[arguments.length-1];if(typeof r==="function"||Se){return Te.apply(undefined,arguments)}for(var t=0,i=arguments.length-1;t<i;t++){e.push(arguments[t])}var n;if(r.set){n=function(e,t){if(arguments.length>1){return r.set.call(this,e,t)}else{return r.get.call(this,e)}}}else{n=function(e){return r.get.call(this,e)}}e.push(n);return Te.apply(undefined,e)}var xe=Object.keys||e.keys;var Ce=xe(Te);for(var Ne=0,we=Ce.length;Ne<we;Ne++){Pe[Ce[Ne]]=Te[Ce[Ne]]}var De=false;var Ie=Ember.get;var Oe=Ember.merge;var Le=Ember.copy;var $e=r.forEach;var je=r.indexOf;function Ke(e,r){var t=[];$e.call(e,function(e){if(je.call(r,e)>=0){t.push(e)}});return t}var He=["currentState","data","store"];var Be=Ember.computed("currentState",function(e){return Ie(this._internalModel.currentState,e)}).readOnly();var Ue=Ember.Object.extend(Ember.Evented,{_recordArrays:undefined,_relationships:undefined,_internalModel:null,store:null,isEmpty:Be,isLoading:Be,isLoaded:Be,isDirty:Ember.computed("currentState.isDirty",function(){return this.get("currentState.isDirty")}),error:ke("adapterError",{get:function(){if(!De){De=true}return Ember.get(this,"adapterError")}}),hasDirtyAttributes:Ember.computed("currentState.isDirty",function(){return this.get("currentState.isDirty")}),isSaving:Be,isDeleted:Be,isNew:Be,isValid:Be,dirtyType:Be,isError:false,isReloading:false,id:null,errors:Ember.computed(function(){var e=Ae.create();e.registerHandlers(this._internalModel,function(){this.send("becameInvalid")},function(){this.send("becameValid")});return e}).readOnly(),adapterError:null,serialize:function(e){return this.store.serialize(this,e)},toJSON:function(e){var r=this.store.serializerFor("-default");var t=this._internalModel.createSnapshot();return r.serialize(t,e)},ready:Ember.K,didLoad:Ember.K,didUpdate:Ember.K,didCreate:Ember.K,didDelete:Ember.K,becameInvalid:Ember.K,becameError:Ember.K,rolledBack:Ember.K,data:Ember.computed.readOnly("_internalModel._data"),send:function(e,r){return this._internalModel.send(e,r)},transitionTo:function(e){return this._internalModel.transitionTo(e)},deleteRecord:function(){this._internalModel.deleteRecord()},destroyRecord:function(e){this.deleteRecord();return this.save(e)},unloadRecord:function(){if(this.isDestroyed){return}this._internalModel.unloadRecord()},_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=Ie(this._internalModel,"_data");var r=Ie(this._internalModel,"_attributes");var n=Ie(this._internalModel,"_inFlightAttributes");var a=Oe(Le(n),r);var o=i(null);var s=t(a);for(var l=0,u=s.length;l<u;l++){var d=s[l];o[d]=[e[d],a[d]]}return o},rollback:function(){this.rollbackAttributes()},rollbackAttributes:function(){this._internalModel.rollbackAttributes()},_createSnapshot:function(){return this._internalModel.createSnapshot()},toStringExtension:function(){return Ie(this,"id")},save:function(e){var r=this;return fe.create({promise:this._internalModel.save(e).then(function(){return r})})},reload:function(){var e=this;return fe.create({promise:this._internalModel.reload().then(function(){return e})})},trigger:function(e){var r=arguments.length;var t=new Array(r-1);for(var i=1;i<r;i++){t[i-1]=arguments[i]}Ember.tryInvoke(this,e,t);this._super.apply(this,arguments)},willDestroy:function(){this._internalModel.clearRelationships();this._internalModel.recordObjectWillDestroy();this._super.apply(this,arguments)},willMergeMixin:function(e){var r=this.constructor},attr:function(){},belongsTo:function(){},hasMany:function(){}});Ue.reopenClass({_create:Ue.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.")},modelName:null});var Ve=Ue;var qe=r.forEach;var We=r.map;var Qe=Ember.get;function Je(e){var r=[];if(!e||typeof e!=="object"){r.push("Top level of a JSON API document must be an object")}else{if(!("data"in e)&&!("errors"in e)&&!("meta"in e)){r.push('One or more of the following keys must be present: "data", "errors", "meta".')}else{if("data"in e&&"errors"in e){r.push('Top level keys "errors" and "data" cannot both be present in a JSON API document')}}if("data"in e){if(!(e.data===null||Ember.isArray(e.data)||typeof e.data==="object")){r.push("data must be null, an object, or an array")}}if("meta"in e){if(typeof e.meta!=="object"){r.push("meta must be an object")}}if("errors"in e){if(!Ember.isArray(e.errors)){r.push("errors must be an array")}}if("links"in e){if(typeof e.links!=="object"){r.push("links must be an object")}}if("jsonapi"in e){if(typeof e.jsonapi!=="object"){r.push("jsonapi must be an object")}}if("included"in e){if(typeof e.included!=="object"){r.push("included must be an array")}}}return r}function Ge(e,r,t,i,n,a){if(Qe(e,"isNewSerializerAPI")){var o=function(){var o=e.normalizeResponse(r,t,i,n,a);var s=[];if(o.meta){r._setMetadataFor(t.modelName,o.meta)}return{v:o}}();if(typeof o==="object")return o.v}else{var s=e.extract(r,t,i,n,a);return Xe(t,s)}}function Xe(e,r){var t=null;if(r){if(Ember.typeOf(r)==="array"){t=We.call(r,function(r){return Ye(e,r)})}else{t=Ye(e,r)}}return{data:t}}function Ye(e,r){var t={};t.id=""+r.id;t.type=e.modelName;t.attributes={};t.relationships={};e.eachAttribute(function(e){if(r.hasOwnProperty(e)){t.attributes[e]=r[e]}});e.eachRelationship(function(e,i){var n,a;if(r.hasOwnProperty(e)){var o;(function(){n={};a=r[e];var t=function(e,r){if(Ember.isNone(e)){return null}if(e instanceof Ve){e={id:e.id,type:e.constructor.modelName}}if(Ember.typeOf(e)==="object"){if(e.id){e.id=""+e.id}return e}return{id:""+e,type:r.type}};if(i.kind==="belongsTo"){n.data=t(a,i);if(i.options&&i.options.polymorphic&&r[e+"Type"]){n.data.type=r[e+"Type"]}}else if(i.kind==="hasMany"){o=Ember.A(a||[]);n.data=We.call(o,function(e){return t(e,i)})}})()}if(r.links&&r.links.hasOwnProperty(e)){n=n||{};a=r.links[e];n.links={related:a}}if(n){n.meta=Qe(r,"meta."+e);t.relationships[e]=n}});return t}function Ze(e,r){var t=er(e,r);rr(e,r);return t}function er(e,r){var t;if(r&&r.data){if(Ember.isArray(r.data)){t=We.call(r.data,function(r){return tr(e,r)})}else{t=tr(e,r.data)}}return t}function rr(e,r){var t;if(r&&r.included&&Ember.isArray(r.included)){t=We.call(r.included,function(r){return tr(e,r)})}return t}function tr(e,r){return e.push({data:r})}function ir(e){
2
+ if(!e){return e}var r={id:e.id,type:e.type,links:{}};if(e.attributes){var i=t(e.attributes);qe.call(i,function(t){var i=e.attributes[t];r[t]=i})}if(e.relationships){var n=t(e.relationships);qe.call(n,function(t){var i=e.relationships[t];if(i.hasOwnProperty("data")){r[t]=i.data}else if(i.links&&i.links.related){r.links[t]=i.links.related}})}return r}var nr=r.forEach;var ar=r.map;var or=Ember.String.camelize;var sr=Ember.get;var lr=ue.extend({normalize:function(e,r,t){if(this.get("isNewSerializerAPI")){dr.apply(this,arguments);return this._super.apply(this,arguments)}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},normalizeArray:function(e,r,t,i){var n=this;var a={data:[],included:[]};var o=e.modelFor(r);var s=e.serializerFor(r);nr.call(t,function(r){var t=n._normalizePolymorphicRecord(e,r,i,o,s);var l=t.data;var u=t.included;a.data.push(l);if(u){var d;(d=a.included).push.apply(d,u)}},this);return a},_normalizePolymorphicRecord:function(e,r,t,i,n){var a=undefined,o=undefined;if(r.type&&e._hasModelFor(this.modelNameFromPayloadKey(r.type))){a=e.serializerFor(r.type);o=e.modelFor(r.type)}else{a=n;o=i}return a.normalize(o,r,t)},_normalizeResponse:function(e,r,i,n,a,o){var s={data:null,included:[]};var l=this.extractMeta(e,r,i);if(l){s.meta=l}var u=t(i);for(var d=0,c=u.length;d<c;d++){var h=u[d];var f=h;var p=false;if(h.charAt(0)==="_"){p=true;f=h.substr(1)}var m=this.modelNameFromPayloadKey(f);if(!e.modelFactoryFor(m)){continue}var v=!p&&this.isPrimaryType(e,m,r);var y=i[h];if(y===null){continue}if(v&&Ember.typeOf(y)!=="array"){var g=this._normalizePolymorphicRecord(e,y,h,r,this);var b=g.data;var R=g.included;s.data=b;if(R){var E;(E=s.included).push.apply(E,R)}continue}var _=this.normalizeArray(e,m,y,h);var F=_.data;var A=_.included;if(A){var z;(z=s.included).push.apply(z,A)}if(o){nr.call(F,function(e){var r=v&&Y(e.id)===n;var t=v&&!n&&!s.data;if(t||r){s.data=e}else{s.included.push(e)}})}else{if(v){s.data=F}else{if(F){var M;(M=s.included).push.apply(M,F)}}}}return s},extractSingle:function(e,r,t,i){var n=this.normalizePayload(t);var a;for(var o in n){var s=this.modelNameFromPayloadKey(o);if(!e.modelFactoryFor(s)){continue}var l=this.isPrimaryType(e,s,r);var u=n[o];if(u===null){continue}if(l&&Ember.typeOf(u)!=="array"){a=this.normalize(r,u,o);continue}nr.call(u,function(r){var t=this.modelNameFromPayloadKey(o);var n=e.modelFor(t);var u=e.serializerFor(n.modelName);r=u.normalize(n,r,o);var d=l&&!i&&!a;var c=l&&Y(r.id)===i;if(d||c){a=r}else{e.push(s,r)}},this)}return a},extractArray:function(e,r,t){var i=this.normalizePayload(t);var n;for(var a in i){var o=a;var s=false;if(a.charAt(0)==="_"){s=true;o=a.substr(1)}var l=this.modelNameFromPayloadKey(o);if(!e.modelFactoryFor(l)){continue}var u=e.modelFor(l);var d=e.serializerFor(u.modelName);var c=!s&&this.isPrimaryType(e,l,r);var h=ar.call(i[a],function(e){return d.normalize(u,e,a)},this);if(c){n=h}else{e.pushMany(l,h)}}return n},isPrimaryType:function(e,r,t){var i=e.modelFor(r);return i.modelName===t.modelName},pushPayload:function(e,r){if(this.get("isNewSerializerAPI")){cr.apply(this,arguments);return}var t=this.normalizePayload(r);for(var i in t){var n=this.modelNameFromPayloadKey(i);if(!e.modelFactoryFor(n)){continue}var a=e.modelFor(n);var o=e.serializerFor(n);var s=ar.call(Ember.makeArray(t[i]),function(e){return o.normalize(a,e,i)},this);e.pushMany(n,s)}},modelNameFromPayloadKey:function(e){return H(ee(e))},serialize:function(e,r){return this._super.apply(this,arguments)},serializeIntoHash:function(e,r,t,i){var n=this.payloadKeyFromModelName(r.modelName);e[n]=this.serialize(t,i)},payloadKeyFromModelName:function(e){return or(e)},typeForRoot:function(e){return this.modelNameFromPayloadKey(e)},serializePolymorphicType:function(e,r,t){var i=t.key;var n=e.belongsTo(i);i=this.keyForAttribute?this.keyForAttribute(i,"serialize"):i;if(Ember.isNone(n)){r[i+"Type"]=null}else{r[i+"Type"]=Ember.String.camelize(n.modelName)}}});var ur=lr;function dr(e,r,t){if(this.normalizeHash&&this.normalizeHash[t]){this.normalizeHash[t](r)}}function cr(e,r){var t={data:[],included:[]};var i=this.normalizePayload(r);for(var n in i){var a=this.modelNameFromPayloadKey(n);if(!e.modelFactoryFor(a)){continue}var o=e.modelFor(a);var s=e.serializerFor(o.modelName);nr.call(Ember.makeArray(i[n]),function(e){var r=s.normalize(o,e,n);var i=r.data;var a=r.included;t.data.push(i);if(a){var l;(l=t.included).push.apply(l,a)}},this)}Ze(e,t)}var hr=e.String;var fr=hr.singularize;var pr=hr.classify;var mr=hr.decamelize;var vr=hr.camelize;var yr=hr.underscore;var gr=ur.extend({keyForAttribute:function(e){return mr(e)},keyForRelationship:function(e,r){var t=mr(e);if(r==="belongsTo"){return t+"_id"}else if(r==="hasMany"){return fr(t)+"_ids"}else{return t}},keyForLink:function(e,r){return vr(e)},serializeHasMany:e.K,payloadKeyFromModelName:function(e){return yr(mr(e))},serializePolymorphicType:function(r,t,i){var n=i.key;var a=r.belongsTo(n);var o=yr(n+"_type");if(e.isNone(a)){t[o]=null}else{t[o]=pr(a.modelName).replace("/","::")}},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=vr(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,n;if(t.options.polymorphic){i=this.keyForAttribute(e,"deserialize");n=r[i];if(n&&n.type){n.type=this.modelNameFromPayloadKey(n.type)}else if(n&&t.kind==="hasMany"){for(var a=0,o=n.length;a<o;a++){var s=n[a];s.type=this.modelNameFromPayloadKey(s.type)}}}else{i=this.keyForRelationship(e,t.kind,"deserialize");if(!r.hasOwnProperty(i)){return}n=r[i]}r[e]=n;if(e!==i){delete r[i]}},this)}},extractRelationships:function(e,r){e.eachRelationship(function(e,t){var i=this.keyForRelationship(e,t.kind,"deserialize");if(t.options.polymorphic){br(e,t,r,i)}if(r.hasOwnProperty(i)&&typeof r[i]!=="object"){var n=this.keyForRelationship(e)+"_type";if(r[n]&&t.options.polymorphic){var a=r[i];var o=r[n];delete r[n];delete r[i];r[i]={id:a,type:o}}}},this);return this._super.apply(this,arguments)},modelNameFromPayloadKey:function(e){var r=fr(e.replace("::","/"));return ee(r)}});function br(e,r,t,i){var n=mr(e);if(n in t&&typeof t[n]==="object"){if(r.kind==="belongsTo"){var a=t[n];var o=a.id;var s=a.type;t[i]={id:o,type:s}}else{var l=t[n];if(!l){return}var u=[];for(var d=0,c=l.length;d<c;d++){var a=l[d];var o=a.id;var s=a.type;u.push({id:o,type:s})}t[i]=u}}}var Rr=gr;function Er(e){this.container=e}Er.prototype.aliasedFactory=function(e,r){var t=this;return{create:function(){if(r){r()}return t.container.lookup(e)}}};Er.prototype.registerAlias=function(e,r,t){var i=this.aliasedFactory(r,t);return this.container.register(e,i)};Er.prototype.registerDeprecation=function(e,r){var t=function(){};return this.registerAlias(e,r,t)};Er.prototype.registerDeprecations=function(e){var r,t,i,n;for(r=e.length;r>0;r--){t=e[r-1];i=t["deprecated"];n=t["valid"];this.registerDeprecation(i,n)}};var _r=Er;var Fr=Ar;function Ar(e,r){var t=new _r(e);t.registerDeprecations([{deprecated:"serializer:_ams",valid:"serializer:-active-model"},{deprecated:"adapter:_ams",valid:"adapter:-active-model"}]);e.register("serializer:-active-model",Rr.extend({isNewSerializerAPI:true}));e.register("adapter:-active-model",J)}var zr=Ember.get;var Mr=Ember.String.fmt;var Sr=r.indexOf;var kr=0;var Tr=m.extend({serializer:null,coalesceFindRequests:false,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(Mr("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(t.modelName).serialize(t,{includeId:true})},generateIdForRecord:function(e){return"fixture-"+kr++},find:function(e,r,t,i){var n=this.fixturesForType(r);var a;if(n){a=Ember.A(n).findBy("id",t)}if(a){return this.simulateRemoteCall(function(){return a},this)}},findMany:function(e,r,t,i){var n=this.fixturesForType(r);if(n){n=n.filter(function(e){return Sr.call(t,e.id)!==-1})}if(n){return this.simulateRemoteCall(function(){return n},this)}},findAll:function(e,r){var t=this.fixturesForType(r);return this.simulateRemoteCall(function(){return t},this)},findQuery:function(e,r,t,i){var n=this.fixturesForType(r);n=this.queryFixtures(n,t,r);if(n){return this.simulateRemoteCall(function(){return n},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=Sr.call(e.FIXTURES,t);e.FIXTURES.splice(i,1);return true}},findExistingFixture:function(e,r){var t=this.fixturesForType(e);var i=r.id;return this.findFixtureById(t,i)},findFixtureById:function(e,r){return Ember.A(e).find(function(e){if(""+zr(e,"id")===""+r){return true}else{return false}})},simulateRemoteCall:function(e,r){var t=this;return new Ember.RSVP.Promise(function(i){var n=Ember.copy(e.call(r),true);if(zr(t,"simulateRemoteResponse")){Ember.run.later(function(){i(n)},zr(t,"latency"))}else{Ember.run.schedule("actions",null,function(){i(n)})}},"DS: FixtureAdapter#simulateRemoteCall")}});var Pr=P.extend({defaultSerializer:"-json-api",ajaxOptions:function(e,r,t){var i=this._super.apply(this,arguments);if(i.contentType){i.contentType="application/vnd.api+json"}var n=i.beforeSend;i.beforeSend=function(e){e.setRequestHeader("Accept","application/vnd.api+json");if(n){n(e)}};return i},findMany:function(e,r,t,i){var n=this.buildURL(r.modelName,t,i,"findMany");return this.ajax(n,"GET",{data:{filter:{id:t.join(",")}}})},pathForType:function(e){var r=Ember.String.dasherize(e);return Ember.String.pluralize(r)},updateRecord:function(e,r,t){var i={};var n=e.serializerFor(r.modelName);n.serializeIntoHash(i,r,t,{includeId:true});var a=t.id;var o=this.buildURL(r.modelName,a,t,"updateRecord");return this.ajax(o,"PATCH",{data:i})}});var xr=Ember.Namespace.create({VERSION:"1.13.10"});if(Ember.libraries){Ember.libraries.registerCoreLibrary("Ember Data",xr.VERSION)}var Cr={};Ember.merge(Ember.FEATURES,Cr);var Nr=xr;var wr=Ember.get;function Dr(e){var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(undefined,r)}}function Ir(e,r){var t=e["finally"](function(){if(!r()){t._subscribers.length=0}});return t}function Or(e){return!(wr(e,"isDestroyed")||wr(e,"isDestroying"))}function Lr(e,r,t){var i=r.serializer;if(i===undefined){i=e.serializerFor(t)}if(i===null||i===undefined){i={extract:function(e,r,t){return t}}}return i}var $r=Ember.RSVP.Promise;var jr=r.map;var Kr=Ember.get;function Hr(e,r,t,i,n,a){var o=n.createSnapshot(a);var s;if(!e.findRecord){s=e.find(r,t,i,o)}else{s=e.findRecord(r,t,i,o)}var l=Lr(r,e,n.type.modelName);var u="DS: Handle Adapter#find of "+t+" with id: "+i;s=$r.cast(s,u);s=Ir(s,Dr(Or,r));return s.then(function(e){return r._adapterRun(function(){var n=Kr(l,"isNewSerializerAPI")?"findRecord":"find";var a=Ge(l,r,t,e,i,n);var o=Ze(r,a);return o._internalModel})},function(e){n.notFound();if(n.isEmpty()){n.unloadRecord()}throw e},"DS: Extract payload of '"+t+"'")}function Br(e,r,t,i,n){var a=Ember.A(n).invoke("createSnapshot");var o=e.findMany(r,t,i,a);var s=Lr(r,e,t.modelName);var l="DS: Handle Adapter#findMany of "+t;if(o===undefined){throw new Error("adapter.findMany returned undefined, this was very likely a mistake")}o=$r.cast(o,l);o=Ir(o,Dr(Or,r));return o.then(function(e){return r._adapterRun(function(){var i=Ge(s,r,t,e,null,"findMany");var n=Ze(r,i);return jr.call(n,function(e){return e._internalModel})})},null,"DS: Extract payload of "+t)}function Ur(e,r,t,i,n){var a=t.createSnapshot();var o=r.modelFor(n.type);var s=e.findHasMany(r,a,i,n);var l=Lr(r,e,n.type);var u="DS: Handle Adapter#findHasMany of "+t+" : "+n.type;s=$r.cast(s,u);s=Ir(s,Dr(Or,r));s=Ir(s,Dr(Or,t));return s.then(function(e){return r._adapterRun(function(){var t=Ge(l,r,o,e,null,"findHasMany");var i=Ze(r,t);var n=jr.call(i,function(e){return e._internalModel});if(Kr(l,"isNewSerializerAPI")){n.meta=t.meta}return n})},null,"DS: Extract payload of "+t+" : hasMany "+n.type)}function Vr(e,r,t,i,n){var a=t.createSnapshot();var o=r.modelFor(n.type);var s=e.findBelongsTo(r,a,i,n);var l=Lr(r,e,n.type);var u="DS: Handle Adapter#findBelongsTo of "+t+" : "+n.type;s=$r.cast(s,u);s=Ir(s,Dr(Or,r));s=Ir(s,Dr(Or,t));return s.then(function(e){return r._adapterRun(function(){var t=Ge(l,r,o,e,null,"findBelongsTo");if(!t.data){return null}var i=Ze(r,t);return i._internalModel})},null,"DS: Extract payload of "+t+" : "+n.type)}function qr(e,r,t,i,n){var a=t.modelName;var o=r.peekAll(a);var s=o.createSnapshot(n);var l=e.findAll(r,t,i,s);var u=Lr(r,e,a);var d="DS: Handle Adapter#findAll of "+t;l=$r.cast(l,d);l=Ir(l,Dr(Or,r));return l.then(function(e){r._adapterRun(function(){var i=Ge(u,r,t,e,null,"findAll");Ze(r,i)});r.didUpdateAll(t);return r.peekAll(a)},null,"DS: Extract payload of findAll "+t)}function Wr(e,r,t,i,n){var a=t.modelName;var o;if(!e.query){o=e.findQuery(r,t,i,n)}else{o=e.query(r,t,i,n)}var s=Lr(r,e,a);var l="DS: Handle Adapter#findQuery of "+t;o=$r.cast(o,l);o=Ir(o,Dr(Or,r));return o.then(function(e){var i;r._adapterRun(function(){var n=Kr(s,"isNewSerializerAPI")?"query":"findQuery";var a=Ge(s,r,t,e,null,n);i=Ze(r,a)});n.loadRecords(i);return n},null,"DS: Extract payload of findQuery "+t)}function Qr(e,r,t,i){var n=t.modelName;var a=e.queryRecord(r,t,i);var o=Lr(r,e,n);var s="DS: Handle Adapter#queryRecord of "+t;a=$r.cast(a,s);a=Ir(a,Dr(Or,r));return a.then(function(e){var i;r._adapterRun(function(){var n=Ge(o,r,t,e,null,"queryRecord");i=Ze(r,n)});return i},null,"DS: Extract payload of queryRecord "+t)}function Jr(e,r,t){this._snapshots=null;this._recordArray=e;this.length=e.get("length");this.type=e.get("type");this.meta=r;this.adapterOptions=t}Jr.prototype.snapshots=function(){if(this._snapshots){return this._snapshots}var e=this._recordArray;this._snapshots=e.invoke("createSnapshot");return this._snapshots};var Gr=Jr;var Xr=Ember.get;var Yr=Ember.set;var Zr=Ember.ArrayProxy.extend(Ember.Evented,{type:null,content:null,isLoaded:false,isUpdating:false,store:null,objectAtContent:function(e){var r=Xr(this,"content");var t=r.objectAt(e);return t&&t.getRecord()},update:function(){if(Xr(this,"isUpdating")){return}var e=Xr(this,"store");var r=Xr(this,"type.modelName");return e.findAll(r,{reload:true})},addInternalModel:function(e,r){var t=Xr(this,"content");if(r===undefined){t.addObject(e)}else if(!t.contains(e)){t.insertAt(r,e)}},removeInternalModel:function(e){Xr(this,"content").removeObject(e)},save:function(){var e=this;var r="DS: RecordArray#save "+Xr(this,"type");var t=Ember.RSVP.all(this.invoke("save"),r).then(function(r){return e},null,"DS: RecordArray#save return RecordArray");return he.create({promise:t})},_dissociateFromOwnRecords:function(){var e=this;this.get("content").forEach(function(r){var t=r._recordArrays;if(t){t["delete"](e)}})},_unregisterFromManager:function(){var e=Xr(this,"manager");e.unregisterRecordArray(this)},willDestroy:function(){this._unregisterFromManager();this._dissociateFromOwnRecords();Yr(this,"content",undefined);this._super.apply(this,arguments)},createSnapshot:function(e){var r=e&&e.adapterOptions;var t=this.get("meta");return new Gr(this,t,r)}});var et=Ember.get;var rt=Zr.extend({filterFunction:null,isLoaded:true,replace:function(){var e=et(this,"type").toString();throw new Error("The result of a client-side filter (on "+e+") is immutable.")},_updateFilter:function(){var e=et(this,"manager");e.updateFilter(this,et(this,"type"),et(this,"filterFunction"))},updateFilter:Ember.observer("filterFunction",function(){Ember.run.once(this,this._updateFilter)})});var tt=it;function it(e){var r=i(null);for(var t in e){r[t]=e[t]}return r}var nt=Ember.get;var at=Zr.extend({query:null,replace:function(){var e=nt(this,"type").toString();throw new Error("The result of a server query (on "+e+") is immutable.")},load:function(e){var r=nt(this,"store");var t=nt(this,"type");var i=t.modelName;var n=r.pushMany(i,e);this.loadRecords(n)},loadRecords:function(e){var r=nt(this,"store");var t=nt(this,"type");var i=t.modelName;var n=r._metadataFor(i);var a=Ember.A(e).mapBy("_internalModel");this.setProperties({content:Ember.A(a),isLoaded:true,meta:tt(n)});a.forEach(function(e){this.manager.recordArraysForRecord(e).add(this)},this);Ember.run.once(this,"trigger","didLoad")}});var ot=Ember.OrderedSet;var st=Ember.guidFor;var lt=function(){this._super$constructor()};lt.create=function(){var e=this;return new e};lt.prototype=i(ot.prototype);lt.prototype.constructor=lt;lt.prototype._super$constructor=ot;lt.prototype.addWithIndex=function(e,r){var t=st(e);var i=this.presenceSet;var n=this.list;if(i[t]===true){return}i[t]=true;if(r===undefined||r==null){n.push(e)}else{n.splice(r,0,e)}this.size+=1;return this};var ut=lt;var dt=Ember.get;var ct=r.forEach;var ht=r.indexOf;var ft=Ember.Object.extend({init:function(){var e=this;this.filteredRecordArrays=y.create({defaultValue:function(){return[]}});this.liveRecordArrays=y.create({defaultValue:function(r){return e.createRecordArray(r)}});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||ut.create();return e._recordArrays},updateRecordArrays:function(){ct.call(this.changedRecords,function(e){if(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.removeInternalModel(e)});e._recordArrays=null},_recordWasChanged:function(e){var r=e.type;var t=this.filteredRecordArrays.get(r);var i;ct.call(t,function(t){i=dt(t,"filterFunction");this.updateFilterRecordArray(t,i,r,e)},this)},recordWasLoaded:function(e){var r=e.type;var t=this.filteredRecordArrays.get(r);var i;ct.call(t,function(t){i=dt(t,"filterFunction");this.updateFilterRecordArray(t,i,r,e)},this);if(this.liveRecordArrays.has(r)){var n=this.liveRecordArrays.get(r);this._addRecordToRecordArray(n,e)}},updateFilterRecordArray:function(e,r,t,i){var n=r(i.getRecord());var a=this.recordArraysForRecord(i);if(n){this._addRecordToRecordArray(e,i)}else{a["delete"](e);e.removeInternalModel(i)}},_addRecordToRecordArray:function(e,r){var t=this.recordArraysForRecord(r);if(!t.has(e)){e.addInternalModel(r);t.add(e)}},populateLiveRecordArray:function(e,r){var t=this.store.typeMapFor(r);var i=t.records;var n;for(var a=0,o=i.length;a<o;a++){n=i[a];if(!n.isDeleted()&&!n.isEmpty()){this._addRecordToRecordArray(e,n)}}},updateFilter:function(e,r,t){var i=this.store.typeMapFor(r);var n=i.records;var a;for(var o=0,s=n.length;o<s;o++){a=n[o];if(!a.isDeleted()&&!a.isEmpty()){this.updateFilterRecordArray(e,t,r,a)}}},liveRecordArrayFor:function(e){return this.liveRecordArrays.get(e)},createRecordArray:function(e){var r=Zr.create({type:e,content:Ember.A(),store:this.store,isLoaded:true,manager:this});return r},createFilteredRecordArray:function(e,r,t){var i=rt.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=at.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)},unregisterRecordArray:function(e){var r=e.type;var t=this.filteredRecordArrays.get(r);var i=ht.call(t,e);if(i!==-1){t.splice(i,1)}else if(this.liveRecordArrays.has(r)){var n=this.liveRecordArrayFor(r);if(e===n){this.liveRecordArrays["delete"](r)}}},willDestroy:function(){this._super.apply(this,arguments);this.filteredRecordArrays.forEach(function(e){ct.call(mt(e),pt)});this.liveRecordArrays.forEach(pt);ct.call(this._adapterPopulatedRecordArrays,pt)}});function pt(e){e.destroy()}function mt(e){var r=e.length;var t=Ember.A();for(var i=0;i<r;i++){t=t.concat(e[i])}return t}function vt(e){this._container=e;this._cache=i(null)}vt.prototype=i(null);e.merge(vt.prototype,{get:function(e,r,t){var i=this._cache;var n=e+":"+r;if(!(n in i)){var a=this.instanceFor(n)||this._findInstance(e,t);if(a){i[n]=a}}return i[n]},_findInstance:function(e,r){for(var t=0,i=r.length;t<i;t++){var n=r[t];var a=e+":"+n;var o=this.instanceFor(a);if(o){return o}}},instanceFor:function(r){if(r==="adapter:-rest"){e.deprecate("You are currently using the default DS.RESTAdapter adapter. For Ember 2.0 the default adapter will be DS.JSONAPIAdapter. If you would like to continue using DS.RESTAdapter please create an application adapter that extends DS.RESTAdapter.",false,{id:"ds.adapter.default-adapter-changing-to-json-api",until:"2.0.0"})}var t=this._cache;if(!t[r]){var i=this._container.lookup(r);if(i){t[r]=i}}return t[r]},destroy:function(){var e=this._cache;var r=t(e);for(var i=0,n=r.length;i<n;i++){var a=r[i];var o=e[a];if(o){o.destroy()}}this._container=null},constructor:vt,toString:function(){return"ContainerInstanceCache"}});var yt=vt;function gt(e,r){if(!r||typeof r!=="object"){return e}var i=t(r);var n;var a=i.length;for(var o=0;o<a;o++){n=i[o];e[n]=r[n]}return e}var bt=gt;var Rt=Ember.get;function Et(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 _t={initialState:"uncommitted",isDirty:true,uncommitted:{didSetProperty:Et,loadingData:Ember.K,propertyWasReset:function(e,r){var i=t(e._attributes).length;var n=i>0;if(!n){e.send("rolledBack")}},pushedData:Ember.K,becomeDirty:Ember.K,willCommit:function(e){e.transitionTo("inFlight")},reloadRecord:function(e,r){r(e.store.reloadRecord(e))},rolledBack:function(e){e.transitionTo("loaded.saved")},becameInvalid:function(e){e.transitionTo("invalid")},rollback:function(e){e.rollbackAttributes();e.triggerLater("ready")}},inFlight:{isSaving:true,didSetProperty:Et,becomeDirty:Ember.K,pushedData:Ember.K,unloadRecord:kt,willCommit:Ember.K,didCommit:function(e){var r=Rt(this,"dirtyType");e.transitionTo("saved");e.send("invokeLifecycleCallbacks",r)},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,r){e.removeErrorMessageFromAttribute(r.name);Et(e,r)},becomeDirty:Ember.K,pushedData:Ember.K,willCommit:function(e){e.clearErrorMessages();e.transitionTo("inFlight")},rolledBack:function(e){e.clearErrorMessages();e.transitionTo("loaded.saved");e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")},invokeLifecycleCallbacks:function(e){e.triggerLater("becameInvalid",e)},exit:function(e){e._inFlightAttributes=i(null)}}};function Ft(e){var r={};var t;for(var i in e){t=e[i];if(t&&typeof t==="object"){r[i]=Ft(t)}else{r[i]=t}}return r}function At(e,r){for(var t in r){e[t]=r[t]}return e}function zt(e){var r=Ft(_t);return At(r,e)}var Mt=zt({dirtyType:"created",isNew:true});Mt.invalid.rolledBack=function(e){e.transitionTo("deleted.saved")};Mt.uncommitted.rolledBack=function(e){e.transitionTo("deleted.saved")};var St=zt({dirtyType:"updated"});Mt.uncommitted.deleteRecord=function(e){e.disconnectRelationships();e.transitionTo("deleted.saved");e.send("invokeLifecycleCallbacks")};Mt.uncommitted.rollback=function(e){_t.uncommitted.rollback.apply(this,arguments);e.transitionTo("deleted.saved")};Mt.uncommitted.pushedData=function(e){e.transitionTo("loaded.updated.uncommitted");e.triggerLater("didLoad")};Mt.uncommitted.propertyWasReset=Ember.K;function kt(e){}St.inFlight.unloadRecord=kt;St.uncommitted.deleteRecord=function(e){e.transitionTo("deleted.uncommitted");e.disconnectRelationships()};var Tt={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.triggerLater("ready")},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");e.triggerLater("ready")}},loading:{isLoading:true,exit:function(e){e._loadingPromise=null},pushedData:function(e){e.transitionTo("loaded.saved");e.triggerLater("didLoad");e.triggerLater("ready");e.didCleanError()},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 i=t(r).length>0;if(i){e.adapterDidDirty()}},didSetProperty:Et,pushedData:Ember.K,becomeDirty:function(e){e.transitionTo("updated.uncommitted")},willCommit:function(e){e.transitionTo("updated.inFlight")},reloadRecord:function(e,r){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",Rt(e,"lastDirtyType"))},notFound:Ember.K},created:Mt,updated:St},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.rollbackAttributes();e.triggerLater("ready")},pushedData:Ember.K,becomeDirty:Ember.K,deleteRecord:Ember.K,rolledBack:function(e){e.transitionTo("loaded.saved");e.triggerLater("ready")}},inFlight:{isSaving:true,unloadRecord:kt,willCommit:Ember.K,didCommit:function(e){e.transitionTo("saved");e.send("invokeLifecycleCallbacks")},becameError:function(e){e.transitionTo("uncommitted");e.triggerLater("becameError",e)},becameInvalid:function(e){e.transitionTo("invalid");e.triggerLater("becameInvalid",e)}},saved:{isDirty:false,setup:function(e){var r=e.store;r._dematerializeRecord(e)},invokeLifecycleCallbacks:function(e){e.triggerLater("didDelete",e);e.triggerLater("didCommit",e)},willCommit:Ember.K,didCommit:Ember.K},invalid:{isValid:false,didSetProperty:function(e,r){e.removeErrorMessageFromAttribute(r.name);Et(e,r)},deleteRecord:Ember.K,becomeDirty:Ember.K,willCommit:Ember.K,rolledBack:function(e){e.clearErrorMessages();e.transitionTo("loaded.saved");e.triggerLater("ready")},becameValid:function(e){e.transitionTo("uncommitted")}}},invokeLifecycleCallbacks:function(e,r){if(r==="created"){e.triggerLater("didCreate",e)}else{e.triggerLater("didUpdate",e)}e.triggerLater("didCommit",e)}};function Pt(e,r,t){e=At(r?i(r):{},e);e.parentState=r;e.stateName=t;for(var n in e){if(!e.hasOwnProperty(n)||n==="parentState"||n==="stateName"){continue}if(typeof e[n]==="object"){e[n]=Pt(e[n],e,t+"."+n)}}return e}Tt=Pt(Tt,null,"root");var xt=Tt;var Ct=r.forEach;function Nt(e,r,t,i){this.members=new ut;this.canonicalMembers=new ut;this.store=e;this.key=i.key;this.inverseKey=t;this.record=r;this.isAsync=i.options.async;this.relationshipMeta=i;this.inverseKeyForImplicit=this.record.constructor.modelName+this.key;this.linkPromise=null;this.meta=null;this.hasData=false}Nt.prototype={constructor:Nt,destroy:Ember.K,updateMeta:function(e){this.meta=e},clear:function(){var e=this.members.list;var r;while(e.length>0){r=e[0];this.removeRecord(r)}},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;Ct.call(e,function(e){r.removeRecord(e)})},addRecords:function(e,r){var t=this;Ct.call(e,function(e){t.addRecord(e,r);if(r!==undefined){r++}})},addCanonicalRecords:function(e,r){for(var t=0;t<e.length;t++){if(r!==undefined){this.addCanonicalRecord(e[t],t+r)}else{this.addCanonicalRecord(e[t])}}},addCanonicalRecord:function(e,r){if(!this.canonicalMembers.has(e)){this.canonicalMembers.add(e);if(this.inverseKey){e._relationships.get(this.inverseKey).addCanonicalRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new Nt(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addCanonicalRecord(this.record)}}this.flushCanonicalLater();this.setHasData(true)},removeCanonicalRecords:function(e,r){for(var t=0;t<e.length;t++){if(r!==undefined){this.removeCanonicalRecord(e[t],t+r)}else{this.removeCanonicalRecord(e[t])}}},removeCanonicalRecord:function(e,r){if(this.canonicalMembers.has(e)){this.removeCanonicalRecordFromOwn(e);if(this.inverseKey){this.removeCanonicalRecordFromInverse(e)}else{if(e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit].removeCanonicalRecord(this.record)}}}this.flushCanonicalLater()},addRecord:function(e,r){if(!this.members.has(e)){this.members.addWithIndex(e,r);this.notifyRecordRelationshipAdded(e,r);if(this.inverseKey){e._relationships.get(this.inverseKey).addRecord(this.record)}else{if(!e._implicitRelationships[this.inverseKeyForImplicit]){e._implicitRelationships[this.inverseKeyForImplicit]=new Nt(this.store,e,this.key,{options:{}})}e._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record)}this.record.updateRecordArraysLater()}this.setHasData(true)},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.get(this.inverseKey).addRecord(this.record)}},removeRecordFromInverse:function(e){var r=e._relationships.get(this.inverseKey);if(r){r.removeRecordFromOwn(this.record)}},removeRecordFromOwn:function(e){this.members["delete"](e);this.notifyRecordRelationshipRemoved(e);this.record.updateRecordArrays()},removeCanonicalRecordFromInverse:function(e){var r=e._relationships.get(this.inverseKey);if(r){r.removeCanonicalRecordFromOwn(this.record)}},removeCanonicalRecordFromOwn:function(e){this.canonicalMembers["delete"](e);this.flushCanonicalLater()},flushCanonical:function(){this.willSync=false;var e=[];for(var r=0;r<this.members.list.length;r++){if(this.members.list[r].isNew()){e.push(this.members.list[r])}}this.members=this.canonicalMembers.copy();for(r=0;r<e.length;r++){this.members.add(e[r])}},flushCanonicalLater:function(){if(this.willSync){return}this.willSync=true;var e=this;this.store._backburner.join(function(){e.store._backburner.schedule("syncRelationships",e,e.flushCanonical)})},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;
3
+ return e.then(function(e){return e})}},updateRecordsFromAdapter:function(e){var r=this;r.computeChanges(e);r.setHasData(true)},notifyRecordRelationshipAdded:Ember.K,notifyRecordRelationshipRemoved:Ember.K,setHasData:function(e){this.hasData=e}};var wt=Nt;var Dt=Ember.get;var It=Ember.set;var Ot=r.filter;var Lt=Ember.Object.extend(Ember.MutableArray,Ember.Evented,{init:function(){this.currentState=Ember.A([])},record:null,canonicalState:null,currentState:null,length:0,objectAt:function(e){if(!this.currentState[e]){return undefined}return this.currentState[e].getRecord()},flushCanonical:function(){var e=Ot.call(this.canonicalState,function(e){return!e.isDeleted()});var r=this.currentState.filter(function(e){return e.isNew()});e=e.concat(r);var t=this.length;this.arrayContentWillChange(0,this.length,e.length);this.set("length",e.length);this.currentState=e;this.arrayContentDidChange(0,t,this.length);this.relationship.notifyHasManyChanged();this.record.updateRecordArrays()},isPolymorphic:false,isLoaded:false,relationship:null,meta:null,internalReplace:function(e,r,t){if(!t){t=[]}this.arrayContentWillChange(e,r,t.length);this.currentState.splice.apply(this.currentState,[e,r].concat(t));this.set("length",this.currentState.length);this.arrayContentDidChange(e,r,t.length);if(t){this.relationship.notifyHasManyChanged()}this.record.updateRecordArrays()},internalRemoveRecords:function(e){var r;for(var t=0;t<e.length;t++){r=this.currentState.indexOf(e[t]);this.internalReplace(r,1)}},internalAddRecords:function(e,r){if(r===undefined){r=this.currentState.length}this.internalReplace(r,0,e)},replace:function(e,t,i){var n;if(t>0){n=this.currentState.slice(e,e+t);this.get("relationship").removeRecords(n)}var a=i.map||r.map;if(i){this.get("relationship").addRecords(a.call(i,function(e){return e._internalModel}),e)}},promise:null,loadingRecordsCount:function(e){this.loadingRecordsCount=e},loadedRecord:function(){this.loadingRecordsCount--;if(this.loadingRecordsCount===0){It(this,"isLoaded",true);this.trigger("didLoad")}},reload:function(){return this.relationship.reload()},save:function(){var e=this;var r="DS: ManyArray#save "+Dt(this,"type");var t=Ember.RSVP.all(this.invoke("save"),r).then(function(r){return e},null,"DS: ManyArray#save return ManyArray");return he.create({promise:t})},createRecord:function(e){var r=Dt(this,"store");var t=Dt(this,"type");var i;i=r.createRecord(t.modelName,e);this.pushObject(i);return i},addRecord:function(e){this.addObject(e)},removeRecord:function(e){this.removeObject(e)}});var $t=function(r,t,i){var n=i.type.modelName;var a=r.type.modelName;var o=t.key;var s=r.store.modelFor(t.type);var l="You cannot add a record of type '"+n+"' to the '"+a+"."+o+"' relationship (only '"+s.modelName+"' allowed)";e.assert(l,jt(s,i))};function jt(r,t){if(r.__isMixin){return r.__mixin.detect(t.type.PrototypeMixin)}if(e.MODEL_FACTORY_INJECTIONS){r=r.superclass}return r.detect(t.type)}var Kt=r.map;var Ht=function(e,r,t,i){this._super$constructor(e,r,t,i);this.belongsToType=i.type;this.canonicalState=[];this.manyArray=Lt.create({canonicalState:this.canonicalState,store:this.store,relationship:this,type:this.store.modelFor(this.belongsToType),record:r});this.isPolymorphic=i.options.polymorphic;this.manyArray.isPolymorphic=this.isPolymorphic};Ht.prototype=i(wt.prototype);Ht.prototype.constructor=Ht;Ht.prototype._super$constructor=wt;Ht.prototype.destroy=function(){this.manyArray.destroy()};Ht.prototype._super$updateMeta=wt.prototype.updateMeta;Ht.prototype.updateMeta=function(e){this._super$updateMeta(e);this.manyArray.set("meta",e)};Ht.prototype._super$addCanonicalRecord=wt.prototype.addCanonicalRecord;Ht.prototype.addCanonicalRecord=function(e,r){if(this.canonicalMembers.has(e)){return}if(r!==undefined){this.canonicalState.splice(r,0,e)}else{this.canonicalState.push(e)}this._super$addCanonicalRecord(e,r)};Ht.prototype._super$addRecord=wt.prototype.addRecord;Ht.prototype.addRecord=function(e,r){if(this.members.has(e)){return}this._super$addRecord(e,r);this.manyArray.internalAddRecords([e],r)};Ht.prototype._super$removeCanonicalRecordFromOwn=wt.prototype.removeCanonicalRecordFromOwn;Ht.prototype.removeCanonicalRecordFromOwn=function(e,r){var t=r;if(!this.canonicalMembers.has(e)){return}if(t===undefined){t=this.canonicalState.indexOf(e)}if(t>-1){this.canonicalState.splice(t,1)}this._super$removeCanonicalRecordFromOwn(e,r)};Ht.prototype._super$flushCanonical=wt.prototype.flushCanonical;Ht.prototype.flushCanonical=function(){this.manyArray.flushCanonical();this._super$flushCanonical()};Ht.prototype._super$removeRecordFromOwn=wt.prototype.removeRecordFromOwn;Ht.prototype.removeRecordFromOwn=function(e,r){if(!this.members.has(e)){return}this._super$removeRecordFromOwn(e,r);if(r!==undefined){this.manyArray.currentState.removeAt(r)}else{this.manyArray.internalRemoveRecords([e])}};Ht.prototype.notifyRecordRelationshipAdded=function(e,r){$t(this.record,this.relationshipMeta,e);this.record.notifyHasManyAdded(this.key,e,r)};Ht.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})}};Ht.prototype.computeChanges=function(e){var r=this.canonicalMembers;var t=[];var i;var n;var a;e=Bt(e);r.forEach(function(r){if(e.has(r)){return}t.push(r)});this.removeCanonicalRecords(t);e=e.toArray();i=e.length;for(a=0;a<i;a++){n=e[a];this.removeCanonicalRecord(n);this.addCanonicalRecord(n,a)}};Ht.prototype.fetchLink=function(){var e=this;return this.store.findHasMany(this.record,this.link,this.relationshipMeta).then(function(r){if(r.hasOwnProperty("meta")){e.updateMeta(r.meta)}e.store._backburner.join(function(){e.updateRecordsFromAdapter(r)});return e.manyArray})};Ht.prototype.findRecords=function(){var e=this.manyArray;return this.store.findMany(Kt.call(e.toArray(),function(e){return e._internalModel})).then(function(){e.set("isLoaded",true);return e})};Ht.prototype.notifyHasManyChanged=function(){this.record.notifyHasManyAdded(this.key)};Ht.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 ye.create({content:this.manyArray,promise:r})}else{if(!this.manyArray.get("isDestroyed")){this.manyArray.set("isLoaded",true)}return this.manyArray}};function Bt(e){var r=new ut;if(e){for(var t=0,i=e.length;t<i;t++){r.add(e[t])}}return r}var Ut=Ht;var Vt=function(e,r,t,i){this._super$constructor(e,r,t,i);this.record=r;this.key=i.key;this.inverseRecord=null;this.canonicalState=null};Vt.prototype=i(wt.prototype);Vt.prototype.constructor=Vt;Vt.prototype._super$constructor=wt;Vt.prototype.setRecord=function(e){if(e){this.addRecord(e)}else if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.setHasData(true)};Vt.prototype.setCanonicalRecord=function(e){if(e){this.addCanonicalRecord(e)}else if(this.inverseRecord){this.removeCanonicalRecord(this.inverseRecord)}this.setHasData(true)};Vt.prototype._super$addCanonicalRecord=wt.prototype.addCanonicalRecord;Vt.prototype.addCanonicalRecord=function(e){if(this.canonicalMembers.has(e)){return}if(this.canonicalState){this.removeCanonicalRecord(this.canonicalState)}this.canonicalState=e;this._super$addCanonicalRecord(e)};Vt.prototype._super$flushCanonical=wt.prototype.flushCanonical;Vt.prototype.flushCanonical=function(){if(this.inverseRecord&&this.inverseRecord.isNew()&&!this.canonicalState){return}this.inverseRecord=this.canonicalState;this.record.notifyBelongsToChanged(this.key);this._super$flushCanonical()};Vt.prototype._super$addRecord=wt.prototype.addRecord;Vt.prototype.addRecord=function(e){if(this.members.has(e)){return}$t(this.record,this.relationshipMeta,e);if(this.inverseRecord){this.removeRecord(this.inverseRecord)}this.inverseRecord=e;this._super$addRecord(e);this.record.notifyBelongsToChanged(this.key)};Vt.prototype.setRecordPromise=function(e){var r=e.get&&e.get("content");this.setRecord(r?r._internalModel:r)};Vt.prototype._super$removeRecordFromOwn=wt.prototype.removeRecordFromOwn;Vt.prototype.removeRecordFromOwn=function(e){if(!this.members.has(e)){return}this.inverseRecord=null;this._super$removeRecordFromOwn(e);this.record.notifyBelongsToChanged(this.key)};Vt.prototype._super$removeCanonicalRecordFromOwn=wt.prototype.removeCanonicalRecordFromOwn;Vt.prototype.removeCanonicalRecordFromOwn=function(e){if(!this.canonicalMembers.has(e)){return}this.canonicalState=null;this._super$removeCanonicalRecordFromOwn(e)};Vt.prototype.findRecord=function(){if(this.inverseRecord){return this.store._findByInternalModel(this.inverseRecord)}else{return Ember.RSVP.Promise.resolve(null)}};Vt.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})};Vt.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 fe.create({promise:e,content:this.inverseRecord?this.inverseRecord.getRecord():null})}else{if(this.inverseRecord===null){return null}var t=this.inverseRecord.getRecord();return t}};var qt=Vt;var Wt=Ember.get;var Qt=function(e,r,t){var i;var n=e.type.inverseFor(r.key,t);if(n){i=n.name}if(r.kind==="hasMany"){return new Ut(t,e,i,r)}else{return new qt(t,e,i,r)}};var Jt=function(e){this.record=e;this.initializedRelationships=i(null)};Jt.prototype.has=function(e){return!!this.initializedRelationships[e]};Jt.prototype.get=function(e){var r=this.initializedRelationships;var t=Wt(this.record.type,"relationshipsByName");if(!r[e]&&t.get(e)){r[e]=Qt(this.record,t.get(e),this.record.store)}return r[e]};var Gt=Jt;var Xt=Ember.get;function Yt(e){this._attributes=i(null);this._belongsToRelationships=i(null);this._belongsToIds=i(null);this._hasManyRelationships=i(null);this._hasManyIds=i(null);var r=e.getRecord();this.record=r;r.eachAttribute(function(e){this._attributes[e]=Xt(r,e)},this);this.id=e.id;this._internalModel=e;this.type=e.type;this.modelName=e.type.modelName;this._changedAttributes=r.changedAttributes();if(Ember.platform.hasPropertyAccessors){var t=true;Ember.defineProperty(this,"constructor",{get:function(){if(t){t=false;t=true}return this.type}})}else{this.constructor=this.type}}Yt.prototype={constructor:Yt,id:null,record:null,type:null,modelName:null,attr:function(e){if(e in this._attributes){return this._attributes[e]}throw new Ember.Error("Model '"+Ember.inspect(this.record)+"' has no attribute named '"+e+"' defined.")},attributes:function(){return Ember.copy(this._attributes)},changedAttributes:function(){var e=i(null);var r=t(this._changedAttributes);for(var n=0,a=r.length;n<a;n++){var o=r[n];e[o]=Ember.copy(this._changedAttributes[o])}return e},belongsTo:function(e,r){var t=r&&r.id;var i,n,a;var o;if(t&&e in this._belongsToIds){return this._belongsToIds[e]}if(!t&&e in this._belongsToRelationships){return this._belongsToRelationships[e]}i=this._internalModel._relationships.get(e);if(!(i&&i.relationshipMeta.kind==="belongsTo")){throw new Ember.Error("Model '"+Ember.inspect(this.record)+"' has no belongsTo relationship named '"+e+"' defined.")}a=Xt(i,"hasData");n=Xt(i,"inverseRecord");if(a){if(n&&!n.isDeleted()){if(t){o=Xt(n,"id")}else{o=n.createSnapshot()}}else{o=null}}if(t){this._belongsToIds[e]=o}else{this._belongsToRelationships[e]=o}return o},hasMany:function(e,r){var t=r&&r.ids;var i,n,a;var o;if(t&&e in this._hasManyIds){return this._hasManyIds[e]}if(!t&&e in this._hasManyRelationships){return this._hasManyRelationships[e]}i=this._internalModel._relationships.get(e);if(!(i&&i.relationshipMeta.kind==="hasMany")){throw new Ember.Error("Model '"+Ember.inspect(this.record)+"' has no hasMany relationship named '"+e+"' defined.")}a=Xt(i,"hasData");n=Xt(i,"members");if(a){o=[];n.forEach(function(e){if(!e.isDeleted()){if(t){o.push(e.id)}else{o.push(e.createSnapshot())}}})}if(t){this._hasManyIds[e]=o}else{this._hasManyRelationships[e]=o}return o},eachAttribute:function(e,r){this.record.eachAttribute(e,r)},eachRelationship:function(e,r){this.record.eachRelationship(e,r)},get:function(e){if(e==="id"){return this.id}if(e in this._attributes){return this.attr(e)}var r=this._internalModel._relationships.get(e);if(r&&r.relationshipMeta.kind==="belongsTo"){return this.belongsTo(e)}if(r&&r.relationshipMeta.kind==="hasMany"){return this.hasMany(e)}return Xt(this.record,e)},serialize:function(e){return this.record.store.serializerFor(this.modelName).serialize(this,e)},unknownProperty:function(e){return this.get(e)},_createSnapshot:function(){return this}};Ember.defineProperty(Yt.prototype,"typeKey",{enumerable:false,get:function(){return this.modelName},set:function(){}});var Zt=Yt;var ei=Ember.RSVP.Promise;var ri=Ember.get;var ti=Ember.set;var ii=r.forEach;var ni=r.map;var ai=i(null);var oi=i(null);function si(e){return oi[e]||(oi[e]=e.split("."))}function li(e){return ai[e]||(ai[e]=si(e)[0])}function ui(e){return function(){return ri(this.currentState,e)}}var di=function ea(e,r,t,n,a){this.type=e;this.id=r;this.store=t;this.container=n;this._data=a||i(null);this.modelName=e.modelName;this.dataHasInitialized=false;this._deferredTriggers=[];this._attributes=i(null);this._inFlightAttributes=i(null);this._relationships=new Gt(this);this.currentState=xt.empty;this.isReloading=false;this.isError=false;this.error=null;this._implicitRelationships=i(null)};di.prototype={isEmpty:ui("isEmpty"),isLoading:ui("isLoading"),isLoaded:ui("isLoaded"),hasDirtyAttributes:ui("hasDirtyAttributes"),isSaving:ui("isSaving"),isDeleted:ui("isDeleted"),isNew:ui("isNew"),isValid:ui("isValid"),dirtyType:ui("dirtyType"),constructor:di,materializeRecord:function(){this.record=this.type._create({id:this.id,store:this.store,container:this.container,_internalModel:this,currentState:ri(this,"currentState"),isError:this.isError,adapterError:this.error});this._triggerDeferredTriggers()},recordObjectWillDestroy:function(){this.record=null},deleteRecord:function(){this.send("deleteRecord")},save:function(e){var r="DS: Model#save "+this;var t=Ember.RSVP.defer(r);this.store.scheduleSave(this,t,e);return t.promise},startedReloading:function(){this.isReloading=true;if(this.record){ti(this.record,"isReloading",true)}},finishedReloading:function(){this.isReloading=false;if(this.record){ti(this.record,"isReloading",false)}},reload:function(){this.startedReloading();var e=this;var r="DS: Model#reload of "+this;return new ei(function(r){e.send("reloadRecord",r)},r).then(function(){e.didCleanError();return e},function(r){e.didError(r);throw r},"DS: Model#reload complete, update flags")["finally"](function(){e.finishedReloading();e.updateRecordArrays()})},getRecord:function(){if(!this.record){this.materializeRecord()}return this.record},unloadRecord:function(){this.send("unloadRecord")},eachRelationship:function(e,r){return this.type.eachRelationship(e,r)},eachAttribute:function(e,r){return this.type.eachAttribute(e,r)},inverseFor:function(e){return this.type.inverseFor(e)},setupData:function(e){var r=this._changedKeys(e.attributes);bt(this._data,e.attributes);this.pushedData();if(this.record){this.record._notifyProperties(r)}this.didInitalizeData()},becameReady:function(){Ember.run.schedule("actions",this.store.recordArrayManager,this.store.recordArrayManager.recordWasLoaded,this)},didInitalizeData:function(){if(!this.dataHasInitialized){this.becameReady();this.dataHasInitialized=true}},destroy:function(){if(this.record){return this.record.destroy()}},createSnapshot:function(e){var r=e&&e.adapterOptions;var t=new Zt(this);t.adapterOptions=r;return t},loadingData:function(e){this.send("loadingData",e)},loadedData:function(){this.send("loadedData");this.didInitalizeData()},notFound:function(){this.send("notFound")},pushedData:function(){this.send("pushedData")},flushChangedAttributes:function(){this._inFlightAttributes=this._attributes;this._attributes=i(null)},adapterWillCommit:function(){this.send("willCommit")},adapterDidDirty:function(){this.send("becomeDirty");this.updateRecordArraysLater()},send:function(e,r){var t=ri(this,"currentState");if(!t[e]){this._unhandledEvent(t,e,r)}return t[e](this,r)},notifyHasManyAdded:function(e,r,t){if(this.record){this.record.notifyHasManyAdded(e,r,t)}},notifyHasManyRemoved:function(e,r,t){if(this.record){this.record.notifyHasManyRemoved(e,r,t)}},notifyBelongsToChanged:function(e,r){if(this.record){this.record.notifyBelongsToChanged(e,r)}},notifyPropertyChange:function(e){if(this.record){this.record.notifyPropertyChange(e)}},rollbackAttributes:function(){var e=t(this._attributes);this._attributes=i(null);if(ri(this,"isError")){this._inFlightAttributes=i(null);this.didCleanError()}if(this.isDeleted()){this.becameReady();this.reconnectRelationships()}if(this.isNew()){this.clearRelationships()}if(this.isValid()){this._inFlightAttributes=i(null)}this.send("rolledBack");this.record._notifyProperties(e)},transitionTo:function(e){var r=li(e);var t=ri(this,"currentState");var i=t;do{if(i.exit){i.exit(this)}i=i.parentState}while(!i.hasOwnProperty(r));var n=si(e);var a=[];var o=[];var s,l;for(s=0,l=n.length;s<l;s++){i=i[n[s]];if(i.enter){o.push(i)}if(i.setup){a.push(i)}}for(s=0,l=o.length;s<l;s++){o[s].enter(this)}ti(this,"currentState",i);if(this.record){ti(this.record,"currentState",i)}for(s=0,l=a.length;s<l;s++){a[s].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)},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.scheduleOnce("actions",this,"_triggerDeferredTriggers")},_triggerDeferredTriggers:function(){if(!this.record){return}for(var e=0,r=this._deferredTriggers.length;e<r;e++){this.record.trigger.apply(this.record,this._deferredTriggers[e])}this._deferredTriggers.length=0},clearRelationships:function(){this.eachRelationship(function(e,r){if(this._relationships.has(e)){var t=this._relationships.get(e);t.clear();t.destroy()}},this);var e=this;ii.call(t(this._implicitRelationships),function(r){e._implicitRelationships[r].clear();e._implicitRelationships[r].destroy()})},disconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships.get(e).disconnect()},this);var e=this;ii.call(t(this._implicitRelationships),function(r){e._implicitRelationships[r].disconnect()})},reconnectRelationships:function(){this.eachRelationship(function(e,r){this._relationships.get(e).reconnect()},this);var e=this;ii.call(t(this._implicitRelationships),function(r){e._implicitRelationships[r].reconnect()})},_preloadData:function(e){var r=this;ii.call(t(e),function(t){var i=ri(e,t);var n=r.type.metaForProperty(t);if(n.isRelationship){r._preloadRelationship(t,i)}else{r._data[t]=i}})},_preloadRelationship:function(e,r){var t=this.type.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 n=ni.call(r,function(e){return i._convertStringOrNumberIntoInternalModel(e,t)});this._relationships.get(e).updateRecordsFromAdapter(n)},_preloadBelongsTo:function(e,r,t){var i=this._convertStringOrNumberIntoInternalModel(r,t);this._relationships.get(e).setRecord(i)},_convertStringOrNumberIntoInternalModel:function(e,r){if(typeof e==="string"||typeof e==="number"){return this.store._internalModelForId(r,e)}if(e._internalModel){return e._internalModel}return e},updateRecordArrays:function(){this._updatingRecordArraysLater=false;this.store.dataWasUpdated(this.type,this)},setId:function(e){this.id=e;ti(this.record,"id",e)},didError:function(e){this.error=e;this.isError=true;if(this.record){this.record.setProperties({isError:true,adapterError:e})}},didCleanError:function(){this.error=null;this.isError=false;if(this.record){this.record.setProperties({isError:false,adapterError:null})}},adapterDidCommit:function(e){if(e){e=e.attributes}this.didCleanError();var r=this._changedKeys(e);bt(this._data,this._inFlightAttributes);if(e){bt(this._data,e)}this._inFlightAttributes=i(null);this.send("didCommit");this.updateRecordArraysLater();if(!e){return}this.record._notifyProperties(r)},updateRecordArraysLater:function(){if(this._updatingRecordArraysLater){return}this._updatingRecordArraysLater=true;Ember.run.schedule("actions",this,this.updateRecordArrays)},addErrorMessageToAttribute:function(e,r){var t=this.getRecord();ri(t,"errors").add(e,r)},removeErrorMessageFromAttribute:function(e){var r=this.getRecord();ri(r,"errors").remove(e)},clearErrorMessages:function(){var e=this.getRecord();ri(e,"errors").clear()},adapterDidInvalidate:function(e){var r;for(r in e){if(e.hasOwnProperty(r)){this.addErrorMessageToAttribute(r,e[r])}}this._saveWasRejected()},adapterDidError:function(e){this.send("becameError");this.didError(e);this._saveWasRejected()},_saveWasRejected:function(){var e=t(this._inFlightAttributes);for(var r=0;r<e.length;r++){if(this._attributes[e[r]]===undefined){this._attributes[e[r]]=this._inFlightAttributes[e[r]]}}this._inFlightAttributes=i(null)},_changedKeys:function(e){var r=[];if(e){var n,a,o,s;var l=t(e);var u=l.length;n=bt(i(null),this._data);n=bt(n,this._inFlightAttributes);for(a=0;a<u;a++){s=l[a];o=e[s];if(this._attributes[s]!==undefined){continue}if(!Ember.isEqual(n[s],o)){r.push(s)}}}return r},toString:function(){if(this.record){return this.record.toString()}else{return"<"+this.modelName+":"+this.id+">"}}};var ci=di;var hi=Ember._Backburner||Ember.Backburner||Ember.__loader.require("backburner")["default"]||Ember.__loader.require("backburner")["Backburner"];if(!hi.prototype.join){var fi=function(e){return typeof e==="string"};hi.prototype.join=function(){var e,r;if(this.currentInstance){var t=arguments.length;if(t===1){e=arguments[0];r=null}else{r=arguments[0];e=arguments[1]}if(fi(e)){e=r[e]}if(t===1){return e()}else if(t===2){return e.call(r)}else{var i=new Array(t-2);for(var n=0,a=t-2;n<a;n++){i[n]=arguments[n+2]}return e.apply(r,i)}}else{return this.run.apply(this,arguments)}}}function pi(e,r){var t=e.then(function(e){return e.getRecord()});return pe(t,r)}var mi=Ember.get;var vi=Ember.set;var yi=Ember.run.once;var gi=Ember.isNone;var bi=r.forEach;var Ri=r.indexOf;var Ei=r.map;var _i=r.filter;var Fi=Ember.RSVP.Promise;var Ai=Ember.copy;var zi;var Mi=Ember.Service;if(!Mi){Mi=Ember.Object}zi=Mi.extend({init:function(){this._backburner=new hi(["normalizeRelationships","syncRelationships","finished"]);this.typeMaps={};this.recordArrayManager=ft.create({store:this});this._pendingSave=[];this._instanceCache=new yt(this.container);this._pendingFetch=v.create()},adapter:"-rest",serialize:function(e,r){var t=e._internalModel.createSnapshot();return t.serialize(r)},defaultAdapter:Ember.computed("adapter",function(){var e=mi(this,"adapter");e=this.retrieveManagedInstance("adapter",e);return e}),createRecord:function(e,r){var t=this.modelFor(e);var n=Ai(r)||i(null);if(gi(n.id)){n.id=this._generateId(e,n)}n.id=Y(n.id);var a=this.buildInternalModel(t,n.id);var o=a.getRecord();a.loadedData();o.setProperties(n);a.eachRelationship(function(e,r){a._relationships.get(e).setHasData(true)});return o},_generateId:function(e,r){var t=this.adapterFor(e);if(t&&t.generateIdForRecord){return t.generateIdForRecord(this,e,r)}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.query(e,r)}var i=Ni(t,this.modelFor(e),"find");return this.findRecord(e,Y(r),i)},fetchById:function(e,r,t){var i=Ni(t,this.modelFor(e),"fetchById");if(this.hasRecordForId(e,r)){return this.peekRecord(e,r).reload()}else{return this.findRecord(e,r,i)}},fetchAll:function(e){return this.findAll(e,{reload:true})},fetch:function(e,r,t){return this.findRecord(e,r,{reload:true,preload:t})},findById:function(e,r,t){var i=Ni(t,this.modelFor(e),"findById");return this.findRecord(e,r,i)},findRecord:function(e,r,t){var i=this._internalModelForId(e,r);t=t||{};if(!this.hasRecordForId(e,r)){return this._findByInternalModel(i,t)}var n=this._findRecord(i,t);return pi(n,"DS: Store#findRecord "+i.typeKey+" with id: "+mi(i,"id"))},_findRecord:function(e,r){if(r.reload){return this.scheduleFetch(e,r)}var t=e.createSnapshot();t.adapterOptions=r&&r.adapterOptions;var i=e.type;var n=this.adapterFor(i.modelName);if(n.shouldReloadRecord(this,t)){return this.scheduleFetch(e,r)}if(n.shouldBackgroundReloadRecord(this,t)){this.scheduleFetch(e,r)}return Fi.resolve(e)},_findByInternalModel:function(e,r){r=r||{};if(r.preload){e._preloadData(r.preload)}var t=this._findEmptyInternalModel(e,r);return pi(t,"DS: Store#findRecord "+e.typeKey+" with id: "+mi(e,"id"))},_findEmptyInternalModel:function(e,r){if(e.isEmpty()){return this.scheduleFetch(e,r)}if(e.isLoading()){return e._loadingPromise}return Fi.resolve(e)},findByIds:function(e,r){var t=this;return me(Ember.RSVP.all(Ei.call(r,function(r){return t.findRecord(e,r)})).then(Ember.A,null,"DS: Store#findByIds of "+e+" complete"))},fetchRecord:function(e,r){var t=e.type;var i=e.id;var n=this.adapterFor(t.modelName);var a=Hr(n,this,t,i,e,r);return a},scheduleFetchMany:function(e){var r=Ei.call(e,function(e){return e._internalModel});return Fi.all(Ei.call(r,this.scheduleFetch,this))},scheduleFetch:function(e,r){var t=e.type;if(e._loadingPromise){return e._loadingPromise}var i=Ember.RSVP.defer("Fetching "+t+"with id: "+e.id);var n={record:e,resolver:i,options:r};var a=i.promise;e.loadingData(a);if(!this._pendingFetch.get(t)){this._pendingFetch.set(t,[n])}else{this._pendingFetch.get(t).push(n)}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=v.create()},_flushPendingFetchForType:function(e,r){var t=this;var i=t.adapterFor(r.modelName);var n=!!i.findMany&&i.coalesceFindRequests;var a=Ember.A(e).mapBy("record");function o(e){e.resolver.resolve(t.fetchRecord(e.record,e.options))}function s(r){bi.call(r,function(r){var t=Ember.A(e).findBy("record",r);if(t){var i=t.resolver;i.resolve(r)}});return r}function l(e){return function r(t){t=Ember.A(t);var i=e.reject(function(e){return t.contains(e)});if(i.length){}d(i)}}function u(e){return function(r){d(e,r)}}function d(r,t){bi.call(r,function(r){var i=Ember.A(e).findBy("record",r);if(i){var n=i.resolver;n.reject(t)}})}if(e.length===1){o(e[0])}else if(n){var c=Ember.A(a).invoke("createSnapshot");var h=i.groupRecordsForFindMany(this,c);bi.call(h,function(n){var a=Ember.A(n).mapBy("_internalModel");var d=Ember.A(a);var c=d.mapBy("id");if(c.length>1){Br(i,t,r,c,d).then(s).then(l(d)).then(null,u(d))}else if(c.length===1){var h=Ember.A(e).findBy("record",a[0]);o(h)}else{}})}else{bi.call(e,o)}},getById:function(e,r){return this.peekRecord(e,r)},peekRecord:function(e,r){if(this.hasRecordForId(e,r)){return this._internalModelForId(e,r).getRecord()}else{return null}},reloadRecord:function(e){var r=e.type.modelName;var t=this.adapterFor(r);var i=e.id;return this.scheduleFetch(e)},hasRecordForId:function(e,r){var t=this.modelFor(e);var i=Y(r);var n=this.typeMapFor(t).idToRecord[i];return!!n&&n.isLoaded()},recordForId:function(e,r){return this._internalModelForId(e,r).getRecord()},_internalModelForId:function(e,r){var t=this.modelFor(e);var i=Y(r);var n=this.typeMapFor(t).idToRecord;var a=n[i];if(!a||!n[i]){a=this.buildInternalModel(t,i)}return a},findMany:function(e){var r=this;return Fi.all(Ei.call(e,function(e){return r._findByInternalModel(e)}))},findHasMany:function(e,r,t){var i=this.adapterFor(e.type.modelName);return Ur(i,this,e,r,t)},findBelongsTo:function(e,r,t){var i=this.adapterFor(e.type.modelName);return Vr(i,this,e,r,t)},query:function(e,r){var t=this.modelFor(e);var i=this.recordArrayManager.createAdapterPopulatedRecordArray(t,r);var n=this.adapterFor(e);return me(Wr(n,this,t,r,i))},queryRecord:function(e,r){var t=this.modelFor(e);var i=this.adapterFor(e);return pe(Qr(i,this,t,r))},findQuery:function(e,r){return this.query(e,r)},findAll:function(e,r){var t=this.modelFor(e);return this._fetchAll(t,this.peekAll(e),r)},_fetchAll:function(e,r,t){t=t||{};var i=this.adapterFor(e.modelName);var n=this.typeMapFor(e).metadata.since;vi(r,"isUpdating",true);if(t.reload){return me(qr(i,this,e,n,t))}var a=r.createSnapshot(t);if(i.shouldReloadAll(this,a)){return me(qr(i,this,e,n,t))}if(i.shouldBackgroundReloadAll(this,a)){me(qr(i,this,e,n,t))}return me(Fi.resolve(r))},didUpdateAll:function(e){var r=this.recordArrayManager.liveRecordArrayFor(e);vi(r,"isUpdating",false)},all:function(e){return this.peekAll(e)},peekAll:function(e){var r=this.modelFor(e);var t=this.recordArrayManager.liveRecordArrayFor(r);this.recordArrayManager.populateLiveRecordArray(t,r);return t},unloadAll:function(e){if(arguments.length===0){var r=this.typeMaps;var n=t(r);var a=Ei.call(n,c);bi.call(a,this.unloadAll,this)}else{var o=this.modelFor(e);var s=this.typeMapFor(o);var l=s.records.slice();var u;for(var d=0;d<l.length;d++){u=l[d];u.unloadRecord();u.destroy()}s.metadata=i(null)}function c(e){return r[e]["type"].modelName}},filter:function(e,r,t){if(!Ember.ENV.ENABLE_DS_FILTER){}var i;var n=arguments.length;var a;var o=n===3;if(o){i=this.query(e,r)}else if(arguments.length===2){t=r}e=this.modelFor(e);if(o){a=this.recordArrayManager.createFilteredRecordArray(e,t,r)}else{a=this.recordArrayManager.createFilteredRecordArray(e,t)}i=i||Fi.cast(a);return me(i.then(function(){return a},null,"DS: Store#filter of "+e))},recordIsLoaded:function(e,r){return this.hasRecordForId(e,r)},metadataFor:function(e){return this._metadataFor(e)},_metadataFor:function(e){var r=this.modelFor(e);return this.typeMapFor(r).metadata},setMetadataFor:function(e,r){this._setMetadataFor(e,r)},_setMetadataFor:function(e,r){var t=this.modelFor(e);Ember.merge(this.typeMapFor(t).metadata,r)},dataWasUpdated:function(e,r){this.recordArrayManager.recordDidChange(r)},scheduleSave:function(e,r,t){var i=e.createSnapshot(t);e.flushChangedAttributes();e.adapterWillCommit();this._pendingSave.push({snapshot:i,resolver:r});yi(this,"flushPendingSave")},flushPendingSave:function(){var e=this._pendingSave.slice();this._pendingSave=[];bi.call(e,function(e){var r=e.snapshot;var t=e.resolver;var i=r._internalModel;var n=this.adapterFor(i.type.modelName);var a;if(mi(i,"currentState.stateName")==="root.deleted.saved"){return t.resolve()}else if(i.isNew()){a="createRecord"}else if(i.isDeleted()){a="deleteRecord"}else{a="updateRecord"}t.resolve(xi(n,this,a,r))},this)},didSaveRecord:function(e,r){var t;if(r){t=r.data}if(t){this._backburner.schedule("normalizeRelationships",this,"_setupRelationships",e,e.type,t);this.updateId(e,t)}e.adapterDidCommit(t)},recordWasInvalid:function(e,r){e.adapterDidInvalidate(r)},recordWasError:function(e,r){e.adapterDidError(r)},updateId:function(e,r){var t=e.id;var i=Y(r.id);this.typeMapFor(e.type).idToRecord[i]=e;e.setId(i)},typeMapFor:function(e){var r=mi(this,"typeMaps");var t=Ember.guidFor(e);var n=r[t];if(n){return n}n={idToRecord:i(null),records:[],metadata:i(null),type:e};r[t]=n;return n},_load:function(e){var r=Y(e.id);var t=this._internalModelForId(e.type,r);t.setupData(e);this.recordArrayManager.recordDidChange(t);return t},_modelForMixin:function(e){var r=ee(e);var t=this.container._registry?this.container._registry:this.container;var i=t.resolve("mixin:"+r);if(i){t.register("model:"+r,DS.Model.extend(i))}var n=this.modelFactoryFor(r);if(n){n.__isMixin=true;n.__mixin=i}return n},modelFor:function(e){var r=this.modelFactoryFor(e);if(!r){r=this._modelForMixin(e)}if(!r){throw new Ember.Error("No model was found for '"+e+"'");
4
+ }r.modelName=r.modelName||ee(e);if(!("typeKey"in r)){Ember.defineProperty(r,"typeKey",{enumerable:true,configurable:false,get:function(){var e=this.modelName;if(e){e=Ember.String.camelize(this.modelName)}return e},set:function(){}})}return r},modelFactoryFor:function(e){var r=ee(e);return this.container.lookupFactory("model:"+r)},push:function(e,r){var t=this;var i,n;if(Ember.typeOf(e)==="object"&&Ember.typeOf(r)==="undefined"){i=e}else{i=Xe(this.modelFor(e),r);n=e}if(i.included){bi.call(i.included,function(e){return t._pushInternalModel(e)})}if(Ember.typeOf(i.data)==="array"){var a=Ei.call(i.data,function(e){return t._pushInternalModel(e)});return Ei.call(a,function(e){return e.getRecord()})}var o=this._pushInternalModel(i.data||i);return o.getRecord()},_hasModelFor:function(e){return this.container.lookupFactory("model:"+e)},_pushInternalModel:function(e){var r=e.type;var t=this.modelFor(r);if(Ember.ENV.DS_WARN_ON_UNKNOWN_KEYS){}var i=this._load(e);var n=this;this._backburner.join(function(){n._backburner.schedule("normalizeRelationships",n,"_setupRelationships",i,t,e)});return i},_setupRelationships:function(e,r,t){t=Si(this,r,t);Ci(this,e,t)},pushPayload:function(e,r){var t;var i;if(!r){i=e;t=Pi(this)}else{i=r;t=this.serializerFor(e)}var n=this;this._adapterRun(function(){t.pushPayload(n,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)},pushMany:function(e,r){var t=r.length;var i=new Array(t);for(var n=0;n<t;n++){i[n]=this.push(e,r[n])}return i},metaForType:function(e,r){this.setMetadataFor(e,r)},buildInternalModel:function(e,r,t){var i=this.typeMapFor(e);var n=i.idToRecord;var a=new ci(e,r,this,this.container,t);if(r){n[r]=a}i.records.push(a);return a},recordWasLoaded:function(e){this.recordArrayManager.recordWasLoaded(e)},dematerializeRecord:function(e){this._dematerializeRecord(e)},_dematerializeRecord:function(e){var r=e.type;var t=this.typeMapFor(r);var i=e.id;e.updateRecordArrays();if(i){delete t.idToRecord[i]}var n=Ri.call(t.records,e);t.records.splice(n,1)},adapterFor:function(e){var r;if(typeof e==="string"){r=e}else{r=e.modelName}return this.lookupAdapter(r)},_adapterRun:function(e){return this._backburner.run(e)},serializerFor:function(e){var r;if(typeof e==="string"){r=e}else{r=e.modelName}var t=["application",this.adapterFor(r).get("defaultSerializer"),"-default"];var i=this.lookupSerializer(r,t);return i},retrieveManagedInstance:function(e,r,t){var i=ee(r);var n=this._instanceCache.get(e,i,t);vi(n,"store",this);return n},lookupAdapter:function(e){return this.retrieveManagedInstance("adapter",e,this.get("_adapterFallbacks"))},_adapterFallbacks:Ember.computed("adapter",function(){var e=this.get("adapter");return["application",e,"-rest"]}),lookupSerializer:function(e,r){return this.retrieveManagedInstance("serializer",e,r)},willDestroy:function(){this.recordArrayManager.destroy();this.unloadAll();for(var e in this._containerCache){this._containerCache[e].destroy();delete this._containerCache[e]}delete this._containerCache}});function Si(e,r,t,i){t.relationships=t.relationships||{};r.eachRelationship(function(r,i){var n=i.kind;var a;if(t.relationships[r]&&t.relationships[r].data){a=t.relationships[r].data;if(n==="belongsTo"){t.relationships[r].data=ki(e,r,i,a)}else if(n==="hasMany"){t.relationships[r].data=Ti(e,r,i,a)}}});return t}function ki(e,r,t,i){if(gi(i)){return}return e._internalModelForId(i.type,i.id)}function Ti(e,r,t,i){if(gi(i)){return}return Ei.call(i,function(i){return ki(e,r,t,i)})}function Pi(e){return e.serializerFor("application")}function xi(e,r,t,i){var n=i._internalModel;var a=i.modelName;var o=r.modelFor(a);var s=e[t](r,o,i);var u=Lr(r,e,a);var d="DS: Extract and notify about "+t+" completion of "+n;s=Fi.cast(s,d);s=Ir(s,Dr(Or,r));s=Ir(s,Dr(Or,n));return s.then(function(e){r._adapterRun(function(){var a,s;if(e){a=Ge(u,r,o,e,i.id,t);if(a.included){r.push({data:a.included})}s=ir(a.data)}r.didSaveRecord(n,Xe(n.type,s))});return n},function(e){if(e instanceof l){var t=u.extractErrors(r,o,e,i.id);r.recordWasInvalid(n,t)}else{r.recordWasError(n,e)}throw e},d)}function Ci(e,r,t){var i=r.type;if(!t.relationships){return}i.eachRelationship(function(e,i){var n=i.kind;if(!t.relationships[e]){return}var a;if(t.relationships[e].links&&t.relationships[e].links.related){a=r._relationships.get(e);a.updateLink(t.relationships[e].links.related)}if(t.relationships[e].meta){a=r._relationships.get(e);a.updateMeta(t.relationships[e].meta)}var o=t.relationships[e].data;if(o!==undefined){if(n==="belongsTo"){a=r._relationships.get(e);a.setCanonicalRecord(o)}else if(n==="hasMany"){a=r._relationships.get(e);a.updateRecordsFromAdapter(o)}}})}function Ni(e,r,t){if(e){var i=[];var n=Ember.get(r,"fields");n.forEach(function(e,r){i.push(r)});var a=false;for(var o=0,s=i.length;o<s;o++){var l=i[o];if(typeof e[l]!=="undefined"){a=true;break}}if(a){var u=e;return{preload:u}}}return e}var wi=zi;var Di=r.map;var Ii=e.String.dasherize;var Oi=e.get;var Li=ue.extend({isNewSerializerAPI:true,_normalizeDocumentHelper:function(r){if(e.typeOf(r.data)==="object"){r.data=this._normalizeResourceHelper(r.data)}else if(e.typeOf(r.data)==="array"){r.data=Di.call(r.data,this._normalizeResourceHelper,this)}if(e.typeOf(r.included)==="array"){r.included=Di.call(r.included,this._normalizeResourceHelper,this)}return r},_normalizeRelationshipDataHelper:function(e){var r=this.modelNameFromPayloadKey(e.type);e.type=r;return e},_normalizeResourceHelper:function(r){var t=this.modelNameFromPayloadKey(r.type);var i=this.store.modelFor(t);var n=this.store.serializerFor(t);e.assert(this.toString()+" is using the "+(Oi(this,"isNewSerializerAPI")?"new":"old")+" serializer API and expects "+n.toString()+" it collaborates with to do the same. Make sure to set `isNewSerializerAPI: true` in your custom serializers if you want to use the new Serializer API.",Oi(this,"isNewSerializerAPI")===Oi(n,"isNewSerializerAPI"));var a=n.normalize(i,r);var o=a.data;return o},pushPayload:function(e,r){var t=this._normalizeDocumentHelper(r);e.push(t)},_normalizeResponse:function(e,r,t,i,n,a){var o=this._normalizeDocumentHelper(t);return o},extractAttributes:function(e,r){var t=this;var i={};if(r.attributes){e.eachAttribute(function(e){var n=t.keyForAttribute(e,"deserialize");if(r.attributes.hasOwnProperty(n)){i[e]=r.attributes[n]}})}return i},extractRelationship:function(r){if(e.typeOf(r.data)==="object"){r.data=this._normalizeRelationshipDataHelper(r.data)}if(e.typeOf(r.data)==="array"){r.data=Di.call(r.data,this._normalizeRelationshipDataHelper,this)}return r},extractRelationships:function(e,r){var t=this;var i={};if(r.relationships){e.eachRelationship(function(e,n){var a=t.keyForRelationship(e,n.kind,"deserialize");if(r.relationships.hasOwnProperty(a)){var o=r.relationships[a];i[e]=t.extractRelationship(o)}})}return i},_extractType:function(e,r){return this.modelNameFromPayloadKey(r.type)},modelNameFromPayloadKey:function(e){return H(ee(e))},payloadKeyFromModelName:function(e){return K(e)},normalize:function(e,r){this.normalizeUsingDeclaredMapping(e,r);var t={id:this.extractId(e,r),type:this._extractType(e,r),attributes:this.extractAttributes(e,r),relationships:this.extractRelationships(e,r)};this.applyTransforms(e,t.attributes);return{data:t}},keyForAttribute:function(e,r){return Ii(e)},keyForRelationship:function(e,r,t){return Ii(e)},serialize:function(e,r){var t=this._super.apply(this,arguments);t.type=this.payloadKeyFromModelName(e.modelName);return{data:t}},serializeAttribute:function(e,r,t,i){var n=i.type;if(this._canSerialize(t)){r.attributes=r.attributes||{};var a=e.attr(t);if(n){var o=this.transformFor(n);a=o.serialize(a)}var s=this._getMappedKey(t);if(s===t){s=this.keyForAttribute(t,"serialize")}r.attributes[s]=a}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this._canSerialize(i)){var n=e.belongsTo(i);if(n!==undefined){r.relationships=r.relationships||{};var a=this._getMappedKey(i);if(a===i){a=this.keyForRelationship(i,"belongsTo","serialize")}var o=null;if(n){o={type:this.payloadKeyFromModelName(n.modelName),id:n.id}}r.relationships[a]={data:o}}}},serializeHasMany:function(e,r,t){var i=this;var n=t.key;if(this._shouldSerializeHasMany(e,n,t)){var a=e.hasMany(n);if(a!==undefined){r.relationships=r.relationships||{};var o=this._getMappedKey(n);if(o===n&&this.keyForRelationship){o=this.keyForRelationship(n,"hasMany","serialize")}var s=Di.call(a,function(e){return{type:i.payloadKeyFromModelName(e.modelName),id:e.id}});r.relationships[o]={data:s}}}}});var $i=ji;function ji(e,r){e.optionsForType("serializer",{singleton:false});e.optionsForType("adapter",{singleton:false});var t=new _r(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",ue.extend({isNewSerializerAPI:true}));e.register("serializer:-rest",ur.extend({isNewSerializerAPI:true}));e.register("adapter:-rest",P);e.register("adapter:-json-api",Pr);e.register("serializer:-json-api",Li);var i;if(e.has("store:main")){i=e.lookup("store:main")}else{var n=new _r(e);n.registerDeprecations([{deprecated:"store:main",valid:"service:store"}])}if(e.has("store:application")){i=e.lookup("store:application")}else{var a=new _r(e);a.registerDeprecations([{deprecated:"store:application",valid:"service:store"}])}if(i){e.register("service:store",i,{instantiate:false})}else if(!e.has("service:store")){e.register("service:store",r&&r.Store||wi)}}var Ki=Ember.Object.extend({serialize:null,deserialize:null});var Hi=Ember.isEmpty;function Bi(e){return e===e&&e!==Infinity&&e!==-Infinity}var Ui=Ki.extend({deserialize:function(e){var r;if(Hi(e)){return null}else{r=Number(e);return Bi(r)?r:null}},serialize:function(e){var r;if(Hi(e)){return null}else{r=Number(e);return Bi(r)?r:null}}});var Vi=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=Vi}}var qi=Ki.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 Vi.call(e)}else{return null}}});var Wi=Ember.isNone;var Qi=Ki.extend({deserialize:function(e){return Wi(e)?null:String(e)},serialize:function(e){return Wi(e)?null:String(e)}});var Ji=Ki.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)}});var Gi=Xi;function Xi(e){e.register("transform:boolean",Ji);e.register("transform:date",qi);e.register("transform:number",Ui);e.register("transform:string",Qi)}var Yi=Zi;function Zi(e){e.injection("controller","store","service:store");e.injection("route","store","service:store");e.injection("data-adapter","store","service:store")}var en=on;var rn=Ember.get;Ve.reopenClass({attributes:Ember.computed(function(){var e=v.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=v.create();this.eachAttribute(function(r,t){if(t.type){e.set(r,t.type)}});return e}).readOnly(),eachAttribute:function(e,r){rn(this,"attributes").forEach(function(t,i){e.call(r,i,t)},r)},eachTransformedAttribute:function(e,r){rn(this,"transformedAttributes").forEach(function(t,i){e.call(r,i,t)})}});Ve.reopen({eachAttribute:function(e,r){this.constructor.eachAttribute(e,r)}});function tn(e,r,t){if(typeof r.defaultValue==="function"){return r.defaultValue.apply(null,arguments)}else{return r.defaultValue}}function nn(e,r){return r in e._attributes||r in e._inFlightAttributes||r in e._data}function an(e,r){if(r in e._attributes){return e._attributes[r]}else if(r in e._inFlightAttributes){return e._inFlightAttributes[r]}else{return e._data[r]}}function on(e,r){if(typeof e==="object"){r=e;e=undefined}else{r=r||{}}var t={type:e,isAttribute:true,options:r};return ke({get:function(e){var t=this._internalModel;if(nn(t,e)){return an(t,e)}else{return tn(this,r,e)}},set:function(e,r){var t=this._internalModel;var i=an(t,e);if(r!==i){t._attributes[e]=r;this._internalModel.send("didSetProperty",{name:e,oldValue:i,originalValue:t._data[e],value:r})}return r}}).meta(t)}var sn=Ve;var ln=Ember.get;var un=Ember.String.capitalize;var dn=Ember.String.underscore;var cn=Ember;var hn=cn.assert;var fn=Ember.DataAdapter.extend({getFilters:function(){return[{name:"isNew",desc:"New"},{name:"isModified",desc:"Modified"},{name:"isClean",desc:"Clean"}]},detect:function(e){return e!==sn&&sn.detect(e)},columnsForType:function(e){var r=[{name:"id",desc:"Id"}];var t=0;var i=this;ln(e,"attributes").forEach(function(e,n){if(t++>i.attributeLimit){return false}var a=un(dn(n).replace("_"," "));r.push({name:n,desc:a})});return r},getRecords:function(e,r){if(arguments.length<2){var t=e._debugContainerKey;if(t){var i=t.match(/model:(.*)/);if(i){r=i[1]}}}hn("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support",!!r);return this.get("store").peekAll(r)},getRecordColumnValues:function(e){var r=this;var t=0;var i={id:ln(e,"id")};e.eachAttribute(function(n){if(t++>r.attributeLimit){return false}var a=ln(e,n);i[n]=a});return i},getRecordKeywords:function(e){var r=[];var t=Ember.A(["id"]);e.eachAttribute(function(e){t.push(e)});t.forEach(function(t){r.push(ln(e,t))});return r},getRecordFilterValues:function(e){return{isNew:e.get("isNew"),isModified:e.get("hasDirtyAttributes")&&!e.get("isNew"),isClean:!e.get("hasDirtyAttributes")}},getRecordColor:function(e){var r="black";if(e.get("isNew")){r="green"}else if(e.get("hasDirtyAttributes")){r="blue"}return r},observeRecord:function(e,r){var t=Ember.A();var i=this;var n=Ember.A(["id","isNew","hasDirtyAttributes"]);e.eachAttribute(function(e){n.push(e)});n.forEach(function(n){var a=function(){r(i.wrapRecord(e))};Ember.addObserver(e,n,a);t.push(function(){Ember.removeObserver(e,n,a)})});var a=function(){t.forEach(function(e){e()})};return a}});var pn=mn;function mn(e){e.register("data-adapter:main",fn)}var vn=yn;function yn(e){var r,t;if(e.registry&&e.container){r=e.registry;t=e.container}else{r=e;if(r.container){t=r.container()}else{t=r}}t.lookup("service:store")}var gn=bn;function bn(e,r){Rn(e,r);vn(e)}function Rn(e,r){pn(e,r);Gi(e,r);Yi(e,r);Fr(e,r);$i(e,r)}var En=Ember.K;Ember.onLoad("Ember.Application",function(e){e.initializer({name:"ember-data",initialize:Rn});if(e.instanceInitializer){e.instanceInitializer({name:"ember-data",initialize:vn})}else{e.initializer({name:"ember-data-store-service",after:"ember-data",initialize:vn})}e.initializer({name:"store",after:"ember-data",initialize:En});e.initializer({name:"activeModelAdapter",before:"store",initialize:En});e.initializer({name:"transforms",before:"store",initialize:En});e.initializer({name:"data-adapter",before:"store",initialize:En});e.initializer({name:"injectStore",before:"store",initialize:En})});Ember.Date=Ember.Date||{};var _n=Date.parse;var Fn=[1,4,5,6,7,10,11];Ember.Date.parse=function(e){var r,t;var i=0;if(t=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(e)){for(var n=0,a;a=Fn[n];++n){t[a]=+t[a]||0}t[2]=(+t[2]||1)-1;t[3]=+t[3]||1;if(t[8]!=="Z"&&t[9]!==undefined){i=t[10]*60+t[11];if(t[9]==="+"){i=0-i}}r=Date.UTC(t[1],t[2],t[3],t[4],t[5]+i,t[6],t[7])}else{r=_n?_n(e):NaN}return r};if(Ember.EXTEND_PROTOTYPES===true||Ember.EXTEND_PROTOTYPES.Date){Date.parse=Ember.Date.parse}sn.reopen({_debugInfo:function(){var e=["id"];var r={belongsTo:[],hasMany:[]};var 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","hasDirtyAttributes","isSaving","isDeleted","isError","isNew","isValid"]}];return{propertyInfo:{includeOtherProperties:true,groups:i,expensiveProperties:t}}}});var An=sn;var zn=fn;var Mn=Ember.get;var Sn=Ember.set;var kn=r.forEach;var Tn=Ember.String.camelize;var Pn=Ember.Mixin.create({normalize:function(e,r,t){var i=this._super(e,r,t);return this._extractEmbeddedRecords(this,this.store,e,i)},keyForRelationship:function(e,r,t){if(t==="serialize"&&this.hasSerializeRecordsOption(e)||t==="deserialize"&&this.hasDeserializeRecordsOption(e)){return this.keyForAttribute(e,t)}else{return this._super(e,r,t)||e}},serializeBelongsTo:function(e,r,t){var i=t.key;if(this.noSerializeOptionSpecified(i)){this._super(e,r,t);return}var n=this.hasSerializeIdsOption(i);var a=this.hasSerializeRecordsOption(i);var o=e.belongsTo(i);var s;if(n){s=this.keyForRelationship(i,t.kind,"serialize");if(!o){r[s]=null}else{r[s]=o.id}}else if(a){s=this.keyForAttribute(i,"serialize");if(!o){r[s]=null}else{r[s]=o.record.serialize({includeId:true});this.removeEmbeddedForeignKey(e,o,t,r[s])}}},serializeHasMany:function(e,r,t){var i=t.key;if(this.noSerializeOptionSpecified(i)){this._super(e,r,t);return}var n=this.hasSerializeIdsOption(i);var a=this.hasSerializeRecordsOption(i);var o,s;if(n){o=this.keyForRelationship(i,t.kind,"serialize");r[o]=e.hasMany(i,{ids:true})}else if(a){o=this.keyForAttribute(i,"serialize");s=e.hasMany(i);r[o]=Ember.A(s).map(function(r){var i=r.record.serialize({includeId:true});this.removeEmbeddedForeignKey(e,r,t,i);return i},this)}},removeEmbeddedForeignKey:function(e,r,t,i){if(t.kind==="hasMany"){return}else if(t.kind==="belongsTo"){var n=e.type.inverseFor(t.key,this.store);if(n){var a=n.name;var o=this.store.serializerFor(r.modelName);var s=o.keyForRelationship(a,n.kind,"deserialize");if(s){delete i[s]}}}},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[Tn(e)]||r[e])},_extractEmbeddedRecords:function(e,r,t,i){if(this.get("isNewSerializerAPI")){return Cn.apply(this,arguments)}t.eachRelationship(function(t,n){if(e.hasDeserializeRecordsOption(t)){var a=r.modelFor(n.type);if(n.kind==="hasMany"){if(n.options.polymorphic){this._extractEmbeddedHasManyPolymorphic(r,t,i)}else{this._extractEmbeddedHasMany(r,t,a,i)}}if(n.kind==="belongsTo"){if(n.options.polymorphic){this._extractEmbeddedBelongsToPolymorphic(r,t,i)}else{this._extractEmbeddedBelongsTo(r,t,a,i)}}}},this);return i},_extractEmbeddedHasMany:function(e,r,t,i){if(this.get("isNewSerializerAPI")){return Nn.apply(this,arguments)}if(!i[r]){return i}var n=[];var a=e.serializerFor(t.modelName);kn.call(i[r],function(r){var i=a.normalize(t,r,null);e.push(t.modelName,i);n.push(i.id)});i[r]=n;return i},_extractEmbeddedHasManyPolymorphic:function(e,r,t){var i=this;if(!t[r]){return t}var n=[];kn.call(t[r],function(r){var t=r.type;var i=e.serializerFor(t);var a=e.modelFor(t);var o=i.normalize(a,r,null);e.push(a.modelName,o);n.push({id:o.id,type:t})});t[r]=n;return t},_extractEmbeddedBelongsTo:function(e,r,t,i){if(this.get("isNewSerializerAPI")){return wn.apply(this,arguments)}if(!i[r]){return i}var n=e.serializerFor(t.modelName);var a=n.normalize(t,i[r],null);e.push(t.modelName,a);i[r]=a.id;return i},_extractEmbeddedBelongsToPolymorphic:function(e,r,t){if(!t[r]){return t}var i=t[r];var n=i.type;var a=e.serializerFor(n);var o=e.modelFor(n);var s=a.normalize(o,i,null);e.push(o.modelName,s);t[r]=s.id;t[r+"Type"]=n;return t},_normalizeEmbeddedRelationship:function(e,r,t){var i=r.type;if(r.options.polymorphic){i=t.type}var n=e.modelFor(i);var a=e.serializerFor(i);return a.normalize(n,t,null)}});var xn=Pn;function Cn(e,r,t,i){var n=this;t.eachRelationship(function(t,a){if(e.hasDeserializeRecordsOption(t)){if(a.kind==="hasMany"){n._extractEmbeddedHasMany(r,t,i,a)}if(a.kind==="belongsTo"){n._extractEmbeddedBelongsTo(r,t,i,a)}}},this);return i}function Nn(e,r,t,i){var n=this;var a=Mn(t,"data.relationships."+r+".data");if(!a){return}var o=a.map(function(r){var a=n._normalizeEmbeddedRelationship(e,i,r);var o=a.data;var s=a.included;t.included=t.included||[];t.included.push(o);if(s){var l;(l=t.included).push.apply(l,s)}return{id:o.id,type:o.type}});var s={data:o};Sn(t,"data.relationships."+r,s)}function wn(e,r,t,i){var n=Mn(t,"data.relationships."+r+".data");if(!n){return}var a=this._normalizeEmbeddedRelationship(e,i,n);var o=a.data;var s=a.included;t.included=t.included||[];t.included.push(o);if(s){var l;(l=t.included).push.apply(l,s)}var u={id:o.id,type:o.type};var d={data:u};Sn(t,"data.relationships."+r,d)}function Dn(e,r){var t,i;if(typeof e==="object"){t=e;i=undefined}else{t=r;i=e}if(typeof i==="string"){i=ee(i)}t=t||{};var n=false;if(typeof t.async==="undefined"){n=true}var a={type:i,isRelationship:true,options:t,kind:"belongsTo",key:null,shouldWarnAsync:n};return ke({get:function(e){if(t.hasOwnProperty("serialize")){}if(t.hasOwnProperty("embedded")){}if(a.shouldWarnAsync){a.shouldWarnAsync=false}return this._internalModel._relationships.get(e).getRecord()},set:function(e,r){if(r===undefined){r=null}if(r&&r.then){this._internalModel._relationships.get(e).setRecordPromise(r)}else if(r){this._internalModel._relationships.get(e).setRecord(r._internalModel)}else{this._internalModel._relationships.get(e).setRecord(r)}return this._internalModel._relationships.get(e).getRecord()}}).meta(a)}sn.reopen({notifyBelongsToChanged:function(e){this.notifyPropertyChange(e)}});var In=Dn;function On(e,r){if(typeof e==="object"){r=e;e=undefined}r=r||{};var t=false;if(typeof r.async==="undefined"){t=true}if(typeof e==="string"){e=ee(e)}var i={type:e,isRelationship:true,options:r,kind:"hasMany",key:null,shouldWarnAsync:t};return ke({get:function(e){if(i.shouldWarnAsync){i.shouldWarnAsync=false}var r=this._internalModel._relationships.get(e);return r.getRecords()},set:function(e,r){var t=this._internalModel._relationships.get(e);t.clear();t.addRecords(Ember.A(r).mapBy("_internalModel"));return t.getRecords()}}).meta(i)}sn.reopen({notifyHasManyAdded:function(e){this.notifyPropertyChange(e)}});var Ln=On;function $n(e){var r;r=e.type||e.key;if(e.kind==="hasMany"){r=H(ee(r))}return r}function jn(e){return{key:e.key,kind:e.kind,type:$n(e),options:e.options,parentType:e.parentType,isRelationship:true}}var Kn=Ember.get;var Hn=r.filter;var Bn=Ember.computed(function(){if(Ember.testing===true&&Bn._cacheable===true){Bn._cacheable=false}var e=new y({defaultValue:function(){return[]}});this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var i=e.get($n(t));i.push({name:r,kind:t.kind})}});return e}).readOnly();var Un=Ember.computed(function(){if(Ember.testing===true&&Un._cacheable===true){Un._cacheable=false}var e;var r=Ember.A();this.eachComputedProperty(function(t,i){if(i.isRelationship){i.key=t;e=$n(i);if(!r.contains(e)){r.push(e)}}});return r}).readOnly();var Vn=Ember.computed(function(){if(Ember.testing===true&&Vn._cacheable===true){Vn._cacheable=false}var e=v.create();this.eachComputedProperty(function(r,t){if(t.isRelationship){t.key=r;var i=jn(t);i.type=$n(t);e.set(r,i)}});return e}).readOnly();sn.reopen({didDefineProperty:function(e,r,t){if(t instanceof Ember.ComputedProperty){var i=t.meta();i.parentType=e.constructor}}});sn.reopenClass({typeForRelationship:function(e,r){var t=Kn(this,"relationshipsByName").get(e);return t&&r.modelFor(t.type)},inverseMap:Ember.computed(function(){return i(null)}),inverseFor:function(e,r){var t=Kn(this,"inverseMap");if(t[e]){return t[e]}else{var i=this._findInverseFor(e,r);t[e]=i;return i}},_findInverseFor:function(e,r){var t=this.typeForRelationship(e,r);if(!t){return null}var i=this.metaForProperty(e);var n=i.options;if(n.inverse===null){return null}var a,o,s;if(n.inverse){a=n.inverse;s=Ember.get(t,"relationshipsByName").get(a);o=s.kind}else{if(i.type===i.parentType.modelName){}var l=d(this,t);if(l.length===0){return null}var u=Hn.call(l,function(r){var i=t.metaForProperty(r.name).options;return e===i.inverse});if(u.length===1){l=u}a=l[0].name;o=l[0].kind}function d(r,t,i){var n=i||[];var a=Kn(t,"relationships");if(!a){return n}var o=a.get(r.modelName);o=Hn.call(o,function(r){var i=t.metaForProperty(r.name).options;if(!i.inverse){return true}return e===i.inverse});if(o){n.push.apply(n,o)}if(r.superclass){d(r.superclass,t,n)}return n}return{type:t,name:a,kind:o}},relationships:Bn,relationshipNames:Ember.computed(function(){var e={hasMany:[],belongsTo:[]};this.eachComputedProperty(function(r,t){if(t.isRelationship){e[t.kind].push(r)}});return e}),relatedTypes:Un,relationshipsByName:Vn,fields:Ember.computed(function(){var e=v.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){Kn(this,"relationshipsByName").forEach(function(t,i){e.call(r,i,t)})},eachRelatedType:function(e,r){Kn(this,"relatedTypes").forEach(function(t){e.call(r,t)})},determineRelationshipType:function(e,r){var t=e.key;var i=e.kind;var n=this.inverseFor(t,r);var a,o;if(!n){return i==="belongsTo"?"oneToNone":"manyToNone"}a=n.name;o=n.kind;if(o==="belongsTo"){return i==="belongsTo"?"oneToOne":"manyToOne"}else{return i==="belongsTo"?"oneToMany":"manyToMany"}}});sn.reopen({eachRelationship:function(e,r){this.constructor.eachRelationship(e,r)},relationshipFor:function(e){return Kn(this.constructor,"relationshipsByName").get(e)},inverseFor:function(e){return this.constructor.inverseFor(e,this.store)}});if(Ember.VERSION.match(/^1\.[0-7]\./)){throw new Ember.Error("Ember Data requires at least Ember 1.8.0, but you have "+Ember.VERSION+". Please upgrade your version of Ember, then upgrade Ember Data")}if(Ember.VERSION.match(/^1\.12\.0/)){throw new Ember.Error("Ember Data does not work with Ember 1.12.0. Please upgrade to Ember 1.12.1 or higher.")}Ember.RSVP.Promise.cast=Ember.RSVP.Promise.cast||Ember.RSVP.resolve;Nr.Store=zi;Nr.PromiseArray=he;Nr.PromiseObject=fe;Nr.PromiseManyArray=ye;Nr.Model=sn;Nr.RootState=xt;Nr.attr=en;Nr.Errors=Ae;Nr.InternalModel=ci;Nr.Snapshot=Zt;Nr.Adapter=m;Nr.AdapterError=s;Nr.InvalidError=l;Nr.TimeoutError=u;Nr.AbortError=d;Nr.errorsHashToArray=c;Nr.errorsArrayToHash=h;Nr.Serializer=X;Nr.DebugAdapter=zn;Nr.RecordArray=Zr;Nr.FilteredRecordArray=rt;Nr.AdapterPopulatedRecordArray=at;Nr.ManyArray=Lt;Nr.RecordArrayManager=ft;Nr.RESTAdapter=P;Nr.BuildURLMixin=F;Nr.RESTSerializer=ur;Nr.JSONSerializer=ue;Nr.JSONAPIAdapter=Pr;Nr.JSONAPISerializer=Li;Nr.Transform=Ki;Nr.DateTransform=qi;Nr.StringTransform=Qi;Nr.NumberTransform=Ui;Nr.BooleanTransform=Ji;var qn=J;var Wn=Rr;if(Ember.platform.hasPropertyAccessors){Ember.defineProperty(Nr,"ActiveModelAdapter",{get:function(){if(Wn===J){}return qn},set:function(e){qn=e}});Ember.defineProperty(Nr,"ActiveModelSerializer",{get:function(){if(Wn===Rr){}return Wn},set:function(e){Wn=e}})}else{Nr.ActiveModelAdapter=J;Nr.ActiveModelSerializer=Rr}Nr.EmbeddedRecordsMixin=xn;Nr.belongsTo=In;Nr.hasMany=Ln;Nr.Relationship=wt;Nr.ContainerProxy=_r;Nr._setupContainer=gn;Ember.defineProperty(Nr,"normalizeModelName",{enumerable:true,writable:false,configurable:false,value:ee});var Qn=Tr;if(Ember.platform.hasPropertyAccessors){Ember.defineProperty(Nr,"FixtureAdapter",{get:function(){if(Qn===Tr){}return Qn},set:function(e){Qn=e}})}else{Nr.FixtureAdapter=Tr}Ember.lookup.DS=Nr;var Jn=Nr;var Gn=Xn;function Xn(r){if(e.Helper){return e.Helper.helper(r)}if(e.HTMLBars){return e.HTMLBars.makeBoundHelper(r)}return e.Handlebars.makeBoundHelper(r)}var Yn=Gn(function(e){var r,t;if(e.length===1){t=e[0];return K(t)}else{r=e[0];t=e[1];if((r|0)!==1){t=K(t)}return r+" "+t}});var Zn=Gn(function(e){return H(e[0])})}).call(this);