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.10.0 to 2.10.1

5

CHANGELOG.md

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

##### 2.10.1 - 13 February 2018
###### Bug fixes
- #492 - Fixed bug where pending queries were used even when pending queries were set to disabled. Thanks @eldridge
##### 2.10.0 - 22 September 2016

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

6

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

@@ -10,4 +10,4 @@ * @copyright (c) 2014-2016 Jason Dobry

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

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

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

[![npm version][npm_b]][npm_l]
[![npm version](https://img.shields.io/badge/npm-v3.0.0--rc.7-yellow.svg?style=flat)](https://www.npmjs.org/package/js-data)
[![Circle CI][circle_b]][circle_l]
[![npm downloads][dn_b]][dn_l]
[![Coverage Status][cov_b]][cov_l]
[![Codacy][cod_b]][cod_l]
*JSData 3.x is code complete (waiting on documentation updates to release 3.0.0 stable). Read more in the [3.x docs](http://www.js-data.io/v3.0/docs).*
**ATTENTION: JSData 3.x is code complete (waiting on documentation updates to release 3.0.0 stable). If you're just getting started with JSData, I recommended going straight for v3. Read more in the [3.x docs](http://www.js-data.io/v3.0/docs).**

@@ -272,4 +272,2 @@ -----

[cov_l]: https://coveralls.io/github/js-data/js-data?branch=master
[cod_b]: https://img.shields.io/codacy/88b55f71c45a47838d24ed1e5fd2476c.svg
[cod_l]: https://www.codacy.com/app/jasondobry/js-data/dashboard

@@ -276,0 +274,0 @@ [ember]: https://github.com/emberjs/data

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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