Comparing version 2.5.0 to 2.6.0
@@ -0,1 +1,10 @@ | ||
##### 2.6.0 - 08 October 2015 | ||
###### Backwards compatible API changes | ||
- #234 - findAll should query adapter if previous query is expired. | ||
- #235 - Support maxAge in find/findAll requests by @antoinebrault | ||
###### Bug fixes | ||
- #236 - actions defined in defineResource are shared across definitions | ||
##### 2.5.0 - 04 October 2015 | ||
@@ -2,0 +11,0 @@ |
/*! | ||
* js-data | ||
* @version 2.5.0 - Homepage <http://www.js-data.io/> | ||
* @version 2.6.0 - Homepage <http://www.js-data.io/> | ||
* @author Jason Dobry <jason.dobry@gmail.com> | ||
@@ -11,4 +11,4 @@ * @copyright (c) 2014-2015 Jason Dobry | ||
!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.JSData=b():a.JSData=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){var d=c(1),e=c(2),f=c(3);a.exports={DS:d["default"],DSUtils:e["default"],DSErrors:f["default"],createStore:function(a){return new d["default"](a)},version:{full:"2.5.0",major:parseInt("2",10),minor:parseInt("5",10),patch:parseInt("0",10),alpha:"false",beta:"false"}}},function(a,b,c){function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b,c){c(null,b)}function f(a,b){return b}function g(a,b,c,d){var e=!0;a:for(;e;){var f=a,g=b,h=c,i=d;k=l=m=void 0,e=!1;var k=f[g],l=j["default"].get(h,k[0]),m=j["default"].get(i,k[0]);if(j["default"]._s(l)&&(l=j["default"].upperCase(l)),j["default"]._s(m)&&(m=j["default"].upperCase(m)),"DESC"===k[1]){if(l>m)return-1;if(m>l)return 1;if(g<f.length-1){a=f,b=g+1,c=h,d=i,e=!0;continue a}return 0}if(m>l)return-1;if(l>m)return 1;if(!(g<f.length-1))return 0;a=f,b=g+1,c=h,d=i,e=!0}}function h(a,b){j["default"].forOwn(b,function(b,c){a[c]=b,a[c].before=function(b){var d=a[c];a[c]=function(){for(var a=arguments.length,c=Array(a),e=0;a>e;e++)c[e]=arguments[e];return d.apply(this,b.apply(this,c)||c)}}})}var i=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),j=c(2),k=c(3),l=c(30),m=c(36),n=function(){function a(){d(this,a)}return i(a,[{key:"errorFn",value:function(a,b){if(this.error&&"function"==typeof this.error){try{throw"string"==typeof a?new Error(a):a}catch(c){a=c}this.error(this.name||null,a||null,b||null)}}}]),a}(),o=n.prototype;o.actions={},o.afterCreate=e,o.afterCreateCollection=f,o.afterCreateInstance=f,o.afterDestroy=e,o.afterEject=f,o.afterFind=e,o.afterFindAll=e,o.afterInject=f,o.afterLoadRelations=e,o.afterReap=f,o.afterUpdate=e,o.afterValidate=e,o.allowSimpleWhere=!0,o.basePath="",o.beforeCreate=e,o.beforeCreateCollection=f,o.beforeCreateInstance=f,o.beforeDestroy=e,o.beforeEject=f,o.beforeInject=f,o.beforeReap=f,o.beforeUpdate=e,o.beforeValidate=e,o.bypassCache=!1,o.cacheResponse=!!j["default"].w,o.clearEmptyQueries=!0,o.computed={},o.defaultAdapter="http",o.debug=!1,o.defaultValues={},o.eagerEject=!1,o.eagerInject=!1,o.endpoint="",o.error=console?function(a,b,c){return console["function"==typeof console.error?"error":"log"](a,b,c)}:!1,o.errorHandler=function(){return j["default"].Promise.reject(arguments[0])},o.fallbackAdapters=["http"],o.findStrictCache=!1,o.idAttribute="id",o.ignoredChanges=[/\$/],o.instanceEvents=!!j["default"].w,o.keepChangeHistory=!1,o.linkRelations=!!j["default"].w,o.log=console?function(a,b,c,d,e){return console["function"==typeof console.info?"info":"log"](a,b,c,d,e)}:!1,o.logFn=function(a,b,c,d){var e=this;e.debug&&e.log&&"function"==typeof e.log&&e.log(e.name||null,a||null,b||null,c||null,d||null)},o.maxAge=!1,o.methods={},o.notify=!!j["default"].w,o.omit=[],o.onConflict="merge",o.reapAction=j["default"].w?"inject":"none",o.reapInterval=j["default"].w?3e4:!1,o.relationsEnumerable=!1,o.resetHistoryOnInject=!0,o.returnMeta=!1,o.scopes={},o.strategy="single",o.upsert=!!j["default"].w,o.useClass=!0,o.useFilter=!1,o.validate=e,o.watchChanges=!!j["default"].w,o.defaultFilter=function(a,b,c,d){var e=a,f=null,h={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""};c=c||{},d=d||{},f=j["default"]._o(c.where)?c.where:{},d.allowSimpleWhere&&j["default"].forOwn(c,function(a,b){b in h||b in f||(f[b]={"==":a})}),j["default"].isEmpty(f)&&(f=null),f&&(e=j["default"].filter(e,function(a){var b=!0,c=!0;return j["default"].forOwn(f,function(d,e){j["default"]._o(d)||(d={"==":d}),j["default"].forOwn(d,function(d,f){var g=void 0,h="|"===f[0],i=j["default"].get(a,e);f=h?f.substr(1):f,"=="===f?g=i==d:"==="===f?g=i===d:"!="===f?g=i!=d:"!=="===f?g=i!==d:">"===f?g=i>d:">="===f?g=i>=d:"<"===f?g=d>i:"<="===f?g=d>=i:"isectEmpty"===f?g=!j["default"].intersection(i||[],d||[]).length:"isectNotEmpty"===f?g=j["default"].intersection(i||[],d||[]).length:"in"===f?g=j["default"]._s(d)?-1!==d.indexOf(i):j["default"].contains(d,i):"notIn"===f?g=j["default"]._s(d)?-1===d.indexOf(i):!j["default"].contains(d,i):"contains"===f?g=j["default"]._s(i)?-1!==i.indexOf(d):j["default"].contains(i,d):"notContains"===f&&(g=j["default"]._s(i)?-1===i.indexOf(d):!j["default"].contains(i,d)),void 0!==g&&(c=b?g:h?c||g:c&&g),b=!1})}),c}));var i=null;j["default"]._s(c.orderBy)?i=[[c.orderBy,"ASC"]]:j["default"]._a(c.orderBy)&&(i=c.orderBy),!i&&j["default"]._s(c.sort)?i=[[c.sort,"ASC"]]:!i&&j["default"]._a(c.sort)&&(i=c.sort),i&&!function(){var a=0;j["default"].forEach(i,function(a,c){if(j["default"]._s(a))i[c]=[a,"ASC"];else if(!j["default"]._a(a))throw new k["default"].IA('DS.filter("'+b+'"[, params][, options]): '+j["default"].toJson(a)+": Must be a string or an array!",{params:{"orderBy[i]":{actual:typeof a,expected:"string|array"}}})}),e=j["default"].sort(e,function(b,c){return g(i,a,b,c)})}();var l=j["default"]._n(c.limit)?c.limit:null,m=null;return j["default"]._n(c.skip)?m=c.skip:j["default"]._n(c.offset)&&(m=c.offset),l&&m?e=j["default"].slice(e,m,Math.min(e.length,m+l)):j["default"]._n(l)?e=j["default"].slice(e,0,Math.min(e.length,l)):j["default"]._n(m)&&(e=m<e.length?j["default"].slice(e,m):[]),e===a?e.slice():e};var p=function(){function a(b){d(this,a);var c=this;b=b||{},c.store={},c.definitions={},c.adapters={},c.defaults=new n,c.observe=j["default"].observe,j["default"].forOwn(b,function(a,b){"omit"===b?c.defaults.omit=a.concat(n.prototype.omit):c.defaults[b]=a});var e=j["default"].Promise;e&&!e.prototype.spread&&(e.prototype.spread=function(a){return this.then(function(b){return a.apply(this,b)})}),j["default"].Events(c)}return i(a,[{key:"getAdapterName",value:function(a){var b=!1;if(a=a||{},j["default"]._s(a)&&(b=!0,a={adapter:a}),this.adapters[a.adapter])return a.adapter;if(b)throw new Error(a.adapter+" is not a registered adapter!");return a.defaultAdapter}},{key:"getAdapter",value:function(a){return a=a||{},this.adapters[this.getAdapterName(a)]}},{key:"registerAdapter",value:function(a,b,c){var d=this;c=c||{},j["default"].isFunction(b)?d.adapters[a]=new b(c):d.adapters[a]=b,c["default"]&&(d.defaults.defaultAdapter=a)}},{key:"is",value:function(a,b){var c=this.definitions[a];if(!c)throw new k["default"].NER(a);return b instanceof c[c["class"]]}},{key:"clear",value:function(){var a=this,b={};return j["default"].forOwn(this.definitions,function(c){var d=c.name;b[d]=c.ejectAll(),a.store[d].completedQueries={},a.store[d].queryData={}}),b}},{key:"errorFn",value:function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b[b.length-1],e=this.defaults.errorHandler,f=d?d.errorHandler:e;return f=f||e,function(a){return f.apply(void 0,[a].concat(b))}}}]),a}(),q=p.prototype;q.getAdapterName.shorthand=!1,q.getAdapter.shorthand=!1,q.registerAdapter.shorthand=!1,q.errors=k["default"],q.utils=j["default"],h(q,l["default"]),h(q,m["default"]),b["default"]=p},function(a,b,c){function d(a){return"[object Array]"===T.call(a)||!1}function e(a){return"[object RegExp]"===T.call(a)||!1}function f(a){return"string"==typeof a||a&&"object"==typeof a&&"[object String]"===T.call(a)||!1}function g(a){return"[object Object]"===T.call(a)||!1}function h(a){return a&&"object"==typeof a&&"[object Date]"===T.call(a)||!1}function i(a){var b=typeof a;return"number"===b||a&&"object"===b&&"[object Number]"===T.call(a)||!1}function j(a){return"function"==typeof a||a&&"[object Function]"===T.call(a)||!1}function k(a){return f(a)||i(a)}function l(a){return new z["default"].IA('"'+a+'" must be a string or a number!')}function m(a){return new z["default"].IA('"'+a+'" must be an object!')}function n(a){return new z["default"].IA('"'+a+'" must be an array!')}function o(a){if(null==a)return!0;if("string"==typeof a||V(a))return!a.length;if("object"==typeof a){var b=!0;return D(a,function(){return b=!1,!1}),b}return!0}function p(a,b){if(!a||!b)return[];for(var c=[],d=void 0,e=0,f=a.length;f>e;e++)d=a[e],E(c,d)||E(b,d)&&c.push(d);return c}function q(a,b,c){var d=[];return B(a,function(a,c,e){b(a,c,e)&&d.push(a)},c),d}function r(a){var b={};a=a||this,Object.defineProperties(a,{on:{value:function(a,c,d){b[a]=b[a]||[],b[a].push({f:c,c:d})}},off:{value:function(a,c){var d=b[a];if(d)if(c){for(var e=0;e<d.length;e++)if(d[e].f===c){d.splice(e,1);break}}else d.splice(0,d.length);else b={}}},emit:{value:function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];var e=b[c.shift()]||[];if(e)for(var f=0;f<e.length;f++)e[f].f.apply(e[f].c,c)}}})}function s(a,b,c,d,f){if(b){if(a===b)throw new Error("Cannot copy! Source and destination are identical.");if(c=c||[],d=d||[],g(a)){var i=c.indexOf(a);if(-1!==i)return d[i];c.push(a),d.push(b)}var j=void 0;if(V(a)){var k=void 0;for(b.length=0,k=0;k<a.length;k++)j=s(a[k],null,c,d,f),g(a[k])&&(c.push(a[k]),d.push(j)),b.push(j)}else{V(b)?b.length=0:B(b,function(a,c){delete b[c]});for(var l in a)if(a.hasOwnProperty(l)){if(X(l,f))continue;j=s(a[l],null,c,d,f),g(a[l])&&(c.push(a[l]),d.push(j)),b[l]=j}}}else b=a,a&&(V(a)?b=s(a,[],c,d,f):h(a)?b=new Date(a.getTime()):e(a)?(b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex):g(a)&&(b=s(a,Object.create(Object.getPrototypeOf(a)),c,d,f)));return b}function t(a,b){var c=!0;a:for(;c;){var d=a,f=b;if(l=m=g=i=k=void 0,c=!1,d===f)return!0;if(null===d||null===f)return!1;if(d!==d&&f!==f)return!0;var g,i,k,l=typeof d,m=typeof f;if(l==m&&"object"==l){if(!V(d)){if(h(d)){if(!h(f))return!1;a=d.getTime(),b=f.getTime(),c=!0;continue a}if(e(d)&&e(f))return d.toString()==f.toString();if(V(f))return!1;k={};for(i in d)if("$"!==i.charAt(0)&&!j(d[i])){if(!t(d[i],f[i]))return!1;k[i]=!0}for(i in f)if(!k.hasOwnProperty(i)&&"$"!==i.charAt(0)&&void 0!==f[i]&&!j(f[i]))return!1;return!0}if(!V(f))return!1;if((g=d.length)===f.length){for(i=0;g>i;i++)if(!t(d[i],f[i]))return!1;return!0}}return!1}}function u(a,b){return f(b)||i(b)?b:b&&a?b[a.idAttribute]||b:b}function v(a,b){return a&&(f(b)||i(b))?a.index[b]||b:b}function w(a){return null!=a&&""!==a}function x(a,b){return b=b||"",q(a,w).join(b)}function y(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=x(b,"/");return d.replace(/([^:\/]|^)\/{2,}/g,"$1/")}var z=c(3),A=c(4),B=c(5),C=c(6),D=c(7),E=c(10),F=c(12),G=c(14),H=c(21),I=c(22),J=c(23),K=c(24),L=c(19),M=c(25),N=c(27),O=c(29),P=void 0,Q=void 0,R=void 0,S=Object.prototype,T=S.toString;try{Q=Promise}catch(U){console.error("js-data requires a global Promise constructor!")}try{R=window.File}catch(U){R=function(){}}var V=Array.isArray||d;try{P=window,P={}}catch(U){P=null}var W=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],X=O.isBlacklisted;b["default"]={Promise:Q,_:function(a,b){var c=this;if(a=a||{},b=b||{},b&&b.constructor===a.constructor)return b;if(!g(b))throw new z["default"].IA('"options" must be an object!');B(W,function(a){"function"==typeof b[a]&&-1===b[a].toString().indexOf("for (var _len = arg")&&(b[a]=c.promisify(b[a]))});var d=function(a){var b=this;D(a,function(a,c){b[c]=a})};return d.prototype=a,d.prototype.orig=function(){var a={};return D(this,function(b,c){a[c]=b}),a},new d(b)},_n:i,_s:f,_sn:k,_snErr:l,_o:g,_oErr:m,_a:V,_aErr:n,applyScope:function(a,b,c){var d=c.scope,e=s(b);d?f(d)&&(d=[d]):d=[],d.unshift("defaultScope"),B(d,function(d){var e=c.scopes[d];"function"==typeof e?F(b,e(a)):e&&F(b,e)}),F(b,e)},compute:function(a,b){var c=this,d=[];g(a)||(B(a.deps,function(a){d.push(M(c,a))}),N(c,b,a[a.length-1].apply(c,d)))},contains:E,copy:s,deepMixIn:F,diffObjectFromOldObject:O.diffObjectFromOldObject,BinaryHeap:A,equals:t,Events:r,filter:q,fillIn:function(a,b){return D(b,function(b,c){c in a||(a[c]=b)}),a},forEach:B,forOwn:D,fromJson:function(a){return f(a)?JSON.parse(a):a},get:M,intersection:p,isArray:V,isBlacklisted:X,isEmpty:o,isFunction:j,isObject:g,isNumber:i,isString:f,keys:J,makePath:y,observe:O,omit:function(a,b){var c=[];return D(a,function(a,d){X(d,b)&&c.push(d)}),B(c,function(b){delete a[b]}),a},pascalCase:G,pick:I,promisify:function(a,b){var c=this;if(a){if("function"!=typeof a)throw new Error("Can only promisify functions!");return function(){for(var d=arguments.length,e=Array(d),f=0;d>f;f++)e[f]=arguments[f];return new c.Promise(function(c,d){e.push(function(a,b){a?d(a):c(b)});try{var f=a.apply(b||this,e);f&&f.then&&f.then(c,d)}catch(g){d(g)}})}}},remove:H,set:N,slice:C,sort:K,toJson:JSON.stringify,updateTimestamp:function(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b},upperCase:L,removeCircular:function(a){return function b(a,c){var d=void 0,e=void 0;if(!("object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String||a instanceof R)){for(var f=c.cur,g=c.ctx;g;){if(g.cur===f)return void 0;g=g.ctx}if(V(a))for(e=[],d=0;d<a.length;d+=1)e[d]=b(a[d],{ctx:c,cur:a[d]});else e={},D(a,function(d,f){e[f]=b(a[f],{ctx:c,cur:a[f]})});return e}return a}(a,{ctx:null,cur:a})},resolveItem:v,resolveId:u,respond:function(a,b,c){return"array"===c.returnMeta?[a,b]:"object"===c.returnMeta?{response:a,meta:b}:a},w:P,applyRelationGettersToTarget:function(a,b,c){this.forEach(b.relationList,function(d){var e=d.relation,f=d.localField,g=d.localKey,h=d.foreignKey,i=d.localKeys,j=d.foreignKeys,k="boolean"==typeof d.enumerable?d.enumerable:!!b.relationsEnumerable;if("boolean"==typeof d.link?d.link:!!b.linkRelations){delete c[f];var l={enumerable:k};"belongsTo"===d.type?(l.get=function(){return M(this,g)?b.getResource(e).get(M(this,g)):void 0},l.set=function(a){return a&&N(this,g,M(a,b.getResource(e).idAttribute)),M(this,f)}):"hasMany"===d.type?(l.get=function(){var c={};if(h)return c[h]=this[b.idAttribute],b.getResource(e).defaultFilter.call(a,a.store[e].collection,e,c,{allowSimpleWhere:!0});if(i){var d=M(this,i)||[];return b.getResource(e).getAll(V(d)?d:J(d))}return j?(N(c,"where."+j+".contains",this[b.idAttribute]),b.getResource(e).defaultFilter.call(a,a.store[e].collection,e,c)):void 0},l.set=function(a){var c=this;return a&&a.length&&!function(){var d=M(c,b.idAttribute);h?B(a,function(a){N(a,h,d)}):i?!function(){var d=[];B(a,function(a){d.push(M(a,b.getResource(e).idAttribute))}),N(c,i,d)}():j&&B(a,function(a){var b=M(a,j);b?E(b,d)||b.push(d):N(a,j,[d])})}(),M(this,f)}):"hasOne"===d.type&&(g?(l.get=function(){return M(this,g)?b.getResource(e).get(M(this,g)):void 0},l.set=function(a){return a&&N(this,g,M(a,b.getResource(e).idAttribute)),M(this,f)}):(l.get=function(){var c={};c[h]=this[b.idAttribute];var d=c[h]?b.getResource(e).defaultFilter.call(a,a.store[e].collection,e,c,{allowSimpleWhere:!0}):[];return d.length?d[0]:void 0},l.set=function(a){return a&&N(a,h,M(this,b.idAttribute)),M(this,f)})),d.get&&!function(){var a=l.get;l.get=function(){var c=this;return d.get(b,d,this,function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return a.apply(c,d)})}}(),Object.defineProperty(c,f,l)}})}}},function(a,b){function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var e=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;h=j=i=void 0,d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;return void 0===i?void 0:i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return void 0;a=j,b=f,c=g,d=!0}},f=function(a){function b(a){c(this,b),e(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a}return d(b,a),b}(Error),g=function(a){function b(a){c(this,b),e(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a}return d(b,a),b}(Error),h=function(a){function b(a){c(this,b),e(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a+" is not a registered resource!"}return d(b,a),b}(Error);b["default"]={IllegalArgumentError:f,IA:f,RuntimeError:g,R:g,NonexistentResourceError:h,NER:h}},function(a,b,c){!function(b,c){a.exports=c()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){function d(a,b,c){for(var d=a[c],e=b(d);c>0;){var f=Math.floor((c+1)/2)-1,g=a[f];if(e>=b(g))break;a[f]=d,a[c]=g,c=f}}function e(a,b){if(a||(a=function(a){return a}),b||(b=function(a,b){return a===b}),"function"!=typeof a)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');if("function"!=typeof b)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');this.weightFunc=a,this.compareFunc=b,this.heap=[]}var f=function(a,b,c){for(var d=a.length,e=a[c],f=b(e);;){var g=2*(c+1),h=g-1,i=null;if(d>h){var j=a[h],k=b(j);f>k&&(i=h)}if(d>g){var l=a[g],m=b(l);m<(null===i?f:b(a[h]))&&(i=g)}if(null===i)break;a[c]=a[i],a[i]=e,c=i}},g=e.prototype;g.push=function(a){this.heap.push(a),d(this.heap,this.weightFunc,this.heap.length-1)},g.peek=function(){return this.heap[0]},g.pop=function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,f(this.heap,this.weightFunc,0)),a},g.remove=function(a){for(var b=this.heap.length,c=0;b>c;c++)if(this.compareFunc(this.heap[c],a)){var e=this.heap[c],g=this.heap.pop();return c!==b-1&&(this.heap[c]=g,d(this.heap,this.weightFunc,c),f(this.heap,this.weightFunc,c)),e}return null},g.removeAll=function(){this.heap=[]},g.size=function(){return this.heap.length},a.exports=e}])})},function(a,b){function c(a,b,c){if(null!=a)for(var d=-1,e=a.length;++d<e&&b.call(c,a[d],d,a)!==!1;);}a.exports=c},function(a,b){function c(a,b,c){var d=a.length;b=null==b?0:0>b?Math.max(d+b,0):Math.min(b,d),c=null==c?d:0>c?Math.max(d+c,0):Math.min(c,d);for(var e=[];c>b;)e.push(a[b++]);return e}a.exports=c},function(a,b,c){function d(a,b,c){f(a,function(d,f){return e(a,f)?b.call(c,a[f],f,a):void 0})}var e=c(8),f=c(9);a.exports=d},function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}a.exports=c},function(a,b,c){function d(){h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],g=!0;for(var a in{toString:null})g=!1}function e(a,b,c){var e,j=0;null==g&&d();for(e in a)if(f(b,a,e,c)===!1)break;if(g)for(var k=a.constructor,l=!!k&&a===k.prototype;(e=h[j++])&&("constructor"===e&&(l||!i(a,e))||a[e]===Object.prototype[e]||f(b,a,e,c)!==!1););}function f(a,b,c,d){return a.call(d,b[c],c,b)}var g,h,i=c(8);a.exports=e},function(a,b,c){function d(a,b){return-1!==e(a,b)}var e=c(11);a.exports=d},function(a,b){function c(a,b,c){if(c=c||0,null==a)return-1;for(var d=a.length,e=0>c?d+c:c;d>e;){if(a[e]===b)return e;e++}return-1}a.exports=c},function(a,b,c){function d(a,b){for(var c,d=0,g=arguments.length;++d<g;)c=arguments[d],c&&f(c,e,a);return a}function e(a,b){var c=this[b];g(a)&&g(c)?d(c,a):this[b]=a}var f=c(7),g=c(13);a.exports=d},function(a,b){function c(a){return!!a&&"object"==typeof a&&a.constructor===Object}a.exports=c},function(a,b,c){function d(a){return a=e(a),f(a).replace(/^[a-z]/,g)}var e=c(15),f=c(16),g=c(19);a.exports=d},function(a,b){function c(a){return null==a?"":a.toString()}a.exports=c},function(a,b,c){function d(a){return a=e(a),a=f(a),a=g(a).replace(/[\-_]/g," ").replace(/\s[a-z]/g,h).replace(/\s+/g,"").replace(/^[A-Z]/g,i)}var e=c(15),f=c(17),g=c(18),h=c(19),i=c(20);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.search(/[\xC0-\xFF]/g)>-1&&(a=a.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),a}var e=c(15);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.replace(f,"")}var e=c(15),f=/[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toUpperCase()}var e=c(15);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toLowerCase()}var e=c(15);a.exports=d},function(a,b,c){function d(a,b){var c=e(a,b);-1!==c&&a.splice(c,1)}var e=c(11);a.exports=d},function(a,b,c){function d(a,b){for(var c,d="string"!=typeof arguments[1]?arguments[1]:e(arguments,1),f={},g=0;c=d[g++];)f[c]=a[c];return f}var e=c(6);a.exports=d},function(a,b,c){var d=c(7),e=Object.keys||function(a){var b=[];return d(a,function(a,c){b.push(c)}),b};a.exports=e},function(a,b){function c(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=d);var f,g,h;return f=~~(a.length/2),g=c(a.slice(0,f),b),h=c(a.slice(f,a.length),b),e(g,h,b)}function d(a,b){return b>a?-1:a>b?1:0}function e(a,b,c){for(var d=[];a.length&&b.length;)c(a[0],b[0])<=0?d.push(a.shift()):d.push(b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}a.exports=c},function(a,b,c){function d(a,b){for(var c=b.split("."),d=c.pop();b=c.shift();)if(a=a[b],null==a)return;return a[d]}c(26);a.exports=d},function(a,b){function c(a){switch(typeof a){case"string":case"number":case"boolean":return!0}return null==a}a.exports=c},function(a,b,c){function d(a,b,c){var d=/^(.+)\.(.+)$/.exec(b);d?e(a,d[1])[d[2]]=c:a[b]=c}var e=c(28);a.exports=d},function(a,b,c){function d(a,b){return b?(e(b.split("."),function(b){a[b]||(a[b]={}),a=a[b]}),a):a}var e=c(5);a.exports=d},function(a,b){!function(a){function b(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function c(b){for(var c=0;s>c&&b.check_();)c++;return p&&(a.dirtyCheckCycleCount=c),c>0}function d(a){for(var b in a)return!1;return!0}function e(a){return d(a.added)&&d(a.removed)&&d(a.changed)}function f(a,b){if(!b||!b.length)return!1;for(var c,d=0;d<b.length;d++)if("[object RegExp]"===Object.prototype.toString.call(b[d])&&b[d].test(a)||b[d]===a)return c=a;return!!c}function g(a,b,c,d){var e={},g={},h={};for(var i in b){var j=a[i];f(i,d)||void 0!==j&&(c?c(j,b[i]):j===b[i])||(i in a?(c?c(j,b[i]):j===b[i])||(h[i]=j):g[i]=void 0)}for(var i in a)i in b||f(i,d)||(e[i]=a[i]);return Array.isArray(a)&&a.length!==b.length&&(h.length=a.length),{added:e,removed:g,changed:h}}function h(){if(!t.length)return!1;for(var a=0;a<t.length;a++)t[a]();return t.length=0,!0}function i(){function a(a){b&&b.state_===x&&!d&&b.check_(a)}var b,c,d=!1,e=!0;return{open:function(c){if(b)throw Error("ObservedObject in use");e||Object.deliverChangeRecords(a),b=c,e=!1},observe:function(b,d){c=b,d?Array.observe(c,a):Object.observe(c,a)},deliver:function(b){d=b,Object.deliverChangeRecords(a),d=!1},close:function(){b=void 0,Object.unobserve(c,a),v.push(this)}}}function j(a,b,c){var d=v.pop()||i();return d.open(a),d.observe(b,c),d}function k(){this.state_=w,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=z++}function l(a){k._allObserversCount++,B&&A.push(a)}function m(a){k._allObserversCount--}function n(a){k.call(this),this.value_=a,this.oldObject_=void 0}function o(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];E[g.type]?(g.name in c||(c[g.name]=g.oldValue),"update"!=g.type&&("add"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}var p=a.testingExposeCycleCount,q=b(),r="__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c},s=1e3,t=[],u=q?function(){return function(a){return Promise.resolve().then(a)}}():function(){return function(a){t.push(a)}}(),v=[],w=0,x=1,y=2,z=1;k.prototype={open:function(a,b){if(this.state_!=w)throw Error("Observer has already been opened.");return l(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=x,this.value_},close:function(){this.state_==x&&(m(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=y)},deliver:function(){this.state_==x&&c(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){k._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var A,B=!q;k._allObserversCount=0,B&&(A=[]);var C=!1;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!C&&B){C=!0;var b,c,d=0;do{d++,c=A,A=[],b=!1;for(var e=0;e<c.length;e++){var f=c[e];f.state_==x&&(f.check_()&&(b=!0),A.push(f))}h()&&(b=!0)}while(s>d&&b);p&&(a.dirtyCheckCycleCount=d),C=!1}},B&&(a.Platform.clearObservers=function(){A=[]}),n.prototype=r({__proto__:k.prototype,arrayObserve:!1,connect_:function(a,b){q?this.directObserver_=j(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(a){var b=Array.isArray(a)?[]:{};for(var c in a)b[c]=a[c];return Array.isArray(a)&&(b.length=a.length),b},check_:function(a,b){var c,d;if(q){if(!a)return!1;d={},c=o(this.value_,a,d)}else d=this.oldObject_,c=g(this.value_,this.oldObject_);return e(c)?!1:(q||(this.oldObject_=this.copyObject(this.value_)),this.report_([c.added||{},c.removed||{},c.changed||{},function(a){return d[a]}]),!0)},disconnect_:function(){q?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==x&&(q?this.directObserver_.deliver(!1):c(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}});var D={},E={add:!0,update:!0,"delete":!0};a.Observer=k,a.isBlacklisted=f,a.Observer.runEOM_=u,a.Observer.observerSentinel_=D,a.Observer.hasObjectObserve=q,a.diffObjectFromOldObject=g,a.ObjectObserver=n}(b)},function(a,b,c){function d(a){return!(f["default"].isEmpty(a.added)&&f["default"].isEmpty(a.removed)&&f["default"].isEmpty(a.changed))}function e(a,b,c,d){var e=this,g=e.definitions[b];if(d=d||{},c=f["default"].resolveId(g,c),!g)throw new h(b);if(!f["default"]._sn(c))throw f["default"]._snErr("id");return c=c===k?void 0:c,d=f["default"]._(g,d),{_this:e,definition:g,_resourceName:b,_id:c,_options:d}}var f=c(2),g=c(3),h=g["default"].NER,i=g["default"].IA,j=g["default"].R,k="DS_"+(new Date).getTime();b["default"]={changes:function(a,b,c){var d=e.call(this,"changes",a,b,c),g=d._this,h=d.definition,i=d._resourceName,j=d._id,k=d._options,l=h.get(j);if(l){var m=function(){var a=g.store[i].observers[j];a&&"function"==typeof a&&a.deliver();var b=k.ignoredChanges||[];f["default"].forEach(h.relationFields,function(a){f["default"].contains(b,a)||b.push(a)});var c=f["default"].diffObjectFromOldObject(l,g.store[i].previousAttributes[j],f["default"].equals,b);return f["default"].forOwn(c,function(a,b){var d=[];f["default"].forOwn(a,function(a,b){f["default"].isFunction(a)||d.push(b)}),c[b]=f["default"].pick(c[b],d)}),f["default"].forEach(h.relationFields,function(a){delete c.added[a],delete c.removed[a],delete c.changed[a]}),{v:c}}();if("object"==typeof m)return m.v}},changeHistory:function(a,b){var c=e.call(this,"changeHistory",a,b||k),d=c._this,f=c.definition,g=c._resourceName,h=c._id,i=d.store[g];if(f.keepChangeHistory){if(!g)return i.changeHistory;var j=f.get(h);if(j)return i.changeHistories[h]}else f.errorFn("changeHistory is disabled for this resource!")},compute:function(a,b){var c=this,d=c.definitions[a];if(b=f["default"].resolveItem(c.store[a],b),!d)throw new h(a);if(!b)throw new j("Item not in the store!");if(!f["default"]._o(b)&&!f["default"]._sn(b))throw new i('"instance" must be an object, string or number!');return f["default"].forOwn(d.computed,function(a,c){f["default"].compute.call(b,a,c)}),b},createInstance:function(a,b,c){var d=this.definitions[a],e=void 0;if(b=b||{},!d)throw new h(a);if(b&&!f["default"].isObject(b))throw new i('"attrs" must be an object!');c=f["default"]._(d,c),c.beforeCreateInstance(c,b);var g=d[d["class"]];return e=new g,d.instanceEvents&&f["default"].Events(e),c.defaultValues&&f["default"].deepMixIn(e,c.defaultValues),f["default"].deepMixIn(e,b),d.computed&&d.compute(e),c.afterCreateInstance(c,e),e},createCollection:function(a,b,c,d){var e=this,g=e.definitions[a];if(b=b||[],c=c||{},!g)throw new h(a);if(b&&!f["default"].isArray(b))throw new i('"arr" must be an array!');return d=f["default"]._(g,d),d.beforeCreateCollection(d,b),Object.defineProperties(b,{fetch:{value:function(b,c){var d=this;return d.params=b||d.params,g.findAll(d.params,c).then(function(b){return b===d?d:(b.unshift(d.length),b.unshift(0),d.splice.apply(d,b),b.shift(),b.shift(),b.$$injected&&(e.store[a].queryData[f["default"].toJson(d.params)]=d,d.$$injected=!0),d)})}},params:{value:c,writable:!0},resourceName:{value:a}}),d.afterCreateCollection(d,b),b},defineResource:c(31),digest:function(){this.observe.Platform.performMicrotaskCheckpoint()},eject:c(32),ejectAll:c(33),filter:c(34),get:function(a,b){var c=e.call(this,"get",a,b),d=c._this,f=c._resourceName,g=c._id;return d.store[f].index[g]},getAll:function(a,b){var c=this,d=c.definitions[a],e=c.store[a],g=[];if(!d)throw new h(a);if(b&&!f["default"]._a(b))throw f["default"]._aErr("ids");if(f["default"]._a(b))for(var i=b.length,j=0;i>j;j++)e.index[b[j]]&&g.push(e.index[b[j]]);else g=e.collection.slice();return g},hasChanges:function(a,b){var c=e.call(this,"hasChanges",a,b),f=c.definition,g=c._id;return f.get(g)?d(f.changes(g)):!1},inject:c(35),lastModified:function(a,b){var c=e.call(this,"lastModified",a,b||k),d=c._this,f=c._resourceName,g=c._id,h=d.store[f];return g?(g in h.modified||(h.modified[g]=0),h.modified[g]):h.collectionModified},lastSaved:function(a,b){var c=e.call(this,"lastSaved",a,b||k),d=c._this,f=c._resourceName,g=c._id,h=d.store[f];return g in h.saved||(h.saved[g]=0),h.saved[g]},previous:function(a,b){var c=e.call(this,"previous",a,b),d=c._this,g=c._resourceName,h=c._id,i=d.store[g];return i.previousAttributes[h]?f["default"].copy(i.previousAttributes[h]):void 0; | ||
},revert:function(a,b){var c=e.call(this,"revert",a,b),d=c._this,f=c.definition,g=c._resourceName,h=c._id;return f.inject(d.previous(g,h))}}},function(a,b,c){var d=c(2),e=c(3),f=["compute","eject","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","previous","revert"];a.exports=function(a){function b(b){this.defaultValues={},this.methods={},this.computed={},this.scopes={},d["default"].deepMixIn(this,b);var e=c.defaults;a["extends"]&&g[a["extends"]]&&(e=g[a["extends"]]),d["default"].fillIn(this.defaultValues,e.defaultValues),d["default"].fillIn(this.methods,e.methods),d["default"].fillIn(this.computed,e.computed),d["default"].fillIn(this.scopes,e.scopes),this.endpoint="endpoint"in b?b.endpoint:this.name}var c=this,g=c.definitions;if(d["default"]._s(a)&&(a={name:a.replace(/\s/gi,"")}),!d["default"]._o(a))throw d["default"]._oErr("definition");if(!d["default"]._s(a.name))throw new e["default"].IA('"name" must be a string!');if(g[a.name])throw new e["default"].R(a.name+" is already registered!");try{var h,i,j=function(){if(a["extends"]&&g[a["extends"]]?b.prototype=g[a["extends"]]:b.prototype=c.defaults,g[a.name]=new b(a),h=g[a.name],h.getResource=function(a){return c.definitions[a]},!d["default"]._s(h.idAttribute))throw new e["default"].IA('"idAttribute" must be a string!');h.relations&&(h.relationList=[],h.relationFields=[],d["default"].forOwn(h.relations,function(a,b){d["default"].forOwn(a,function(c,e){d["default"]._a(c)||(a[e]=[c]),d["default"].forEach(a[e],function(a){a.type=b,a.relation=e,a.name=h.name,h.relationList.push(a),a.localField&&h.relationFields.push(a.localField)})})}),h.relations.belongsTo&&d["default"].forOwn(h.relations.belongsTo,function(a,b){d["default"].forEach(a,function(a){a.parent&&(h.parent=b,h.parentKey=a.localKey,h.parentField=a.localField)})}),"function"==typeof Object.freeze&&(Object.freeze(h.relations),Object.freeze(h.relationList))),i=h["class"]=d["default"].pascalCase(h.name);try{"function"==typeof h.useClass?(h[i]=new Function("def","return function "+i+"() { def.useClass.call(this); }")(h),h[i].prototype=function(a){function b(){}return b.prototype=a,new b}(h.useClass.prototype)):h[i]=new Function("return function "+i+"() {}")()}catch(j){h[i]=function(){}}d["default"].forOwn(h.methods,function(a,b){h[i].prototype[b]=a}),h[i].prototype.set=function(a,b){var c=this;return d["default"].set(this,a,b),h.compute(this),h.instanceEvents&&setTimeout(function(){c.emit("DS.change",h,c)},0),h.handleChange(this),this},h[i].prototype.get=function(a){return d["default"].get(this,a)},d["default"].applyRelationGettersToTarget(c,h,h[i].prototype);var k=null;h.hasOwnProperty("omit")?k=c.defaults.omit:(k=h.omit,h.omit=[]),h.omit=h.omit.concat(k||[]),d["default"].forOwn(h.computed,function(a,b){if(d["default"].isFunction(a)&&(h.computed[b]=[a],a=h.computed[b]),h.methods&&b in h.methods&&h.errorFn('Computed property "'+b+'" conflicts with previously defined prototype method!'),h.omit.push(b),d["default"].isArray(a)){var c;if(1===a.length){var e=a[0].toString().match(/function.*?\(([\s\S]*?)\)/);c=e[1].split(","),c=d["default"].filter(c,function(a){return a}),h.computed[b]=c.concat(a),a=h.computed[b],c.length&&h.errorFn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),d["default"].forEach(c,function(a,b){c[b]=a.trim()}),a.deps=d["default"].filter(c,function(a){return!!a})}else d["default"].isObject(a)&&Object.defineProperty(h[i].prototype,b,a)}),d["default"].forEach(f,function(a){h[i].prototype["DS"+d["default"].pascalCase(a)]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return d.unshift(this[h.idAttribute]||this),d.unshift(h.name),c[a].apply(c,d)}}),h[i].prototype.DSCreate=function(){for(var a=arguments.length,b=Array(a),d=0;a>d;d++)b[d]=arguments[d];return b.unshift(this),b.unshift(h.name),c.create.apply(c,b)},c.store[h.name]={collection:[],expiresHeap:new d["default"].BinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},queryData:{},pendingQueries:{},index:{},modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0};var l=c.store[h.name];h.reapInterval&&setInterval(function(){return h.reap()},h.reapInterval);var m=["registerAdapter","getAdapterName","getAdapter","is","!clear"];for(var n in c)"function"==typeof c[n]&&m.push(n);d["default"].forEach(m,function(a){var b=a;"!"!==b[0]&&(c[b].shorthand!==!1?(h[b]=function(){for(var a=arguments.length,d=Array(a),e=0;a>e;e++)d[e]=arguments[e];return d.unshift(h.name),c[b].apply(c,d)},h[b].before=function(a){var c=h[b];h[b]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return c.apply(h,a.apply(h,d)||d)}}):h[b]=function(){for(var a=arguments.length,d=Array(a),e=0;a>e;e++)d[e]=arguments[e];return c[b].apply(c,d)})}),h.beforeValidate=d["default"].promisify(h.beforeValidate),h.validate=d["default"].promisify(h.validate),h.afterValidate=d["default"].promisify(h.afterValidate),h.beforeCreate=d["default"].promisify(h.beforeCreate),h.afterCreate=d["default"].promisify(h.afterCreate),h.afterFind=d["default"].promisify(h.afterFind),h.afterFindAll=d["default"].promisify(h.afterFindAll),h.afterLoadRelations=d["default"].promisify(h.afterLoadRelations),h.beforeUpdate=d["default"].promisify(h.beforeUpdate),h.afterUpdate=d["default"].promisify(h.afterUpdate),h.beforeDestroy=d["default"].promisify(h.beforeDestroy),h.afterDestroy=d["default"].promisify(h.afterDestroy);var o=void 0;return h.hasOwnProperty("defaultAdapter")&&(o=h.defaultAdapter),d["default"].forOwn(h.actions,function(a,b){if(h[b]&&!h.actions[b])throw new Error('Cannot override existing method "'+b+'"!');a.request=a.request||function(a){return a},a.response=a.response||function(a){return a},a.responseError=a.responseError||function(a){return d["default"].Promise.reject(a)},h[b]=function(c,e){d["default"]._o(c)&&(e=c),e=e||{};var f=h.getAdapter(a.adapter||o||"http"),g=d["default"].deepMixIn({},a);if(!e.hasOwnProperty("endpoint")&&g.endpoint&&(e.endpoint=g.endpoint),"function"==typeof e.getEndpoint)g.url=e.getEndpoint(h,e);else{var i=[e.basePath||h.basePath||f.defaults.basePath,f.getEndpoint(h,d["default"]._sn(c)?c:null,e)];d["default"]._sn(c)&&i.push(c),i.push(a.pathname||b),g.url=d["default"].makePath.apply(null,i)}return g.method=g.method||"GET",d["default"].deepMixIn(g,e),new d["default"].Promise(function(a){return a(g)}).then(e.request||a.request).then(function(a){return f.HTTP(a)}).then(e.response||a.response,e.responseError||a.responseError)}}),d["default"].Events(h),h.handleChange=function(a){l.collectionModified=d["default"].updateTimestamp(l.collectionModified),h.notify&&setTimeout(function(){h.emit("DS.change",h,a)},0)},{v:h}}();if("object"==typeof j)return j.v}catch(k){throw c.defaults.errorFn(k),delete g[a.name],delete c.store[a.name],k}}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=d.store[a],h=void 0,i=!1;if(b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");c=e._(f,c);for(var j=0;j<g.collection.length;j++)if(g.collection[j][f.idAttribute]==b){h=g.collection[j],g.expiresHeap.remove(h),i=!0;break}if(i){var k=function(){f.beforeEject(c,h),c.notify&&f.emit("DS.beforeEject",f,h);var a=[];return e.forOwn(g.queryData,function(b,d){b.$$injected&&e.remove(b,h),!b.length&&c.clearEmptyQueries&&a.push(d)}),e.forEach(g.changeHistories[b],function(a){e.remove(g.changeHistory,a)}),e.forEach(a,function(a){delete g.completedQueries[a],delete g.queryData[a]}),g.observers[b]&&"function"==typeof g.observers[b].close&&g.observers[b].close(),delete g.observers[b],delete g.index[b],delete g.previousAttributes[b],delete g.completedQueries[b],delete g.pendingQueries[b],delete g.changeHistories[b],delete g.modified[b],delete g.saved[b],f.instanceEvents&&h.off&&h.off(),g.collection.splice(j,1),f.handleChange(h),f.afterEject(c,h),c.notify&&f.emit("DS.afterEject",f,h),{v:h}}();if("object"==typeof k)return k.v}}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a];if(b=b||{},!f)throw new d.errors.NER(a);if(!e._o(b))throw e._oErr("params");c=e._(f,c),e.applyScope(f,b,c);var g=d.store[a],h=e.toJson(b),i=f.filter(b);return e.isEmpty(b)?g.completedQueries={}:delete g.completedQueries[h],e.forEach(i,function(a){a&&a[f.idAttribute]&&f.eject(a[f.idAttribute],c)}),f.handleChange(i),i}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a];if(!f)throw new d.errors.NER(a);if(b&&!e._o(b))throw e._oErr("params");return b=b||{},c=e._(f,c),e.applyScope(f,b,c),f.defaultFilter.call(d,d.store[a].collection,a,b,c)}},function(a,b,c){function d(a,b){var c=this,d=a.name;return function(e,g,h,i,j){var k=this,l=void 0,m=i&&i(a.idAttribute)?i(a.idAttribute):k[a.idAttribute];if(f["default"].forEach(a.relationFields,function(a){delete e[a],delete g[a],delete h[a]}),(!f["default"].isEmpty(e)||!f["default"].isEmpty(g)||!f["default"].isEmpty(h)||j)&&(l=c.get(d,m),b.modified[m]=f["default"].updateTimestamp(b.modified[m]),l&&a.instanceEvents&&setTimeout(function(){l.emit("DS.change",a,l)},0),a.handleChange(l),a.keepChangeHistory)){var n={resourceName:d,target:l,added:e,removed:g,changed:h,timestamp:b.modified[m]};b.changeHistories[m].push(n),b.changeHistory.push(n)}a.computed&&(l=l||c.get(d,m),f["default"].forOwn(a.computed,function(a,b){if(!f["default"]._o(a)){var c=!1;f["default"].forEach(a.deps,function(a){(a in e||a in g||a in h||!(b in l))&&(c=!0)}),c=c||!a.deps.length,c&&f["default"].compute.call(l,a,b)}})),a.idAttribute in h&&a.errorFn('Doh! You just changed the primary key of an object! Your data for the "'+d+'" resource is now in an undefined (probably broken) state.')}}function e(a,b,c,h){var i=this,j=void 0;if(f["default"]._a(c)){j=[];for(var k=0;k<c.length;k++)j.push(e.call(i,a,b,c[k],h))}else{var l=a.computed,m=a.idAttribute;if(l&&l[m]&&!function(){var a=[];f["default"].forEach(l[m].deps,function(b){a.push(c[b])}),c[m]=l[m][l[m].length-1].apply(c,a)}(),!(m in c)){var n=new g["default"].R(a.name+'.inject: "attrs" must contain the property specified by "idAttribute"!');throw h.errorFn(n),n}try{!function(){f["default"].forEach(a.relationList,function(b){var d=b.relation,e=i.definitions[d],j=c[b.localField];if("function"==typeof b.inject)b.inject(a,b,c);else if(j&&b.inject!==!1){if(!e)throw new g["default"].R(a.name+" relation is defined but the resource is not!");if(f["default"]._a(j))!function(){var g=[];f["default"].forEach(j,function(j){if(j!==i.store[d].index[j[e.idAttribute]])try{var k=e.inject(j,h.orig());b.foreignKey&&f["default"].set(k,b.foreignKey,c[a.idAttribute]),g.push(k)}catch(l){h.errorFn(l,"Failed to inject "+b.type+' relation: "'+d+'"!')}})}();else if(j!==i.store[d].index[j[e.idAttribute]])try{var k=e.inject(c[b.localField],h.orig());b.foreignKey&&f["default"].set(k,b.foreignKey,c[a.idAttribute])}catch(l){h.errorFn(l,"Failed to inject "+b.type+' relation: "'+d+'"!')}}});var e=c[m],k=a.get(e),l=k?b.modified[e]:0;if(k)"merge"===h.onConflict?f["default"].deepMixIn(k,c):"replace"===h.onConflict&&(f["default"].forOwn(k,function(b,d){d!==a.idAttribute&&(c.hasOwnProperty(d)||delete k[d])}),f["default"].forOwn(c,function(b,c){c!==a.idAttribute&&(k[c]=b)})),a.resetHistoryOnInject&&(b.previousAttributes[e]=f["default"].copy(k,null,null,null,a.relationFields),b.changeHistories[e].length&&(f["default"].forEach(b.changeHistories[e],function(a){f["default"].remove(b.changeHistory,a)}),b.changeHistories[e].splice(0,b.changeHistories[e].length))),b.observers[e]&&"function"==typeof b.observers[e]&&b.observers[e].deliver();else{k=c instanceof a[a["class"]]?c:new a[a["class"]],a.instanceEvents&&"function"!=typeof k.emit&&f["default"].Events(k),f["default"].forEach(a.relationList,function(b){("boolean"==typeof b.link?b.link:!!a.linkRelations)&&delete c[b.localField]}),f["default"].deepMixIn(k,c),b.collection.push(k),b.changeHistories[e]=[];var n=d.call(i,a,b);a.watchChanges&&(b.observers[e]=new i.observe.ObjectObserver(k),b.observers[e].open(n,k)),b.index[e]=k,n.call(k,{},{},{},null,!0),b.previousAttributes[e]=f["default"].copy(k,null,null,null,a.relationFields)}b.modified[e]=l&&b.modified[e]===l?f["default"].updateTimestamp(b.modified[e]):b.modified[e],b.expiresHeap.remove(k);var o=(new Date).getTime();b.expiresHeap.push({item:k,timestamp:o,expires:a.maxAge?o+a.maxAge:Number.MAX_VALUE}),j=k}()}catch(o){h.errorFn(o,c)}}return j}var f=c(2),g=c(3);a.exports=function(a,b,c){var d=this,h=d.definitions[a],i=d.store[a],j=void 0;if(!h)throw new g["default"].NER(a);if(!f["default"]._o(b)&&!f["default"]._a(b))throw new g["default"].IA(a+'.inject: "attrs" must be an object or an array!');return c=f["default"]._(h,c),c.beforeInject(c,b),c.notify&&h.emit("DS.beforeInject",h,b),j=e.call(d,h,i,b,c),h.handleChange(j),c.afterInject(c,j),c.notify&&h.emit("DS.afterInject",h,j),j}},function(a,b,c){b["default"]={create:c(37),destroy:c(38),destroyAll:c(39),find:c(40),findAll:c(41),loadRelations:c(42),reap:c(43),refresh:function(a,b,c){var d=this,e=d.utils;return new e.Promise(function(f,g){var h=d.definitions[a];b=e.resolveId(d.definitions[a],b),h?e._sn(b)?(c=e._(h,c),c.bypassCache=!0,f(d.get(a,b))):g(e._snErr("id")):g(new d.errors.NER(a))}).then(function(e){return e?d.find(a,b,c):e})["catch"](d.errorFn("refresh",a,b,c))},refreshAll:function(a,b,c){var d=this,e=d.utils,f=d.definitions[a];return b=b||{},new e.Promise(function(g,h){f?e._o(b)?(c=e._(f,c),c.bypassCache=!0,g(d.filter(a,b,c))):h(e._oErr("params")):h(new d.errors.NER(a))}).then(function(g){return c.bypassCache=!0,d.findAll(a,b,c).then(function(a){return e.forEach(g,function(b){-1===a.indexOf(b)&&f.eject(b)}),a})})["catch"](d.errorFn("refreshAll",a,b,c))},save:c(44),update:c(45),updateAll:c(46)}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=void 0;c=c||{},b=b||{};var h=void 0;if(f)if(e._o(b)){if(c=e._(f,c),c.upsert&&e._sn(b[f.idAttribute]))return d.update(a,b[f.idAttribute],b,c)}else h=e._oErr("attrs");else h=new d.errors.NER(a);return new e.Promise(function(a,c){h?c(h):a(b)}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeCreate.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeCreate",f,a),g=d.getAdapterName(c),d.adapters[g].create(f,e.omit(a,c.omit),c)}).then(function(a){return c.afterCreate.call(a,c,a)}).then(function(b){if(c.notify&&f.emit("DS.afterCreate",f,b),c.cacheResponse){var g=d.inject(f.name,b,c.orig()),h=g[f.idAttribute],i=d.store[a];return i.completedQueries[h]=(new Date).getTime(),i.saved[h]=e.updateTimestamp(i.saved[h]),g}return d.createInstance(a,b,c)}).then(function(a){return e.respond(a,{adapter:g},c)})["catch"](d.errorFn("create",a,b,c))}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=void 0,h=void 0;return new e.Promise(function(h,i){b=e.resolveId(f,b),f?e._sn(b)?(g=f.get(b)||{id:b},c=e._(f,c),h(g)):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){return c.beforeDestroy.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeDestroy",f,a),c.eagerEject&&f.eject(b),h=f.getAdapter(c),h.destroy(f,b,c)}).then(function(){return c.afterDestroy.call(g,c,g)}).then(function(a){return c.notify&&f.emit("DS.afterDestroy",f,a),f.eject(b),e.respond(b,{adapter:h},c)})["catch"](function(e){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),d.errorFn("destroy",a,b,c)(e)})}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=void 0,h=void 0,i=void 0;return b=b||{},new e.Promise(function(g,h){f?e._o(b)?(c=e._(f,c),e.applyScope(f,b,c),g()):h(e._oErr("attrs")):h(new d.errors.NER(a))}).then(function(){return h=f.defaultFilter.call(d,a,b),c.beforeDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.beforeDestroy",f,h),c.eagerEject&&(g=f.ejectAll(b)),i=f.getAdapterName(c),d.adapters[i].destroyAll(f,b,c)}).then(function(){return c.afterDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.afterDestroy",f,h),g||f.ejectAll(b)}).then(function(a){return e.respond(a,{adapter:i},c)})["catch"](function(e){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),d.errorFn("destroyAll",a,b,c)(e)})}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=d.store[a],h=void 0;return new e.Promise(function(h,i){f?e._sn(b)?(c=e._(f,c),c.params&&(c.params=e.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&delete g.completedQueries[b],(!c.findStrictCache||b in g.completedQueries)&&f.get(b)&&!c.bypassCache?h(f.get(b)):(delete g.completedQueries[b],h())):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){if(a)return a;if(!(b in g.pendingQueries)){var i=void 0,j=c.findStrategy||c.strategy;if("fallback"===j){var k=function l(a){return h=f.getAdapterName((c.findFallbackAdapters||c.fallbackAdapters)[a]),d.adapters[h].find(f,b,c)["catch"](function(b){return a++,a<c.fallbackAdapters.length?l(a):e.Promise.reject(b)})};i=k(0)}else h=f.getAdapterName(c),i=d.adapters[h].find(f,b,c);g.pendingQueries[b]=i.then(function(a){return c.afterFind.call(a,c,a)}).then(function(a){if(delete g.pendingQueries[b],c.cacheResponse){var d=f.inject(a,c.orig());return g.completedQueries[b]=(new Date).getTime(),g.saved[b]=e.updateTimestamp(g.saved[b]),d}return f.createInstance(a,c.orig())})}return g.pendingQueries[b]}).then(function(a){return e.respond(a,{adapter:h},c)})["catch"](function(e){return g&&delete g.pendingQueries[b],d.errorFn("find",a,b,c)(e)})}},function(a,b){function c(a,b,c,d){var e=this,f=e.utils,g=e.definitions[b],h=e.store[b],i=e.definitions[b].idAttribute,j=(new Date).getTime();a=a||[],delete h.pendingQueries[c],h.completedQueries[c]=j;var k=g.inject(a,d.orig());return f._a(k)?f.forEach(k,function(a){if(a){var b=a[i];b&&(h.completedQueries[b]=j,h.saved[b]=f.updateTimestamp(h.saved[b]))}}):(d.errorFn("response is expected to be an array!"),h.completedQueries[k[i]]=j),k}a.exports=function(a,b,d){var e=this,f=e.utils,g=e.definitions[a],h=e.store[a],i=void 0,j=void 0;return new f.Promise(function(c,j){b=b||{},e.definitions[a]?f._o(b)?(d=f._(g,d),i=f.toJson(b),d.params&&(d.params=f.copy(d.params)),f.applyScope(g,b,d),(d.bypassCache||!d.cacheResponse)&&(delete h.completedQueries[i],delete h.queryData[i]),i in h.completedQueries?c(d.useFilter?d.localKeys?g.getAll(d.localKeys,d.orig()):g.filter(b,d.orig()):h.queryData[i]):c()):j(f._oErr("params")):j(new e.errors.NER(a))}).then(function(k){if(i in h.completedQueries)return k;if(!(i in h.pendingQueries)){var l=void 0,m=d.findAllStrategy||d.strategy;if("fallback"===m){var n=function o(a){return j=g.getAdapterName((d.findAllFallbackAdapters||d.fallbackAdapters)[a]),e.adapters[j].findAll(g,b,d)["catch"](function(b){return a++,a<d.fallbackAdapters.length?o(a):f.Promise.reject(b)})};l=n(0)}else j=g.getAdapterName(d),l=e.adapters[j].findAll(g,b,d);h.pendingQueries[i]=l.then(function(a){return d.afterFindAll.call(a,d,a)}).then(function(b){return delete h.pendingQueries[i],d.cacheResponse?(h.queryData[i]=c.call(e,b,a,i,d),h.queryData[i].$$injected=!0,h.queryData[i]):(f.forEach(b,function(a,c){b[c]=g.createInstance(a,d.orig())}),b)})}return h.pendingQueries[i]}).then(function(a){return f.respond(a,{adapter:j},d)})["catch"](function(c){return h&&delete h.pendingQueries[i],e.errorFn("findAll",a,b,d)(c)})}},function(a,b){function c(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}a.exports=function(a,b,d,e){var f=this,g=f.utils,h=f.errors,i=f.definitions[a],j=void 0;return new g.Promise(function(f,k){g._sn(b)&&(b=i.get(b)),g._s(d)&&(d=[d]),d=d||[],i?g._o(b)?g._a(d)?!function(){j=g._(i,e);var a=[];g.forEach(i.relationList,function(f){var h=f.relation,j=i.getResource(h),k=g._(j,e);if(!d.length||g.contains(d,h)||g.contains(d,f.localField)){var l=void 0,m={};k.allowSimpleWhere?m[f.foreignKey]=b[i.idAttribute]:(m.where={},m.where[f.foreignKey]={"==":b[i.idAttribute]});var n=k.orig();if("function"==typeof f.load)l=f.load(i,f,b,n);else if("hasMany"===f.type){if(f.localKeys){delete m[f.foreignKey];var o=g.get(b,f.localKeys)||[];o=g._a(o)?o:g.keys(o),m.where=c({},j.idAttribute,{"in":o}),n.localKeys=o}else f.foreignKeys&&(delete m[f.foreignKey],m.where=c({},f.foreignKeys,{contains:b[i.idAttribute]}));l=j.findAll(m,n)}else"hasOne"===f.type?f.localKey&&g.get(b,f.localKey)?l=j.find(g.get(b,f.localKey),n):f.foreignKey&&(l=j.findAll(m,n).then(function(a){return a.length?a[0]:null})):g.get(b,f.localKey)&&(l=j.find(g.get(b,f.localKey),n));l&&a.push(l)}}),f(a)}():k(new h.IA('"relations" must be a string or an array!')):k(new h.IA('"instance(id)" must be a string, number or object!')):k(new h.NER(a))}).then(function(a){return g.Promise.all(a)}).then(function(){return j.afterLoadRelations.call(b,j,b)})["catch"](f.errorFn("loadRelations",a,b,d,e))}},function(a,b){a.exports=function(a,b){var c=this,d=c.utils,e=c.definitions[a],f=c.store[a];return new d.Promise(function(g,h){if(e){b=d._(e,b),b.hasOwnProperty("notify")||(b.notify=!1);for(var i=[],j=(new Date).getTime(),k=void 0;(k=f.expiresHeap.peek())&&k.expires<j;)i.push(k.item),delete k.item,f.expiresHeap.pop();g(i)}else h(new c.errors.NER(a))}).then(function(a){if(a.length&&(e.beforeReap(b,a),b.notify&&e.emit("DS.beforeReap",e,a)),"inject"===b.reapAction)!function(){var b=(new Date).getTime();d.forEach(a,function(a){f.expiresHeap.push({item:a,timestamp:b,expires:e.maxAge?b+e.maxAge:Number.MAX_VALUE})})}();else if("eject"===b.reapAction)d.forEach(a,function(a){e.eject(a[e.idAttribute])});else if("refresh"===b.reapAction){var c=function(){var b=[];return d.forEach(a,function(a){b.push(e.refresh(a[e.idAttribute]))}),{v:d.Promise.all(b)}}();if("object"==typeof c)return c.v}return a}).then(function(a){return a.length&&(e.afterReap(b,a),b.notify&&e.emit("DS.afterReap",e,a)),a})["catch"](c.errorFn("reap",a,b))}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.errors,g=d.definitions[a],h=d.store[a],i=void 0,j=void 0,k=void 0;return new e.Promise(function(d,h){b=e.resolveId(g,b),g?e._sn(b)?g.get(b)?(i=g.get(b),c=e._(g,c),d(i)):h(new f.R('id "'+b+'" not found in cache!')):h(e._snErr("id")):h(new f.NER(a))}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.beforeUpdate",g,a),c.changesOnly){h.observers[b]&&"function"==typeof h.observers[b]&&h.observers[b].deliver();var f=[],i=g.changes(b);for(var l in i.added)f.push(l);for(l in i.changed)f.push(l);if(i=e.pick(a,f),e.isEmpty(i))return j=!0,a;a=i}return k=g.getAdapterName(c),d.adapters[k].update(g,b,e.omit(a,c.omit),c)}).then(function(a){return c.afterUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.afterUpdate",g,a),j)return a;if(c.cacheResponse){var b=g.inject(a,c.orig()),d=b[g.idAttribute];return h.saved[d]=e.updateTimestamp(h.saved[d]),g.resetHistoryOnInject||(h.previousAttributes[d]=e.copy(b,null,null,null,g.relationFields)),b}return g.createInstance(a,c.orig())}).then(function(a){return e.respond(a,{adapter:k},c)})["catch"](d.errorFn("save",a,b,c))}},function(a,b){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.definitions[a],i=void 0;return new f.Promise(function(e,i){b=f.resolveId(h,b),h?f._sn(b)?(d=f._(h,d),e(c)):i(f._snErr("id")):i(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),i=h.getAdapterName(d),e.adapters[i].update(h,b,f.omit(a,d.omit),d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(b){if(d.notify&&h.emit("DS.afterUpdate",h,b),d.cacheResponse){var c=h.inject(b,d.orig()),g=e.store[a],i=c[h.idAttribute];return g.saved[i]=f.updateTimestamp(g.saved[i]),h.resetHistoryOnInject||(g.previousAttributes[i]=f.copy(c,null,null,null,h.relationFields)),c}return h.createInstance(b,d.orig())}).then(function(a){return f.respond(a,{adapter:i},d)})["catch"](e.errorFn("update",a,b,c,d))}},function(a,b){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.definitions[a],i=void 0;return new f.Promise(function(e,i){h?(d=f._(h,d),f.applyScope(h,c,d),e(b)):i(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),i=h.getAdapterName(d),e.adapters[i].updateAll(h,f.omit(a,d.omit),c,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(c){d.notify&&h.emit("DS.afterUpdate",h,b);var g=d.orig();if(d.cacheResponse){var i=function(){var b=h.inject(c,g),d=e.store[a];return f.forEach(b,function(a){var b=a[h.idAttribute];d.saved[b]=f.updateTimestamp(d.saved[b]),h.resetHistoryOnInject||(d.previousAttributes[b]=f.copy(a,null,null,null,h.relationFields))}),{v:b}}();if("object"==typeof i)return i.v}else{var j=function(){var a=[];return f.forEach(c,function(b){a.push(h.createInstance(b,g))}),{v:a}}();if("object"==typeof j)return j.v}}).then(function(a){return f.respond(a,{adapter:i},d)})["catch"](e.errorFn("updateAll",a,b,c,d))}}])}); | ||
!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.JSData=b():a.JSData=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){var d=c(1),e=c(2),f=c(3);a.exports={DS:d["default"],DSUtils:e["default"],DSErrors:f["default"],createStore:function(a){return new d["default"](a)},version:{full:"2.6.0",major:parseInt("2",10),minor:parseInt("6",10),patch:parseInt("0",10),alpha:"false",beta:"false"}}},function(a,b,c){function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b,c){c(null,b)}function f(a,b){return b}function g(a,b,c,d){var e=!0;a:for(;e;){var f=a,g=b,h=c,i=d;k=l=m=void 0,e=!1;var k=f[g],l=j["default"].get(h,k[0]),m=j["default"].get(i,k[0]);if(j["default"]._s(l)&&(l=j["default"].upperCase(l)),j["default"]._s(m)&&(m=j["default"].upperCase(m)),"DESC"===k[1]){if(l>m)return-1;if(m>l)return 1;if(g<f.length-1){a=f,b=g+1,c=h,d=i,e=!0;continue a}return 0}if(m>l)return-1;if(l>m)return 1;if(!(g<f.length-1))return 0;a=f,b=g+1,c=h,d=i,e=!0}}function h(a,b){j["default"].forOwn(b,function(b,c){a[c]=b,a[c].before=function(b){var d=a[c];a[c]=function(){for(var a=arguments.length,c=Array(a),e=0;a>e;e++)c[e]=arguments[e];return d.apply(this,b.apply(this,c)||c)}}})}var i=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),j=c(2),k=c(3),l=c(30),m=c(36),n=function(){function a(){d(this,a)}return i(a,[{key:"errorFn",value:function(a,b){if(this.error&&"function"==typeof this.error){try{throw"string"==typeof a?new Error(a):a}catch(c){a=c}this.error(this.name||null,a||null,b||null)}}}]),a}(),o=n.prototype;o.actions={},o.afterCreate=e,o.afterCreateCollection=f,o.afterCreateInstance=f,o.afterDestroy=e,o.afterEject=f,o.afterFind=e,o.afterFindAll=e,o.afterInject=f,o.afterLoadRelations=e,o.afterReap=f,o.afterUpdate=e,o.afterValidate=e,o.allowSimpleWhere=!0,o.basePath="",o.beforeCreate=e,o.beforeCreateCollection=f,o.beforeCreateInstance=f,o.beforeDestroy=e,o.beforeEject=f,o.beforeInject=f,o.beforeReap=f,o.beforeUpdate=e,o.beforeValidate=e,o.bypassCache=!1,o.cacheResponse=!!j["default"].w,o.clearEmptyQueries=!0,o.computed={},o.defaultAdapter="http",o.debug=!1,o.defaultValues={},o.eagerEject=!1,o.eagerInject=!1,o.endpoint="",o.error=console?function(a,b,c){return console["function"==typeof console.error?"error":"log"](a,b,c)}:!1,o.errorHandler=function(){return j["default"].Promise.reject(arguments[0])},o.fallbackAdapters=["http"],o.findStrictCache=!1,o.idAttribute="id",o.ignoredChanges=[/\$/],o.instanceEvents=!!j["default"].w,o.keepChangeHistory=!1,o.linkRelations=!!j["default"].w,o.log=console?function(a,b,c,d,e){return console["function"==typeof console.info?"info":"log"](a,b,c,d,e)}:!1,o.logFn=function(a,b,c,d){var e=this;e.debug&&e.log&&"function"==typeof e.log&&e.log(e.name||null,a||null,b||null,c||null,d||null)},o.maxAge=!1,o.methods={},o.notify=!!j["default"].w,o.omit=[],o.onConflict="merge",o.reapAction=j["default"].w?"inject":"none",o.reapInterval=j["default"].w?3e4:!1,o.relationsEnumerable=!1,o.resetHistoryOnInject=!0,o.returnMeta=!1,o.scopes={},o.strategy="single",o.upsert=!!j["default"].w,o.useClass=!0,o.useFilter=!1,o.validate=e,o.watchChanges=!!j["default"].w,o.defaultFilter=function(a,b,c,d){var e=a,f=null,h={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""};c=c||{},d=d||{},f=j["default"]._o(c.where)?c.where:{},d.allowSimpleWhere&&j["default"].forOwn(c,function(a,b){b in h||b in f||(f[b]={"==":a})}),j["default"].isEmpty(f)&&(f=null),f&&(e=j["default"].filter(e,function(a){var b=!0,c=!0;return j["default"].forOwn(f,function(d,e){j["default"]._o(d)||(d={"==":d}),j["default"].forOwn(d,function(d,f){var g=void 0,h="|"===f[0],i=j["default"].get(a,e);f=h?f.substr(1):f,"=="===f?g=i==d:"==="===f?g=i===d:"!="===f?g=i!=d:"!=="===f?g=i!==d:">"===f?g=i>d:">="===f?g=i>=d:"<"===f?g=d>i:"<="===f?g=d>=i:"isectEmpty"===f?g=!j["default"].intersection(i||[],d||[]).length:"isectNotEmpty"===f?g=j["default"].intersection(i||[],d||[]).length:"in"===f?g=j["default"]._s(d)?-1!==d.indexOf(i):j["default"].contains(d,i):"notIn"===f?g=j["default"]._s(d)?-1===d.indexOf(i):!j["default"].contains(d,i):"contains"===f?g=j["default"]._s(i)?-1!==i.indexOf(d):j["default"].contains(i,d):"notContains"===f&&(g=j["default"]._s(i)?-1===i.indexOf(d):!j["default"].contains(i,d)),void 0!==g&&(c=b?g:h?c||g:c&&g),b=!1})}),c}));var i=null;j["default"]._s(c.orderBy)?i=[[c.orderBy,"ASC"]]:j["default"]._a(c.orderBy)&&(i=c.orderBy),!i&&j["default"]._s(c.sort)?i=[[c.sort,"ASC"]]:!i&&j["default"]._a(c.sort)&&(i=c.sort),i&&!function(){var a=0;j["default"].forEach(i,function(a,c){if(j["default"]._s(a))i[c]=[a,"ASC"];else if(!j["default"]._a(a))throw new k["default"].IA('DS.filter("'+b+'"[, params][, options]): '+j["default"].toJson(a)+": Must be a string or an array!",{params:{"orderBy[i]":{actual:typeof a,expected:"string|array"}}})}),e=j["default"].sort(e,function(b,c){return g(i,a,b,c)})}();var l=j["default"]._n(c.limit)?c.limit:null,m=null;return j["default"]._n(c.skip)?m=c.skip:j["default"]._n(c.offset)&&(m=c.offset),l&&m?e=j["default"].slice(e,m,Math.min(e.length,m+l)):j["default"]._n(l)?e=j["default"].slice(e,0,Math.min(e.length,l)):j["default"]._n(m)&&(e=m<e.length?j["default"].slice(e,m):[]),e===a?e.slice():e};var p=function(){function a(b){d(this,a);var c=this;b=b||{},c.store={},c.definitions={},c.adapters={},c.defaults=new n,c.observe=j["default"].observe,j["default"].forOwn(b,function(a,b){"omit"===b?c.defaults.omit=a.concat(n.prototype.omit):c.defaults[b]=a});var e=j["default"].Promise;e&&!e.prototype.spread&&(e.prototype.spread=function(a){return this.then(function(b){return a.apply(this,b)})}),j["default"].Events(c)}return i(a,[{key:"getAdapterName",value:function(a){var b=!1;if(a=a||{},j["default"]._s(a)&&(b=!0,a={adapter:a}),this.adapters[a.adapter])return a.adapter;if(b)throw new Error(a.adapter+" is not a registered adapter!");return a.defaultAdapter}},{key:"getAdapter",value:function(a){return a=a||{},this.adapters[this.getAdapterName(a)]}},{key:"registerAdapter",value:function(a,b,c){var d=this;c=c||{},j["default"].isFunction(b)?d.adapters[a]=new b(c):d.adapters[a]=b,c["default"]&&(d.defaults.defaultAdapter=a)}},{key:"is",value:function(a,b){var c=this.definitions[a];if(!c)throw new k["default"].NER(a);return b instanceof c[c["class"]]}},{key:"clear",value:function(){var a=this,b={};return j["default"].forOwn(this.definitions,function(c){var d=c.name;b[d]=c.ejectAll(),a.store[d].completedQueries={},a.store[d].queryData={}}),b}},{key:"errorFn",value:function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b[b.length-1],e=this.defaults.errorHandler,f=d?d.errorHandler:e;return f=f||e,function(a){return f.apply(void 0,[a].concat(b))}}}]),a}(),q=p.prototype;q.getAdapterName.shorthand=!1,q.getAdapter.shorthand=!1,q.registerAdapter.shorthand=!1,q.errors=k["default"],q.utils=j["default"],h(q,l["default"]),h(q,m["default"]),b["default"]=p},function(a,b,c){function d(a){return"[object Array]"===T.call(a)||!1}function e(a){return"[object RegExp]"===T.call(a)||!1}function f(a){return"string"==typeof a||a&&"object"==typeof a&&"[object String]"===T.call(a)||!1}function g(a){return"[object Object]"===T.call(a)||!1}function h(a){return a&&"object"==typeof a&&"[object Date]"===T.call(a)||!1}function i(a){var b=typeof a;return"number"===b||a&&"object"===b&&"[object Number]"===T.call(a)||!1}function j(a){return"function"==typeof a||a&&"[object Function]"===T.call(a)||!1}function k(a){return f(a)||i(a)}function l(a){return new z["default"].IA('"'+a+'" must be a string or a number!')}function m(a){return new z["default"].IA('"'+a+'" must be an object!')}function n(a){return new z["default"].IA('"'+a+'" must be an array!')}function o(a){if(null==a)return!0;if("string"==typeof a||V(a))return!a.length;if("object"==typeof a){var b=!0;return D(a,function(){return b=!1,!1}),b}return!0}function p(a,b){if(!a||!b)return[];for(var c=[],d=void 0,e=0,f=a.length;f>e;e++)d=a[e],E(c,d)||E(b,d)&&c.push(d);return c}function q(a,b,c){var d=[];return B(a,function(a,c,e){b(a,c,e)&&d.push(a)},c),d}function r(a){var b={};a=a||this,Object.defineProperties(a,{on:{value:function(a,c,d){b[a]=b[a]||[],b[a].push({f:c,c:d})}},off:{value:function(a,c){var d=b[a];if(d)if(c){for(var e=0;e<d.length;e++)if(d[e].f===c){d.splice(e,1);break}}else d.splice(0,d.length);else b={}}},emit:{value:function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];var e=b[c.shift()]||[];if(e)for(var f=0;f<e.length;f++)e[f].f.apply(e[f].c,c)}}})}function s(a,b,c,d,f){if(b){if(a===b)throw new Error("Cannot copy! Source and destination are identical.");if(c=c||[],d=d||[],g(a)){var i=c.indexOf(a);if(-1!==i)return d[i];c.push(a),d.push(b)}var j=void 0;if(V(a)){var k=void 0;for(b.length=0,k=0;k<a.length;k++)j=s(a[k],null,c,d,f),g(a[k])&&(c.push(a[k]),d.push(j)),b.push(j)}else{V(b)?b.length=0:B(b,function(a,c){delete b[c]});for(var l in a)if(a.hasOwnProperty(l)){if(X(l,f))continue;j=s(a[l],null,c,d,f),g(a[l])&&(c.push(a[l]),d.push(j)),b[l]=j}}}else b=a,a&&(V(a)?b=s(a,[],c,d,f):h(a)?b=new Date(a.getTime()):e(a)?(b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex):g(a)&&(b=s(a,Object.create(Object.getPrototypeOf(a)),c,d,f)));return b}function t(a,b){var c=!0;a:for(;c;){var d=a,f=b;if(l=m=g=i=k=void 0,c=!1,d===f)return!0;if(null===d||null===f)return!1;if(d!==d&&f!==f)return!0;var g,i,k,l=typeof d,m=typeof f;if(l==m&&"object"==l){if(!V(d)){if(h(d)){if(!h(f))return!1;a=d.getTime(),b=f.getTime(),c=!0;continue a}if(e(d)&&e(f))return d.toString()==f.toString();if(V(f))return!1;k={};for(i in d)if("$"!==i.charAt(0)&&!j(d[i])){if(!t(d[i],f[i]))return!1;k[i]=!0}for(i in f)if(!k.hasOwnProperty(i)&&"$"!==i.charAt(0)&&void 0!==f[i]&&!j(f[i]))return!1;return!0}if(!V(f))return!1;if((g=d.length)===f.length){for(i=0;g>i;i++)if(!t(d[i],f[i]))return!1;return!0}}return!1}}function u(a,b){return f(b)||i(b)?b:b&&a?b[a.idAttribute]||b:b}function v(a,b){return a&&(f(b)||i(b))?a.index[b]||b:b}function w(a){return null!=a&&""!==a}function x(a,b){return b=b||"",q(a,w).join(b)}function y(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=x(b,"/");return d.replace(/([^:\/]|^)\/{2,}/g,"$1/")}var z=c(3),A=c(4),B=c(5),C=c(6),D=c(7),E=c(10),F=c(12),G=c(14),H=c(21),I=c(22),J=c(23),K=c(24),L=c(19),M=c(25),N=c(27),O=c(29),P=void 0,Q=void 0,R=void 0,S=Object.prototype,T=S.toString;try{Q=Promise}catch(U){console.error("js-data requires a global Promise constructor!")}try{R=window.File}catch(U){R=function(){}}var V=Array.isArray||d;try{P=window,P={}}catch(U){P=null}var W=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],X=O.isBlacklisted;b["default"]={Promise:Q,_:function(a,b){var c=this;if(a=a||{},b=b||{},b&&b.constructor===a.constructor)return b;if(!g(b))throw new z["default"].IA('"options" must be an object!');B(W,function(a){"function"==typeof b[a]&&-1===b[a].toString().indexOf("for (var _len = arg")&&(b[a]=c.promisify(b[a]))});var d=function(a){var b=this;D(a,function(a,c){b[c]=a})};return d.prototype=a,d.prototype.orig=function(){var a={};return D(this,function(b,c){a[c]=b}),a},new d(b)},_n:i,_s:f,_sn:k,_snErr:l,_o:g,_oErr:m,_a:V,_aErr:n,applyScope:function(a,b,c){var d=c.scope,e=s(b);d?f(d)&&(d=[d]):d=[],d.unshift("defaultScope"),B(d,function(d){var e=c.scopes[d];"function"==typeof e?F(b,e(a)):e&&F(b,e)}),F(b,e)},compute:function(a,b){var c=this,d=[];g(a)||(B(a.deps,function(a){d.push(M(c,a))}),N(c,b,a[a.length-1].apply(c,d)))},contains:E,copy:s,deepMixIn:F,diffObjectFromOldObject:O.diffObjectFromOldObject,BinaryHeap:A,equals:t,Events:r,filter:q,fillIn:function(a,b){return D(b,function(b,c){c in a||(a[c]=b)}),a},forEach:B,forOwn:D,fromJson:function(a){return f(a)?JSON.parse(a):a},get:M,intersection:p,isArray:V,isBlacklisted:X,isEmpty:o,isFunction:j,isObject:g,isNumber:i,isString:f,keys:J,makePath:y,observe:O,omit:function(a,b){var c=[];return D(a,function(a,d){X(d,b)&&c.push(d)}),B(c,function(b){delete a[b]}),a},pascalCase:G,pick:I,promisify:function(a,b){var c=this;if(a){if("function"!=typeof a)throw new Error("Can only promisify functions!");return function(){for(var d=arguments.length,e=Array(d),f=0;d>f;f++)e[f]=arguments[f];return new c.Promise(function(c,d){e.push(function(a,b){a?d(a):c(b)});try{var f=a.apply(b||this,e);f&&f.then&&f.then(c,d)}catch(g){d(g)}})}}},remove:H,set:N,slice:C,sort:K,toJson:JSON.stringify,updateTimestamp:function(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b},upperCase:L,removeCircular:function(a){return function b(a,c){var d=void 0,e=void 0;if(!("object"!=typeof a||null===a||a instanceof Boolean||a instanceof Date||a instanceof Number||a instanceof RegExp||a instanceof String||a instanceof R)){for(var f=c.cur,g=c.ctx;g;){if(g.cur===f)return void 0;g=g.ctx}if(V(a))for(e=[],d=0;d<a.length;d+=1)e[d]=b(a[d],{ctx:c,cur:a[d]});else e={},D(a,function(d,f){e[f]=b(a[f],{ctx:c,cur:a[f]})});return e}return a}(a,{ctx:null,cur:a})},resolveItem:v,resolveId:u,respond:function(a,b,c){return"array"===c.returnMeta?[a,b]:"object"===c.returnMeta?{response:a,meta:b}:a},w:P,applyRelationGettersToTarget:function(a,b,c){this.forEach(b.relationList,function(d){var e=d.relation,f=d.localField,g=d.localKey,h=d.foreignKey,i=d.localKeys,j=d.foreignKeys,k="boolean"==typeof d.enumerable?d.enumerable:!!b.relationsEnumerable;if("boolean"==typeof d.link?d.link:!!b.linkRelations){delete c[f];var l={enumerable:k};"belongsTo"===d.type?(l.get=function(){return M(this,g)?b.getResource(e).get(M(this,g)):void 0},l.set=function(a){return a&&N(this,g,M(a,b.getResource(e).idAttribute)),M(this,f)}):"hasMany"===d.type?(l.get=function(){var c={};if(h)return c[h]=this[b.idAttribute],b.getResource(e).defaultFilter.call(a,a.store[e].collection,e,c,{allowSimpleWhere:!0});if(i){var d=M(this,i)||[];return b.getResource(e).getAll(V(d)?d:J(d))}return j?(N(c,"where."+j+".contains",this[b.idAttribute]),b.getResource(e).defaultFilter.call(a,a.store[e].collection,e,c)):void 0},l.set=function(a){var c=this;return a&&a.length&&!function(){var d=M(c,b.idAttribute);h?B(a,function(a){N(a,h,d)}):i?!function(){var d=[];B(a,function(a){d.push(M(a,b.getResource(e).idAttribute))}),N(c,i,d)}():j&&B(a,function(a){var b=M(a,j);b?E(b,d)||b.push(d):N(a,j,[d])})}(),M(this,f)}):"hasOne"===d.type&&(g?(l.get=function(){return M(this,g)?b.getResource(e).get(M(this,g)):void 0},l.set=function(a){return a&&N(this,g,M(a,b.getResource(e).idAttribute)),M(this,f)}):(l.get=function(){var c={};c[h]=this[b.idAttribute];var d=c[h]?b.getResource(e).defaultFilter.call(a,a.store[e].collection,e,c,{allowSimpleWhere:!0}):[];return d.length?d[0]:void 0},l.set=function(a){return a&&N(a,h,M(this,b.idAttribute)),M(this,f)})),d.get&&!function(){var a=l.get;l.get=function(){var c=this;return d.get(b,d,this,function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return a.apply(c,d)})}}(),Object.defineProperty(c,f,l)}})}}},function(a,b){function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var e=function(a,b,c){for(var d=!0;d;){var e=a,f=b,g=c;h=j=i=void 0,d=!1,null===e&&(e=Function.prototype);var h=Object.getOwnPropertyDescriptor(e,f);if(void 0!==h){if("value"in h)return h.value;var i=h.get;return void 0===i?void 0:i.call(g)}var j=Object.getPrototypeOf(e);if(null===j)return void 0;a=j,b=f,c=g,d=!0}},f=function(a){function b(a){c(this,b),e(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a}return d(b,a),b}(Error),g=function(a){function b(a){c(this,b),e(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a}return d(b,a),b}(Error),h=function(a){function b(a){c(this,b),e(Object.getPrototypeOf(b.prototype),"constructor",this).call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.message=a+" is not a registered resource!"}return d(b,a),b}(Error);b["default"]={IllegalArgumentError:f,IA:f,RuntimeError:g,R:g,NonexistentResourceError:h,NER:h}},function(a,b,c){!function(b,c){a.exports=c()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){function d(a,b,c){for(var d=a[c],e=b(d);c>0;){var f=Math.floor((c+1)/2)-1,g=a[f];if(e>=b(g))break;a[f]=d,a[c]=g,c=f}}function e(a,b){if(a||(a=function(a){return a}),b||(b=function(a,b){return a===b}),"function"!=typeof a)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');if("function"!=typeof b)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');this.weightFunc=a,this.compareFunc=b,this.heap=[]}var f=function(a,b,c){for(var d=a.length,e=a[c],f=b(e);;){var g=2*(c+1),h=g-1,i=null;if(d>h){var j=a[h],k=b(j);f>k&&(i=h)}if(d>g){var l=a[g],m=b(l);m<(null===i?f:b(a[h]))&&(i=g)}if(null===i)break;a[c]=a[i],a[i]=e,c=i}},g=e.prototype;g.push=function(a){this.heap.push(a),d(this.heap,this.weightFunc,this.heap.length-1)},g.peek=function(){return this.heap[0]},g.pop=function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,f(this.heap,this.weightFunc,0)),a},g.remove=function(a){for(var b=this.heap.length,c=0;b>c;c++)if(this.compareFunc(this.heap[c],a)){var e=this.heap[c],g=this.heap.pop();return c!==b-1&&(this.heap[c]=g,d(this.heap,this.weightFunc,c),f(this.heap,this.weightFunc,c)),e}return null},g.removeAll=function(){this.heap=[]},g.size=function(){return this.heap.length},a.exports=e}])})},function(a,b){function c(a,b,c){if(null!=a)for(var d=-1,e=a.length;++d<e&&b.call(c,a[d],d,a)!==!1;);}a.exports=c},function(a,b){function c(a,b,c){var d=a.length;b=null==b?0:0>b?Math.max(d+b,0):Math.min(b,d),c=null==c?d:0>c?Math.max(d+c,0):Math.min(c,d);for(var e=[];c>b;)e.push(a[b++]);return e}a.exports=c},function(a,b,c){function d(a,b,c){f(a,function(d,f){return e(a,f)?b.call(c,a[f],f,a):void 0})}var e=c(8),f=c(9);a.exports=d},function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}a.exports=c},function(a,b,c){function d(){h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],g=!0;for(var a in{toString:null})g=!1}function e(a,b,c){var e,j=0;null==g&&d();for(e in a)if(f(b,a,e,c)===!1)break;if(g)for(var k=a.constructor,l=!!k&&a===k.prototype;(e=h[j++])&&("constructor"===e&&(l||!i(a,e))||a[e]===Object.prototype[e]||f(b,a,e,c)!==!1););}function f(a,b,c,d){return a.call(d,b[c],c,b)}var g,h,i=c(8);a.exports=e},function(a,b,c){function d(a,b){return-1!==e(a,b)}var e=c(11);a.exports=d},function(a,b){function c(a,b,c){if(c=c||0,null==a)return-1;for(var d=a.length,e=0>c?d+c:c;d>e;){if(a[e]===b)return e;e++}return-1}a.exports=c},function(a,b,c){function d(a,b){for(var c,d=0,g=arguments.length;++d<g;)c=arguments[d],c&&f(c,e,a);return a}function e(a,b){var c=this[b];g(a)&&g(c)?d(c,a):this[b]=a}var f=c(7),g=c(13);a.exports=d},function(a,b){function c(a){return!!a&&"object"==typeof a&&a.constructor===Object}a.exports=c},function(a,b,c){function d(a){return a=e(a),f(a).replace(/^[a-z]/,g)}var e=c(15),f=c(16),g=c(19);a.exports=d},function(a,b){function c(a){return null==a?"":a.toString()}a.exports=c},function(a,b,c){function d(a){return a=e(a),a=f(a),a=g(a).replace(/[\-_]/g," ").replace(/\s[a-z]/g,h).replace(/\s+/g,"").replace(/^[A-Z]/g,i)}var e=c(15),f=c(17),g=c(18),h=c(19),i=c(20);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.search(/[\xC0-\xFF]/g)>-1&&(a=a.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),a}var e=c(15);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.replace(f,"")}var e=c(15),f=/[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toUpperCase()}var e=c(15);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toLowerCase()}var e=c(15);a.exports=d},function(a,b,c){function d(a,b){var c=e(a,b);-1!==c&&a.splice(c,1)}var e=c(11);a.exports=d},function(a,b,c){function d(a,b){for(var c,d="string"!=typeof arguments[1]?arguments[1]:e(arguments,1),f={},g=0;c=d[g++];)f[c]=a[c];return f}var e=c(6);a.exports=d},function(a,b,c){var d=c(7),e=Object.keys||function(a){var b=[];return d(a,function(a,c){b.push(c)}),b};a.exports=e},function(a,b){function c(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=d);var f,g,h;return f=~~(a.length/2),g=c(a.slice(0,f),b),h=c(a.slice(f,a.length),b),e(g,h,b)}function d(a,b){return b>a?-1:a>b?1:0}function e(a,b,c){for(var d=[];a.length&&b.length;)c(a[0],b[0])<=0?d.push(a.shift()):d.push(b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}a.exports=c},function(a,b,c){function d(a,b){for(var c=b.split("."),d=c.pop();b=c.shift();)if(a=a[b],null==a)return;return a[d]}c(26);a.exports=d},function(a,b){function c(a){switch(typeof a){case"string":case"number":case"boolean":return!0}return null==a}a.exports=c},function(a,b,c){function d(a,b,c){var d=/^(.+)\.(.+)$/.exec(b);d?e(a,d[1])[d[2]]=c:a[b]=c}var e=c(28);a.exports=d},function(a,b,c){function d(a,b){return b?(e(b.split("."),function(b){a[b]||(a[b]={}),a=a[b]}),a):a}var e=c(5);a.exports=d},function(a,b){!function(a){function b(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function c(b){for(var c=0;s>c&&b.check_();)c++;return p&&(a.dirtyCheckCycleCount=c),c>0}function d(a){for(var b in a)return!1;return!0}function e(a){return d(a.added)&&d(a.removed)&&d(a.changed)}function f(a,b){if(!b||!b.length)return!1;for(var c,d=0;d<b.length;d++)if("[object RegExp]"===Object.prototype.toString.call(b[d])&&b[d].test(a)||b[d]===a)return c=a;return!!c}function g(a,b,c,d){var e={},g={},h={};for(var i in b){var j=a[i];f(i,d)||void 0!==j&&(c?c(j,b[i]):j===b[i])||(i in a?(c?c(j,b[i]):j===b[i])||(h[i]=j):g[i]=void 0)}for(var i in a)i in b||f(i,d)||(e[i]=a[i]);return Array.isArray(a)&&a.length!==b.length&&(h.length=a.length),{added:e,removed:g,changed:h}}function h(){if(!t.length)return!1;for(var a=0;a<t.length;a++)t[a]();return t.length=0,!0}function i(){function a(a){b&&b.state_===x&&!d&&b.check_(a)}var b,c,d=!1,e=!0;return{open:function(c){if(b)throw Error("ObservedObject in use");e||Object.deliverChangeRecords(a),b=c,e=!1},observe:function(b,d){c=b,d?Array.observe(c,a):Object.observe(c,a)},deliver:function(b){d=b,Object.deliverChangeRecords(a),d=!1},close:function(){b=void 0,Object.unobserve(c,a),v.push(this)}}}function j(a,b,c){var d=v.pop()||i();return d.open(a),d.observe(b,c),d}function k(){this.state_=w,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=z++}function l(a){k._allObserversCount++,B&&A.push(a)}function m(a){k._allObserversCount--}function n(a){k.call(this),this.value_=a,this.oldObject_=void 0}function o(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];E[g.type]?(g.name in c||(c[g.name]=g.oldValue),"update"!=g.type&&("add"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}var p=a.testingExposeCycleCount,q=b(),r="__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c},s=1e3,t=[],u=q?function(){return function(a){return Promise.resolve().then(a)}}():function(){return function(a){t.push(a)}}(),v=[],w=0,x=1,y=2,z=1;k.prototype={open:function(a,b){if(this.state_!=w)throw Error("Observer has already been opened.");return l(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=x,this.value_},close:function(){this.state_==x&&(m(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=y)},deliver:function(){this.state_==x&&c(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){k._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var A,B=!q;k._allObserversCount=0,B&&(A=[]);var C=!1;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!C&&B){C=!0;var b,c,d=0;do{d++,c=A,A=[],b=!1;for(var e=0;e<c.length;e++){var f=c[e];f.state_==x&&(f.check_()&&(b=!0),A.push(f))}h()&&(b=!0)}while(s>d&&b);p&&(a.dirtyCheckCycleCount=d),C=!1}},B&&(a.Platform.clearObservers=function(){A=[]}),n.prototype=r({__proto__:k.prototype,arrayObserve:!1,connect_:function(a,b){q?this.directObserver_=j(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(a){var b=Array.isArray(a)?[]:{};for(var c in a)b[c]=a[c];return Array.isArray(a)&&(b.length=a.length),b},check_:function(a,b){var c,d;if(q){if(!a)return!1;d={},c=o(this.value_,a,d)}else d=this.oldObject_,c=g(this.value_,this.oldObject_);return e(c)?!1:(q||(this.oldObject_=this.copyObject(this.value_)),this.report_([c.added||{},c.removed||{},c.changed||{},function(a){return d[a]}]),!0)},disconnect_:function(){q?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==x&&(q?this.directObserver_.deliver(!1):c(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}});var D={},E={add:!0,update:!0,"delete":!0};a.Observer=k,a.isBlacklisted=f,a.Observer.runEOM_=u,a.Observer.observerSentinel_=D,a.Observer.hasObjectObserve=q,a.diffObjectFromOldObject=g,a.ObjectObserver=n}(b)},function(a,b,c){function d(a){return!(f["default"].isEmpty(a.added)&&f["default"].isEmpty(a.removed)&&f["default"].isEmpty(a.changed))}function e(a,b,c,d){var e=this,g=e.definitions[b];if(d=d||{},c=f["default"].resolveId(g,c),!g)throw new h(b);if(!f["default"]._sn(c))throw f["default"]._snErr("id");return c=c===k?void 0:c,d=f["default"]._(g,d),{_this:e,definition:g,_resourceName:b,_id:c,_options:d}}var f=c(2),g=c(3),h=g["default"].NER,i=g["default"].IA,j=g["default"].R,k="DS_"+(new Date).getTime();b["default"]={changes:function(a,b,c){var d=e.call(this,"changes",a,b,c),g=d._this,h=d.definition,i=d._resourceName,j=d._id,k=d._options,l=h.get(j);if(l){var m=function(){var a=g.store[i].observers[j];a&&"function"==typeof a&&a.deliver();var b=k.ignoredChanges||[];f["default"].forEach(h.relationFields,function(a){f["default"].contains(b,a)||b.push(a)});var c=f["default"].diffObjectFromOldObject(l,g.store[i].previousAttributes[j],f["default"].equals,b);return f["default"].forOwn(c,function(a,b){var d=[];f["default"].forOwn(a,function(a,b){f["default"].isFunction(a)||d.push(b)}),c[b]=f["default"].pick(c[b],d)}),f["default"].forEach(h.relationFields,function(a){delete c.added[a],delete c.removed[a],delete c.changed[a]}),{v:c}}();if("object"==typeof m)return m.v}},changeHistory:function(a,b){var c=e.call(this,"changeHistory",a,b||k),d=c._this,f=c.definition,g=c._resourceName,h=c._id,i=d.store[g];if(f.keepChangeHistory){if(!g)return i.changeHistory;var j=f.get(h);if(j)return i.changeHistories[h]}else f.errorFn("changeHistory is disabled for this resource!")},compute:function(a,b){var c=this,d=c.definitions[a];if(b=f["default"].resolveItem(c.store[a],b),!d)throw new h(a);if(!b)throw new j("Item not in the store!");if(!f["default"]._o(b)&&!f["default"]._sn(b))throw new i('"instance" must be an object, string or number!');return f["default"].forOwn(d.computed,function(a,c){f["default"].compute.call(b,a,c)}),b},createInstance:function(a,b,c){var d=this.definitions[a],e=void 0;if(b=b||{},!d)throw new h(a);if(b&&!f["default"].isObject(b))throw new i('"attrs" must be an object!');c=f["default"]._(d,c),c.beforeCreateInstance(c,b);var g=d[d["class"]];return e=new g,d.instanceEvents&&f["default"].Events(e),c.defaultValues&&f["default"].deepMixIn(e,c.defaultValues),f["default"].deepMixIn(e,b),d.computed&&d.compute(e),c.afterCreateInstance(c,e),e},createCollection:function(a,b,c,d){var e=this,g=e.definitions[a];if(b=b||[],c=c||{},!g)throw new h(a);if(b&&!f["default"].isArray(b))throw new i('"arr" must be an array!');return d=f["default"]._(g,d),d.beforeCreateCollection(d,b),Object.defineProperties(b,{fetch:{value:function(b,c){var d=this;return d.params=b||d.params,g.findAll(d.params,c).then(function(b){return b===d?d:(b.unshift(d.length),b.unshift(0),d.splice.apply(d,b),b.shift(),b.shift(),b.$$injected&&(e.store[a].queryData[f["default"].toJson(d.params)]=d,d.$$injected=!0),d)})}},params:{value:c,writable:!0},resourceName:{value:a}}),d.afterCreateCollection(d,b),b},defineResource:c(31),digest:function(){this.observe.Platform.performMicrotaskCheckpoint()},eject:c(32),ejectAll:c(33),filter:c(34),get:function(a,b){var c=e.call(this,"get",a,b),d=c._this,f=c._resourceName,g=c._id;return d.store[f].index[g]},getAll:function(a,b){var c=this,d=c.definitions[a],e=c.store[a],g=[];if(!d)throw new h(a);if(b&&!f["default"]._a(b))throw f["default"]._aErr("ids");if(f["default"]._a(b))for(var i=b.length,j=0;i>j;j++)e.index[b[j]]&&g.push(e.index[b[j]]);else g=e.collection.slice();return g},hasChanges:function(a,b){var c=e.call(this,"hasChanges",a,b),f=c.definition,g=c._id;return f.get(g)?d(f.changes(g)):!1},inject:c(35),lastModified:function(a,b){var c=e.call(this,"lastModified",a,b||k),d=c._this,f=c._resourceName,g=c._id,h=d.store[f];return g?(g in h.modified||(h.modified[g]=0),h.modified[g]):h.collectionModified},lastSaved:function(a,b){var c=e.call(this,"lastSaved",a,b||k),d=c._this,f=c._resourceName,g=c._id,h=d.store[f];return g in h.saved||(h.saved[g]=0),h.saved[g]},previous:function(a,b){var c=e.call(this,"previous",a,b),d=c._this,g=c._resourceName,h=c._id,i=d.store[g];return i.previousAttributes[h]?f["default"].copy(i.previousAttributes[h]):void 0; | ||
},revert:function(a,b){var c=e.call(this,"revert",a,b),d=c._this,f=c.definition,g=c._resourceName,h=c._id;return f.inject(d.previous(g,h))}}},function(a,b,c){var d=c(2),e=c(3),f=["compute","eject","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","previous","revert"];a.exports=function(a){function b(b){this.defaultValues={},this.methods={},this.computed={},this.scopes={},this.actions={},d["default"].deepMixIn(this,b);var e=c.defaults;a["extends"]&&g[a["extends"]]&&(e=g[a["extends"]]),d["default"].fillIn(this.defaultValues,e.defaultValues),d["default"].fillIn(this.methods,e.methods),d["default"].fillIn(this.computed,e.computed),d["default"].fillIn(this.scopes,e.scopes),d["default"].fillIn(this.actions,e.actions),this.endpoint="endpoint"in b?b.endpoint:this.name}var c=this,g=c.definitions;if(d["default"]._s(a)&&(a={name:a.replace(/\s/gi,"")}),!d["default"]._o(a))throw d["default"]._oErr("definition");if(!d["default"]._s(a.name))throw new e["default"].IA('"name" must be a string!');if(g[a.name])throw new e["default"].R(a.name+" is already registered!");try{var h,i,j=function(){if(a["extends"]&&g[a["extends"]]?b.prototype=g[a["extends"]]:b.prototype=c.defaults,g[a.name]=new b(a),h=g[a.name],h.getResource=function(a){return c.definitions[a]},!d["default"]._s(h.idAttribute))throw new e["default"].IA('"idAttribute" must be a string!');h.relations&&(h.relationList=[],h.relationFields=[],d["default"].forOwn(h.relations,function(a,b){d["default"].forOwn(a,function(c,e){d["default"]._a(c)||(a[e]=[c]),d["default"].forEach(a[e],function(a){a.type=b,a.relation=e,a.name=h.name,h.relationList.push(a),a.localField&&h.relationFields.push(a.localField)})})}),h.relations.belongsTo&&d["default"].forOwn(h.relations.belongsTo,function(a,b){d["default"].forEach(a,function(a){a.parent&&(h.parent=b,h.parentKey=a.localKey,h.parentField=a.localField)})}),"function"==typeof Object.freeze&&(Object.freeze(h.relations),Object.freeze(h.relationList))),i=h["class"]=d["default"].pascalCase(h.name);try{"function"==typeof h.useClass?(h[i]=new Function("def","return function "+i+"() { def.useClass.call(this); }")(h),h[i].prototype=function(a){function b(){}return b.prototype=a,new b}(h.useClass.prototype)):h[i]=new Function("return function "+i+"() {}")()}catch(j){h[i]=function(){}}d["default"].forOwn(h.methods,function(a,b){h[i].prototype[b]=a}),h[i].prototype.set=function(a,b){var c=this;return d["default"].set(this,a,b),h.compute(this),h.instanceEvents&&setTimeout(function(){c.emit("DS.change",h,c)},0),h.handleChange(this),this},h[i].prototype.get=function(a){return d["default"].get(this,a)},d["default"].applyRelationGettersToTarget(c,h,h[i].prototype);var k=null;h.hasOwnProperty("omit")?k=c.defaults.omit:(k=h.omit,h.omit=[]),h.omit=h.omit.concat(k||[]),d["default"].forOwn(h.computed,function(a,b){if(d["default"].isFunction(a)&&(h.computed[b]=[a],a=h.computed[b]),h.methods&&b in h.methods&&h.errorFn('Computed property "'+b+'" conflicts with previously defined prototype method!'),h.omit.push(b),d["default"].isArray(a)){var c;if(1===a.length){var e=a[0].toString().match(/function.*?\(([\s\S]*?)\)/);c=e[1].split(","),c=d["default"].filter(c,function(a){return a}),h.computed[b]=c.concat(a),a=h.computed[b],c.length&&h.errorFn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),d["default"].forEach(c,function(a,b){c[b]=a.trim()}),a.deps=d["default"].filter(c,function(a){return!!a})}else d["default"].isObject(a)&&Object.defineProperty(h[i].prototype,b,a)}),d["default"].forEach(f,function(a){h[i].prototype["DS"+d["default"].pascalCase(a)]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return d.unshift(this[h.idAttribute]||this),d.unshift(h.name),c[a].apply(c,d)}}),h[i].prototype.DSCreate=function(){for(var a=arguments.length,b=Array(a),d=0;a>d;d++)b[d]=arguments[d];return b.unshift(this),b.unshift(h.name),c.create.apply(c,b)},c.store[h.name]={collection:[],expiresHeap:new d["default"].BinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},queryData:{},pendingQueries:{},index:{},modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0};var l=c.store[h.name];h.reapInterval&&setInterval(function(){return h.reap()},h.reapInterval);var m=["registerAdapter","getAdapterName","getAdapter","is","!clear"];for(var n in c)"function"==typeof c[n]&&m.push(n);d["default"].forEach(m,function(a){var b=a;"!"!==b[0]&&(c[b].shorthand!==!1?(h[b]=function(){for(var a=arguments.length,d=Array(a),e=0;a>e;e++)d[e]=arguments[e];return d.unshift(h.name),c[b].apply(c,d)},h[b].before=function(a){var c=h[b];h[b]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return c.apply(h,a.apply(h,d)||d)}}):h[b]=function(){for(var a=arguments.length,d=Array(a),e=0;a>e;e++)d[e]=arguments[e];return c[b].apply(c,d)})}),h.beforeValidate=d["default"].promisify(h.beforeValidate),h.validate=d["default"].promisify(h.validate),h.afterValidate=d["default"].promisify(h.afterValidate),h.beforeCreate=d["default"].promisify(h.beforeCreate),h.afterCreate=d["default"].promisify(h.afterCreate),h.afterFind=d["default"].promisify(h.afterFind),h.afterFindAll=d["default"].promisify(h.afterFindAll),h.afterLoadRelations=d["default"].promisify(h.afterLoadRelations),h.beforeUpdate=d["default"].promisify(h.beforeUpdate),h.afterUpdate=d["default"].promisify(h.afterUpdate),h.beforeDestroy=d["default"].promisify(h.beforeDestroy),h.afterDestroy=d["default"].promisify(h.afterDestroy);var o=void 0;return h.hasOwnProperty("defaultAdapter")&&(o=h.defaultAdapter),d["default"].forOwn(h.actions,function(a,b){if(h[b]&&!h.actions[b])throw new Error('Cannot override existing method "'+b+'"!');a.request=a.request||function(a){return a},a.response=a.response||function(a){return a},a.responseError=a.responseError||function(a){return d["default"].Promise.reject(a)},h[b]=function(c,e){d["default"]._o(c)&&(e=c),e=e||{};var f=h.getAdapter(a.adapter||o||"http"),g=d["default"].deepMixIn({},a);if(!e.hasOwnProperty("endpoint")&&g.endpoint&&(e.endpoint=g.endpoint),"function"==typeof e.getEndpoint)g.url=e.getEndpoint(h,e);else{var i=[e.basePath||h.basePath||f.defaults.basePath,f.getEndpoint(h,d["default"]._sn(c)?c:null,e)];d["default"]._sn(c)&&i.push(c),i.push(a.pathname||b),g.url=d["default"].makePath.apply(null,i)}return g.method=g.method||"GET",g.resourceName=h.name,d["default"].deepMixIn(g,e),new d["default"].Promise(function(a){return a(g)}).then(e.request||a.request).then(function(a){return f.HTTP(a)}).then(function(a){return a&&a.config&&(a.config.resourceName=h.name),a}).then(e.response||a.response,e.responseError||a.responseError)}}),d["default"].Events(h),h.handleChange=function(a){l.collectionModified=d["default"].updateTimestamp(l.collectionModified),h.notify&&setTimeout(function(){h.emit("DS.change",h,a)},0)},{v:h}}();if("object"==typeof j)return j.v}catch(k){throw c.defaults.errorFn(k),delete g[a.name],delete c.store[a.name],k}}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=d.store[a],h=void 0,i=!1;if(b=e.resolveId(f,b),!f)throw new d.errors.NER(a);if(!e._sn(b))throw e._snErr("id");c=e._(f,c);for(var j=0;j<g.collection.length;j++)if(g.collection[j][f.idAttribute]==b){h=g.collection[j],g.expiresHeap.remove(h),i=!0;break}if(i){var k=function(){f.beforeEject(c,h),c.notify&&f.emit("DS.beforeEject",f,h);var a=[];return e.forOwn(g.queryData,function(b,d){b.$$injected&&e.remove(b,h),!b.length&&c.clearEmptyQueries&&a.push(d)}),e.forEach(g.changeHistories[b],function(a){e.remove(g.changeHistory,a)}),e.forEach(a,function(a){delete g.completedQueries[a],delete g.queryData[a]}),g.observers[b]&&"function"==typeof g.observers[b].close&&g.observers[b].close(),delete g.observers[b],delete g.index[b],delete g.previousAttributes[b],delete g.completedQueries[b],delete g.pendingQueries[b],delete g.changeHistories[b],delete g.modified[b],delete g.saved[b],f.instanceEvents&&h.off&&h.off(),g.collection.splice(j,1),f.handleChange(h),f.afterEject(c,h),c.notify&&f.emit("DS.afterEject",f,h),{v:h}}();if("object"==typeof k)return k.v}}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a];if(b=b||{},!f)throw new d.errors.NER(a);if(!e._o(b))throw e._oErr("params");c=e._(f,c),e.applyScope(f,b,c);var g=d.store[a],h=e.toJson(b),i=f.filter(b);return e.isEmpty(b)?g.completedQueries={}:delete g.completedQueries[h],e.forEach(i,function(a){a&&a[f.idAttribute]&&f.eject(a[f.idAttribute],c)}),f.handleChange(i),i}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a];if(!f)throw new d.errors.NER(a);if(b&&!e._o(b))throw e._oErr("params");return b=b||{},c=e._(f,c),e.applyScope(f,b,c),f.defaultFilter.call(d,d.store[a].collection,a,b,c)}},function(a,b,c){function d(a,b){var c=this,d=a.name;return function(e,g,h,i,j){var k=this,l=void 0,m=i&&i(a.idAttribute)?i(a.idAttribute):k[a.idAttribute];if(f["default"].forEach(a.relationFields,function(a){delete e[a],delete g[a],delete h[a]}),(!f["default"].isEmpty(e)||!f["default"].isEmpty(g)||!f["default"].isEmpty(h)||j)&&(l=c.get(d,m),b.modified[m]=f["default"].updateTimestamp(b.modified[m]),l&&a.instanceEvents&&setTimeout(function(){l.emit("DS.change",a,l)},0),a.handleChange(l),a.keepChangeHistory)){var n={resourceName:d,target:l,added:e,removed:g,changed:h,timestamp:b.modified[m]};b.changeHistories[m].push(n),b.changeHistory.push(n)}a.computed&&(l=l||c.get(d,m),f["default"].forOwn(a.computed,function(a,b){if(!f["default"]._o(a)){var c=!1;f["default"].forEach(a.deps,function(a){(a in e||a in g||a in h||!(b in l))&&(c=!0)}),c=c||!a.deps.length,c&&f["default"].compute.call(l,a,b)}})),a.idAttribute in h&&a.errorFn('Doh! You just changed the primary key of an object! Your data for the "'+d+'" resource is now in an undefined (probably broken) state.')}}function e(a,b,c,h){var i=this,j=void 0;if(f["default"]._a(c)){j=[];for(var k=0;k<c.length;k++)j.push(e.call(i,a,b,c[k],h))}else{var l=a.computed,m=a.idAttribute;if(l&&l[m]&&!function(){var a=[];f["default"].forEach(l[m].deps,function(b){a.push(c[b])}),c[m]=l[m][l[m].length-1].apply(c,a)}(),!(m in c)){var n=new g["default"].R(a.name+'.inject: "attrs" must contain the property specified by "idAttribute"!');throw h.errorFn(n),n}try{!function(){f["default"].forEach(a.relationList,function(b){var d=b.relation,e=i.definitions[d],j=c[b.localField];if("function"==typeof b.inject)b.inject(a,b,c);else if(j&&b.inject!==!1){if(!e)throw new g["default"].R(a.name+" relation is defined but the resource is not!");if(f["default"]._a(j))!function(){var g=[];f["default"].forEach(j,function(j){if(j!==i.store[d].index[j[e.idAttribute]])try{var k=e.inject(j,h.orig());b.foreignKey&&f["default"].set(k,b.foreignKey,c[a.idAttribute]),g.push(k)}catch(l){h.errorFn(l,"Failed to inject "+b.type+' relation: "'+d+'"!')}})}();else if(j!==i.store[d].index[j[e.idAttribute]])try{var k=e.inject(c[b.localField],h.orig());b.foreignKey&&f["default"].set(k,b.foreignKey,c[a.idAttribute])}catch(l){h.errorFn(l,"Failed to inject "+b.type+' relation: "'+d+'"!')}}});var e=c[m],k=a.get(e),l=k?b.modified[e]:0;if(k)"merge"===h.onConflict?f["default"].deepMixIn(k,c):"replace"===h.onConflict&&(f["default"].forOwn(k,function(b,d){d!==a.idAttribute&&(c.hasOwnProperty(d)||delete k[d])}),f["default"].forOwn(c,function(b,c){c!==a.idAttribute&&(k[c]=b)})),a.resetHistoryOnInject&&(b.previousAttributes[e]=f["default"].copy(k,null,null,null,a.relationFields),b.changeHistories[e].length&&(f["default"].forEach(b.changeHistories[e],function(a){f["default"].remove(b.changeHistory,a)}),b.changeHistories[e].splice(0,b.changeHistories[e].length))),b.observers[e]&&"function"==typeof b.observers[e]&&b.observers[e].deliver();else{k=c instanceof a[a["class"]]?c:new a[a["class"]],a.instanceEvents&&"function"!=typeof k.emit&&f["default"].Events(k),f["default"].forEach(a.relationList,function(b){("boolean"==typeof b.link?b.link:!!a.linkRelations)&&delete c[b.localField]}),f["default"].deepMixIn(k,c),b.collection.push(k),b.changeHistories[e]=[];var n=d.call(i,a,b);a.watchChanges&&(b.observers[e]=new i.observe.ObjectObserver(k),b.observers[e].open(n,k)),b.index[e]=k,n.call(k,{},{},{},null,!0),b.previousAttributes[e]=f["default"].copy(k,null,null,null,a.relationFields)}b.modified[e]=l&&b.modified[e]===l?f["default"].updateTimestamp(b.modified[e]):b.modified[e],b.expiresHeap.remove(k);var o=(new Date).getTime();b.expiresHeap.push({item:k,timestamp:o,expires:a.maxAge?o+a.maxAge:Number.MAX_VALUE}),j=k}()}catch(o){h.errorFn(o,c)}}return j}var f=c(2),g=c(3);a.exports=function(a,b,c){var d=this,h=d.definitions[a],i=d.store[a],j=void 0;if(!h)throw new g["default"].NER(a);if(!f["default"]._o(b)&&!f["default"]._a(b))throw new g["default"].IA(a+'.inject: "attrs" must be an object or an array!');return c=f["default"]._(h,c),c.beforeInject(c,b),c.notify&&h.emit("DS.beforeInject",h,b),j=e.call(d,h,i,b,c),h.handleChange(j),c.afterInject(c,j),c.notify&&h.emit("DS.afterInject",h,j),j}},function(a,b,c){b["default"]={create:c(37),destroy:c(38),destroyAll:c(39),find:c(40),findAll:c(41),loadRelations:c(42),reap:c(43),refresh:function(a,b,c){var d=this,e=d.utils;return new e.Promise(function(f,g){var h=d.definitions[a];b=e.resolveId(d.definitions[a],b),h?e._sn(b)?(c=e._(h,c),c.bypassCache=!0,f(d.get(a,b))):g(e._snErr("id")):g(new d.errors.NER(a))}).then(function(e){return e?d.find(a,b,c):e})["catch"](d.errorFn("refresh",a,b,c))},refreshAll:function(a,b,c){var d=this,e=d.utils,f=d.definitions[a];return b=b||{},new e.Promise(function(g,h){f?e._o(b)?(c=e._(f,c),c.bypassCache=!0,g(d.filter(a,b,c))):h(e._oErr("params")):h(new d.errors.NER(a))}).then(function(g){return c.bypassCache=!0,d.findAll(a,b,c).then(function(a){return e.forEach(g,function(b){-1===a.indexOf(b)&&f.eject(b)}),a})})["catch"](d.errorFn("refreshAll",a,b,c))},save:c(44),update:c(45),updateAll:c(46)}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=void 0;c=c||{},b=b||{};var h=void 0;if(f)if(e._o(b)){if(c=e._(f,c),c.upsert&&e._sn(b[f.idAttribute]))return d.update(a,b[f.idAttribute],b,c)}else h=e._oErr("attrs");else h=new d.errors.NER(a);return new e.Promise(function(a,c){h?c(h):a(b)}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeCreate.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeCreate",f,a),g=d.getAdapterName(c),d.adapters[g].create(f,e.omit(a,c.omit),c)}).then(function(a){return c.afterCreate.call(a,c,a)}).then(function(b){if(c.notify&&f.emit("DS.afterCreate",f,b),c.cacheResponse){var g=d.inject(f.name,b,c.orig()),h=g[f.idAttribute],i=d.store[a];return i.completedQueries[h]=(new Date).getTime(),i.saved[h]=e.updateTimestamp(i.saved[h]),g}return d.createInstance(a,b,c)}).then(function(a){return e.respond(a,{adapter:g},c)})["catch"](d.errorFn("create",a,b,c))}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=void 0,h=void 0;return new e.Promise(function(h,i){b=e.resolveId(f,b),f?e._sn(b)?(g=f.get(b)||{id:b},c=e._(f,c),h(g)):i(e._snErr("id")):i(new d.errors.NER(a))}).then(function(a){return c.beforeDestroy.call(a,c,a)}).then(function(a){return c.notify&&f.emit("DS.beforeDestroy",f,a),c.eagerEject&&f.eject(b),h=f.getAdapter(c),h.destroy(f,b,c)}).then(function(){return c.afterDestroy.call(g,c,g)}).then(function(a){return c.notify&&f.emit("DS.afterDestroy",f,a),f.eject(b),e.respond(b,{adapter:h},c)})["catch"](function(e){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),d.errorFn("destroy",a,b,c)(e)})}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=void 0,h=void 0,i=void 0;return b=b||{},new e.Promise(function(g,h){f?e._o(b)?(c=e._(f,c),e.applyScope(f,b,c),g()):h(e._oErr("attrs")):h(new d.errors.NER(a))}).then(function(){return h=f.defaultFilter.call(d,a,b),c.beforeDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.beforeDestroy",f,h),c.eagerEject&&(g=f.ejectAll(b)),i=f.getAdapterName(c),d.adapters[i].destroyAll(f,b,c)}).then(function(){return c.afterDestroy(c,h)}).then(function(){return c.notify&&f.emit("DS.afterDestroy",f,h),g||f.ejectAll(b)}).then(function(a){return e.respond(a,{adapter:i},c)})["catch"](function(e){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),d.errorFn("destroyAll",a,b,c)(e)})}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.definitions[a],g=d.store[a],h=void 0;return new e.Promise(function(h,i){if(f)if(e._sn(b)){c=e._(f,c),c.params&&(c.params=e.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&delete g.completedQueries[b];var j=c.maxAge&&b in g.completedQueries&&g.completedQueries[b]+c.maxAge<(new Date).getTime();c.findStrictCache&&!(b in g.completedQueries)||!f.get(b)||c.bypassCache||j?(delete g.completedQueries[b],h()):h(f.get(b))}else i(e._snErr("id"));else i(new d.errors.NER(a))}).then(function(a){if(a)return a;if(!(b in g.pendingQueries)){var i=void 0,j=c.findStrategy||c.strategy;if("fallback"===j){var k=function l(a){return h=f.getAdapterName((c.findFallbackAdapters||c.fallbackAdapters)[a]),d.adapters[h].find(f,b,c)["catch"](function(b){return a++,a<c.fallbackAdapters.length?l(a):e.Promise.reject(b)})};i=k(0)}else h=f.getAdapterName(c),i=d.adapters[h].find(f,b,c);g.pendingQueries[b]=i.then(function(a){return c.afterFind.call(a,c,a)}).then(function(a){if(delete g.pendingQueries[b],c.cacheResponse){var d=f.inject(a,c.orig());return g.completedQueries[b]=(new Date).getTime(),g.saved[b]=e.updateTimestamp(g.saved[b]),d}return f.createInstance(a,c.orig())})}return g.pendingQueries[b]}).then(function(a){return e.respond(a,{adapter:h},c)})["catch"](function(e){return g&&delete g.pendingQueries[b],d.errorFn("find",a,b,c)(e)})}},function(a,b){function c(a,b,c,d){var e=this,f=e.utils,g=e.definitions[b],h=e.store[b],i=e.definitions[b].idAttribute,j=(new Date).getTime();a=a||[],delete h.pendingQueries[c],h.completedQueries[c]=j;var k=g.inject(a,d.orig());return f._a(k)?f.forEach(k,function(a){if(a){var b=a[i];b&&(h.completedQueries[b]=j,h.saved[b]=f.updateTimestamp(h.saved[b]))}}):(d.errorFn("response is expected to be an array!"),h.completedQueries[k[i]]=j),k}a.exports=function(a,b,d){var e=this,f=e.utils,g=e.definitions[a],h=e.store[a],i=void 0,j=void 0;return new f.Promise(function(c,j){if(b=b||{},e.definitions[a])if(f._o(b)){d=f._(g,d),i=f.toJson(b),d.params&&(d.params=f.copy(d.params)),f.applyScope(g,b,d),(d.bypassCache||!d.cacheResponse)&&(delete h.completedQueries[i],delete h.queryData[i]);var k=d.maxAge&&i in h.completedQueries&&h.completedQueries[i]+d.maxAge<(new Date).getTime();i in h.completedQueries&&!k?c(d.useFilter?d.localKeys?g.getAll(d.localKeys,d.orig()):g.filter(b,d.orig()):h.queryData[i]):c()}else j(f._oErr("params"));else j(new e.errors.NER(a))}).then(function(k){if(k)return k;if(!(i in h.pendingQueries)){var l=void 0,m=d.findAllStrategy||d.strategy;if("fallback"===m){var n=function o(a){return j=g.getAdapterName((d.findAllFallbackAdapters||d.fallbackAdapters)[a]),e.adapters[j].findAll(g,b,d)["catch"](function(b){return a++,a<d.fallbackAdapters.length?o(a):f.Promise.reject(b)})};l=n(0)}else j=g.getAdapterName(d),l=e.adapters[j].findAll(g,b,d);h.pendingQueries[i]=l.then(function(a){return d.afterFindAll.call(a,d,a)}).then(function(b){return delete h.pendingQueries[i],d.cacheResponse?(h.queryData[i]=c.call(e,b,a,i,d),h.queryData[i].$$injected=!0,h.queryData[i]):(f.forEach(b,function(a,c){b[c]=g.createInstance(a,d.orig())}),b)})}return h.pendingQueries[i]}).then(function(a){return f.respond(a,{adapter:j},d)})["catch"](function(c){return h&&delete h.pendingQueries[i],e.errorFn("findAll",a,b,d)(c)})}},function(a,b){function c(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}a.exports=function(a,b,d,e){var f=this,g=f.utils,h=f.errors,i=f.definitions[a],j=void 0;return new g.Promise(function(f,k){g._sn(b)&&(b=i.get(b)),g._s(d)&&(d=[d]),d=d||[],i?g._o(b)?g._a(d)?!function(){j=g._(i,e);var a=[];g.forEach(i.relationList,function(f){var h=f.relation,j=i.getResource(h),k=g._(j,e);if(!d.length||g.contains(d,h)||g.contains(d,f.localField)){var l=void 0,m={};k.allowSimpleWhere?m[f.foreignKey]=b[i.idAttribute]:(m.where={},m.where[f.foreignKey]={"==":b[i.idAttribute]});var n=k.orig();if("function"==typeof f.load)l=f.load(i,f,b,n);else if("hasMany"===f.type){if(f.localKeys){delete m[f.foreignKey];var o=g.get(b,f.localKeys)||[];o=g._a(o)?o:g.keys(o),m.where=c({},j.idAttribute,{"in":o}),n.localKeys=o}else f.foreignKeys&&(delete m[f.foreignKey],m.where=c({},f.foreignKeys,{contains:b[i.idAttribute]}));l=j.findAll(m,n)}else"hasOne"===f.type?f.localKey&&g.get(b,f.localKey)?l=j.find(g.get(b,f.localKey),n):f.foreignKey&&(l=j.findAll(m,n).then(function(a){return a.length?a[0]:null})):g.get(b,f.localKey)&&(l=j.find(g.get(b,f.localKey),n));l&&a.push(l)}}),f(a)}():k(new h.IA('"relations" must be a string or an array!')):k(new h.IA('"instance(id)" must be a string, number or object!')):k(new h.NER(a))}).then(function(a){return g.Promise.all(a)}).then(function(){return j.afterLoadRelations.call(b,j,b)})["catch"](f.errorFn("loadRelations",a,b,d,e))}},function(a,b){a.exports=function(a,b){var c=this,d=c.utils,e=c.definitions[a],f=c.store[a];return new d.Promise(function(g,h){if(e){b=d._(e,b),b.hasOwnProperty("notify")||(b.notify=!1);for(var i=[],j=(new Date).getTime(),k=void 0;(k=f.expiresHeap.peek())&&k.expires<j;)i.push(k.item),delete k.item,f.expiresHeap.pop();g(i)}else h(new c.errors.NER(a))}).then(function(a){if(a.length&&(e.beforeReap(b,a),b.notify&&e.emit("DS.beforeReap",e,a)),"inject"===b.reapAction)!function(){var b=(new Date).getTime();d.forEach(a,function(a){f.expiresHeap.push({item:a,timestamp:b,expires:e.maxAge?b+e.maxAge:Number.MAX_VALUE})})}();else if("eject"===b.reapAction)d.forEach(a,function(a){e.eject(a[e.idAttribute])});else if("refresh"===b.reapAction){var c=function(){var b=[];return d.forEach(a,function(a){b.push(e.refresh(a[e.idAttribute]))}),{v:d.Promise.all(b)}}();if("object"==typeof c)return c.v}return a}).then(function(a){return a.length&&(e.afterReap(b,a),b.notify&&e.emit("DS.afterReap",e,a)),a})["catch"](c.errorFn("reap",a,b))}},function(a,b){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.errors,g=d.definitions[a],h=d.store[a],i=void 0,j=void 0,k=void 0;return new e.Promise(function(d,h){b=e.resolveId(g,b),g?e._sn(b)?g.get(b)?(i=g.get(b),c=e._(g,c),d(i)):h(new f.R('id "'+b+'" not found in cache!')):h(e._snErr("id")):h(new f.NER(a))}).then(function(a){return c.beforeValidate.call(a,c,a)}).then(function(a){return c.validate.call(a,c,a)}).then(function(a){return c.afterValidate.call(a,c,a)}).then(function(a){return c.beforeUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.beforeUpdate",g,a),c.changesOnly){h.observers[b]&&"function"==typeof h.observers[b]&&h.observers[b].deliver();var f=[],i=g.changes(b);for(var l in i.added)f.push(l);for(l in i.changed)f.push(l);if(i=e.pick(a,f),e.isEmpty(i))return j=!0,a;a=i}return k=g.getAdapterName(c),d.adapters[k].update(g,b,e.omit(a,c.omit),c)}).then(function(a){return c.afterUpdate.call(a,c,a)}).then(function(a){if(c.notify&&g.emit("DS.afterUpdate",g,a),j)return a;if(c.cacheResponse){var b=g.inject(a,c.orig()),d=b[g.idAttribute];return h.saved[d]=e.updateTimestamp(h.saved[d]),g.resetHistoryOnInject||(h.previousAttributes[d]=e.copy(b,null,null,null,g.relationFields)),b}return g.createInstance(a,c.orig())}).then(function(a){return e.respond(a,{adapter:k},c)})["catch"](d.errorFn("save",a,b,c))}},function(a,b){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.definitions[a],i=void 0;return new f.Promise(function(e,i){b=f.resolveId(h,b),h?f._sn(b)?(d=f._(h,d),e(c)):i(f._snErr("id")):i(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),i=h.getAdapterName(d),e.adapters[i].update(h,b,f.omit(a,d.omit),d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(b){if(d.notify&&h.emit("DS.afterUpdate",h,b),d.cacheResponse){var c=h.inject(b,d.orig()),g=e.store[a],i=c[h.idAttribute];return g.saved[i]=f.updateTimestamp(g.saved[i]),h.resetHistoryOnInject||(g.previousAttributes[i]=f.copy(c,null,null,null,h.relationFields)),c}return h.createInstance(b,d.orig())}).then(function(a){return f.respond(a,{adapter:i},d)})["catch"](e.errorFn("update",a,b,c,d))}},function(a,b){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.definitions[a],i=void 0;return new f.Promise(function(e,i){h?(d=f._(h,d),f.applyScope(h,c,d),e(b)):i(new g.NER(a))}).then(function(a){return d.beforeValidate.call(a,d,a)}).then(function(a){return d.validate.call(a,d,a)}).then(function(a){return d.afterValidate.call(a,d,a)}).then(function(a){return d.beforeUpdate.call(a,d,a)}).then(function(a){return d.notify&&h.emit("DS.beforeUpdate",h,a),i=h.getAdapterName(d),e.adapters[i].updateAll(h,f.omit(a,d.omit),c,d)}).then(function(a){return d.afterUpdate.call(a,d,a)}).then(function(c){d.notify&&h.emit("DS.afterUpdate",h,b);var g=d.orig();if(d.cacheResponse){var i=function(){var b=h.inject(c,g),d=e.store[a];return f.forEach(b,function(a){var b=a[h.idAttribute];d.saved[b]=f.updateTimestamp(d.saved[b]),h.resetHistoryOnInject||(d.previousAttributes[b]=f.copy(a,null,null,null,h.relationFields))}),{v:b}}();if("object"==typeof i)return i.v}else{var j=function(){var a=[];return f.forEach(c,function(b){a.push(h.createInstance(b,g))}),{v:a}}();if("object"==typeof j)return j.v}}).then(function(a){return f.respond(a,{adapter:i},d)})["catch"](e.errorFn("updateAll",a,b,c,d))}}])}); | ||
//# sourceMappingURL=js-data.min.map |
{ | ||
"name": "js-data", | ||
"description": "Robust, framework-agnostic in-memory data store.", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"homepage": "http://www.js-data.io", | ||
@@ -53,3 +53,3 @@ "repository": { | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "0.2.0", | ||
"karma-chrome-launcher": "0.2.1", | ||
"karma-coverage": "0.5.2", | ||
@@ -56,0 +56,0 @@ "karma-firefox-launcher": "0.1.6", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
515968
9511