Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-data

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-data - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

5

CHANGELOG.md

@@ -0,1 +1,6 @@

##### 2.2.1 - 09 July 2015
###### Backwards compatible bug fixes
- #176 - `localKey`, `localKeys` and `foreignKey` don't support nested fields.
##### 2.2.0 - 07 July 2015

@@ -2,0 +7,0 @@

6

dist/js-data.min.js
/*!
* js-data
* @version 2.2.0 - Homepage <http://www.js-data.io/>
* @version 2.2.1 - Homepage <http://www.js-data.io/>
* @author Jason Dobry <jason.dobry@gmail.com>

@@ -11,5 +11,5 @@ * @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.2.0",major:parseInt("2",10),minor:parseInt("2",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(5),m=c(6),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.afterInject=f,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.fallbackAdapters=["http"],o.findStrictCache=!1,o.idAttribute="id",o.ignoredChanges=[/\$/],o.instanceEvents=!!j["default"].w,o.keepChangeHistory=!1,o.linkRelations=!0,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.strategy="single",o.upsert=!!j["default"].w,o.useClass=!0,o.useFilter=!1,o.validate=e,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.s=c.store,c.definitions={},c.defs=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.defs[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}}]),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){var b={};a=a||this,a.on=function(a,c,d){b[a]=b[a]||[],b[a].push({f:c,c:d})},a.off=function(a,c){var d=b[a];if(d)if(c){for(var e=0;e<d.length;e++)if(d[e]===c){d.splice(e,1);break}}else d.splice(0,d.length);else b={}},a.emit=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)}}var e=c(3),f=c(7),g=c(8),h=c(9),i=c(13),j=c(10),k=c(14),l=c(19),m=c(11),n=c(15),o=c(16),p=c(12),q=c(20),r=c(17),s=c(18),t=c(4),u=void 0,v=Object.prototype,w=v.toString,x=void 0;try{x=Promise}catch(y){console.error("js-data requires a global Promise constructor!")}var z=Array.isArray||function(a){return"[object Array]"==w.call(a)||!1},A=function(a){return"[object RegExp]"==w.call(a)||!1},B=function(a){return"string"==typeof a||a&&"object"==typeof a&&"[object String]"==w.call(a)||!1},C=function(a){return"[object Object]"==w.call(a)||!1},D=function(a){return a&&"object"==typeof a&&"[object Date]"==w.call(a)||!1},E=function(a){var b=typeof a;return"number"==b||a&&"object"==b&&"[object Number]"==w.call(a)||!1},F=function(a){return"function"==typeof a||a&&"[object Function]"===w.call(a)||!1},G=function(a){return B(a)||E(a)},H=function(a){return new e["default"].IA('"'+a+'" must be a string or a number!')},I=function(a){return new e["default"].IA('"'+a+'" must be an object!')},J=function(a){return new e["default"].IA('"'+a+'" must be an array!')},K=function(a){if(null==a)return!0;if("string"==typeof a||z(a))return!a.length;if("object"==typeof a){var b=!0;return i(a,function(){return b=!1,!1}),b}return!0},L=function(a,b){if(!a||!b)return[];for(var c=[],d=void 0,e=0,f=a.length;f>e;e++)d=a[e],j(c,d)||j(b,d)&&c.push(d);return c},M=function(a,b,c){var d=[];return g(a,function(a,c,e){b(a,c,e)&&d.push(a)},c),d};try{u=window,u={}}catch(N){u=null}var O=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],P=t.isBlacklisted,Q=function X(a,b,c,d,e){if(b){if(a===b)throw new Error("Cannot copy! Source and destination are identical.");if(c=c||[],d=d||[],C(a)){var f=c.indexOf(a);if(-1!==f)return d[f];c.push(a),d.push(b)}var h=void 0;if(z(a)){var i=void 0;for(b.length=0,i=0;i<a.length;i++)h=X(a[i],null,c,d,e),C(a[i])&&(c.push(a[i]),d.push(h)),b.push(h)}else{z(b)?b.length=0:g(b,function(a,c){delete b[c]});for(var j in a)if(a.hasOwnProperty(j)){if(P(j,e))continue;h=X(a[j],null,c,d,e),C(a[j])&&(c.push(a[j]),d.push(h)),b[j]=h}}}else b=a,a&&(z(a)?b=X(a,[],c,d,e):D(a)?b=new Date(a.getTime()):A(a)?(b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex):C(a)&&(b=X(a,Object.create(Object.getPrototypeOf(a)),c,d,e)));return b},R=function Y(a,b){var c=!0;a:for(;c;){var d=a,e=b;if(i=j=f=g=h=void 0,c=!1,d===e)return!0;if(null===d||null===e)return!1;if(d!==d&&e!==e)return!0;var f,g,h,i=typeof d,j=typeof e;if(i==j&&"object"==i){if(!z(d)){if(D(d)){if(!D(e))return!1;a=d.getTime(),b=e.getTime(),c=!0;continue a}if(A(d)&&A(e))return d.toString()==e.toString();if(z(e))return!1;h={};for(g in d)if("$"!==g.charAt(0)&&!F(d[g])){if(!Y(d[g],e[g]))return!1;h[g]=!0}for(g in e)if(!h.hasOwnProperty(g)&&"$"!==g.charAt(0)&&void 0!==e[g]&&!F(e[g]))return!1;return!0}if(!z(e))return!1;if((f=d.length)==e.length){for(g=0;f>g;g++)if(!Y(d[g],e[g]))return!1;return!0}}return!1}},S=function(a,b){return B(b)||E(b)?b:b&&a?b[a.idAttribute]||b:b},T=function(a,b){return a&&(B(b)||E(b))?a.index[b]||b:b},U=function(a){return null!=a&&""!==a},V=function(a,b){return b=b||"",M(a,U).join(b)},W=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=V(b,"/");return d.replace(/([^:\/]|^)\/{2,}/g,"$1/")};b["default"]={Promise:x,_:function(a,b){var c=this;if(b=b||{},b&&b.constructor===a.constructor)return b;if(!C(b))throw new e["default"].IA('"options" must be an object!');g(O,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;i(a,function(a,c){b[c]=a})};return d.prototype=a,d.prototype.orig=function(){var a={};return i(this,function(b,c){a[c]=b}),a},new d(b)},_n:E,_s:B,_sn:G,_snErr:H,_o:C,_oErr:I,_a:z,_aErr:J,compute:function(a,b){var c=this,d=[];g(a.deps,function(a){d.push(r(c,a))}),s(c,b,a[a.length-1].apply(c,d))},contains:j,copy:Q,deepMixIn:k,diffObjectFromOldObject:t.diffObjectFromOldObject,BinaryHeap:f,equals:R,Events:d,filter:M,fillIn:function(a,b){return i(b,function(b,c){c in a||(a[c]=b)}),a},forEach:g,forOwn:i,fromJson:function(a){return B(a)?JSON.parse(a):a},get:r,intersection:L,isArray:z,isBlacklisted:P,isEmpty:K,isFunction:F,isObject:C,isNumber:E,isString:B,keys:o,makePath:W,observe:t,omit:function(a,b){var c=[];return i(a,function(a,d){P(d,b)&&c.push(d)}),g(c,function(b){delete a[b]}),a},pascalCase:l,pick:n,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:m,set:s,slice:h,sort:p,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:q,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)){for(var f=c.cur,g=c.ctx;g;){if(g.cur===f)return void 0;g=g.ctx}if(z(a))for(e=[],d=0;d<a.length;d+=1)e[d]=b(a[d],{ctx:c,cur:a[d]});else e={},i(a,function(d,f){e[f]=b(a[f],{ctx:c,cur:a[f]})});return e}return a}(a,{ctx:null,cur:a})},resolveItem:T,resolveId:S,respond:function(a,b,c){return"array"===c.returnMeta?[a,b]:"object"===c.returnMeta?{response:a,meta:b}:a},w:u,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="boolean"==typeof d.enumerable?d.enumerable:!!b.relationsEnumerable;if("boolean"==typeof d.link?d.link:!!b.linkRelations){delete c[f];var k={enumerable:j,set:function(){}};"belongsTo"===d.type?k.get=function(){return this[g]?b.getResource(e).get(this[g]):void 0}:"hasMany"===d.type?k.get=function(){var c={};if(h)return c[h]=this[b.idAttribute],b.getResource(e).defaultFilter.call(a,a.s[e].collection,e,c,{allowSimpleWhere:!0});if(i){var d=this[i]||[];return b.getResource(e).getAll(z(d)?d:o(d))}return void 0}:"hasOne"===d.type&&(g?k.get=function(){return this[g]?b.getResource(e).get(this[g]):void 0}:k.get=function(){var c={};c[h]=this[b.idAttribute];var d=c[h]?b.getResource(e).defaultFilter.call(a,a.s[e].collection,e,c,{allowSimpleWhere:!0}):[];return d.length?d[0]:void 0}),d.get&&!function(){var a=k.get;k.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,d.localField,k)}})}}},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){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&&(a.__proto__=b)}var f=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}},g=function(a){function b(a){d(this,b),f(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 e(b,a),b}(Error),h=function(a){function b(a){d(this,b),f(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 e(b,a),b}(Error),i=function(a){function b(a){d(this,b),f(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 e(b,a),b}(Error);b["default"]={IllegalArgumentError:g,IA:g,RuntimeError:h,R:h,NonexistentResourceError:i,NER:i}},function(a,b,c){!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.defs[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(){f["default"].w&&g.s[i].observers[j].deliver();var a=k.ignoredChanges||[];f["default"].forEach(h.relationFields,function(b){f["default"].contains(a,b)||a.push(b)});var b=f["default"].diffObjectFromOldObject(l,g.s[i].previousAttributes[j],f["default"].equals,a);return f["default"].forOwn(b,function(a,c){var d=[];f["default"].forOwn(a,function(a,b){f["default"].isFunction(a)||d.push(b)}),b[c]=f["default"].pick(b[c],d)}),f["default"].forEach(h.relationFields,function(a){delete b.added[a],delete b.removed[a],delete b.changed[a]}),{v:b}}();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.s[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.defs[a];if(b=f["default"].resolveItem(c.s[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.defs[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,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.defs[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.s[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(29),digest:function(){this.observe.Platform.performMicrotaskCheckpoint()},eject:c(30),ejectAll:c(31),filter:c(32),get:function(a,b){var c=e.call(this,"get",a,b),d=c._this,f=c._resourceName,g=c._id;return d.s[f].index[g]},getAll:function(a,b){var c=this,d=c.defs[a],e=c.s[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(33),lastModified:function(a,b){var c=e.call(this,"lastModified",a,b||k),d=c._this,f=c._resourceName,g=c._id,h=d.s[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.s[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.s[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){b["default"]={create:c(34),destroy:c(35),destroyAll:c(36),find:c(37),findAll:c(38),loadRelations:c(39),reap:c(40),refresh:function(a,b,c){var d=this,e=d.utils;return new e.Promise(function(f,g){var h=d.defs[a];b=e.resolveId(d.defs[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})},refreshAll:function(a,b,c){var d=this,e=d.utils,f=d.defs[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})})},save:c(41),update:c(42),updateAll:c(43)}},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}}var e=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},f=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}}();Object.defineProperty(b,"__esModule",{value:!0});var g=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}},h=function(){function a(b,c){if(e(this,a),b||(b=function(a){return a}),c||(c=function(a,b){return a===b}),"function"!=typeof b)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');if("function"!=typeof c)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');this.weightFunc=b,this.compareFunc=c,this.heap=[]}return f(a,[{key:"push",value:function(a){this.heap.push(a),d(this.heap,this.weightFunc,this.heap.length-1)}},{key:"peek",value:function(){return this.heap[0]}},{key:"pop",value:function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,g(this.heap,this.weightFunc,0)),a}},{key:"remove",value: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],f=this.heap.pop();return c!==b-1&&(this.heap[c]=f,d(this.heap,this.weightFunc,c),g(this.heap,this.weightFunc,c)),e}return null}},{key:"removeAll",value:function(){this.heap=[]}},{key:"size",value:function(){return this.heap.length}}]),a}();b["default"]=h,a.exports=b["default"]}])})},function(a,b,c){function d(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=d},function(a,b,c){function d(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=d},function(a,b,c){function d(a,b){return-1!==e(a,b)}var e=c(21);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(21);a.exports=d},function(a,b,c){function d(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=e);var c,g,h;return c=~~(a.length/2),g=d(a.slice(0,c),b),h=d(a.slice(c,a.length),b),f(g,h,b)}function e(a,b){return b>a?-1:a>b?1:0}function f(a,b,c){for(var d=[];a.length&&b.length;)d.push(c(a[0],b[0])<=0?a.shift():b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}a.exports=d},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(22),f=c(23);a.exports=d},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(13),g=c(24);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(9);a.exports=d},function(a,b,c){var d=c(13),e=Object.keys||function(a){var b=[];return d(a,function(a,c){b.push(c)}),b};a.exports=e},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(25);a.exports=d},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(26);a.exports=d},function(a,b,c){function d(a){return a=e(a),f(a).replace(/^[a-z]/,g)}var e=c(27),f=c(28),g=c(20);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toUpperCase()}var e=c(27);a.exports=d},function(a,b,c){function d(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=d},function(a,b,c){function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}a.exports=d},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(22);a.exports=e},function(a,b,c){function d(a){return!!a&&"object"==typeof a&&a.constructor===Object}a.exports=d},function(a,b,c){function d(a){switch(typeof a){case"string":case"number":case"boolean":return!0}return null==a}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(8);a.exports=d},function(a,b,c){function d(a){return null==a?"":a.toString()}a.exports=d},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(27),f=c(44),g=c(45),h=c(20),i=c(46);a.exports=d},function(module,exports,__webpack_require__){var _utils=__webpack_require__(2),_errors=__webpack_require__(3),instanceMethods=["compute","eject","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","previous","revert"];module.exports=function defineResource(definition){function Resource(a){this.defaultValues={},this.methods={},this.computed={},_utils["default"].deepMixIn(this,a);var b=_this.defaults;definition["extends"]&&definitions[definition["extends"]]&&(b=definitions[definition["extends"]]),_utils["default"].fillIn(this.defaultValues,b.defaultValues),_utils["default"].fillIn(this.methods,b.methods),_utils["default"].fillIn(this.computed,b.computed),this.endpoint="endpoint"in a?a.endpoint:this.name}var _this=this,definitions=_this.defs;if(_utils["default"]._s(definition)&&(definition={name:definition.replace(/\s/gi,"")}),!_utils["default"]._o(definition))throw _utils["default"]._oErr("definition");
!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.2.1",major:parseInt("2",10),minor:parseInt("2",10),patch:parseInt("1",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(4),m=c(5),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.afterInject=f,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.fallbackAdapters=["http"],o.findStrictCache=!1,o.idAttribute="id",o.ignoredChanges=[/\$/],o.instanceEvents=!!j["default"].w,o.keepChangeHistory=!1,o.linkRelations=!0,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.strategy="single",o.upsert=!!j["default"].w,o.useClass=!0,o.useFilter=!1,o.validate=e,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.s=c.store,c.definitions={},c.defs=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.defs[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}}]),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,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a){var b={};a=a||this,a.on=function(a,c,d){b[a]=b[a]||[],b[a].push({f:c,c:d})},a.off=function(a,c){var d=b[a];if(d)if(c){for(var e=0;e<d.length;e++)if(d[e]===c){d.splice(e,1);break}}else d.splice(0,d.length);else b={}},a.emit=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)}}var f=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}}(),g=c(3),h=c(7),i=c(8),j=c(9),k=c(13),l=c(10),m=c(14),n=c(19),o=c(11),p=c(15),q=c(16),r=c(12),s=c(20),t=c(17),u=c(18),v=c(6),w=void 0,x=Object.prototype,y=x.toString,z=void 0,A=function(){function a(){d(this,a),this.data={}}return f(a,[{key:"get",value:function(a){return this.data[a]}},{key:"insert",value:function(a,b){return this.data[a]=b,this.data[a]}},{key:"update",value:function(a,b,c){return this.data[a]=this.data[a]||{},u(this.data[a],b,c),this.data[a]}},{key:"remove",value:function(a){delete this.data[a]}}]),a}();try{z=Promise}catch(B){console.error("js-data requires a global Promise constructor!")}var C=Array.isArray||function(a){return"[object Array]"==y.call(a)||!1},D=function(a){return"[object RegExp]"==y.call(a)||!1},E=function(a){return"string"==typeof a||a&&"object"==typeof a&&"[object String]"==y.call(a)||!1},F=function(a){return"[object Object]"==y.call(a)||!1},G=function(a){return a&&"object"==typeof a&&"[object Date]"==y.call(a)||!1},H=function(a){var b=typeof a;return"number"==b||a&&"object"==b&&"[object Number]"==y.call(a)||!1},I=function(a){return"function"==typeof a||a&&"[object Function]"===y.call(a)||!1},J=function(a){return E(a)||H(a)},K=function(a){return new g["default"].IA('"'+a+'" must be a string or a number!')},L=function(a){return new g["default"].IA('"'+a+'" must be an object!')},M=function(a){return new g["default"].IA('"'+a+'" must be an array!')},N=function(a){if(null==a)return!0;if("string"==typeof a||C(a))return!a.length;if("object"==typeof a){var b=!0;return k(a,function(){return b=!1,!1}),b}return!0},O=function(a,b){if(!a||!b)return[];for(var c=[],d=void 0,e=0,f=a.length;f>e;e++)d=a[e],l(c,d)||l(b,d)&&c.push(d);return c},P=function(a,b,c){var d=[];return i(a,function(a,c,e){b(a,c,e)&&d.push(a)},c),d};try{w=window,w={}}catch(Q){w=null}var R=["beforeValidate","validate","afterValidate","beforeCreate","afterCreate","beforeUpdate","afterUpdate","beforeDestroy","afterDestroy"],S=v.isBlacklisted,T=function $(a,b,c,d,e){if(b){if(a===b)throw new Error("Cannot copy! Source and destination are identical.");if(c=c||[],d=d||[],F(a)){var f=c.indexOf(a);if(-1!==f)return d[f];c.push(a),d.push(b)}var g=void 0;if(C(a)){var h=void 0;for(b.length=0,h=0;h<a.length;h++)g=$(a[h],null,c,d,e),F(a[h])&&(c.push(a[h]),d.push(g)),b.push(g)}else{C(b)?b.length=0:i(b,function(a,c){delete b[c]});for(var j in a)if(a.hasOwnProperty(j)){if(S(j,e))continue;g=$(a[j],null,c,d,e),F(a[j])&&(c.push(a[j]),d.push(g)),b[j]=g}}}else b=a,a&&(C(a)?b=$(a,[],c,d,e):G(a)?b=new Date(a.getTime()):D(a)?(b=new RegExp(a.source,a.toString().match(/[^\/]*$/)[0]),b.lastIndex=a.lastIndex):F(a)&&(b=$(a,Object.create(Object.getPrototypeOf(a)),c,d,e)));return b},U=function _(a,b){var c=!0;a:for(;c;){var d=a,e=b;if(i=j=f=g=h=void 0,c=!1,d===e)return!0;if(null===d||null===e)return!1;if(d!==d&&e!==e)return!0;var f,g,h,i=typeof d,j=typeof e;if(i==j&&"object"==i){if(!C(d)){if(G(d)){if(!G(e))return!1;a=d.getTime(),b=e.getTime(),c=!0;continue a}if(D(d)&&D(e))return d.toString()==e.toString();if(C(e))return!1;h={};for(g in d)if("$"!==g.charAt(0)&&!I(d[g])){if(!_(d[g],e[g]))return!1;h[g]=!0}for(g in e)if(!h.hasOwnProperty(g)&&"$"!==g.charAt(0)&&void 0!==e[g]&&!I(e[g]))return!1;return!0}if(!C(e))return!1;if((f=d.length)==e.length){for(g=0;f>g;g++)if(!_(d[g],e[g]))return!1;return!0}}return!1}},V=function(a,b){return E(b)||H(b)?b:b&&a?b[a.idAttribute]||b:b},W=function(a,b){return a&&(E(b)||H(b))?a.index.get(b)||b:b},X=function(a){return null!=a&&""!==a},Y=function(a,b){return b=b||"",P(a,X).join(b)},Z=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=Y(b,"/");return d.replace(/([^:\/]|^)\/{2,}/g,"$1/")};b["default"]={Promise:z,_:function(a,b){var c=this;if(b=b||{},b&&b.constructor===a.constructor)return b;if(!F(b))throw new g["default"].IA('"options" must be an object!');i(R,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;k(a,function(a,c){b[c]=a})};return d.prototype=a,d.prototype.orig=function(){var a={};return k(this,function(b,c){a[c]=b}),a},new d(b)},_n:H,_s:E,_sn:J,_snErr:K,_o:F,_oErr:L,_a:C,_aErr:M,compute:function(a,b){var c=this,d=[];i(a.deps,function(a){d.push(t(c,a))}),u(c,b,a[a.length-1].apply(c,d))},contains:l,copy:T,deepMixIn:m,diffObjectFromOldObject:v.diffObjectFromOldObject,BinaryHeap:h,equals:U,Events:e,filter:P,fillIn:function(a,b){return k(b,function(b,c){c in a||(a[c]=b)}),a},forEach:i,forOwn:k,fromJson:function(a){return E(a)?JSON.parse(a):a},get:t,Index:A,intersection:O,isArray:C,isBlacklisted:S,isEmpty:N,isFunction:I,isObject:F,isNumber:H,isString:E,keys:q,makePath:Z,observe:v,omit:function(a,b){var c=[];return k(a,function(a,d){S(d,b)&&c.push(d)}),i(c,function(b){delete a[b]}),a},pascalCase:n,pick:p,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:o,set:u,slice:j,sort:r,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:s,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)){for(var f=c.cur,g=c.ctx;g;){if(g.cur===f)return void 0;g=g.ctx}if(C(a))for(e=[],d=0;d<a.length;d+=1)e[d]=b(a[d],{ctx:c,cur:a[d]});else e={},k(a,function(d,f){e[f]=b(a[f],{ctx:c,cur:a[f]})});return e}return a}(a,{ctx:null,cur:a})},resolveItem:W,resolveId:V,respond:function(a,b,c){return"array"===c.returnMeta?[a,b]:"object"===c.returnMeta?{response:a,meta:b}:a},w:w,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="boolean"==typeof d.enumerable?d.enumerable:!!b.relationsEnumerable;if("boolean"==typeof d.link?d.link:!!b.linkRelations){delete c[f];var k={enumerable:j,set:function(){}};"belongsTo"===d.type?k.get=function(){return t(this,g)?b.getResource(e).get(t(this,g)):void 0}:"hasMany"===d.type?k.get=function(){var c={};if(h)return c[h]=this[b.idAttribute],b.getResource(e).defaultFilter.call(a,a.s[e].collection,e,c,{allowSimpleWhere:!0});if(i){var d=t(this,i)||[];return b.getResource(e).getAll(C(d)?d:q(d))}return void 0}:"hasOne"===d.type&&(g?k.get=function(){return t(this,g)?b.getResource(e).get(t(this,g)):void 0}:k.get=function(){var c={};c[h]=this[b.idAttribute];var d=c[h]?b.getResource(e).defaultFilter.call(a,a.s[e].collection,e,c,{allowSimpleWhere:!0}):[];return d.length?d[0]:void 0}),d.get&&!function(){var a=k.get;k.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,d.localField,k)}})}}},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){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&&(a.__proto__=b)}var f=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}},g=function(a){function b(a){d(this,b),f(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 e(b,a),b}(Error),h=function(a){function b(a){d(this,b),f(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 e(b,a),b}(Error),i=function(a){function b(a){d(this,b),f(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 e(b,a),b}(Error);b["default"]={IllegalArgumentError:g,IA:g,RuntimeError:h,R:h,NonexistentResourceError:i,NER:i}},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.defs[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(){f["default"].w&&g.s[i].observers[j].deliver();var a=k.ignoredChanges||[];f["default"].forEach(h.relationFields,function(b){f["default"].contains(a,b)||a.push(b)});var b=f["default"].diffObjectFromOldObject(l,g.s[i].previousAttributes[j],f["default"].equals,a);return f["default"].forOwn(b,function(a,c){var d=[];f["default"].forOwn(a,function(a,b){f["default"].isFunction(a)||d.push(b)}),b[c]=f["default"].pick(b[c],d)}),f["default"].forEach(h.relationFields,function(a){delete b.added[a],delete b.removed[a],delete b.changed[a]}),{v:b}}();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.s[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.defs[a];if(b=f["default"].resolveItem(c.s[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.defs[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,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.defs[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.s[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(29),digest:function(){this.observe.Platform.performMicrotaskCheckpoint()},eject:c(30),ejectAll:c(31),filter:c(32),get:function(a,b){var c=e.call(this,"get",a,b),d=c._this,f=c._resourceName,g=c._id;return d.s[f].index.get(g)},getAll:function(a,b){var c=this,d=c.defs[a],e=c.s[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.get(b[j])&&g.push(e.index.get(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(33),lastModified:function(a,b){var c=e.call(this,"lastModified",a,b||k),d=c._this,f=c._resourceName,g=c._id,h=d.s[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.s[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.s[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){b["default"]={create:c(34),destroy:c(35),destroyAll:c(36),find:c(37),findAll:c(38),loadRelations:c(39),reap:c(40),refresh:function(a,b,c){var d=this,e=d.utils;return new e.Promise(function(f,g){var h=d.defs[a];b=e.resolveId(d.defs[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})},refreshAll:function(a,b,c){var d=this,e=d.utils,f=d.defs[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})})},save:c(41),update:c(42),updateAll:c(43)}},function(a,b,c){!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(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}}var e=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},f=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}}();Object.defineProperty(b,"__esModule",{value:!0});var g=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}},h=function(){function a(b,c){if(e(this,a),b||(b=function(a){return a}),c||(c=function(a,b){return a===b}),"function"!=typeof b)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');if("function"!=typeof c)throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');this.weightFunc=b,this.compareFunc=c,this.heap=[]}return f(a,[{key:"push",value:function(a){this.heap.push(a),d(this.heap,this.weightFunc,this.heap.length-1)}},{key:"peek",value:function(){return this.heap[0]}},{key:"pop",value:function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,g(this.heap,this.weightFunc,0)),a}},{key:"remove",value: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],f=this.heap.pop();return c!==b-1&&(this.heap[c]=f,d(this.heap,this.weightFunc,c),g(this.heap,this.weightFunc,c)),e}return null}},{key:"removeAll",value:function(){this.heap=[]}},{key:"size",value:function(){return this.heap.length}}]),a}();b["default"]=h,a.exports=b["default"]}])})},function(a,b,c){function d(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=d},function(a,b,c){function d(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=d},function(a,b,c){function d(a,b){return-1!==e(a,b)}var e=c(21);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(21);a.exports=d},function(a,b,c){function d(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=e);var c,g,h;return c=~~(a.length/2),g=d(a.slice(0,c),b),h=d(a.slice(c,a.length),b),f(g,h,b)}function e(a,b){return b>a?-1:a>b?1:0}function f(a,b,c){for(var d=[];a.length&&b.length;)d.push(c(a[0],b[0])<=0?a.shift():b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}a.exports=d},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(22),f=c(23);a.exports=d},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(13),g=c(24);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(9);a.exports=d},function(a,b,c){var d=c(13),e=Object.keys||function(a){var b=[];return d(a,function(a,c){b.push(c)}),b};a.exports=e},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(25);a.exports=d},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(26);a.exports=d},function(a,b,c){function d(a){return a=e(a),f(a).replace(/^[a-z]/,g)}var e=c(27),f=c(28),g=c(20);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.toUpperCase()}var e=c(27);a.exports=d},function(a,b,c){function d(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=d},function(a,b,c){function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}a.exports=d},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(22);a.exports=e},function(a,b,c){function d(a){return!!a&&"object"==typeof a&&a.constructor===Object}a.exports=d},function(a,b,c){function d(a){switch(typeof a){case"string":case"number":case"boolean":return!0}return null==a}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(8);a.exports=d},function(a,b,c){function d(a){return null==a?"":a.toString()}a.exports=d},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(27),f=c(44),g=c(45),h=c(20),i=c(46);a.exports=d},function(module,exports,__webpack_require__){var _utils=__webpack_require__(2),_errors=__webpack_require__(3),instanceMethods=["compute","eject","refresh","save","update","destroy","loadRelations","changeHistory","changes","hasChanges","lastModified","lastSaved","previous","revert"];
if(!_utils["default"]._s(definition.name))throw new _errors["default"].IA('"name" must be a string!');if(definitions[definition.name])throw new _errors["default"].R(definition.name+" is already registered!");try{var def,_class,_ret=function(){if(definition["extends"]&&definitions[definition["extends"]]?Resource.prototype=definitions[definition["extends"]]:Resource.prototype=_this.defaults,definitions[definition.name]=new Resource(definition),def=definitions[definition.name],def.getResource=function(a){return _this.defs[a]},!_utils["default"]._s(def.idAttribute))throw new _errors["default"].IA('"idAttribute" must be a string!');def.relations&&(def.relationList=[],def.relationFields=[],_utils["default"].forOwn(def.relations,function(a,b){_utils["default"].forOwn(a,function(c,d){_utils["default"]._a(c)||(a[d]=[c]),_utils["default"].forEach(a[d],function(a){a.type=b,a.relation=d,a.name=def.name,def.relationList.push(a),a.localField&&def.relationFields.push(a.localField)})})}),def.relations.belongsTo&&_utils["default"].forOwn(def.relations.belongsTo,function(a,b){_utils["default"].forEach(a,function(a){a.parent&&(def.parent=b,def.parentKey=a.localKey,def.parentField=a.localField)})}),"function"==typeof Object.freeze&&(Object.freeze(def.relations),Object.freeze(def.relationList))),_class=def["class"]=_utils["default"].pascalCase(def.name);try{"function"==typeof def.useClass?(eval("function "+_class+"() { def.useClass.call(this); }"),def[_class]=eval(_class),def[_class].prototype=function(a){function b(){}return b.prototype=a,new b}(def.useClass.prototype)):(eval("function "+_class+"() {}"),def[_class]=eval(_class))}catch(e){def[_class]=function(){}}_utils["default"].forOwn(def.methods,function(a,b){def[_class].prototype[b]=a}),def[_class].prototype.set=function(a,b){var c=this;return _utils["default"].set(this,a,b),def.compute(this),def.instanceEvents&&setTimeout(function(){c.emit("DS.change",def,c)},0),def.handleChange(this),this},def[_class].prototype.get=function(a){return _utils["default"].get(this,a)},def.instanceEvents&&_utils["default"].Events(def[_class].prototype),_utils["default"].applyRelationGettersToTarget(_this,def,def[_class].prototype);var parentOmit=null;def.hasOwnProperty("omit")?parentOmit=_this.defaults.omit:(parentOmit=def.omit,def.omit=[]),def.omit=def.omit.concat(parentOmit||[]),_utils["default"].forOwn(def.computed,function(a,b){_utils["default"].isFunction(a)&&(def.computed[b]=[a],a=def.computed[b]),def.methods&&b in def.methods&&def.errorFn('Computed property "'+b+'" conflicts with previously defined prototype method!'),def.omit.push(b);var c;if(1===a.length){var d=a[0].toString().match(/function.*?\(([\s\S]*?)\)/);c=d[1].split(","),def.computed[b]=c.concat(a),a=def.computed[b],c.length&&def.errorFn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),_utils["default"].forEach(c,function(a,b){c[b]=a.trim()}),a.deps=_utils["default"].filter(c,function(a){return!!a})}),_utils["default"].forEach(instanceMethods,function(a){def[_class].prototype["DS"+_utils["default"].pascalCase(a)]=function(){for(var b=arguments.length,c=Array(b),d=0;b>d;d++)c[d]=arguments[d];return c.unshift(this[def.idAttribute]||this),c.unshift(def.name),_this[a].apply(_this,c)}}),def[_class].prototype.DSCreate=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];return b.unshift(this),b.unshift(def.name),_this.create.apply(_this,b)},_this.s[def.name]={collection:[],expiresHeap:new _utils["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 resource=_this.s[def.name];def.reapInterval&&setInterval(function(){return def.reap()},def.reapInterval);var fns=["registerAdapter","getAdapterName","getAdapter","is","!clear"];for(var key in _this)"function"==typeof _this[key]&&fns.push(key);_utils["default"].forEach(fns,function(a){var b=a;"!"!==b[0]&&(_this[b].shorthand!==!1?(def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return c.unshift(def.name),_this[b].apply(_this,c)},def[b].before=function(a){var c=def[b];def[b]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return c.apply(def,a.apply(def,d)||d)}}):def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return _this[b].apply(_this,c)})}),def.beforeValidate=_utils["default"].promisify(def.beforeValidate),def.validate=_utils["default"].promisify(def.validate),def.afterValidate=_utils["default"].promisify(def.afterValidate),def.beforeCreate=_utils["default"].promisify(def.beforeCreate),def.afterCreate=_utils["default"].promisify(def.afterCreate),def.beforeUpdate=_utils["default"].promisify(def.beforeUpdate),def.afterUpdate=_utils["default"].promisify(def.afterUpdate),def.beforeDestroy=_utils["default"].promisify(def.beforeDestroy),def.afterDestroy=_utils["default"].promisify(def.afterDestroy);var defaultAdapter=void 0;return def.hasOwnProperty("defaultAdapter")&&(defaultAdapter=def.defaultAdapter),_utils["default"].forOwn(def.actions,function(a,b){if(def[b]&&!def.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 _utils["default"].Promise.reject(a)},def[b]=function(c,d){_utils["default"]._o(c)&&(d=c),d=d||{};var e=def.getAdapter(a.adapter||defaultAdapter||"http"),f=_utils["default"].deepMixIn({},a);if(!d.hasOwnProperty("endpoint")&&f.endpoint&&(d.endpoint=f.endpoint),"function"==typeof d.getEndpoint)f.url=d.getEndpoint(def,d);else{var g=[d.basePath||e.defaults.basePath||def.basePath,e.getEndpoint(def,_utils["default"]._sn(c)?c:null,d)];_utils["default"]._sn(c)&&g.push(c),g.push(a.pathname||b),f.url=_utils["default"].makePath.apply(null,g)}return f.method=f.method||"GET",_utils["default"].deepMixIn(f,d),new _utils["default"].Promise(function(a){return a(f)}).then(d.request||a.request).then(function(a){return e.HTTP(a)}).then(d.response||a.response,d.responseError||a.responseError)}}),_utils["default"].Events(def),def.handleChange=function(a){resource.collectionModified=_utils["default"].updateTimestamp(resource.collectionModified),def.notify&&setTimeout(function(){def.emit("DS.change",def,a)},0)},{v:def}}();if("object"==typeof _ret)return _ret.v}catch(err){throw _this.defaults.errorFn(err),delete definitions[definition.name],delete _this.s[definition.name],err}}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[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]}),e.w&&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],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,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(b=b||{},!f)throw new d.errors.NER(a);if(!e._o(b))throw e._oErr("params");var g=d.s[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,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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),f.defaultFilter.call(d,d.s[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){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=d.call(i,a,b),m=a.computed,n=a.idAttribute;if(m&&m[n]&&!function(){var a=[];f["default"].forEach(m[n].deps,function(b){a.push(c[b])}),c[n]=m[n][m[n].length-1].apply(c,a)}(),!(n in c)){var o=new g["default"].R(a.name+'.inject: "attrs" must contain the property specified by "idAttribute"!');throw h.errorFn(o),o}try{!function(){f["default"].forEach(a.relationList,function(b){var d=b.relation,e=i.defs[d],j=c[b.localField];if(j){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(f){if(f!==i.s[d].index[f[e.idAttribute]])try{var j=e.inject(f,h.orig());b.foreignKey&&(j[b.foreignKey]=c[a.idAttribute]),g.push(j)}catch(k){h.errorFn(k,"Failed to inject "+b.type+' relation: "'+d+'"!')}})}();else if(j!==i.s[d].index[j[e.idAttribute]])try{var k=e.inject(c[b.localField],h.orig());b.foreignKey&&(k[b.foreignKey]=c[a.idAttribute])}catch(l){h.errorFn(l,"Failed to inject "+b.type+' relation: "'+d+'"!')}}});var d=c[n],e=a.get(d),k=e?b.modified[d]:0;e?("merge"===h.onConflict?f["default"].deepMixIn(e,c):"replace"===h.onConflict&&(f["default"].forOwn(e,function(b,d){d!==a.idAttribute&&(c.hasOwnProperty(d)||delete e[d])}),f["default"].forOwn(c,function(b,c){c!==a.idAttribute&&(e[c]=b)})),a.resetHistoryOnInject&&(b.previousAttributes[d]=f["default"].copy(e,null,null,null,a.relationFields),b.changeHistories[d].length&&(f["default"].forEach(b.changeHistories[d],function(a){f["default"].remove(b.changeHistory,a)}),b.changeHistories[d].splice(0,b.changeHistories[d].length))),f["default"].w&&b.observers[d].deliver()):(e=c instanceof a[a["class"]]?c:new a[a["class"]],f["default"].forEach(a.relationList,function(a){delete c[a.localField]}),f["default"].deepMixIn(e,c),b.collection.push(e),b.changeHistories[d]=[],f["default"].w&&(b.observers[d]=new i.observe.ObjectObserver(e),b.observers[d].open(l,e)),b.index[d]=e,l.call(e,{},{},{},null,!0),b.previousAttributes[d]=f["default"].copy(e,null,null,null,a.relationFields)),b.modified[d]=k&&b.modified[d]===k?f["default"].updateTimestamp(b.modified[d]):b.modified[d],b.expiresHeap.remove(e);var m=(new Date).getTime();b.expiresHeap.push({item:e,timestamp:m,expires:a.maxAge?m+a.maxAge:Number.MAX_VALUE}),j=e}()}catch(p){h.errorFn(p,c)}}return j}var f=c(2),g=c(3);a.exports=function(a,b,c){var d=this,h=d.defs[a],i=d.s[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){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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.s[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)})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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),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(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[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;"fallback"===j?!function(){var a=function g(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?g(a):e.Promise.reject(b)})};i=a(0)}():(h=f.getAdapterName(c),i=d.adapters[h].find(f,b,c)),g.pendingQueries[b]=i.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(a){return g&&delete g.pendingQueries[b],e.Promise.reject(a)})}},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.defs[b],h=e.s[b],i=e.defs[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,c){var e=this,f=e.utils,g=e.defs[a],h=e.s[a],i=void 0,j=void 0;return new f.Promise(function(d,j){b=b||{},e.defs[a]?f._o(b)?(c=f._(g,c),i=f.toJson(b),c.params&&(c.params=f.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&(delete h.completedQueries[i],delete h.queryData[i]),i in h.completedQueries?d(c.useFilter?c.localKeys?g.getAll(c.localKeys,c.orig()):g.filter(b,c.orig()):h.queryData[i]):d()):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=c.findAllStrategy||c.strategy;"fallback"===m?!function(){var a=function d(a){return j=g.getAdapterName((c.findAllFallbackAdapters||c.fallbackAdapters)[a]),e.adapters[j].findAll(g,b,c)["catch"](function(b){return a++,a<c.fallbackAdapters.length?d(a):f.Promise.reject(b)})};l=a(0)}():(j=g.getAdapterName(c),l=e.adapters[j].findAll(g,b,c)),h.pendingQueries[i]=l.then(function(b){return delete h.pendingQueries[i],c.cacheResponse?(h.queryData[i]=d.call(e,b,a,i,c),h.queryData[i].$$injected=!0,h.queryData[i]):(f.forEach(b,function(a,d){b[d]=g.createInstance(a,c.orig())}),b)})}return h.pendingQueries[i]}).then(function(a){return f.respond(a,{adapter:j},c)})["catch"](function(a){return h&&delete h.pendingQueries[i],f.Promise.reject(a)})}},function(a,b,c){function d(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,c,e){var f=this,g=f.utils,h=f.errors,i=f.defs[a];return new g.Promise(function(f,j){g._sn(b)&&(b=i.get(b)),g._s(c)&&(c=[c]),c=c||[],i?g._o(b)?g._a(c)?!function(){var a=(g._(i,e),[]);g.forEach(i.relationList,function(f){var h=f.relation,j=i.getResource(h),k=g._(j,e);if(!c.length||g.contains(c,h)||g.contains(c,f.localField)){var l=void 0,m={};if(k.allowSimpleWhere?m[f.foreignKey]=b[i.idAttribute]:(m.where={},m.where[f.foreignKey]={"==":b[i.idAttribute]}),"hasMany"===f.type){var n=k.orig();if(f.localKeys){delete m[f.foreignKey];var o=b[f.localKeys]||[];o=g._a(o)?o:g.keys(o),m.where=d({},j.idAttribute,{"in":o}),n.localKeys=o}l=j.findAll(m,n)}else"hasOne"===f.type?f.localKey&&b[f.localKey]?l=j.find(b[f.localKey],k.orig()):f.foreignKey&&(l=j.findAll(m,k.orig()).then(function(a){return a.length?a[0]:null})):b[f.localKey]&&(l=j.find(b[f.localKey],k.orig()));l&&a.push(l)}}),f(a)}():j(new h.IA('"relations" must be a string or an array!')):j(new h.IA('"instance(id)" must be a string, number or object!')):j(new h.NER(a))}).then(function(a){return g.Promise.all(a)}).then(function(){return b})}},function(a,b,c){a.exports=function(a,b){var c=this,d=c.utils,e=c.defs[a],f=c.s[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})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.errors,g=d.defs[a],h=d.s[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){e.w&&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)})}},function(a,b,c){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[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.s[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)})}},function(a,b,c){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a],i=void 0;return new f.Promise(function(c,e){h?(d=f._(h,d),c(b)):e(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.s[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)})}},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(27);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.replace(f,"")}var e=c(27),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.toLowerCase()}var e=c(27);a.exports=d}])});
module.exports=function defineResource(definition){function Resource(a){this.defaultValues={},this.methods={},this.computed={},_utils["default"].deepMixIn(this,a);var b=_this.defaults;definition["extends"]&&definitions[definition["extends"]]&&(b=definitions[definition["extends"]]),_utils["default"].fillIn(this.defaultValues,b.defaultValues),_utils["default"].fillIn(this.methods,b.methods),_utils["default"].fillIn(this.computed,b.computed),this.endpoint="endpoint"in a?a.endpoint:this.name}var _this=this,definitions=_this.defs;if(_utils["default"]._s(definition)&&(definition={name:definition.replace(/\s/gi,"")}),!_utils["default"]._o(definition))throw _utils["default"]._oErr("definition");if(!_utils["default"]._s(definition.name))throw new _errors["default"].IA('"name" must be a string!');if(definitions[definition.name])throw new _errors["default"].R(definition.name+" is already registered!");try{var def,_class,_ret=function(){if(definition["extends"]&&definitions[definition["extends"]]?Resource.prototype=definitions[definition["extends"]]:Resource.prototype=_this.defaults,definitions[definition.name]=new Resource(definition),def=definitions[definition.name],def.getResource=function(a){return _this.defs[a]},!_utils["default"]._s(def.idAttribute))throw new _errors["default"].IA('"idAttribute" must be a string!');def.relations&&(def.relationList=[],def.relationFields=[],_utils["default"].forOwn(def.relations,function(a,b){_utils["default"].forOwn(a,function(c,d){_utils["default"]._a(c)||(a[d]=[c]),_utils["default"].forEach(a[d],function(a){a.type=b,a.relation=d,a.name=def.name,def.relationList.push(a),a.localField&&def.relationFields.push(a.localField)})})}),def.relations.belongsTo&&_utils["default"].forOwn(def.relations.belongsTo,function(a,b){_utils["default"].forEach(a,function(a){a.parent&&(def.parent=b,def.parentKey=a.localKey,def.parentField=a.localField)})}),"function"==typeof Object.freeze&&(Object.freeze(def.relations),Object.freeze(def.relationList))),_class=def["class"]=_utils["default"].pascalCase(def.name);try{"function"==typeof def.useClass?(eval("function "+_class+"() { def.useClass.call(this); }"),def[_class]=eval(_class),def[_class].prototype=function(a){function b(){}return b.prototype=a,new b}(def.useClass.prototype)):(eval("function "+_class+"() {}"),def[_class]=eval(_class))}catch(e){def[_class]=function(){}}_utils["default"].forOwn(def.methods,function(a,b){def[_class].prototype[b]=a}),def[_class].prototype.set=function(a,b){var c=this;return _utils["default"].set(this,a,b),def.compute(this),def.instanceEvents&&setTimeout(function(){c.emit("DS.change",def,c)},0),def.handleChange(this),this},def[_class].prototype.get=function(a){return _utils["default"].get(this,a)},def.instanceEvents&&_utils["default"].Events(def[_class].prototype),_utils["default"].applyRelationGettersToTarget(_this,def,def[_class].prototype);var parentOmit=null;def.hasOwnProperty("omit")?parentOmit=_this.defaults.omit:(parentOmit=def.omit,def.omit=[]),def.omit=def.omit.concat(parentOmit||[]),_utils["default"].forOwn(def.computed,function(a,b){_utils["default"].isFunction(a)&&(def.computed[b]=[a],a=def.computed[b]),def.methods&&b in def.methods&&def.errorFn('Computed property "'+b+'" conflicts with previously defined prototype method!'),def.omit.push(b);var c;if(1===a.length){var d=a[0].toString().match(/function.*?\(([\s\S]*?)\)/);c=d[1].split(","),def.computed[b]=c.concat(a),a=def.computed[b],c.length&&def.errorFn("Use the computed property array syntax for compatibility with minified code!")}c=a.slice(0,a.length-1),_utils["default"].forEach(c,function(a,b){c[b]=a.trim()}),a.deps=_utils["default"].filter(c,function(a){return!!a})}),_utils["default"].forEach(instanceMethods,function(a){def[_class].prototype["DS"+_utils["default"].pascalCase(a)]=function(){for(var b=arguments.length,c=Array(b),d=0;b>d;d++)c[d]=arguments[d];return c.unshift(this[def.idAttribute]||this),c.unshift(def.name),_this[a].apply(_this,c)}}),def[_class].prototype.DSCreate=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];return b.unshift(this),b.unshift(def.name),_this.create.apply(_this,b)},_this.s[def.name]={collection:[],expiresHeap:new _utils["default"].BinaryHeap(function(a){return a.expires},function(a,b){return a.item===b}),completedQueries:{},queryData:{},pendingQueries:{},index:new _utils["default"].Index,modified:{},saved:{},previousAttributes:{},observers:{},changeHistories:{},changeHistory:[],collectionModified:0};var resource=_this.s[def.name];def.reapInterval&&setInterval(function(){return def.reap()},def.reapInterval);var fns=["registerAdapter","getAdapterName","getAdapter","is","!clear"];for(var key in _this)"function"==typeof _this[key]&&fns.push(key);_utils["default"].forEach(fns,function(a){var b=a;"!"!==b[0]&&(_this[b].shorthand!==!1?(def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return c.unshift(def.name),_this[b].apply(_this,c)},def[b].before=function(a){var c=def[b];def[b]=function(){for(var b=arguments.length,d=Array(b),e=0;b>e;e++)d[e]=arguments[e];return c.apply(def,a.apply(def,d)||d)}}):def[b]=function(){for(var a=arguments.length,c=Array(a),d=0;a>d;d++)c[d]=arguments[d];return _this[b].apply(_this,c)})}),def.beforeValidate=_utils["default"].promisify(def.beforeValidate),def.validate=_utils["default"].promisify(def.validate),def.afterValidate=_utils["default"].promisify(def.afterValidate),def.beforeCreate=_utils["default"].promisify(def.beforeCreate),def.afterCreate=_utils["default"].promisify(def.afterCreate),def.beforeUpdate=_utils["default"].promisify(def.beforeUpdate),def.afterUpdate=_utils["default"].promisify(def.afterUpdate),def.beforeDestroy=_utils["default"].promisify(def.beforeDestroy),def.afterDestroy=_utils["default"].promisify(def.afterDestroy);var defaultAdapter=void 0;return def.hasOwnProperty("defaultAdapter")&&(defaultAdapter=def.defaultAdapter),_utils["default"].forOwn(def.actions,function(a,b){if(def[b]&&!def.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 _utils["default"].Promise.reject(a)},def[b]=function(c,d){_utils["default"]._o(c)&&(d=c),d=d||{};var e=def.getAdapter(a.adapter||defaultAdapter||"http"),f=_utils["default"].deepMixIn({},a);if(!d.hasOwnProperty("endpoint")&&f.endpoint&&(d.endpoint=f.endpoint),"function"==typeof d.getEndpoint)f.url=d.getEndpoint(def,d);else{var g=[d.basePath||e.defaults.basePath||def.basePath,e.getEndpoint(def,_utils["default"]._sn(c)?c:null,d)];_utils["default"]._sn(c)&&g.push(c),g.push(a.pathname||b),f.url=_utils["default"].makePath.apply(null,g)}return f.method=f.method||"GET",_utils["default"].deepMixIn(f,d),new _utils["default"].Promise(function(a){return a(f)}).then(d.request||a.request).then(function(a){return e.HTTP(a)}).then(d.response||a.response,d.responseError||a.responseError)}}),_utils["default"].Events(def),def.handleChange=function(a){resource.collectionModified=_utils["default"].updateTimestamp(resource.collectionModified),def.notify&&setTimeout(function(){def.emit("DS.change",def,a)},0)},{v:def}}();if("object"==typeof _ret)return _ret.v}catch(err){throw _this.defaults.errorFn(err),delete definitions[definition.name],delete _this.s[definition.name],err}}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[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]}),e.w&&g.observers[b].close(),delete g.observers[b],g.index.remove(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],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,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[a];if(b=b||{},!f)throw new d.errors.NER(a);if(!e._o(b))throw e._oErr("params");var g=d.s[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,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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),f.defaultFilter.call(d,d.s[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){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=d.call(i,a,b),m=a.computed,n=a.idAttribute;if(m&&m[n]&&!function(){var a=[];f["default"].forEach(m[n].deps,function(b){a.push(c[b])}),c[n]=m[n][m[n].length-1].apply(c,a)}(),!(n in c)){var o=new g["default"].R(a.name+'.inject: "attrs" must contain the property specified by "idAttribute"!');throw h.errorFn(o),o}try{!function(){f["default"].forEach(a.relationList,function(b){var d=b.relation,e=i.defs[d],j=c[b.localField];if(j){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.s[d].index.get(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.s[d].index.get(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 d=c[n],e=a.get(d),k=e?b.modified[d]:0;e?("merge"===h.onConflict?f["default"].deepMixIn(e,c):"replace"===h.onConflict&&(f["default"].forOwn(e,function(b,d){d!==a.idAttribute&&(c.hasOwnProperty(d)||delete e[d])}),f["default"].forOwn(c,function(b,c){c!==a.idAttribute&&(e[c]=b)})),a.resetHistoryOnInject&&(b.previousAttributes[d]=f["default"].copy(e,null,null,null,a.relationFields),b.changeHistories[d].length&&(f["default"].forEach(b.changeHistories[d],function(a){f["default"].remove(b.changeHistory,a)}),b.changeHistories[d].splice(0,b.changeHistories[d].length))),f["default"].w&&b.observers[d].deliver()):(e=c instanceof a[a["class"]]?c:new a[a["class"]],f["default"].forEach(a.relationList,function(a){delete c[a.localField]}),f["default"].deepMixIn(e,c),b.collection.push(e),b.changeHistories[d]=[],f["default"].w&&(b.observers[d]=new i.observe.ObjectObserver(e),b.observers[d].open(l,e)),b.index.insert(d,e),l.call(e,{},{},{},null,!0),b.previousAttributes[d]=f["default"].copy(e,null,null,null,a.relationFields)),b.modified[d]=k&&b.modified[d]===k?f["default"].updateTimestamp(b.modified[d]):b.modified[d],b.expiresHeap.remove(e);var m=(new Date).getTime();b.expiresHeap.push({item:e,timestamp:m,expires:a.maxAge?m+a.maxAge:Number.MAX_VALUE}),j=e}()}catch(p){h.errorFn(p,c)}}return j}var f=c(2),g=c(3);a.exports=function(a,b,c){var d=this,h=d.defs[a],i=d.s[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){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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.s[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)})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[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),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(a){return c&&c.eagerEject&&g&&f.inject(g,{notify:!1}),e.Promise.reject(a)})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.defs[a],g=d.s[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;"fallback"===j?!function(){var a=function g(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?g(a):e.Promise.reject(b)})};i=a(0)}():(h=f.getAdapterName(c),i=d.adapters[h].find(f,b,c)),g.pendingQueries[b]=i.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(a){return g&&delete g.pendingQueries[b],e.Promise.reject(a)})}},function(a,b,c){function d(a,b,c,d){var e=this,f=e.utils,g=e.defs[b],h=e.s[b],i=e.defs[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,c){var e=this,f=e.utils,g=e.defs[a],h=e.s[a],i=void 0,j=void 0;return new f.Promise(function(d,j){b=b||{},e.defs[a]?f._o(b)?(c=f._(g,c),i=f.toJson(b),c.params&&(c.params=f.copy(c.params)),(c.bypassCache||!c.cacheResponse)&&(delete h.completedQueries[i],delete h.queryData[i]),i in h.completedQueries?d(c.useFilter?c.localKeys?g.getAll(c.localKeys,c.orig()):g.filter(b,c.orig()):h.queryData[i]):d()):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=c.findAllStrategy||c.strategy;"fallback"===m?!function(){var a=function d(a){return j=g.getAdapterName((c.findAllFallbackAdapters||c.fallbackAdapters)[a]),e.adapters[j].findAll(g,b,c)["catch"](function(b){return a++,a<c.fallbackAdapters.length?d(a):f.Promise.reject(b)})};l=a(0)}():(j=g.getAdapterName(c),l=e.adapters[j].findAll(g,b,c)),h.pendingQueries[i]=l.then(function(b){return delete h.pendingQueries[i],c.cacheResponse?(h.queryData[i]=d.call(e,b,a,i,c),h.queryData[i].$$injected=!0,h.queryData[i]):(f.forEach(b,function(a,d){b[d]=g.createInstance(a,c.orig())}),b)})}return h.pendingQueries[i]}).then(function(a){return f.respond(a,{adapter:j},c)})["catch"](function(a){return h&&delete h.pendingQueries[i],f.Promise.reject(a)})}},function(a,b,c){function d(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,c,e){var f=this,g=f.utils,h=f.errors,i=f.defs[a];return new g.Promise(function(f,j){g._sn(b)&&(b=i.get(b)),g._s(c)&&(c=[c]),c=c||[],i?g._o(b)?g._a(c)?!function(){var a=(g._(i,e),[]);g.forEach(i.relationList,function(f){var h=f.relation,j=i.getResource(h),k=g._(j,e);if(!c.length||g.contains(c,h)||g.contains(c,f.localField)){var l=void 0,m={};if(k.allowSimpleWhere?m[f.foreignKey]=b[i.idAttribute]:(m.where={},m.where[f.foreignKey]={"==":b[i.idAttribute]}),"hasMany"===f.type){var n=k.orig();if(f.localKeys){delete m[f.foreignKey];var o=g.get(b,f.localKeys)||[];o=g._a(o)?o:g.keys(o),m.where=d({},j.idAttribute,{"in":o}),n.localKeys=o}l=j.findAll(m,n)}else"hasOne"===f.type?f.localKey&&g.get(b,f.localKey)?l=j.find(g.get(b,f.localKey),k.orig()):f.foreignKey&&(l=j.findAll(m,k.orig()).then(function(a){return a.length?a[0]:null})):g.get(b,f.localKey)&&(l=j.find(g.get(b,f.localKey),k.orig()));l&&a.push(l)}}),f(a)}():j(new h.IA('"relations" must be a string or an array!')):j(new h.IA('"instance(id)" must be a string, number or object!')):j(new h.NER(a))}).then(function(a){return g.Promise.all(a)}).then(function(){return b})}},function(a,b,c){a.exports=function(a,b){var c=this,d=c.utils,e=c.defs[a],f=c.s[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})}},function(a,b,c){a.exports=function(a,b,c){var d=this,e=d.utils,f=d.errors,g=d.defs[a],h=d.s[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){e.w&&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)})}},function(a,b,c){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[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.s[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)})}},function(a,b,c){a.exports=function(a,b,c,d){var e=this,f=e.utils,g=e.errors,h=e.defs[a],i=void 0;return new f.Promise(function(c,e){h?(d=f._(h,d),c(b)):e(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.s[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)})}},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(27);a.exports=d},function(a,b,c){function d(a){return a=e(a),a.replace(f,"")}var e=c(27),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.toLowerCase()}var e=c(27);a.exports=d}])});
//# sourceMappingURL=js-data.min.map
{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "2.2.0",
"version": "2.2.1",
"homepage": "http://www.js-data.io",

@@ -6,0 +6,0 @@ "repository": {

@@ -176,3 +176,3 @@ <img src="https://raw.githubusercontent.com/js-data/js-data/master/js-data.png" alt="js-data logo" title="js-data" align="right" width="64" height="64" />

First, support is handled via the [Mailing List](https://groups.io/org/groupsio/jsdata). Ask your questions there.
First, support is handled via the [Gitter Channel](https://gitter.im/js-data/js-data) and the [Mailing List](https://groups.io/org/groupsio/jsdata). Ask your questions there.

@@ -191,7 +191,6 @@ When submitting issues on GitHub, please include as much detail as possible to make debugging quick and easy.

1. Fork js-data
1. `git clone https://github.com/<you>/js-data.git`
1. `git clone git@github.com:<you>/js-data.git`
1. `cd js-data; npm install; bower install;`
1. `grunt go` (builds and starts a watch)
1. (in another terminal) `grunt karma:dev` (runs the tests)
1. Write your code, including relevant documentation and tests
1. `grunt test` (build and test)
1. Submit a PR and we'll review

@@ -198,0 +197,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc