forked from gaperton/Type-R
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathindex.js
More file actions
2 lines (2 loc) · 59.4 KB
/
index.js
File metadata and controls
2 lines (2 loc) · 59.4 KB
1
2
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).Nested={})}(this,function(s){"use strict";function a(t,e){for(var n in e)e.hasOwnProperty(n)&&!t.hasOwnProperty(n)&&(t[n]=e[n]);if(2<arguments.length)for(var r=2;r<arguments.length;r++){var i=arguments[r];i&&a(t,i)}return t}function m(t){if(null===t)return!0;switch(typeof t){case"number":case"string":case"boolean":return!0;case"object":var e=Object.getPrototypeOf(t);if(e===Object.prototype||e===Array.prototype)return r(t,m)}return!1}function u(t){return Object.getPrototypeOf(t.prototype).constructor}function t(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function n(t,e){return Object.getPrototypeOf(t)===i?function(t,e){for(var n,r=0;r<t.length;r++)if(n=e(t[r],r))return n}(t,e):function(t,e){var n;for(var r in t)if(t.hasOwnProperty(r)&&(n=e(t[r],r)))return n}(t,e)}function r(t,e){return!n(t,function(t){return!e(t)})}function e(t){for(var e={},n={},r=1;r<arguments.length;r++)n[arguments[r]]=!0;for(var i in t)!n.hasOwnProperty(i)&&t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function c(t,e,n){for(var r in e)if(e.hasOwnProperty(r)){var i=n(e[r],r);void 0===i||(t[r]=i)}return t}function o(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(2<arguments.length)for(var r=2;r<arguments.length;r++){var i=arguments[r];i&&o(t,i)}return t}function p(t){var e,n=!0;return function(){return n&&(n=!1,e=t.apply(this,arguments),t=null),e}}var i=Array.prototype,h=Date.prototype,l=Object.prototype;function f(t,e){if(t===e)return!1;if(t&&e&&"object"==typeof t&&"object"==typeof e){var n=Object.getPrototypeOf(t);if(n!==Object.getPrototypeOf(e))return!0;switch(n){case h:return+t!=+e;case i:return function(t,e){if(t.length!==e.length)return!0;for(var n=0;n<t.length;n++)if(f(t[n],e[n]))return!0;return!1}(t,e);case l:case null:return function(t,e){var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!0;for(var r=0;r<n.length;r++){var i=n[r];if(!e.hasOwnProperty(i)||f(t[i],e[i]))return!0}return!1}(t,e)}}return!0}var d=Object.create(null);function v(t){var e=Object.create(d);return t?o(e,t):e}d.hasOwnProperty=l.hasOwnProperty;var y=Object.freeze({defaults:a,isValidJSON:m,getBaseClass:u,assignToClassProto:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];for(var i=0,o=n;i<o.length;i++){var s=o[i],a=e[s];void 0===a||(t.prototype[s]=a)}},isEmpty:t,some:n,every:r,getPropertyDescriptor:function(t,e){for(var n,r=t;!n&&r;r=Object.getPrototypeOf(r))n=Object.getOwnPropertyDescriptor(r,e);return n},omit:e,transform:c,fastAssign:function(t,e){for(var n in e)t[n]=e[n];return t},fastDefaults:function(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return t},assign:o,keys:function(t){return t?Object.keys(t):[]},once:p,notEqual:f,hashMap:v}),g=function(){function e(t){this.handlers=[],t&&(t instanceof e?this.handlers=t.handlers.slice():t&&this.addEventsMap(t))}return e.prototype.merge=function(t){this.handlers=this.handlers.concat(t.handlers)},e.prototype.addEventsMap=function(t){for(var e in t)this.addEvent(e,t[e])},e.prototype.bubbleEvents=function(t){for(var e=0,n=t.split(P);e<n.length;e++){var r=n[e];this.addEvent(r,w(r))}},e.prototype.addEvent=function(t,e){for(var n=this.handlers,r=0,i=t.split(P);r<i.length;r++){var o=i[r];n.push(new b(o,e))}},e.prototype.subscribe=function(t,e){for(var n=0,r=this.handlers;n<r.length;n++){var i=r[n];j(e,i.name,i.callback,t)}},e.prototype.unsubscribe=function(t,e){for(var n=0,r=this.handlers;n<r.length;n++){var i=r[n];S(e,i.name,i.callback,t)}},e}(),b=function(t,e){this.name=t,this.callback=!0===e?w(t):"string"==typeof e?function(){var t=this[e];t&&t.apply(this,arguments)}:e},_={};function w(o){return _[o]||(_[o]=function(t,e,n,r,i){void 0===r&&void 0===i||D(this,o,t,e,n,r,i),void 0!==n?T(this,o,t,e,n):x(this,o,t,e)})}var O=function(t,e,n){void 0===n&&(n=null),this.callback=t,this.context=e,this.next=n};function C(t,e,n,r){for(var i,o,s=t[e],a=s;a;a=a.next)n&&n!==a.callback&&n!==a.callback._callback||r&&r!==a.context?(o=a,i||(i=a)):o&&(o.next=a.next);s!==i&&(t[e]=i)}function E(t,e,n,r){for(var i=t;i;i=i.next)i.callback.call(i.context,e,n,r)}function j(t,e,n,r){if(n){var i=t._events||(t._events=Object.create(null));i[e]=new O(n,r,i[e])}}function A(t,e,n,r){if(n){var i=p(function(){S(t,e,i),n.apply(this,arguments)});i._callback=n,j(t,e,i,r)}}function S(t,e,n,r){var i=t._events;if(i)if(n||r)if(e)C(i,e,n,r);else for(var o in i)C(i,o,n,r);else e?i[e]=void 0:t._events=void 0}var P=/\s+/;function N(t,e,n,r,i){if(P.test(n))for(var o=0,s=n.split(P);o<s.length;o++){t(e,s[o],r,i)}else t(e,n,r,i)}function x(t,e,n,r){var i=t._events;if(i){var o=i[e],s=i.all;!function(t,e,n){for(var r=t;r;r=r.next)r.callback.call(r.context,e,n)}(o,n,r),E(s,e,n,r)}}function T(t,e,n,r,i){var o=t._events;if(o){var s=o[e],a=o.all;E(s,n,r,i),function(t,e,n,r,i){for(var o=t;o;o=o.next)o.callback.call(o.context,e,n,r,i)}(a,e,n,r,i)}}function D(t,e,n,r,i,o,s){var a=t._events;if(a){var u=a[e],c=a.all;!function(t,e,n,r,i,o){for(var s=t;s;s=s.next)s.callback.call(s.context,e,n,r,i,o)}(u,n,r,i,o,s),function(t,e,n,r,i,o,s){for(var a=t;a;a=a.next)a.callback.call(a.context,e,n,r,i,o,s)}(c,e,n,r,i,o,s)}}var I=Object.freeze({EventMap:g,EventDescriptor:b,EventHandler:O,on:j,once:A,off:S,strings:N,trigger2:x,trigger3:T,trigger5:D}),R=function(t,e){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function k(t,e){function n(){this.constructor=t}R(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var M=function(){return(M=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function J(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]])}return n}function U(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;0<=a;a--)(i=t[a])&&(s=(o<3?i(s):3<o?i(e,n,s):i(e,n))||s);return 3<o&&s&&Object.defineProperty(e,n,s),s}var B=function(){function t(){}return t.define=function(t,e){void 0===t&&(t={});var n=u(this);e&&o(this,e);var r=t.mixins,i=J(t,["mixins"]);return r&&this.mixins.merge(r),this.mixins.mergeObject(this.prototype,i,!0),this.mixins.mergeObject(this.prototype,this.mixins.getStaticDefinitions(n),!0),this.onDefine&&this.onDefine(this.mixins.definitions,n),this.mixins.mergeInheritedMembers(n),this},t.extend=function(t,e){var n;return t&&t.hasOwnProperty("constructor")?k(n=t.constructor,this):n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e}(this),V(n),t&&n.define(t,e),n},t}();function V(t){var e=u(t);t.__super__=e.prototype,t.define||q.get(B).populate(t),q.get(t),t.onExtend&&t.onExtend(e)}function H(e){if("function"!=typeof e)return function(t){V(t),t.define(e)};V(e),e.define()}function z(n){return function(t){var e=q.get(t);e.definitionRules=a(v(),n,e.definitionRules)}}function F(i,o){return function(t,e){var n,r;q.get(t.constructor).mergeObject(t,((n={})[i]=((r={})[e]=o,r),n))}}var q=function(){function o(t){this.Class=t,this.definitions={};var e=u(t).mixins;this.mergeRules=e&&e.mergeRules||v(),this.definitionRules=e&&e.definitionRules||v(),this.appliedMixins=e&&e.appliedMixins||[]}return o.get=function(t){var e=t.mixins;return e&&t===e.Class?e:t.mixins=new o(t)},o.prototype.getStaticDefinitions=function(n){var t=v(),r=this.Class;return c(t,this.definitionRules,function(t,e){if(n[e]!==r[e])return r[e]})},o.prototype.merge=function(t){for(var e=this.Class.prototype,n=(this.mergeRules,this.appliedMixins=this.appliedMixins.slice()),r=0,i=t;r<i.length;r++){var o=i[r];if(Array.isArray(o))this.merge(o);else if(n.indexOf(o)<0)if(n.push(o),"function"==typeof o){this.mergeObject(this.Class,o);var s=o.mixins;s&&(this.mergeRules=a(v(),this.mergeRules,s.mergeRules),this.definitionRules=a(v(),this.definitionRules,s.definitionRules),this.appliedMixins=this.appliedMixins.concat(s.appliedMixins)),this.mergeObject(e,o.prototype)}else this.mergeObject(e,o)}},o.prototype.populate=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0,r=t;n<r.length;n++){var i=r[n];o.get(i).merge([this.Class])}},o.prototype.mergeObject=function(r,i,o){var s=this;!function(t,e){for(var n=W[typeof t],r=0,i=Object.getOwnPropertyNames(t);r<i.length;r++){var o=i[r];n[o]||e(o)}}(i,function(t){var e,n=Object.getOwnPropertyDescriptor(i,t);(e=s.definitionRules[t])&&Z(s.definitions,t,n,e,o),e&&e!==L.protoValue||Z(r,t,n,s.mergeRules[t],o)})},o.prototype.mergeInheritedMembers=function(t){var e=this.mergeRules,n=this.Class;if(e){var r=n.prototype,i=t.prototype;for(var o in e){var s=e[o];r.hasOwnProperty(o)&&o in i&&(r[o]=G(r[o],i[o],s))}}},o}(),W={function:v({length:!0,prototype:!0,caller:!0,arguments:!0,name:!0,__super__:!0}),object:v({constructor:!0})};var K=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return q.get(t).merge(e)}},L=function(n){return function(t){var e=q.get(t);e.mergeRules=a(n,e.mergeRules)}};function Z(t,e,n,r,i){if(t.hasOwnProperty(e)){var o=Object.getOwnPropertyDescriptor(t,e);o.configurable&&"value"in o&&(t[e]=i?G(n.value,o.value,r):G(o.value,n.value,r))}else Object.defineProperty(t,e,n)}function G(t,e,n){return void 0===t?e:n&&void 0!==e?n(t,e):t}L.value=function(t,e){return t},L.protoValue=function(t,e){return t},L.merge=function(t,e){return a({},t,e)},L.pipe=function(e,n){return function(t){return e.call(this,n.call(this,t))}},L.defaults=function(t,e){return function(){return a(t.apply(this,arguments),e.apply(this,arguments))}},L.classFirst=function(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}},L.classLast=function(t,e){return function(){e.apply(this,arguments),t.apply(this,arguments)}},L.every=function(t,e){return function(){return t.apply(this,arguments)&&e.apply(this,arguments)}},L.some=function(t,e){return function(){return t.apply(this,arguments)||e.apply(this,arguments)}};var $=N,Q=j,X=S,Y=A,tt=D,et=x,nt=T,rt=0;function it(){return"l"+rt++}var ot=function(){function t(){this._events=void 0,this._listeningTo=void 0,this.cid=it(),this.initialize.apply(this,arguments)}return t.onDefine=function(t,e){var n=t.localEvents,r=t._localEvents,i=t.properties;if(n||r){var o=new g(this.prototype._localEvents);n&&o.addEventsMap(n),r&&o.merge(r),this.prototype._localEvents=o}i&&Object.defineProperties(this.prototype,c({},i,at))},t.prototype.initialize=function(){},t.prototype.on=function(t,e,n){if("string"==typeof t)$(Q,this,t,e,n);else for(var r in t)$(Q,this,r,t[r],n||e);return this},t.prototype.once=function(t,e,n){if("string"==typeof t)$(Y,this,t,e,n);else for(var r in t)$(Y,this,r,t[r],n||e);return this},t.prototype.off=function(t,e,n){if(t)if("string"==typeof t)$(X,this,t,e,n);else for(var r in t)$(X,this,r,t[r],n||e);else X(this,void 0,e,n);return this},t.prototype.trigger=function(t,e,n,r,i,o){return void 0!==i||void 0!==o?tt(this,t,e,n,r,i,o):void 0!==r?nt(this,t,e,n,r):et(this,t,e,n),this},t.prototype.listenTo=function(t,e,n){return t&&(ut(this,t),t.on(e,n||"object"!=typeof e?n:this,this)),this},t.prototype.listenToOnce=function(t,e,n){return t&&(ut(this,t),t.once(e,n||"object"!=typeof e?n:this,this)),this},t.prototype.stopListening=function(t,e,n){var r=this._listeningTo;if(r){var i=!(e||n),o=n||"object"!=typeof e?n:this;if(t){var s=r[t.cid];s&&(i&&delete r[t.cid],s.off(e,o,this))}else if(null==t){for(var a in r)r[a].off(e,o,this);i&&(this._listeningTo=void 0)}}return this},t.prototype.dispose=function(){this._disposed||(this.stopListening(),this.off(),this._disposed=!0)},t=U([H,z({properties:L.merge,localEvents:L.merge})],t)}(),st=e(ot.prototype,"constructor","initialize");function at(t){if(t)return"function"==typeof t?{get:t,configurable:!0}:t}function ut(t,e){(t._listeningTo||(t._listeningTo=Object.create(null)))[e.cid||(e.cid=it())]=e}var ct="undefined"!=typeof process&&process.env&&"production"===process.env.NODE_ENV,pt=ct?["error","info"]:["error","warn","debug","info","log"],ht=function(n){function t(){var t=null!==n&&n.apply(this,arguments)||this;return t.counter={},t}return k(t,n),t.prototype.logToConsole=function(o,s){return this.on(o,function(t,e,n){if(!s||s.test(t)){var r=["["+t+"] "+e];for(var i in n)r.push("\n\t"+i+":",lt(n[i]));console[o].apply(console,r)}})},t.prototype.throwOn=function(t,r){return this.on(t,function(t,e,n){if(!r||r.test(t))throw new Error("["+t+"] "+e)})},t.prototype.count=function(r,i){var o=this;return this.on(r,function(t,e,n){i&&!i.test(t)||(o.counter[r]=(o.counter[r]||0)+1)})},t.prototype.on=function(t,e){return n.prototype.on.call(this,t,e)},t=U([H],t)}(ot),lt="undefined"==typeof window?function(t){if(t&&"object"==typeof t){var e=t.__inner_state__||t,n=Array.isArray(e)?"[ length = "+e.length+" ]":"{ "+Object.keys(e).join(", ")+" }";return t.constructor.name+" "+n}return JSON.stringify(t)}:function(t){return t},ft=new ht;if("undefined"!=typeof console)for(var dt=0,vt=pt;dt<vt.length;dt++){var yt=vt[dt];ft.logToConsole(yt)}var gt=new ht;gt.throwOn("error").throwOn("warn");var mt=ft.trigger.bind(ft);function bt(n,t,r,i){return _t(n),n._ioPromise=t.then(function(t){n._ioPromise=null;var e=i?i(t):t;return wt(n,"sync",n,t,r),e}).catch(function(t){throw n._ioPromise=null,wt(n,"error",n,t,r),t}),n._ioPromise.abort=t.abort,n._ioPromise}function _t(t){t._ioPromise&&t._ioPromise.abort&&(t._ioPromise.abort(),t._ioPromise=null)}function wt(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t.trigger.apply(t,e);var r=t.collection;r&&r.trigger.apply(r,e)}var Ot=/\^|(store\.[^.]+)|([^.]+)/g,Ct=function(t,e){void 0===e&&(e=!1);var n=t.match(Ot).map(function(t){return"^"===t||"owner"===t?"getOwner()":"~"===t[0]?'getStore().get("'+t.substr(1)+'")':0===t.indexOf("store.")?'getStore().get("'+t.substr(6)+'")':t});this.tail=e&&n.pop(),this.local=!n.length,this.resolve=new Function("self","\n var v = self."+n.shift()+";\n \n "+n.map(function(t){return"\n v = v && v."+t+";\n "}).join("")+"\n\n return v;\n ")};function Et(t,e,n){for(var r=e.match(Ot),i=r.length-1,o=t,s=0;s<i;s++){var a=r[s];switch(a){case"~":o=o.getStore();break;case"^":o=o.getOwner();break;default:o=o.get(a)}if(!o)return}return n(o,r[i])}var jt,At=function(){function i(t){this.length=t._validateNested(this.nested={}),(this.error=t.validate(t))&&this.length++}return i.prototype.each=function(t){var e=this.error,n=this.nested;for(var r in e&&t(e,null),n)t(n[r],r)},i.prototype.eachError=function(n,r){this.each(function(t,e){t instanceof i?t.eachError(n,r.get(e)):n(t,e,r)})},i}(),St=T,Pt=j,Nt=S;(jt=s.ItemsBehavior||(s.ItemsBehavior={}))[jt.share=1]="share",jt[jt.listen=2]="listen",jt[jt.persistent=4]="persistent";var xt=function(){function t(t){this._changeToken={},this._transaction=!1,this._isDirty=null,this._owner=void 0,this._ownerKey=void 0,this._validationError=void 0,this.cid=this.cidPrefix+t}var e;return(e=t).onDefine=function(t,e){t.endpoint&&(this.prototype._endpoint=t.endpoint),ot.onDefine.call(this,t,e)},t.onExtend=function(t){t.create===this.create&&(this.create=e.create)},t.create=function(t,e){return new this(t,e)},t.prototype.dispose=function(){this._disposed||(_t(this),this._owner=void 0,this._ownerKey=void 0,this.off(),this.stopListening(),this._disposed=!0)},t.prototype.onChanges=function(t,e){Pt(this,this._changeEventName,t,e)},t.prototype.offChanges=function(t,e){Nt(this,this._changeEventName,t,e)},t.prototype.listenToChanges=function(t,e){this.listenTo(t,t._changeEventName,e)},t.prototype.transaction=function(t,e){void 0===e&&(e={});var n=Tt.begin(this),r=t.call(this,this);r&&this.set(r),n&&Tt.commit(this)},t.prototype.assignFrom=function(e){var n=this;return this.transaction(function(){n.set(e.__inner_state__||e,{merge:!0});var t=e._changeToken;t&&(n._changeToken=t)}),this},t.from=function(t,e){void 0===e&&(e={});var n=e.strict,r=J(e,["strict"]),i=this.create(t,M({},r,{logger:n?gt:void 0}));return n&&i.validationError&&i.eachValidationError(function(t,e,n){throw new Error(n.getClassName()+"."+e+": "+t)}),i},t.prototype.parse=function(t,e){return t},t.prototype.deepGet=function(t){return Et(this,t,function(t,e){return t.get?t.get(e):t[e]})},t.prototype.getOwner=function(){return this._owner},t.prototype.getStore=function(){var t=this._owner;return t?t.getStore():this._defaultStore},t.prototype.hasPendingIO=function(){return this._ioPromise},t.prototype.getEndpoint=function(){return function t(e){var n=e.collection;if(n)return t(n);if(e._owner){var r=e._owner._endpoints;return r&&r[e._ownerKey]}}(this)||this._endpoint},Object.defineProperty(t.prototype,"validationError",{get:function(){var t=this._validationError||(this._validationError=new At(this));return t.length?t:null},enumerable:!0,configurable:!0}),t.prototype.validate=function(t){},t.prototype.getValidationError=function(t){var e=this.validationError;return(t?e&&e.nested[t]:e)||null},t.prototype.deepValidationError=function(t){return Et(this,t,function(t,e){return t.getValidationError(e)})},t.prototype.eachValidationError=function(t){var e=this.validationError;e&&e.eachError(t,this)},t.prototype.isValid=function(t){return!this.getValidationError(t)},t.prototype.valueOf=function(){return this.cid},t.prototype.toString=function(){return this.cid},t.prototype.getClassName=function(){var t=this.constructor.name;if("Subclass"!==t)return t},t=e=U([H,z({endpoint:L.value}),K(ot)],t)}(),Tt={begin:function(t){return!t._transaction&&(t._transaction=!0)},markAsDirty:function(t,e){var n=!e.silent;return n&&(t._isDirty=e),t._changeToken={},t._validationError=void 0,n},commit:function(t,e){var n=t._isDirty;if(n){for(;t._isDirty;){var r=t._isDirty;t._isDirty=null,St(t,t._changeEventName,t,r,e)}t._transaction=!1;var i=t._owner;i&&i!==e&&i._onChildrenChange(t,n)}else t._isDirty=null,t._transaction=!1},aquire:function(t,e,n){if(e._owner)throw new ReferenceError("Trying to aquire ownership for an object already having an owner");e._owner=t,e._ownerKey=n},free:function(t,e){t===e._owner&&(e._owner=void 0,e._ownerKey=void 0)}};var Dt=Tt.begin,It=Tt.markAsDirty,Rt=Tt.commit,kt=T;function Mt(t,e,n){var r=Jt(t),i={};t._attributes[e].doUpdate(n,t,i)&&(Ut(t,i),kt(t,"change:"+e,t,t.attributes[e],i)),r&&Rt(t)}function Jt(t){return!!Dt(t)&&(t._previousAttributes=new t.AttributesCopy(t.attributes),!(t._changedAttributes=null))}function Ut(t,e){return t._changedAttributes&&(t._changedAttributes=null),It(t,e)}var Bt={transaction:function(t,e){void 0===e&&(e={});var n=Jt(this);t.call(this,this),n&&Rt(this)},_onChildrenChange:function(t,e){var n=t._ownerKey,r=this._attributes[n];r&&!r.propagateChanges||this.forceAttributeChange(n,e)},forceAttributeChange:function(t,e){void 0===e&&(e={});var n=Jt(this);Ut(this,e)&&kt(this,"change:"+t,this,this.attributes[t],e),n&&Rt(this)},_createTransaction:function(t,e){void 0===e&&(e={});var n,r=Jt(this),i=[],o=[],s=this._attributes,a=e.parse?this.parse(t,e):t;if(Ht(this,a,e)){for(var u in a){var c=s[u];c?c.doUpdate(a[u],this,e,o)&&i.push(u):(n||(n=[]),n.push("'"+u+"'"))}n&&Vt(this,n,{values:a},e)}if(i.length&&Ut(this,e))return new zt(this,r,o,i);for(var p=0,h=o;p<h.length;p++){h[p].commit(this)}r&&Rt(this)}};function Vt(t,e,n,r){t._log("warn","Type-R:UnknownAttrs","undefined attributes "+e.join(", ")+" are ignored.",n,r.logger)}function Ht(t,e,n){return!(!e||e.constructor!==Object)||(t._log("error","Type-R:InvalidObject","update with non-object is ignored!",{values:e},n.logger),!1)}var zt=function(){function t(t,e,n,r){this.object=t,this.isRoot=e,this.nested=n,this.changes=r}return t.prototype.commit=function(t){for(var e=this.nested,n=this.object,r=this.changes,i=0,o=e;i<o.length;i++){o[i].commit(n)}for(var s=n.attributes,a=n._isDirty,u=0,c=r;u<c.length;u++){var p=c[u];kt(n,"change:"+p,n,s[p],a)}this.isRoot&&Rt(n,t)},t}(),Ft=f,qt={},Wt=function(){function t(t,e){this.name=t,this.getHook=null,this.options=e;var n=M({getHooks:[],transforms:[],changeHandlers:[]},e);n.getHooks=n.getHooks.slice(),n.transforms=n.transforms.slice(),n.changeHandlers=n.changeHandlers.slice();var r,i=n.value,o=n.type,s=n.parse,a=n.toJSON,u=n.changeEvents,c=n.properties,p=n.validate,h=n.getHooks,l=n.transforms,f=n.changeHandlers;if(this.value=i,this.type=o,!n.hasCustomDefault&&o?this.defaultValue=this.create:m(i)?this.defaultValue=new Function("return "+JSON.stringify(i)+";"):this.defaultValue=this.defaultValue,this.propagateChanges=!1!==u,this.toJSON=void 0===a?this.toJSON:a,this.properties=null==c?{}:c,this.validate=p||this.validate,n.isRequired&&(this.validate=(r=this.validate,function(t,e,n){return e?r.call(this,t,e,n):"Required"})),l.unshift(this.convert),this.get&&h.unshift(this.get),this.initialize.call(this,n),h.length){var d=this.getHook=h.reduce(Kt),v=this.validate;this.validate=function(t,e,n){return v.call(this,t,d.call(t,e,n),n)}}this.transform=l.length?l.reduce(Lt):this.transform,this.handleChange=f.length?f.reduce(Zt):this.handleChange;var y=this.doInit,g=this.doUpdate;this.doInit=s?function(t,e,n){return y.call(this,n.parse&&void 0!==t?s.call(e,t,this.name):t,e,n)}:y,this.doUpdate=s?function(t,e,n,r){return g.call(this,n.parse&&void 0!==t?s.call(e,t,this.name):t,e,n,r)}:g}return t.prototype.canBeUpdated=function(t,e,n){},t.prototype.transform=function(t,e,n,r){return t},t.prototype.convert=function(t,e,n,r){return t},t.prototype.isChanged=function(t,e){return Ft(t,e)},t.prototype.handleChange=function(t,e,n,r){},t.prototype.create=function(){},t.prototype.clone=function(t,e){return t},t.prototype.dispose=function(t,e){this.handleChange(void 0,e,t,qt)},t.prototype.validate=function(t,e,n){},t.prototype.toJSON=function(t,e,n){return t&&t.toJSON?t.toJSON(n):t},t.prototype.createPropertyDescriptor=function(){var e=this.name,t=this.getHook;if("id"!==e)return{set:function(t){Mt(this,e,t)},get:t?function(){return t.call(this,this.attributes[e],e)}:function(){return this.attributes[e]},configurable:!0}},t.prototype.initialize=function(t,e){},t.prototype.doInit=function(t,e,n){var r=void 0===t?this.defaultValue():t,i=this.transform(r,void 0,e,n);return this.handleChange(i,void 0,e,n),i},t.prototype.doUpdate=function(t,e,n,r){var i=this.name,o=e.attributes,s=o[i],a=this.transform(t,s,e,n);return o[i]=a,!!this.isChanged(a,s)&&(this.handleChange(a,s,e,n),!0)},t.prototype._log=function(t,e,n,r,i,o){i._log(t,e,i.getClassName()+"."+this.name+" "+n,{"New value":r,"Prev. value":i.attributes[this.name]},o)},t.prototype.defaultValue=function(){return this.value},t}();function Kt(n,r){return function(t,e){return r.call(this,n.call(this,t,e),e)}}function Lt(i,o){return function(t,e,n,r){return o.call(this,i.call(this,t,e,n,r),e,n,r)}}function Zt(i,o){return function(t,e,n,r){i.call(this,t,e,n,r),o.call(this,t,e,n,r)}}var Gt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.create=function(){return new this.type},e.prototype.convert=function(t){return null==t||t instanceof this.type?t:new this.type(t)},e.prototype.toJSON=function(t,e,n){return t&&t.toJSON?t.toJSON(n):t},e.prototype.clone=function(t){return new this.type(this.toJSON(t))},e.prototype.isChanged=function(t,e){return t!==e},e}(Wt),$t=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.dispose=function(){},e.prototype.create=function(){return this.type()},e.prototype.toJSON=function(t){return t},e.prototype.convert=function(t){return null==t?t:this.type(t)},e.prototype.isChanged=function(t,e){return t!==e},e.prototype.clone=function(t){return t},e.prototype.doInit=function(t,e,n){return this.transform(void 0===t?this.value:t,void 0,e,n)},e.prototype.doUpdate=function(t,e,n,r){var i=this.name,o=e.attributes,s=o[i];return s!==(o[i]=this.transform(t,s,e,n))},e.prototype.initialize=function(){this.options.hasCustomDefault||(this.value=this.type())},e}(Wt),Qt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.create=function(){return 0},e.prototype.convert=function(t,e,n,r){var i=null==t?t:this.type(t);return i!=i&&this._log("error","Type-R:InvalidNumber","Number attribute is assigned with an invalid number",t,n,r.logger),i},e.prototype.validate=function(t,e,n){if(null!=e&&!isFinite(e))return n+" is not valid number"},e}($t),Xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.toJSON=function(t){return t},e.prototype.dispose=function(){},e.prototype.create=function(){return[]},e.prototype.convert=function(t,e,n,r){return null==t||Array.isArray(t)?t:(this._log("error","Type-R:InvalidArray","Array attribute assigned with non-array value",t,n,r.logger),[])},e.prototype.clone=function(t){return t&&t.slice()},e}(Wt),Yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.create=function(){return{}},e.prototype.convert=function(t,e,n,r){return null==t||"object"==typeof t?t:(this._log("error","Type-R:InvalidObject","Object attribute is assigned with non-object value",t,n,r.logger),{})},e}(Wt);function te(){}var ee=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.toJSON=function(t){},e.prototype.create=function(){return te},e.prototype.dispose=function(){},e.prototype.convert=function(t,e,n,r){return null==t||"function"==typeof t?t:(this._log("error","Type-R:InvalidFunction","Function attribute assigned with non-function value",t,n,r.logger),te)},e.prototype.clone=function(t){return t},e}(Wt),ne=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.create=function(){return new Date},e.prototype.convert=function(t,e,n,r){if(null==t||t instanceof Date)return t;var i=new Date(t),o=i.getTime();return o!=o&&this._log("error","Type-R:InvalidDate","Date attribute assigned with invalid date",t,n,r.logger),i},e.prototype.validate=function(t,e,n){if(null!=e){var r=e.getTime();if(r!=r)return n+" is Invalid Date"}},e.prototype.toJSON=function(t){return t&&t.toISOString()},e.prototype.isChanged=function(t,e){return(t&&t.getTime())!==(e&&e.getTime())},e.prototype.doInit=function(t,e,n){return this.transform(void 0===t?this.defaultValue():t,void 0,e,n)},e.prototype.doUpdate=function(t,e,n,r){var i=this.name,o=e.attributes,s=o[i];return this.isChanged(s,o[i]=this.transform(t,s,e,n))},e.prototype.clone=function(t){return t&&new Date(t.getTime())},e.prototype.dispose=function(){},e}(Wt);function re(t){return!isNaN(new Date(t).getTime())}re("2011-11-29T15:52:30.5")&&re("2011-11-29T15:52:30.52")&&re("2011-11-29T15:52:18.867")&&re("2011-11-29T15:52:18.867Z")&&re("2011-11-29T15:52:18.867-03:30")||(ne.prototype.convert=function(t){return null==t||t instanceof Date?t:new Date(function(t){var e,n,r=0;if(n=oe.exec(t)){for(var i,o=0;i=ie[o];++o)n[i]=+n[i]||0;n[2]=(+n[2]||1)-1,n[3]=+n[3]||1,"Z"!==n[8]&&void 0!==n[9]&&(r=60*n[10]+n[11],"+"===n[9]&&(r=0-r)),e=Date.UTC(n[1],n[2],n[3],n[4],n[5]+r,n[6],n[7])}else e=Date.parse(t);return e}(t))});var ie=[1,4,5,6,7,10,11],oe=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;var se=Tt.free,ae=Tt.aquire,ue=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.clone=function(t){return t?t.clone():t},e.prototype.toJSON=function(t,e,n){return t&&t.toJSON(n)},e.prototype.doInit=function(t,e,n){var r=n.clone?this.clone(t):void 0===t?this.defaultValue():t,i=this.transform(r,void 0,e,n);return this.handleChange(i,void 0,e,n),i},e.prototype.doUpdate=function(t,e,n,r){var i,o=this.name,s=e.attributes,a=s[o];if(i=this.canBeUpdated(a,t,n)){var u=a._createTransaction(i,n);return!(!u||(r?r.push(u):u.commit(e),!this.propagateChanges))}var c=this.transform(t,a,e,n);return s[o]=c,!!this.isChanged(c,a)&&(this.handleChange(c,a,e,n),!0)},e.prototype.canBeUpdated=function(t,e,n){if(t&&null!=e){if(!(e instanceof this.type))return e;if(n.merge)return e.__inner_state__}},e.prototype.convert=function(t,e,n,r){return null==t?t:t instanceof this.type?(!t._shared||t._shared&s.ItemsBehavior.persistent||this._log("error","Type-R:InvalidCollection","aggregated collection attribute is assigned with shared collection type",t,n,r.logger),r.merge?t.clone():t._owner?(this._log("warn","Type-R:InvalidOwner","object alreay has an owner and was cloned. Use explicit object.clone() to dismiss this warning.",t,n,r.logger),t.clone()):t):this.type.create(t,r)},e.prototype.dispose=function(t,e){e&&this.handleChange(void 0,e,t,{})},e.prototype.validate=function(t,e){var n=e&&e.validationError;if(n)return n},e.prototype.create=function(){return this.type.create()},e.prototype.initialize=function(t){t.changeHandlers.unshift(this._handleChange)},e.prototype._handleChange=function(t,e,n,r){e&&(se(n,e),r.unset||e.dispose()),t&&ae(n,t,this.name)},e}(Wt),ce=j,pe=S,he=Tt.free,le=Tt.aquire,fe=s.ItemsBehavior.listen|s.ItemsBehavior.share;function de(t){for(;t&&t.options&&t.options.type;)t=t.options.type;return t}var ve=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.doInit=function(t,e,n){var r=n.clone?this.clone(t,e):void 0===t?this.defaultValue():t,i=this.transform(r,void 0,e,n);return this.handleChange(i,void 0,e,n),i},e.prototype.doUpdate=function(t,e,n,r){var i,o=this.name,s=e.attributes,a=s[o];if(i=this.canBeUpdated(a,t,n)){var u=a._createTransaction(i,n);return!(!u||(r?r.push(u):u.commit(e),!this.propagateChanges))}var c=this.transform(t,a,e,n);return s[o]=c,!!this.isChanged(c,a)&&(this.handleChange(c,a,e,n),!0)},e.prototype.clone=function(t,e){if(!t||t._owner!==e)return t;var n=t.clone();return le(e,n,this.name),n},e.prototype.toJSON=function(){},e.prototype.canBeUpdated=function(t,e,n){var r=de(this);if(t&&null!=e&&!(e instanceof r))return e},e.prototype.convert=function(t,e,n,r){var i=de(this);return null==t||t instanceof i||r.lazyRelations?t:t=i.create(t,r,fe)},e.prototype.validate=function(t,e,n){},e.prototype.create=function(){return null},e.prototype._handleChange=function(t,e,n,r){e&&(e._owner===n?(he(n,e),r.unset||e.dispose()):pe(e,e._changeEventName,this._onChange,n)),t&&t._owner!==n&&ce(t,t._changeEventName,this._onChange,n)},e.prototype.dispose=function(t,e){e&&this.handleChange(void 0,e,t,{})},e.prototype.initialize=function(t){var r=this;this._onChange=this.propagateChanges?function(t,e,n){this===n||this.forceAttributeChange(r.name,e)}:ye,t.changeHandlers.unshift(this._handleChange)},e}(Wt);function ye(){}var ge=[String,Number,Boolean,Date,Object,Array,Function],me=[$t,Qt,$t,ne,Yt,Xt,ee];function be(t){return t._metatype||(e=t,(n=ge.indexOf(e))<0?Gt:me[n]);var e,n}Wt.create=function(t,e){var n=t.type;return new(t._metatype||(n?be(n):Wt))(e,t)};var _e=o,we=function(){function n(t){this.options={getHooks:[],transforms:[],changeHandlers:[]},t&&_e(this.options,t)}return n.prototype.check=function(i,o){function r(t,e,n){if(!i.call(t,e,n)){var r=o||i.error||n+" is not valid";return"function"==typeof r?r.call(t,n):r}}var s=this.options.validate;return this.metadata({validate:s?function(t,e,n){return s(t,e,n)||r(t,e,n)}:r})},Object.defineProperty(n.prototype,"as",{get:function(){return F("attributes",this)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isRequired",{get:function(){return this.required},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"required",{get:function(){return this.metadata({isRequired:!0})},enumerable:!0,configurable:!0}),n.prototype.endpoint=function(t){return this.metadata({endpoint:t})},n.prototype.watcher=function(t){return this.metadata({_onChange:t})},n.prototype.parse=function(t){return this.metadata({parse:t})},n.prototype.toJSON=function(t){return this.metadata({toJSON:"function"==typeof t?t:t?function(t,e,n){return t&&t.toJSON(n)}:Oe})},n.prototype.get=function(t){return this.metadata({getHooks:this.options.getHooks.concat(t)})},n.prototype.set=function(o){return this.metadata({transforms:this.options.transforms.concat(function(t,e,n,r){if(this.isChanged(t,e)){var i=o.call(n,t,this.name);return void 0===i?e:this.convert(i,e,n,r)}return e})})},n.prototype.changeEvents=function(t){return this.metadata({changeEvents:t})},n.prototype.events=function(t){var r=new g(t);return this.metadata({changeHandlers:this.options.changeHandlers.concat(function(t,e,n){e&&e.trigger&&r.unsubscribe(n,e),t&&t.trigger&&r.subscribe(n,t)})})},n.prototype.properties=function(t){return this.metadata({properties:t})},Object.defineProperty(n.prototype,"has",{get:function(){return this},enumerable:!0,configurable:!0}),n.prototype.metadata=function(t){var e=new n(this.options);return _e(e.options,t),e},n.prototype.value=function(t){return this.metadata({value:t,hasCustomDefault:!0})},n.from=function(t){return t&&t instanceof n?t:"function"==typeof t?Ce(t):je(t)},n}();function Oe(){}function Ce(t,e){if(t instanceof we)return t;var n=new we({type:t}),r=t&&void 0===e?be(t).defaultValue:e;return void 0===r?n:n.value(r)}function Ee(t){return new we({value:null,type:t,_metatype:ve})}function je(t){var e=function(t){switch(typeof t){case"number":return Number;case"string":return String;case"boolean":return Boolean;case"function":return Function;case"undefined":return;case"object":return t?t.constructor:void 0}}(t);return(e&&e.prototype instanceof xt?Ee(e):Ce(e)).value(t)}function Ae(t,e){return Wt.create(we.from(t).options,e)}function Se(t,e){var n=c({},t,Ae),r=a({},n,e),i=function(t){var e=Object.keys(t),n=new Function("values","\n "+e.map(function(t){return"\n this."+t+" = values."+t+";\n "}).join("")+"\n ");n.prototype=Object.prototype;var r=new Function("record","values","options","\n var _attrs = record._attributes;\n\n "+e.map(function(t){return"\n this."+t+" = _attrs."+t+".doInit( values."+t+", record, options );\n "}).join("")+"\n ");return r.prototype=Object.prototype,{Attributes:r,AttributesCopy:n}}(r);return M({},i,{_attributes:new i.AttributesCopy(r),_attributesArray:Object.keys(r).map(function(t){return r[t]}),properties:c({},n,function(t){return t.createPropertyDescriptor()})},function(t){var e;for(var n in t){var r=t[n],i=r.options._onChange;i&&(e||(e=new g),e.addEvent("change:"+n,"string"==typeof i?Ne(i,n):Pe(i,n)))}return e?{_localEvents:e}:{}}(n),{_endpoints:c({},r,function(t){return t.options.endpoint})})}function Pe(n,r){return function(t,e){n.call(t,e,r)}}function Ne(t,n){var e=new Ct(t,!0),r=e.local,i=e.resolve,o=e.tail;return r?function(t,e){t[o](e,n)}:function(t,e){i(t)[o](e,n)}}var xe={save:function(e){var n=this;void 0===e&&(e={});var t=this.getEndpoint(),r=this.toJSON(M({ioMethod:"save"},e));return bt(this,this.isNew()?t.create(r,e,this):t.update(this.id,r,e,this),e,function(t){n.set(t,M({parse:!0,ioMethod:"save"},e))})},fetch:function(e){var n=this;return void 0===e&&(e={}),bt(this,this.getEndpoint().read(this.id,e,this),e,function(t){return n.set(t,M({parse:!0,ioMethod:"fetch"},e))})},destroy:function(e){var n=this;return void 0===e&&(e={}),bt(this,this.getEndpoint().destroy(this.id,e,this),e,function(){var t=n.collection;return t?t.remove(n,e):n.dispose(),n})}},Te=o,De=t,Ie=0,Re=function(o){function t(t,e){var n=o.call(this,Ie++)||this;n.attributes={};var r=e||{},i=(r.parse?n.parse(t,r):t)||{};return ct||function(t,e,n){if(Ht(t,e,n)){var r=t._attributes,i=void 0;for(var o in e)r[o]||(i||(i=[]),i.push("'"+o+"'"));i&&Vt(t,i,{values:e},n)}}(n,i,r),n._previousAttributes=n.attributes=new n.Attributes(n,i,r),n.initialize(t,e),n._localEvents&&n._localEvents.subscribe(n,n),n}return k(t,o),t.onDefine=function(t,e){},Object.defineProperty(t,"ref",{get:function(){var n=this;return Ce(this).toJSON(function(t){return t?t.id:null}).parse(function(t){var e;return(e={})[n.prototype.idAttribute]=t,e})},enumerable:!0,configurable:!0}),t.defaults=function(t){return this.extend({attributes:t})},t.prototype.previousAttributes=function(){return new this.AttributesCopy(this._previousAttributes)},Object.defineProperty(t.prototype,"__inner_state__",{get:function(){return this.attributes},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"changed",{get:function(){var t=this._changedAttributes;if(!t){var e=this._previousAttributes;t={};for(var n=this.attributes,r=0,i=this._attributesArray;r<i.length;r++){var o=i[r],s=o.name,a=n[s];o.isChanged(a,e[s])&&(t[s]=a)}this._changedAttributes=t}return t},enumerable:!0,configurable:!0}),t.prototype.changedAttributes=function(t){if(!t)return!!this.hasChanged()&&M({},this.changed);var e,n=!1,r=this._transaction?this._previousAttributes:this.attributes,i=this._attributes;for(var o in t)i[o].isChanged(r[o],e=t[o])&&((n||(n={}))[o]=e);return n},t.prototype.hasChanged=function(t){var e=this._previousAttributes;return!!e&&(t?this._attributes[t].isChanged(this.attributes[t],e[t]):!De(this.changed))},t.prototype.previous=function(t){if(t){var e=this._previousAttributes;if(e)return e[t]}return null},t.prototype.isNew=function(){return null==this.id},t.prototype.has=function(t){return null!=this[t]},t.prototype.unset=function(t,e){var n,r=this[t];return this.set(((n={})[t]=void 0,n),M({unset:!0},e)),r},t.prototype.clear=function(t){var n=this,r=t&&t.nullify;return this.transaction(function(){n.forEach(function(t,e){return n[e]=r?null:void 0})},t),this},t.prototype.getOwner=function(){var t=this._owner;return this._ownerKey?t:t&&t._owner},Object.defineProperty(t.prototype,"id",{get:function(){return this.attributes[this.idAttribute]},set:function(t){Mt(this,this.idAttribute,t)},enumerable:!0,configurable:!0}),t.prototype.defaults=function(t){void 0===t&&(t={});for(var e={},n=0,r=this._attributesArray;n<r.length;n++){var i=r[n],o=i.name,s=t[o];e[o]=void 0===s?i.defaultValue():s}return e},t.prototype.initialize=function(t,e){},t.prototype.clone=function(t){void 0===t&&(t={});var e=new this.constructor(this.attributes,{clone:!0});return t.pinStore&&(e._defaultStore=this.getStore()),e},t.prototype._validateNested=function(t){for(var e=0,n=this.attributes,r=0,i=this._attributesArray;r<i.length;r++){var o=i[r],s=o.name,a=o.validate(this,n[s],s);a&&(t[s]=a,e++)}return e},t.prototype.get=function(t){return this[t]},t.prototype.set=function(t,e){if(t){var n=this._createTransaction(t,e);n&&n.commit()}return this},t.prototype.toJSON=function(t){for(var e={},n=this.attributes,r=0,i=this._attributesArray;r<i.length;r++){var o=i[r],s=o.name,a=n[s];if(void 0!==a){var u=o.toJSON.call(this,a,s,t);void 0!==u&&(e[s]=u)}}return e},t.prototype.parse=function(t,e){return t},t.prototype.deepSet=function(p,h,l){var f=this;return this.transaction(function(){for(var t,e=p.split("."),n=e.length-1,r=e[n],i=f,o=0;o<n;o++){var s=e[o],a=i.get?i.get(s):i[s];if(!a){var u=i._attributes;if(!u)return;var c=u[s].create();l&&l.nullify&&c._attributes&&c.clear(l),i[s]=a=c}i=a}i.set?i.set(((t={})[r]=h,t),l):i[r]=h}),this},Object.defineProperty(t.prototype,"collection",{get:function(){return this._ownerKey?null:this._owner},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(!this._disposed){for(var t=this.attributes,e=0,n=this._attributesArray;e<n.length;e++){var r=n[e];r.dispose(this,t[r.name])}o.prototype.dispose.call(this)}},t.prototype._log=function(t,e,n,r,i){(i||ft).trigger(t,e,this.getClassName()+" "+n,M({},r,{Record:this,"Attributes definition":this._attributes}))},t.prototype.getClassName=function(){return o.prototype.getClassName.call(this)||"Record"},t.prototype._createTransaction=function(t,e){},t.prototype.forEach=function(n,r){var t=void 0!==r?function(t,e){return n.call(r,t,e)}:n,e=this.attributes;for(var i in this.attributes){var o=e[i];void 0!==o&&t(o,i)}},t.prototype.mapObject=function(t,e){var n=void 0===e?t:t.bind(e);return c({},this.attributes,n)},t.prototype[Symbol.iterator]=function(){return new Ue(this)},t.prototype.entries=function(){return new Ue(this)},t.prototype.keys=function(){var n=[];return this.forEach(function(t,e){return n.push(e)}),n},t._metatype=ue,t.id=Ce(String).value(null),t=U([H({cidPrefix:"m",_changeEventName:"change",idAttribute:"id"}),z({defaults:L.merge,attributes:L.merge,collection:L.merge,Collection:L.value,idAttribute:L.protoValue})],t)}(xt);Te(Re.prototype,Bt,xe);var ke=function(t,e,n){this.id=e.id};Re.prototype.Attributes=ke;var Me=function(t){this.id=t.id};Re.prototype.AttributesCopy=Me;var Je=Wt.create({value:void 0},"id");Re.prototype._attributes={id:Je},Re.prototype._attributesArray=[Je];var Ue=function(){function t(t){this.record=t,this.idx=0}return t.prototype.next=function(){var t=this.record,e=t._attributesArray[this.idx++];return{done:!e,value:e?[e.name,t[e.name]]:void 0}},t}(),Be=o,Ve=a;Re.onExtend=function(t){xt.onExtend.call(this,t);var n=this,e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.model=n,e=U([V],e)}(t.Collection);this.DefaultCollection=e,n.Collection===t.Collection&&(this.Collection=e)},Re.onDefine=function(t,e){var n=e.prototype,r=Se(this.attributes=function(t){var e=t.defaults,n=t.attributes,r=t.idAttribute,i=n||e||{};!r||r in i||(i[r]=void 0);return i}(t),n._attributes),i=r.properties,o=r._localEvents,s=J(r,["properties","_localEvents"]);Be(this.prototype,s),t.properties=Ve(t.properties||{},i),t._localEvents=o,xt.onDefine.call(this,t,e),this.DefaultCollection.define(t.collection||{}),this.Collection=t.Collection,this.Collection.prototype.model=this,t.endpoint&&(this.Collection.prototype._endpoint=t.endpoint)};var He=x,ze=T,Fe=j,qe=S,We=Tt.commit,Ke=Tt.aquire,Le=Tt.free;function Ze(t,e,n){var r,i=t.model;t._shared?(r=e instanceof i?e:i.create(e,n),t._shared&s.ItemsBehavior.listen&&Fe(r,r._changeEventName,t._onChildrenChange,t)):(r=e instanceof i?n.merge?e.clone():e:i.create(e,n))._owner?r._owner!==t&&(Ke(t,r.clone()),(t._aggregationError||(t._aggregationError=[])).push(r)):Ke(t,r);var o=t._itemEvents;return o&&o.subscribe(t,r),r}function Ge(t,e,n){t._shared?t._shared&s.ItemsBehavior.listen&&qe(e,e._changeEventName,t._onChildrenChange,t):(Le(t,e),n||e.dispose());var r=t._itemEvents;r&&r.unsubscribe(t,e)}function $e(t,e){var n=t._comparator;return!(!n||!1===e.sort)&&(t.models.sort(n),!0)}function Qe(t,e){var n=(t[e.cid]=e).id;(n||0===n)&&(t[n]=e)}function Xe(t,e){delete t[e.cid];var n=e.id;(n||0===n)&&delete t[n]}function Ye(t,e){delete t[e.previous(e.idAttribute)];var n=e.id;null==n||(t[n]=e)}var tn=function(){function t(t,e,n,r,i,o){this.object=t,this.isRoot=e,this.added=n,this.removed=r,this.nested=i,this.sorted=o}return t.prototype.commit=function(t){for(var e=this.nested,n=this.object,r=n._isDirty,i=0,o=e;i<o.length;i++){(u=o[i]).commit(n)}n._aggregationError&&en(n,r);for(var s=0,a=e;s<a.length;s++){var u=a[s];He(n,"change",u.object,r)}for(var c=this.added,p=this.removed,h=0,l=c;h<l.length;h++){var f=l[h];ze(f,"add",f,n,r),ze(n,"add",f,n,r)}for(var d=0,v=p;d<v.length;d++){f=v[d];ze(f,"remove",f,n,r),ze(n,"remove",f,n,r)}this.sorted&&He(n,"sort",n,r),(c.length||p.length)&&He(n,"update",n,r),this.isRoot&&We(n,t)},t}();function en(t,e){t._log("warn","Type-R:InvalidOwner","added records already have an owner and were cloned. Use explicit record.clone() to dismiss this warning.",t._aggregationError,e.logger),t._aggregationError=void 0}var nn=Tt.begin,rn=Tt.commit,on=Tt.markAsDirty;function sn(t,e,n,r){var i=nn(t),o=[],s=function(t,e,n,r,i){for(var o=t._byId,s=t.models,a=(i||r.merge)&&!t._shared,u=(r.parse,t.model.prototype.idAttribute),c=s.length,p=0,h=e;p<h.length;p++){var l=h[p],f=l?o[l[u]]||o[l.cid]:null;if(f){if(a&&l!==f){var d=l.attributes||l,v=f._createTransaction(d,r);v&&n.push(v),f.hasChanged(u)&&Ye(o,f)}}else f=Ze(t,l,r),s.push(f),Qe(o,f)}return s.slice(c)}(t,e,o,n,r);if(s.length||o.length){var a=function(t,e,n){var r=n.at;if(null==r)return $e(t,n);var i=t.models.length-e.length;(r=Number(r))<0&&(r+=i+1);r<0&&(r=0);i<r&&(r=i);return function(t,e,n){for(var r=t.length-1,i=r-n.length;e<=i;i--,r--)t[r]=t[i];for(i=0,r=e;i<n.length;i++,r++)t[r]=n[i]}(t.models,r,e),!1}(t,s,n);if(on(t,n))return new tn(t,i,s,[],o,a);t._aggregationError&&en(t,n)}i&&rn(t)}var an=x,un=T,cn=Tt.markAsDirty,pn=Tt.begin,hn=Tt.commit;function ln(t,e,n){var r=function(t,e,n){for(var r=Array(e.length),i=t._byId,o=0,s=0;o<e.length;o++){var a=t.get(e[o]);a&&(r[s++]=a,Xe(i,a),Ge(t,a,n))}return r.length=s,r}(t,e,n.unset);if(r.length){var i=pn(t);if(function(t,e){for(var n=t.models,r=t.models=Array(n.length-e),i=t._byId,o=0,s=0;o<n.length;o++){var a=n[o];i[a.cid]&&(r[s++]=a)}r.length=s}(t,r.length),cn(t,n))new tn(t,i,[],r,[],!1).commit();else i&&hn(t)}return r}var fn=Tt.begin,dn=Tt.commit,vn=Tt.markAsDirty,yn={silent:!0};function gn(t,e,n,r){var i=fn(t),o=function(t,e,n){for(var r=e?e.length:0,i=Array(r),o={},s=t.model.prototype.idAttribute,a=0,u=0;a<r;a++){var c=e[a];if(!c||!o[c[s]]&&!o[c.cid]){var p=Ze(t,c,n);i[u++]=p,Qe(o,p)}}return i.length=u,t._byId=o,t.models=i}(t,e,n);if(o.length){var s=$e(t,n);if(vn(t,r?yn:n))return new tn(t,i,o.slice(),[],[],s);t._aggregationError&&en(t,n)}i&&dn(t)}function mn(t,e,n){var r=fn(t),i=[],o=t.models,s=function(t,e,n,r){for(var i=Array(e.length),o={},s=(null==r.merge||r.merge)&&!t._shared,a=t._byId,u=t.models,c=t.model.prototype.idAttribute,p=[],h=!0,l=0,f=0;l<e.length;l++){var d=e[l],v=null;if(d){var y=d[c],g=d.cid;if(o[y]||o[g])continue;v=a[y]||a[g]}if(v){if(s&&d!==v){h&&u[f]!==v&&(h=!1);var m=d.attributes||d,b=v._createTransaction(m,r);b&&n.push(b)}}else v=Ze(t,d,r),p.push(v);i[f++]=v,Qe(o,v)}i.length=f,t.models=i,t._byId=o,h||(r.sorted=!0);return p}(t,e,i,n),a=t.models.length-s.length,u=a<o.length?a?function(t,e){for(var n=t._byId,r=[],i=0,o=e;i<o.length;i++){var s=o[i];n[s.cid]||(r.push(s),Ge(t,s))}return r}(t,o):function(t,e){for(var n=0,r=e;n<r.length;n++)Ge(t,r[n]);return e}(t,o):[],c=i.length||s.length,p=$e(t,n)&&c||s.length||n.sorted;if(c||u.length||p){if(vn(t,n))return new tn(t,r,s,u,i,p);t._aggregationError&&en(t,n)}r&&dn(t)}var bn=function(){function t(){}return t.prototype.map=function(t,e){for(var n=this.models,r=n.length,i=Array(r),o=e?t.bind(e):t,s=0,a=0;s<r;s++){var u=o(n[s],s);void 0===u||(i[a++]=u)}return s!==a&&(i.length=a),i},t.prototype.each=function(t,e){for(var n=this.models,r=n.length,i=e?t.bind(e):t,o=0;o<r;o++)i(n[o],o)},t.prototype.firstMatch=function(t,e){for(var n=this.models,r=n.length,i=e?t.bind(e):t,o=0;o<r;o++){var s=i(n[o],o);if(void 0!==s)return s}},t.prototype.reduce=function(t,e){return void 0===e?this.models.reduce(t):this.models.reduce(t,e)},t.prototype.slice=function(t,e){return this.models.slice(t,e)},t.prototype.indexOf=function(t){return this.models.indexOf(this.get(t))},t.prototype.includes=function(t){return Boolean(this.get(t))},t.prototype.filter=function(t,e){var n=wn(t);return this.map(function(t){return n(t)?t:void 0},e)},t.prototype.find=function(t,e){var n=wn(t);return this.firstMatch(function(t){return n(t)?t:void 0},e)},t.prototype.some=function(t,e){return Boolean(this.find(t,e))},t.prototype.forEach=function(t,e){this.each(t,e)},t.prototype.values=function(){return this.models.values()},t.prototype.entries=function(){return this.models.entries()},t.prototype.every=function(t,e){var n=wn(t);return void 0===this.firstMatch(function(t){return!!n(t)&&void 0},e)},t.prototype.pluck=function(e){return this.map(function(t){return t[e]})},t.prototype.first=function(){return this.models[0]},t.prototype.last=function(){return this.models[this.models.length-1]},t.prototype.at=function(t){var e=t<0?t+this.models.length:t;return this.models[e]},t}(),_n=function(t){return t};function wn(i){if(null==i)return _n;switch(typeof i){case"function":return i;case"object":var o=Object.keys(i);return function(t){for(var e=0,n=o;e<n.length;e++){var r=n[e];if(i[r]!==t[r])return!1}return!0};default:throw new Error("Invalid iteratee")}}var On=x,Cn=Tt.begin,En=Tt.commit,jn=Tt.markAsDirty,An=0,Sn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.defaultValue=[],e}(ve),Pn=function(i){function t(t,e,n){void 0===e&&(e={});var r=i.call(this,An++)||this;(r.models=[],r._byId={},r.comparator=r.comparator,void 0!==e.comparator&&(r.comparator=e.comparator,e.comparator=void 0),r.model=r.model,e.model&&(r.model=e.model,e.model=void 0),r.idAttribute=r.model.prototype.idAttribute,r._shared=n||0,t)&&gn(r,Nn(r,t,e),e,!0);return r.initialize.apply(r,arguments),r._localEvents&&r._localEvents.subscribe(r,r),r}return k(t,i),t.prototype.createSubset=function(t,e){throw new ReferenceError("Failed dependency injection")},t.onExtend=function(t){var r=this;function e(t,e,n){r.call(this,t,e,s.ItemsBehavior.share|(n?s.ItemsBehavior.listen:0))}this._SubsetOf=null,B.mixins.populate(e),e.prototype=this.prototype,e._metatype=Sn,this.Refs=this.Subset=e,xt.onExtend.call(this,t)},t.onDefine=function(t,e){if(t.itemEvents){var n=new g(e.prototype._itemEvents);n.addEventsMap(t.itemEvents),this.prototype._itemEvents=n}void 0!==t.comparator&&(this.prototype.comparator=t.comparator),xt.onDefine.call(this,t)},Object.defineProperty(t.prototype,"__inner_state__",{get:function(){return this.models},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"comparator",{get:function(){return this._comparator},set:function(i){var o=this;switch(typeof i){case"string":this._comparator=function(t,e){var n=t[i],r=e[i];return n===r?0:n<r?-1:1};break;case"function":1===i.length?this._comparator=function(t,e){var n=i.call(o,t),r=i.call(o,e);return n===r?0:n<r?-1:1}:this._comparator=function(t,e){return i.call(o,t,e)};break;default:this._comparator=null}},enumerable:!0,configurable:!0}),t.prototype.getStore=function(){return this._store||(this._store=this._owner?this._owner.getStore():this._defaultStore)},t.prototype._onChildrenChange=function(t,e,n){if(void 0===e&&(e={}),n!==this){var r=this.idAttribute;t.hasChanged(r)&&Ye(this._byId,t);var i=Cn(this);jn(this,e)&&On(this,"change",t,e),i&&En(this)}},t.prototype.get=function(t){if(null!=t){if("object"!=typeof t)return this._byId[t];var e=t[this.idAttribute];return void 0!==e&&this._byId[e]||this._byId[t.cid]}},t.prototype[Symbol.iterator]=function(){return this.models[Symbol.iterator]()},t.prototype.updateEach=function(t){var e=Tt.begin(this);this.each(t),e&&Tt.commit(this)},t.prototype._validateNested=function(n){if(this._shared)return 0;var r=0;return this.each(function(t){var e=t.validationError;e&&(n[t.cid]=e,r++)}),r},t.prototype.initialize=function(){},t.prototype.clone=function(t){void 0===t&&(t={});var e=this._shared&s.ItemsBehavior.share?this.models:this.map(function(t){return t.clone()}),n=new this.constructor(e,{model:this.model,comparator:this.comparator},this._shared);return t.pinStore&&(n._defaultStore=this.getStore()),n},t.prototype.toJSON=function(e){return this.map(function(t){return t.toJSON(e)})},t.prototype.set=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e={}),void 0!==e.add&&this._log("warn","Type-R:InvalidOption","Collection.set doesn't support 'add' option, behaving as if options.add === true.",e),e.reset)this.reset(t,e);else{var n=this._createTransaction(t,e);n&&n.commit()}return this},t.prototype.liveUpdates=function(t){var e=this;if(t){this.liveUpdates(!1);var n="function"==typeof t?t:function(){return!0};return this._liveUpdates={updated:function(t){n(t)&&e.add(t,{parse:!0,merge:!0})},removed:function(t){return e.remove(t)}},this.getEndpoint().subscribe(this._liveUpdates,this).then(function(){return e})}this._liveUpdates&&(this.getEndpoint().unsubscribe(this._liveUpdates,this),this._liveUpdates=null)},t.prototype.fetch=function(t){var n=this;void 0===t&&(t={});var r=M({parse:!0},t);return bt(this,this.getEndpoint().list(r,this),r,function(t){var e=n.set(t,M({parse:!0,ioMethod:"fetch"},r));return r.liveUpdates&&(e=n.liveUpdates(r.liveUpdates)),e})},t.prototype.dispose=function(){if(!this._disposed){for(var t=!this._shared,e=0,n=this.models;e<n.length;e++){var r=n[e];Ge(this,r),t&&r.dispose()}this.liveUpdates(!1),i.prototype.dispose.call(this)}},t.prototype.reset=function(t,e){void 0===e&&(e={});var n=Cn(this),r=this.models;t?gn(this,Nn(this,t,e),e,!0):(this._byId={},this.models=[]),jn(this,e),e.silent||On(this,"reset",this,M({previousModels:r},e));for(var i=this._byId,o=0,s=r;o<s.length;o++){var a=s[o];i[a.cid]||Ge(this,a)}return n&&En(this),this.models},t.prototype.add=function(t,e){void 0===e&&(e={});var n=Nn(this,t,e),r=this.models.length?sn(this,n,e):gn(this,n,e);if(r)return r.commit(),r.added},t.prototype.remove=function(t,e){return void 0===e&&(e={}),t?Array.isArray(t)?ln(this,t,e):function(t,e,n){var r=t.get(e);if(r){var i=pn(t),o=t.models;o.splice(o.indexOf(r),1),Xe(t._byId,r);var s=cn(t,n);return s&&(un(r,"remove",r,t,n),un(t,"remove",r,t,n)),Ge(t,r,n.unset),s&&an(t,"update",t,n),i&&hn(t),r}}(this,t,e):[]},t.prototype._createTransaction=function(t,e){void 0===e&&(e={});var n=Nn(this,t,e);return this.models.length?!1===e.remove?sn(this,n,e,!0):mn(this,n,e):gn(this,n,e)},t.prototype.sort=function(t){if(void 0===t&&(t={}),$e(this,t)){var e=Cn(this);jn(this,t)&&On(this,"sort",this,t),e&&En(this)}return this},t.prototype.unset=function(t,e){var n=this.get(t);return this.remove(t,M({unset:!0},e)),n},t.prototype.modelId=function(t){return t[this.model.prototype.idAttribute]},t.prototype.toggle=function(t,e){var n=Boolean(this.get(t)),r=void 0===e?!n:Boolean(e);return n!==r&&(n?this.remove(t):this.add(t)),r},t.prototype._log=function(t,e,n,r,i){(i||ft).trigger(t,e,this.model.prototype.getClassName()+"."+this.getClassName()+": "+n,{Argument:r,"Attributes spec":this.model.prototype._attributes})},t.prototype.getClassName=function(){return i.prototype.getClassName.call(this)||"Collection"},Object.defineProperty(t.prototype,"length",{get:function(){return this.models.length},enumerable:!0,configurable:!0}),t.prototype.push=function(t,e){return this.add(t,M({at:this.length},e))},t.prototype.pop=function(t){var e=this.at(this.length-1);return this.remove(e,M({unset:!0},t)),e},t.prototype.unshift=function(t,e){return this.add(t,M({at:0},e))},t.prototype.shift=function(t){var e=this.at(0);return this.remove(e,M({unset:!0},t)),e},t._metatype=ue,t=U([H({cidPrefix:"c",model:Re,_changeEventName:"changes",_aggregationError:null}),K(bn),z({comparator:L.value,model:L.protoValue,itemEvents:L.merge})],t)}(xt);function Nn(t,e,n){var r=n.parse?t.parse(e,n):e;return Array.isArray(r)?r:[r]}function xn(e){switch(typeof e){case"function":return function(t){return e.call(t)};case"object":return function(){return e};case"string":return new Ct(e).resolve}}Re.Collection=Pn;var Tn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.toJSON=function(t){return t&&"object"==typeof t?t.id:t},e.prototype.clone=function(t){return t&&"object"==typeof t?t.id:t},e.prototype.isChanged=function(t,e){return(t&&(null==t.id?t:t.id))!==(e&&(null==e.id?e:e.id))},e.prototype.validate=function(t,e,n){},e}(Wt);function Dn(t,e){var n,r=e||Pn,i=r._SubsetOf||(r._SubsetOf=((n=function(o){function t(t,e){var n=o.call(this,[],e,In)||this;return n.resolvedWith=null,n.refs=Mn(t),n}return k(t,o),Object.defineProperty(t.prototype,"__inner_state__",{get:function(){return this.refs||this.models},enumerable:!0,configurable:!0}),t.prototype.add=function(t,e){void 0===e&&(e={});var n=this.resolvedWith,r=Mn(t);if(n)return o.prototype.add.call(this,Rn(n,r),e);if(r.length){var i=Tt.begin(this);this.refs=this.refs?this.refs.concat(r):r.slice(),Tt.markAsDirty(this,e),i&&Tt.commit(this)}},t.prototype.reset=function(t,e){void 0===e&&(e={});var n=this.resolvedWith,r=Mn(t);return n?o.prototype.reset.call(this,Rn(n,r),e):kn(this,r,e)||[]},t.prototype._createTransaction=function(t,e){var n=this.resolvedWith,r=Mn(t);return n?o.prototype._createTransaction.call(this,Rn(n,r),e):kn(this,r,e)},t.prototype.toJSON=function(){return this.refs?this.refs.map(function(t){return t.id||t}):this.models.map(function(t){return t.id})},t.prototype._validateNested=function(){return 0},Object.defineProperty(t.prototype,"length",{get:function(){return this.models.length||(this.refs?this.refs.length:0)},enumerable:!0,configurable:!0}),t.prototype.clone=function(t){var e=this.constructor,n=new e([],{model:this.model,comparator:this.comparator});return this.resolvedWith?(n.resolvedWith=this.resolvedWith,n.refs=null,n.reset(this.models,{silent:!0})):n.refs=this.refs.slice(),n},t.prototype.parse=function(t){return t},t.prototype.resolve=function(t){return t&&t.length&&(this.resolvedWith=t,this.refs&&(this.reset(this.refs,{silent:!0}),this.refs=null)),this},t.prototype.getModelIds=function(){return this.toJSON()},t.prototype.toggle=function(t,e){return o.prototype.toggle.call(this,this.resolvedWith.get(t),e)},t.prototype.addAll=function(){if(this.resolvedWith)return this.set(this.resolvedWith.models),this.models;throw new Error("Cannot add elemens because the subset collection is not resolved yet.")},t.prototype.toggleAll=function(){return this.length?this.reset():this.addAll()},t=U([H],t)}(r)).prototype._itemEvents=void 0,n)),o=xn(t);return Ce(i).get(function(t){return!t||t.resolvedWith||t.resolve(o(this)),t})}Pn.prototype.createSubset=function(t,e){var n=new(Dn(this,this.constructor).options.type)(t,e);return n.resolve(this),n};var In=s.ItemsBehavior.share|s.ItemsBehavior.persistent;function Rn(t,e){for(var n=[],r=0,i=e;r<i.length;r++){var o=i[r],s=t.get(o);s&&n.push(s)}return n}function kn(t,e,n){if(f(t.refs,e)){var r=Tt.begin(t);t.refs=e.slice(),Tt.markAsDirty(t,n),r&&Tt.commit(t)}}function Mn(t){return t?Array.isArray(t)?t:[t]:[]}var Jn,Un=null,Bn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.prototype.getStore=function(){return this},e.prototype.get=function(t){var e=this[t];return e||this===this._defaultStore?e:this._owner?this._owner.get(t):this._defaultStore.get(t)},Object.defineProperty(e,"global",{get:function(){return Un},set:function(t){Un&&Un.dispose(),xt.prototype._defaultStore=Un=t},enumerable:!0,configurable:!0}),e}(Re);Bn.global=new Bn,"undefined"==typeof Symbol&&Object.defineProperty(window,"Symbol",{value:{iterator:"Symbol.iterator"},configurable:!0});var Vn=(Jn=st).on,Hn=Jn.off,zn=Jn.trigger,Fn=Jn.once,qn=Jn.listenTo,Wn=Jn.stopListening,Kn=Jn.listenToOnce;s.Model=Re,s.Record=Re,s.Class=B,s.Mixable=B,s.on=Vn,s.off=Hn,s.trigger=zn,s.once=Fn,s.listenTo=qn,s.stopListening=Wn,s.listenToOnce=Kn,s.transaction=function(i){return function(){for(var t,e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this.transaction(function(){t=i.apply(e,n)}),t}},s.Collection=Pn,s.getOwnerEndpoint=function t(e){var n=e.collection;if(n)return t(n);if(e._owner){var r=e._owner._endpoints;return r&&r[e._ownerKey]}},s.createIOPromise=function(n){var r,i,e;function o(t){e=t}var t=new Promise(function(t,e){n(r=t,i=e,o)});return t.abort=function(){e?e(r,i):i(new Error("I/O Aborted"))},t},s.startIO=bt,s.abortIO=_t,s.triggerAndBubble=wt,s.tools=y,s.eventsApi=I,s.EventMap=g,s.Messenger=ot,s.Events=st,s.isProduction=ct,s.logEvents=pt,s.Logger=ht,s.logger=ft,s.throwingLogger=gt,s.log=mt,s.predefine=V,s.define=H,s.definitions=z,s.propertyListDecorator=function(n){return function(t,e){(t.hasOwnProperty(n)?t[n]:t[n]=(t[n]||[]).slice()).push(e)}},s.definitionDecorator=F,s.MixinsState=q,s.mixins=K,s.mixinRules=L,s.attributes=function(n){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.attributes=n,e=U([H],e)}(Re)},s.auto=function(t,e){if("undefined"!=typeof Reflect&&Reflect.getMetadata){if(!e){var n=t;return function(t,e){Ce(Reflect.getMetadata("design:type",t,e)).value(n).as(t,e)}}Ce(Reflect.getMetadata("design:type",t,e)).as(t,e)}else t._log("error","Type-R:MissingImport",'Add import "reflect-metadata"; as the first line of your app.')},s.ChainableAttributeSpec=we,s.type=Ce,s.shared=Ee,s.value=je,s.getMetatype=be,s.AnyType=Wt,s.ImmutableClassType=Gt,s.PrimitiveType=$t,s.NumericType=Qt,s.ArrayType=Xt,s.ObjectType=Yt,s.doNothing=te,s.FunctionType=ee,s.DateType=ne,s.AggregatedType=ue,s.SharedType=ve,s.memberOf=function(t,e){var i=xn(t);return new we({value:null,_metatype:Tn}).get(function(t,e){if("object"==typeof t)return t;var n=i(this),r=null;return n&&n.length&&(r=n.get(t)||null,(this.attributes[e]=r)&&this._attributes[e].handleChange(r,null,this,{})),r})},s.subsetOf=Dn,s.Store=Bn,s.Transactional=xt,s.transactionApi=Tt,Object.defineProperty(s,"__esModule",{value:!0})});
//# sourceMappingURL=index.js.map