@rentman/rm-core 6.3.8 → 6.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,4 +13,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
13
13
  See the Apache Version 2.0 License for specific language governing permissions
14
14
  and limitations under the License.
15
15
  ***************************************************************************** */
16
- var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}},function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return i}),r.d(t,"g",function(){return o}),r.d(t,"f",function(){return s}),r.d(t,"d",function(){return a}),r.d(t,"e",function(){return c}),r.d(t,"c",function(){return u});var n="7",i=">",o=":",s="-1",a="-2",c="new-",u="dup-"},function(e,t,r){"use strict";var n=r(0),i=function(){return function(e){this.columns=!0,this.parent=null,this.templateOptions={},Object(n.fb)(this,e)}}(),o=0,s=function(){function e(e,t,r,n){this.factory=e,this.itemType=t,this.itemId=r,this.columns=n,this.id=++o,this.reloadQueued=!1}return e.prototype.queueReload=function(){return this.reloadQueued=!0,this},e.prototype.isLocal=function(){return this.factory.keyService.isLocalId(this.itemId)},e.prototype.isLockable=function(){if(this.isLocal())return!1;switch(this.itemType){case"Project":case"Materiaal":case"Contact":case"Medewerker":case"Voertuig":case"Template":return!0;default:return!1}},e.prototype.toJSON=function(){return{id:this.id,columns:this.columns}},e}(),a=function(){function e(e,t,r,n){this.factory=e,this.entry=t,this._isNew=r,this.transaction=n,this.columns=t.columns.response[t.columns.itemType],this.initial=this.transaction.itemHandler.itemChanges[t.id].initial,this.fields=n.itemHandler.itemChanges[t.id].changes,this.onConstruct()}return e.prototype.onConstruct=function(){},e.prototype.setFields=function(e){var t=this,r=this.columns;for(var n in e){void 0===r[n]&&console.warn("setFields: no column found for",n)}var i=this.transaction.createChangesDelta();return i.setItemUpdated(this.entry,e),this.transaction.applyChangesDelta(i).then(function(){return t},this.factory.errorHandler.reject)},e.prototype.copyFields=function(e){void 0===e&&(e={});var t=this.entry;return this.factory.apiFormatter.copyFields(this.fields,e,t.columns.main),e},e.prototype.getParent=function(e){return this.transaction.getParent(this.entry,e,this.fields)},e.prototype.callOnChange=function(e){var t,r=this,n=null===(t=this.transaction.itemHandler.fieldChangeCallbacks[this.entry.itemType])||void 0===t?void 0:t[this.entry.itemId];if(void 0!==n)for(var i=0,o=n;i<o.length;i++){var s=o[i];try{s({itemEntry:this.entry,compareField:function(t){return r.factory.apiFormatter.compareFields(r.entry.columns.response[r.entry.itemType][t].type,r.fields[t],e[t])},fields:this.fields,isCalledAfterSocketUpdate:!1,previous:e})}catch(e){this.factory.exceptionHandler(e)}}},e.prototype.compareItemField=function(e,t){var r=this.columns[e];if(void 0===r)throw new Error("Missing column in ItemResource.compareItemField");return this.factory.apiFormatter.compareFields(r.type,this.fields[e],t[e])},e.prototype.hasChanges=function(){return this.transaction.itemHandler.detectEntryChanges(this.entry.id)},e.prototype.setTransactionParameters=function(e){Object(n.V)(this.transaction.tabRequestParameters,[this.entry.itemType,this.entry.itemId],[{},e])},e.prototype.isNew=function(){return this._isNew},e.prototype.isLocal=function(){return this.entry.isLocal()},e.prototype.toJSON=function(){var e=[];for(var t in this.columns)e.push(t);return{columns:e,fields:this.fields,entry:this.entry}},e.prototype.getDerivedValue=function(e){return this.transaction.itemHandler.getDerivedValue(this.entry,e)},e.prototype.getDerivedValues=function(e){return this.transaction.itemHandler.getDerivedValues(this.entry,e)},e}(),c=r(11),u=0,l=function(){function e(e,t,r,n,i,o,s){this.collectionEntryService=e,this.queryService=t,this.columnSetFactory=r,this.keyService=n,this.columnCache=i,this.itemType=o,this.options=s,this.id=u++,this.parent=null,this.reloadQueued=!1,this.parent=s.parent,this.query=this.collectionEntryService.createQueryFromOptions(s);var a=this.columnCache.retrieve(o,s.columns);(!0===a.missing||a.missing.length>0)&&console.warn("Missing columns in CollectionEntry",a.missing),this.columns=this.columnSetFactory.construct(o,s.columns,a.cached)}return e.prototype.isLocal=function(){var e=this.parent;return null===e?this.queryService.containsLocalId(this.query.object):this.keyService.isLocalId(e.itemId)},e.prototype.queueReload=function(){this.reloadQueued=!0},e.prototype.expandColumns=function(e){var t=e.run(this.columns);null!==t&&(this.columns=t.merged,this.options.columns=this.columns.request)},e}(),h=r(10),d=function(){function e(e,t,r,n,i){this.factory=e,this.options=t,this.transaction=r,this.itemIdMap={},this.fieldChangeDeregFns={},this.onChangeCallbacks=[],this.onAddCallbacks=[],this.onRemoveCallbacks=[],this.removedItemIds=[],this.entry=this.factory.collectionEntryFactory.construct(n,this.options),this.columns=this.entry.columns.response,this.items=[],this.itemIdMap={},this.registerListeners(),this.addItemResources(i,!0),this.onConstruct()}return e.prototype.onConstruct=function(){},e.prototype.setLimit=function(e){var t=null===this.options.limit?null:this.options.limit.limit;if("number"==typeof e){if(null===this.options.limit)throw new Error("Tried to set a limit only using a number, but the collection didn't have a limit object yet");this.options.limit.limit=e}else this.options.limit=e;null===t&&null===this.options.limit||(null===t||t>this.options.limit.limit?this.limitAfterAdd(!1):t<this.options.limit.limit&&this.limitAfterRemove())},e.prototype.onAdd=function(e){return this.__registerCallback(this.onAddCallbacks,e)},e.prototype.onChange=function(e){return this.__registerCallback(this.onChangeCallbacks,e)},e.prototype.onRemove=function(e){return this.__registerCallback(this.onRemoveCallbacks,e)},e.prototype.__clear=function(){this.onAddCallbacks.length=0,this.onChangeCallbacks.length=0,this.onRemoveCallbacks.length=0},e.prototype.moveItems=function(e,t){return this.transaction.collectionHandler.moveItems(this.entry,t.entry,e)},e.prototype.removeItems=function(e){for(var t=this.factory.changesDeltaFactory.construct(),r=[],n=0,i=this.items;n<i.length;n++){var o=i[n].entry;-1!==e.indexOf(o.itemId)&&r.push(o)}return t.setItemsDeleted(r),this.transaction.applyChangesDelta(t)},e.prototype.removeItem=function(e){return this.removeItems([e])},e.prototype.addItems=function(e){var t=this,r=this.transaction.createChangesDelta();if(null!==this.entry.parent)for(var n=this.factory.itemEntryService.getLinkFieldsByParent(this.entry.parent,this.entry.itemType),i=0,o=e;i<o.length;i++){var s=o[i];for(var a in n)s[a]=n[a]}return r.setItemsCreated(this.entry.itemType,e).then(function(){return t.transaction.applyChangesDelta(r)})},e.prototype.addItem=function(e){return this.addItems([e])},e.prototype.getIdArray=function(){return this.items.map(function(e){return e.entry.itemId})},e.prototype.getItemById=function(e){return this.itemIdMap[e]},e.prototype.addItemResources=function(e,t,r){var n=this;if(void 0===t&&(t=!1),void 0===r&&(r=!1),0===e.length)return[];e=e.filter(function(e){return void 0===n.itemIdMap[e.itemId]});for(var i=this.transaction.createItemResources(e),o=0,s=i;o<s.length;o++){var a=s[o],c=a.entry.itemId;if(void 0===this.itemIdMap[c]){this.items.push(a),this.itemIdMap[c]=a;var u=this.removedItemIds.indexOf(c);u>-1&&this.removedItemIds.splice(u),this.fieldChangeDeregFns[a.entry.id]=this.transaction.registerFieldChangeCallback(a.entry.itemType,a.entry.itemId,function(e){n.callOnChange(e.itemEntry,e.compareField,e.fields,r,e.previous)})}}return this.limitAfterAdd(r,i),i.length>0&&(!t||this.options.callOnAddWithInitialItems)&&this.callOnAdd(i,t,r),i},e.prototype.removeItemResources=function(e,t){var r=this,i=[];return 0===e.length?i:(Object(n.Z)(this.items,function(t){for(var n=0,o=e;n<o.length;n++){var s=o[n];if(t.entry===s)return i.push(t),delete r.itemIdMap[s.itemId],r.fieldChangeDeregFns[s.id](),delete r.fieldChangeDeregFns[s.id],r.removedItemIds.push(s.itemId),!1}return!0}),this.callOnRemove(i,t),this.limitAfterRemove(),i)},e.prototype.callOnAdd=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!1);try{for(var n=0,i=this.onAddCallbacks;n<i.length;n++){(0,i[n])({itemResources:e,collectionResource:this,isInitialCall:t,isCalledAfterSocketUpdate:r})}}catch(e){this.factory.exceptionHandler(e)}},e.prototype.callOnChange=function(e,t,r,n,i){try{for(var o=0,s=this.onChangeCallbacks;o<s.length;o++){(0,s[o])({itemEntry:e,compareField:t,fields:r,isCalledAfterSocketUpdate:n,previous:i})}}catch(e){this.factory.exceptionHandler(e)}},e.prototype.callOnRemove=function(e,t){try{for(var r=0,n=this.onRemoveCallbacks;r<n.length;r++){(0,n[r])({itemResources:e,collectionResource:this,isCalledAfterSocketUpdate:t})}}catch(e){this.factory.exceptionHandler(e)}},e.prototype.forEach=function(e){for(var t=0,r=this.items;t<r.length;t++){e(r[t])}},e.prototype.filter=function(e){for(var t=[],r=0,n=this.items;r<n.length;r++){var i=n[r];e(i)&&t.push(i)}return t},e.prototype.first=function(e){for(var t=0,r=this.items;t<r.length;t++){var n=r[t];if(e(n))return n}return null},e.prototype.some=function(e){return null!==this.first(e)},e.prototype.groupBy=function(e){var t=this.items,r={};if("string"==typeof e)for(var n=0,i=t;n<i.length;n++){if(void 0===(a=i[n]).entry.columns.response[this.entry.itemType][e])throw new Error("Trying to group on a column not in one of the items in this collection! (column '"+e+"', item "+a.entry.itemType+":"+a.entry.itemId+")");void 0===r[c=a.fields[e]]&&(r[c]=[]),r[c].push(a)}if("function"==typeof e)for(var o=0,s=t;o<s.length;o++){var a,c;null!==(c=e(a=s[o]))&&(void 0===r[c]&&(r[c]=[]),r[c].push(a))}return r},e.prototype.map=function(e){var t=this.items,r=t.length,n=new Array(r);if("string"==typeof e)for(var i=0;i<r;i++)n[i]=t[i].fields[e];if("function"==typeof e)for(i=0;i<r;i++)n[i]=e(t[i]);return n},e.prototype.reduce=function(e,t){for(var r=0,n=this.items;r<n.length;r++){t=e(n[r],t)}return t},e.prototype.clearResource=function(){for(var e in this.fieldChangeDeregFns)this.fieldChangeDeregFns[e](),delete this.fieldChangeDeregFns[e];this.transaction.clearCollectionResource(this)},e.prototype.registerListeners=function(){var e=this;this.onChangeCallbacks.push(function(t){t.compareField("id")||(e.itemIdMap[t.fields.id]=e.getItemById(t.previous.id),delete e.itemIdMap[t.previous.id])}),this.options.onAdd!==h.c&&this.onAddCallbacks.push(function(t){e.options.onAdd(t.itemResources,t.collectionResource,t.isInitialCall,t.isCalledAfterSocketUpdate)}),this.options.onRemove!==h.c&&this.onRemoveCallbacks.push(function(t){e.options.onRemove(t.itemResources,t.collectionResource,t.isCalledAfterSocketUpdate)}),this.options.onChange!==h.c&&this.onChangeCallbacks.push(function(t){return e.options.onChange(t)})},e.prototype.__registerCallback=function(e,t){return e.push(t),function(){var r=e.indexOf(t);r>-1&&e.splice(r,1)}},e.prototype.limitAfterRemove=function(){var e=this;null===this.options.limit||this.options.limit.limit<=this.items.length||this.transaction.cachedQueryHandler.__fetchCachedQueryItem(this.entry.itemType,new c.a({query:this.factory.queryService.addAndCondition(this.entry.query.object,this.factory.queryService.createNotIn(this.removedItemIds)),columns:this.entry.options.columns,parent:this.entry.parent,limit:this.entry.options.limit})).then(function(t){e.addItemResources(t.items)})},e.prototype.limitAfterAdd=function(e,t){var r=this.entry.options.limit;if(!(null===r||this.items.length<=r.limit)){this.items.sort(function(e,t){var n=e.fields[r.field]-t.fields[r.field];return void 0===r.order||"desc"===r.order?-n:n});for(var n=this.items.splice(r.limit,this.items.length-r.limit),i=0,o=n;i<o.length;i++){var s=o[i];if(this.fieldChangeDeregFns[s.entry.id](),delete this.itemIdMap[s.entry.itemId],delete this.fieldChangeDeregFns[s.entry.id],this.removedItemIds.push(s.entry.itemId),void 0!==t){var a=t.indexOf(s);a>-1&&t.splice(a,1)}}this.callOnRemove(n,e)}},e}(),p=function(){function e(e,t,r,n,i){this.itemType=t,this.response=r;var o=r.fetchColumnsObject();this.responseColumns=e.columnUtil.mergeResponseColumns(o,i).merged,this.columns=e.columnSetFactory.constructFromResponse(t,o),this.columns=this.columns.expand(n[t],!1,i).merged}return e.prototype.getFields=function(){var e=this.itemType;return this.response.fetchObject(e,this.response.links[e][0])},e}();r.d(t,"e",function(){return i}),r.d(t,"d",function(){return s}),r.d(t,"f",function(){return a}),r.d(t,"b",function(){return c.a}),r.d(t,"a",function(){return l}),r.d(t,"c",function(){return d}),r.d(t,"g",function(){return p})},function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(0),i=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e){return new n.d(this.apiFormatter,e)},e}(),o=function(){function e(){}return e.prototype.construct=function(e){return new n.f(e)},e}(),s=r(5),a=r(11),c=function(){function e(e,t,r,n,i){this.collectionEntryService=e,this.columnSetFactory=t,this.keyService=r,this.queryService=n,this.columnCache=i}return e.prototype.construct=function(e,t){return new s.a(this.collectionEntryService,this.queryService,this.columnSetFactory,this.keyService,this.columnCache,e,new a.a(t))},e}(),u=r(3),l=r(28),h=r(13),d=function(e){function t(t,r,n,i,o,s){var a=e.call(this,n,i,o)||this;return a.apiRequestService=t,a.promiseService=r,a.getQueries=s,a.map={},a}return Object(u.b)(t,e),t.prototype.__removeFromAndAddToCachedQueries=function(e,t){var r=this;void 0===e&&(e=!1);var n=[],i=function(e){var i,s=o.map[e],a=o.groupItemEntries(s.matches);if(o.transaction.cachedQueryHandler.__removeItemEntriesFromCachedQueries(s.itemType,s.query,a.notFitting),o.transaction.cachedQueryHandler.__addItemEntriesToCachedQueries(s.itemType,s.query,a.fitting),a.maybe.length>0){if(o.transaction instanceof h.a)for(var c=0,u=a.maybe;c<u.length;c++){var l=u[c];o.transaction.itemHandler.detectEntryChanges(l.id)&&console.error("!! Trying to re-query 'maybe' matching results but one of the entries has changes, please report this to Martijn !!")}n.push(o.apiRequestService.query(s.itemType,s.query.object,(i={},i[s.itemType]=["id"],i)).then(function(e){void 0!==t&&t._setQueryResult(s.itemType,s.query.string,e.links[s.itemType]),r.transaction.cachedQueryHandler.__addItemEntriesToCachedQueries(s.itemType,s.query,a.maybe.filter(function(t){return e.links[s.itemType].indexOf(t.itemId)>-1}))}).then(function(){},function(){}))}},o=this;for(var s in this.map)i(s);return this.promiseService.all(n)},t.prototype._expand=function(e,t){for(var r=0,n=this.getQueries(e.itemType);r<n.length;r++){var i=n[r],o=i.itemType+"-"+i.query.string;void 0===this.map[o]&&(this.map[o]={itemType:e.itemType,query:i.query,matches:{},cachedQuery:i});var s=this.map[o].matches;void 0===s[e.itemId]&&(s[e.itemId]={item:e,isMatch:t(e.itemType,i.query)})}return this},t}(l.a),p=r(17),m=function(){function e(e,t,r,n){this.queryMatcherFactory=e,this.queryService=t,this.apiRequestService=r,this.promiseService=n}return e.prototype.constructCachedCollectionProcessor=function(e,t){return new p.a(this.apiRequestService,this.promiseService,this.queryService,this.queryMatcherFactory,e,t)},e.prototype.constructCachedQueryProcessor=function(e,t){return new d(this.apiRequestService,this.promiseService,this.queryService,this.queryMatcherFactory,e,t)},e}(),f=function(){function e(e,t,r,n,i,o,s,a,c){this.errorHandler=e,this.exceptionHandler=t,this.keyService=r,this.promiseService=n,this.changesDeltaFactory=i,this.itemEntryService=o,this.collectionEntryFactory=s,this.queryService=a,this.columnSetFactory=c}return e.prototype.construct=function(e,t,r,n){return new s.c(this,new s.b(t),r,e,n)},e}(),y=function(){function e(e){this.columnInfoFactory=e}return e.prototype.construct=function(e,t,r){return new n.n(this.columnInfoFactory,e,t,r)},e}(),v=function(){function e(){}return e.prototype.construct=function(e,t){return new n.p(e,t)},e.prototype.constructFromRootMap=function(e,t){void 0===t&&(t=null);var r=[];for(var n in e){var i=e[n],o=this.construct(i.apiColumn,t),s=this.constructFromRootMap(i.children,o);s.length>0&&o.setChildren(o.apiColumn.itemType,s),r.push(o)}return r},e}(),g=function(){function e(e,t,r){this.columnHandler=e,this.columnUtil=t,this.columnInfoFactory=r}return e.prototype.constructStub=function(e,t){var r=new n.q(this.columnUtil,this,e);return r.request=t,r.requestColumnsTrue=!0===t,r},e.prototype.resolveStub=function(e,t,r,n){return void 0===r&&(r=!0),void 0===n&&(n=!0),e.requestColumnsTrue?this.processResponseColumns(e,t,r):this.processRequestColumns(e,t,r,n)},e.prototype.construct=function(e,t,r,n,i){return this.resolveStub(this.constructStub(e,t),r,n,i)},e.prototype.constructFromResponse=function(e,t,r){void 0===r&&(r=!0);var i=new n.q(this.columnUtil,this,e);return i.requestColumnsTrue=!1,this.processResponseColumns(i,t,r)},e.prototype.processResponseColumns=function(e,t,r){var n=e.itemType,i={};return e.response=t,this.expandRootColumnMapFromResponseColumns(n,t,i,r,{}),this.processColumnInfo(e,this.columnInfoFactory.constructFromRootMap(i),n),e.request=this.constructRequestColumnsFromRootColumnMap(i),e},e.prototype.constructRequestColumnsFromRootColumnMap=function(e){var t,r=[];for(var i in e){var o=e[i];Object(n.db)(o.children)?r.push(((t={})[i]=this.constructRequestColumnsFromRootColumnMap(o.children),t)):r.push(i)}return r},e.prototype.expandRootColumnMapFromResponseColumns=function(e,t,r,i,o){if(!0!==o[e])for(var s in o[e]=!0,t[e]){var a=t[e][s];if(void 0!==a&&(i&&this.columnHandler.setColumn(e,a),void 0===r[s]&&(r[s]={apiColumn:a,children:{}}),this.columnUtil.isItemColumn(a,!1))){var c=t[a.itemType];void 0!==c&&Object(n.db)(c)&&this.expandRootColumnMapFromResponseColumns(a.itemType,t,r[s].children,i,o)}}},e.prototype.processRequestColumns=function(e,t,r,n){var i=e.itemType,o={};return this.expandRootColumnMap(e.request,i,t,o,r),n&&this.expandRootColumnMap(["id"],i,t,o,r),e.response={},this.processColumnInfo(e,this.columnInfoFactory.constructFromRootMap(o),i),e},e.prototype.processColumnInfo=function(e,t,r){var n=e.response;void 0===n[r]&&(n[r]={});for(var i=0,o=t;i<o.length;i++){var s=o[i];n[r][s.id]=s.apiColumn,e.groupColumnInfo(s),s.isLeaf||this.processColumnInfo(e,s.children,s.itemType)}},e.prototype.expandRootColumnMap=function(e,t,r,n,i){for(var o=0,s=e;o<s.length;o++){var a=s[o],c=this.columnUtil.parseRequestColumn(a),u=c.id,l=c.children,h=void 0;void 0!==r[t]&&(h=r[t][u]),void 0!==h?(i&&(h=this.columnHandler.setColumn(t,h)),void 0===n[u]&&(n[u]={apiColumn:h,children:{}}),0!==l.length&&this.expandRootColumnMap(l,h.itemType,r,n[u].children,i)):console.warn("No api column for request column",u,"for itemType",t)}},e}(),C=function(){function e(e){this.columnUtil=e}return e.prototype.construct=function(e){return new n.r(this.columnUtil,e)},e}(),I=function(){function e(e,t,r){this.apiFormatter=e,this.keyService=t,this.requestColumnExpansionFactory=r}return e.prototype.construct=function(e,t,r){return new n.u(this.apiFormatter,this.keyService,this.requestColumnExpansionFactory,e,t,r)},e}(),b=function(){function e(e){this.queryMatcherFactory=e}return e.prototype.construct=function(e){return new n.x(this.queryMatcherFactory,e)},e}(),S=function(){function e(e,t,r,n,i,o){this.apiFormatter=e,this.columnSetFactory=t,this.exceptionHandler=r,this.itemEntryService=n,this.keyService=i,this.promiseService=o}return e.prototype.construct=function(e,t){return new s.d(this,t.itemType,e,t)},e}(),E=function(){function e(e,t,r,n,i){this.apiFormatter=e,this.errorHandler=t,this.promiseService=r,this.exceptionHandler=n,this.columnUtil=i}return e.prototype.construct=function(e,t,r){return void 0===r&&(r=!1),new s.f(this,e,r,t)},e}(),F=function(){function e(e,t){this.dependencies=e,this.core=t,this.serverCache=new n.J(this.dependencies,this.core)}return e.prototype.getById=function(e){var t=function(r){for(var n=0,i=r;n<i.length;n++){var o=i[n];if(o.id===e)return o;var s=t(o.children);if(void 0!==s)return s}};return t(this.serverCache.children)},e.prototype.construct=function(e,t){return this.serverCache.createChild(e,t)},e.prototype.getServerCache=function(){return this.serverCache},e}(),R=function(){function e(){}return e.prototype.construct=function(e){return new n.C(e)},e}(),q=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e,t,r){return new n.D(this.apiFormatter,e,t,r)},e}(),T=function(){function e(){}return e.prototype.construct=function(e){return new n.E(e)},e}(),H=function(){function e(e){this.columnUtil=e}return e.prototype.construct=function(){return new n.I(this.columnUtil)},e}(),M=function(){function e(e,t){this.columnSetFactory=e,this.columnUtil=t}return e.prototype.construct=function(e,t,r,n){return new s.g(this,e,t,r,n)},e}(),j=r(25),w=r(26);r.d(t,"a",function(){return i}),r.d(t,"b",function(){return o}),r.d(t,"e",function(){return c}),r.d(t,"f",function(){return m}),r.d(t,"g",function(){return f}),r.d(t,"h",function(){return y}),r.d(t,"i",function(){return v}),r.d(t,"j",function(){return g}),r.d(t,"k",function(){return C}),r.d(t,"l",function(){return I}),r.d(t,"m",function(){return b}),r.d(t,"n",function(){return S}),r.d(t,"o",function(){return E}),r.d(t,"u",function(){return F}),r.d(t,"p",function(){return R}),r.d(t,"q",function(){return q}),r.d(t,"r",function(){return T}),r.d(t,"s",function(){return H}),r.d(t,"t",function(){return M}),r.d(t,"c",function(){return j.a}),r.d(t,"d",function(){return w.a})},function(e,t,r){"use strict";r.r(t);var n=r(30);r.d(t,"StateKeyType",function(){return n.b}),r.d(t,"ApiLinkTreeType",function(){return n.a});var i=r(31);for(var o in i)["StateKeyType","ApiLinkTreeType","default"].indexOf(o)<0&&function(e){r.d(t,e,function(){return i[e]})}(o)},function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return s});var n,i=r(5),o=r(1);!function(e){e.CACHED="cached",e.NOT_CACHED="not_cached",e.NO_CHANGES="no_changes"}(n||(n={}));var s=function(){function e(e,t,r,n,i,o,s,a){this.columnUtil=e,this.apiFormatter=t,this.itemEntryFactory=r,this.promiseService=n,this.errorHandler=i,this.requestColumnExpansionFactory=o,this.transaction=a,this.entries=s.construct(this.transaction)}return e.prototype.getDerivedValues=function(e,t){for(var r=e,n=this.transaction.getChangesFromItemChanges(this.itemChanges[e.id]),i=0,o=t;i<o.length;i++){var s=o[i],a=r.columns.response[r.itemType][s];if(void 0===a)throw new Error("Column '"+s+"' not found on entry in ItemResource.getDerivedValue");if(null===a.itemType)throw new Error("Column '"+s+"' doesn't have children in ItemResource.getDerivedValue");var c=n[s];if(null===c)return;if(void 0===(r=this.transaction.getLocalItemEntryByItemId(a.itemType,c)))throw new Error("Derived itemEntry "+a.itemType+":"+c+" couldn't be found");n=this.transaction.getItemChangesRecursively(r.id,!1)}return n},e.prototype.getDerivedValue=function(e,t){"string"==typeof t&&(t=this.columnUtil.parseConfigColumn(t));var r=this.getDerivedValues(e,t.slice(0,-1));if(void 0!==r)return r[t[t.length-1]]},e.prototype.clearItemEntry=function(e){this.entries.clear(e),delete this.itemChanges[e.id]},e.prototype.fetchDerivedValuesByColumn=function(e,t,r){var n=this,s=t.children;if(0===s.length)return this.promiseService.when();var a=s[0];if(1===s.length&&"id"===a.apiColumn.type)throw new Error("You should use fields[columnId] instead of derived['columnId>id'] to get the id of a derived item");for(var c={},u=0,l=e;u<l.length;u++){var h=l[u];null!==(p=this.getItemIdByColumn(h,t,r))&&(void 0===c[p]&&(c[p]=[]),c[p].push(h))}if(!Object(o.j)(c))return this.promiseService.when();var d=[];for(var p in c)d.push(+p);for(var m=[],f=0,y=s;f<y.length;f++){var v=y[f];m.push(v.id)}return this.fetchItemEntries(t.itemType,d,new i.e({columns:m})).then(function(){return n.resolveDerivedValues(e,s,r)},this.errorHandler.reject)},e.prototype.resolveDerivedValues=function(e,t,r){for(var n=[],i=0,o=t;i<o.length;i++){var s=o[i];n.push(this.fetchDerivedValuesByColumn(e,s,r))}return this.promiseService.all(n).then(function(){return e},this.errorHandler.reject)},e.prototype.createItemEntry=function(e){var t=this.itemEntryFactory.construct(e.itemId,e.columns);return this.entries.add(t),t},e.prototype.getItemIdByColumn=function(e,t,r){if(0===t.level)return void 0!==r&&void 0!==r.updated[e.id]?r.updated[e.id].changes.fields[t.path]:this.transaction.getItemChangesRecursively(e.id)[t.path];var n=this.getItemIdByColumn(e,t.parent,r),i=this.transaction.getLocalItemEntryByItemId(t.parent.itemType,n);return void 0!==r&&void 0!==r.updated[i.id]?r.updated[i.id].changes.fields[t.id]:this.transaction.getItemChangesRecursively(i.id)[t.id]},e.prototype.expandColumnsWithCachedQueryColumns=function(e,t){var r=this.requestColumnExpansionFactory.construct();r.expandWithRequestColumns(e,["id","permissions"]),void 0!==t&&r.expandWithRequestColumns(e,t);for(var n=function(t){var n=t.cachedQueryHandler.cachedQueries[e];if(void 0!==n)for(var i in n){var o=n[i];r.expandWithRequestColumns(o.itemType,o.requestColumns)}},i=function(e){for(var t=0,r=e;t<r.length;t++){var o=r[t];n(o),i(o.children)}},o=0,s=this.transaction.getTransactionChain();o<s.length;o++){var a=s[o];n(a)}return i(this.transaction.children),r.get()[e]},e}()},function(e,t,r){"use strict";var n=r(0),i=r(24),o=r(27),s=r(1),a=function(){function e(e,t,r,n,i,o,s){this.columnUtil=e,this.promiseService=t,this.columnHandler=r,this.templateFactory=n,this.errorHandler=i,this.requestColumnExpansionFactory=o,this.apiRequestService=s,this.pendingTemplateBufferMap={},this.templates={}}return e.prototype.fetchTemplate=function(e,t,r,n,i){var o=this;void 0===r&&(r={}),void 0===n&&(n={}),void 0===i&&(i=null);var a=Object(s.j)(r),c=this.requestColumnExpansionFactory.construct();if(void 0!==n[e]&&c.expandWithRequestColumns(e,n[e]),c.expandWithRequestColumns(e,[{creator:["displayname"]},"created","permissions"]),null!==i&&c.expandWithRequestColumns(e,this.columnUtil.getColumnsFromLink("string"==typeof i?i:i.itemType,e)),n[e]=c.get()[e],!a){var u=this.templates[e];if(void 0!==u&&(null===e||this.columnUtil.responseColumnsAvailable(e,n[e],u.responseColumns)))return this.promiseService.when(u)}return this.promiseService.all({template:this.fetchTemplateById(e,t,r),additionalColumns:void 0===n[e]?{}:this.columnHandler.fetch(e,n[e])}).then(function(t){var r=t.template,i=o.templateFactory.construct(e,r,n,t.additionalColumns);return!a&&r.cacheable&&(o.templates[e]=i),i},this.errorHandler.reject)},e.prototype.fetchTemplateById=function(e,t,r){return void 0===t&&(t="no-id"),void 0===this.pendingTemplateBufferMap[e]||void 0===this.pendingTemplateBufferMap[e][t]?this.constructTemplateBuffer(e,t,r):this.pendingTemplateBufferMap[e][t]},e.prototype.constructTemplateBuffer=function(e,t,r){var n=this;return void 0===this.pendingTemplateBufferMap[e]&&(this.pendingTemplateBufferMap[e]={}),this.pendingTemplateBufferMap[e][t]=this.apiRequestService.template(e,r).then(function(r){return delete n.pendingTemplateBufferMap[e][t],r},function(){return delete n.pendingTemplateBufferMap[e][t],n.errorHandler.reject()})},e}(),c=r(7),u=r(25),l=r(26);r.d(t,"a",function(){return h}),r.d(t,"c",function(){return d}),r.d(t,"b",function(){return p});var h=function(){return function(e,t,r,s,h,p){this.version="6.3.8",this.noop=d;var m=new n.A,f=new n.b,y=new c.q(f),v=new c.r,g=new n.F(m),C=new n.l,I=new n.s(p),b=new c.s(I),S=new n.z(t,p),E=new c.a(f),F=new n.c(e,E),R=new c.f(y,g,F,h),q=new n.m(I),T=new n.o(F,r,h,q,I),H=new c.i,M=new c.h(H),j=new c.j(T,I,H),w=new c.k(I),k=new n.B(F,r,m,h),D=new c.t(j,I),x=new c.m(y),O=new c.o(f,r,h,s,I),Q=new a(I,h,T,D,r,b,F),_=new n.t(m),L=new i.a(j,_,r,m,h,Q),A=new u.a(r,S,L),P=new o.a(h,F,b,m,A),B=new c.n(f,j,s,S,m,h),U=new n.j(v,g),N=new c.e(U,j,m,g,q),V=new c.g(r,s,m,h,A,S,N,g,j),W=new c.l(f,m,b),Y=new c.b,J=new l.a(A,F,Y,M,W,r,h,b,U,S),K=new c.p,G=new c.u({apiFormatter:f,apiRequestService:F,authInterface:t,changesDeltaFactory:A,changesProcessorFactory:J,collectionEntryFactory:N,collectionEntryService:U,collectionMatcherFactory:R,collectionResourceFactory:V,columnCache:q,columnExpansionFactory:M,columnHandler:T,columnSetFactory:j,columnSubsetCacheFactory:w,columnUtil:I,conversionMapService:_,errorHandler:r,exceptionHandler:s,itemCacheFactory:x,itemCreateService:L,itemEntryFactory:B,itemEntryService:S,itemResourceFactory:O,keyService:m,linkTreeService:p,lockService:k,moduleChangesCompilationFactory:K,promiseService:h,queryMatcherFactory:y,queryParserFactory:v,queryService:g,requestBufferManager:P,requestColumnExpansionFactory:b,templateCache:Q},this);P.setServerCache(G.getServerCache());var z=new n.M(P,A,f,r,G,h,b,F,y);this.apiFormatter=f,this.apiRequestService=F,this.apiResponseProcessorFactory=E,this.changesCompilationFactory=Y,this.changesDeltaFactory=A,this.changesProcessorFactory=J,this.collectionEntryFactory=N,this.collectionEntryService=U,this.collectionMatcherFactory=R,this.collectionResourceFactory=V,this.collectionResourceService=C,this.columnCache=q,this.columnExpansionFactory=M,this.columnHandler=T,this.columnInfoFactory=H,this.columnSetFactory=j,this.columnSubsetCacheFactory=w,this.columnUtil=I,this.conversionMapService=_,this.createRequestFactory=W,this.itemCacheFactory=x,this.itemCreateService=L,this.itemEntryFactory=B,this.itemEntryService=S,this.itemResourceFactory=O,this.keyService=m,this.lockService=k,this.moduleChangesCompilationFactory=K,this.queryMatcherFactory=y,this.queryParserFactory=v,this.queryService=g,this.requestColumnExpansionFactory=b,this.socketMessageHandler=z,this.templateCache=Q,this.templateFactory=D,this.transactionCacheFactory=G}}();function d(){}function p(e){return e}},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(0),i=r(10),o=function(){return function(e){this.columns=[],this.query=null,this.queryColumns=[],this.parent=null,this.limit=null,this.onAdd=i.c,this.onRemove=i.c,this.onChange=i.c,this.custom=null,this.callOnAddWithInitialItems=!1,Object(n.fb)(this,e)}}()},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r){this.errorHandler=e,this.exceptionHandler=t,this.promiseService=r,this.callbacks={onBeforeSave:[],onSaveSuccess:[],onSetItemError:[],onClearItemError:[],onSetGlobalError:[],onClearGlobalError:[]}}return e.prototype.registerCallback=function(e,t,r,n,i){var o=this;return void 0===n&&(n="always"),void 0===i&&(i=100),this.getPriorityLevel(e,i)[t]={callback:r,condition:n},function(){delete o.getPriorityLevel(e,i)[t]}},e.prototype.executeCallbacks=function(e,t,r){for(var n=this.callbacks[e],i=r?"onClose":"skipOnClose",o=this.promiseService.when(),s=0,a=n;s<a.length;s++){var c=a[s];o=o.then(this.executeCallbacksPriorityLevel(c[1],i,t),this.errorHandler.reject)}return o},e.prototype.getPriorityLevel=function(e,t){for(var r,n=this.callbacks[e],i=0;i<n.length;i++){var o=n[i];if(!(o[0]<t))return o[0]===t?o[1]:(r={},n.splice(i,0,[t,r]),r)}return r={},n.push([t,r]),r},e.prototype.executeCallbacksPriorityLevel=function(e,t,r){var n=this;return function(){var i={};for(var o in e){var s=e[o];if(s.condition===t||"always"===s.condition)try{i[o]=r(s.callback)}catch(e){n.exceptionHandler(e)}}return n.promiseService.all(i)}},e}()},function(e,t,r){"use strict";r.d(t,"b",function(){return n}),r.d(t,"a",function(){return f});var n,i=r(3),o=r(0),s=r(10),a=r(5),c=r(11),u=r(8),l=r(1),h=r(14),d=r(9),p=r(19),m=r(12);!function(e){e.warning="warning",e.error="error"}(n||(n={}));var f=function(e){function t(t,r,n,i,s){var a=e.call(this,t,r)||this;return a.id=i,a.errors={item:{},global:{}},a.tabRequestParameters={},a.isSaving=!1,a.hasChanges=!1,a.changesInterval=null,a._isValid=!0,a.validator=void 0===s?void 0:s.construct(a),a.parent=n,a.itemHandler=new o.S(t,a,a.validator),a.cachedQueryHandler=new p.a(t,a.itemHandler,a),a.collectionHandler=new o.P(a.itemHandler,a.cachedQueryHandler,a.dependencies,a),a.eventHandler=new m.a(t.errorHandler,t.exceptionHandler,t.promiseService),a}return Object(i.b)(t,e),Object.defineProperty(t.prototype,"isValid",{get:function(){return(void 0===this.validator||!this.validator.isPending())&&this._isValid},enumerable:!0,configurable:!0}),t.prototype.createChild=function(e,r){var n=new t(this.dependencies,this.core,this,e,r);return this.children.push(n),n},t.prototype.destroy=function(){this.parent.onChildDestroy(this)},t.prototype.expandCollectionResource=function(e,t){var r,n=this,i=null===(r=this.cachedQueryHandler.cachedQueries[e.entry.itemType])||void 0===r?void 0:r[e.entry.query.string];return void 0===i?this.collectionHandler.expandCollectionResource(e,t):this.cachedQueryHandler.__expandCachedQuery(i,t).then(function(){e.entry.columns=n.dependencies.columnSetFactory.construct(i.itemType,i.requestColumns,n.dependencies.columnCache.retrieve(i.itemType,i.requestColumns).cached)},this.dependencies.errorHandler.reject)},t.prototype.expandCollectionResources=function(e,t,r){var n=this;if(!Object(l.j)(t))return this.dependencies.promiseService.when(t);var i=[],o=[];for(var s in t)for(var a=0,c=t[s].items;a<c.length;a++){var u=c[a];u.entry.isLocal()?i.push(u.entry):o.push(u.entry)}return(0===o.length?this.dependencies.columnHandler.fetch(e,r):this.getServerCache().itemHandler.extendItemEntries(e,o,r)).then(function(){if(0===i.length)return n.dependencies.promiseService.when();var t=n.createChangesDelta();return n.itemHandler.expandLocalItemEntries(t,e,i,r,n.dependencies.columnCache.retrieve(e,r).cached).then(function(){return n.applyChangesDelta(t)},n.dependencies.errorHandler.reject)},this.dependencies.errorHandler.reject).then(function(){var i,o=n.dependencies.columnExpansionFactory.construct(e,r,n.dependencies.columnCache.retrieve(e,r).cached);for(var s in t){var a=t[s].entry,c=null===(i=n.cachedQueryHandler.cachedQueries[a.itemType])||void 0===i?void 0:i[a.query.string];void 0!==c&&(c.requestColumns=n.dependencies.columnUtil.mergeRequestColumns(c.requestColumns,r).merged),a.expandColumns(o)}return t},this.dependencies.errorHandler.reject)},t.prototype.registerFieldChangeCallback=function(e,t,r){return this.itemHandler.registerFieldChangeCallback(e,t,r)},t.prototype.createChangesDelta=function(){return this.dependencies.changesDeltaFactory.construct()},t.prototype.getFirstErrorString=function(){for(var e in this.errors.global){if((s=this.errors.global[e]).level===n.error)return s.string}for(var t in this.errors.item){var r=this.errors.item[t];for(var i in r){var o=r[i];for(var e in o){var s;if((s=o[e]).level===n.error)return s.string}}}},t.prototype._setGlobalError=function(e,t,r,n){t?(this.errors.global[e]={string:r(),level:n},this.eventHandler.executeCallbacks("onSetGlobalError",function(t){return t(e,n)},!1),this._setIsValid()):this.clearGlobalError(e)},t.prototype._setItemError=function(e,t,r,n,i,s,a){n?(Object(o.V)(this.errors.item,[e,t,r],[{},{},{fieldString:i(),string:s(),level:a}]),this.eventHandler.executeCallbacks("onSetItemError",function(n){return n(e,t,r)},!1),this._setIsValid()):this.clearItemError(e,t,r)},t.prototype._setIsValid=function(){for(var e in this._isValid=!0,this.errors.global){if(this.errors.global[e].level===n.error)return void(this._isValid=!1)}for(var t in this.errors.item){var r=this.errors.item[t];for(var i in r){var o=r[i];for(var e in o){if(o[e].level===n.error)return void(this._isValid=!1)}}}},t.prototype.applyChangesFromParent=function(e,t,r){var n=this;void 0===t&&(t=!1),void 0===r&&(r=!1);var i=this.core.changesDeltaFactory.constructInternalDelta();for(var o in e.created){var s=e.created[o];i.setItemCreated(s.entry,s.fields)}for(var o in e.updated){s=e.updated[o];this.itemHandler.processItemEntryChanges(s,t,!0,r).status!==d.a.NO_CHANGES&&i.setItemUpdated(s.entry,s.changes.fields,s.changes.expandedColumns)}for(var a in e.deleted)for(var c=0,u=e.deleted[a];c<u.length;c++){var l=u[c];if(this.itemHandler.entries.clear(l),delete this.itemHandler.itemChanges[l.id],this.clearItemError(l.id),i.setItemDeleted(l),void 0!==this.itemHandler.deletedItems[l.itemType]){var h=this.itemHandler.deletedItems[l.itemType].indexOf(l);-1!==h&&this.itemHandler.deletedItems[l.itemType].splice(h,1)}}return this.core.collectionMatcherFactory.constructCachedQueryProcessor(this,function(e){return n.cachedQueryHandler.getCachedQueryObjectsByItemType(e)}).processDelta(i).__removeFromAndAddToCachedQueries(r,i).then(function(){return n.core.collectionMatcherFactory.constructCachedCollectionProcessor(n,function(e){return n.collectionHandler.collectionResources[e]}).processDelta(i).__removeFromAndAddToCollections(r,i)}).then(function(){for(var t=[],r=0,i=n.children;r<i.length;r++){var o=i[r];t.push(o.applyChangesFromParent(e))}return n.hasChanges=!1,n.detectChanges(),void 0!==n.validator&&(n.clearGlobalError(),n.validator.validateTransaction()),n.dependencies.promiseService.all(t).then(function(){},n.dependencies.promiseService.reject)})},t.prototype.applyChangesDelta=function(t){var r=this;return t.isEmpty()?this.dependencies.promiseService.when({created:[],rollback:s.c}):this.fetchUpdatedDerivedValuesFromDelta(t).then(function(){var n=e.prototype._applyChangesDelta.call(r,t),i=n.result,o=n.matchingDelta,s=n.internalChangesDelta,a=n.rollbackFunctions;for(var c in t.deleted)for(var u=function(e){r.itemHandler.entries.clear(e);var n=r.itemHandler.itemChanges[e.id];delete t.updated[e.id],delete r.itemHandler.itemChanges[e.id],void 0===r.itemHandler.deletedItems[e.itemType]&&(r.itemHandler.deletedItems[e.itemType]=[]),r.itemHandler.deletedItems[e.itemType].push(e),s.setItemDeleted(e),o.setItemDeleted(e),r.clearItemError(e.id),a.push(function(t){t.setItemUpdated(e,n.changes)})},l=0,h=t.deleted[c];l<h.length;l++){u(h[l])}return r.core.collectionMatcherFactory.constructCachedQueryProcessor(r,function(e){return r.cachedQueryHandler.getCachedQueryObjectsByItemType(e)}).processDelta(o).__removeFromAndAddToCachedQueries(!1,o).then(function(){return r.core.collectionMatcherFactory.constructCachedCollectionProcessor(r,function(e){return r.collectionHandler.collectionResources[e]}).processDelta(o).__removeFromAndAddToCollections(!1,o)}).then(function(){for(var e=0,t=r.children;e<t.length;e++){t[e].applyChangesFromParent(s)}return r.hasChanges=!1,r.detectChanges(),void 0!==r.validator&&r.validator.validateTransaction(),i})})},t.prototype.getServerCache=function(){return this.parent.getServerCache()},t.prototype.getParent=function(e,t,r){var n;if(void 0===t&&(t=!1),void 0!==r)n=r;else{var i=this.itemHandler.itemChanges[e.id];void 0!==i&&(n=i[t?"initial":"changes"])}if(void 0!==n){var o=this.getParentFromFields(e,n);if(null!==o)return o}return this.parent.getParent(e,t)},t.prototype.getCollectionChangesRecursively=function(e,t){var r,n=null===(r=this.cachedQueryHandler.cachedQueries[e])||void 0===r?void 0:r[t.string];if(void 0===n){if(void 0===(n=this.parent.getCollectionChangesRecursively(e,t)))return;this.cachedQueryHandler.setCachedQuery(e,t,n.items.slice(),!0===n.requestColumns||n.requestColumns.slice()).resolve()}return n},t.prototype.getItemChangesRecursively=function(e,t){void 0===t&&(t=!0);var r=this.itemHandler.itemChanges[e],n=this.getLocalItemEntry(e);return void 0!==r&&void 0!==n?t?this.dependencies.apiFormatter.copyFields(r.changes,{},n.columns.main):r.changes:this.parent.getItemChangesRecursively(e,t)},t.prototype.clearCollectionResource=function(e){return this.collectionHandler.clearResource(e)},t.prototype.isLockable=function(){return void 0!==this.rootItem&&this.rootItem.isLockable()},t.prototype.disableChangesWatcher=function(){null!==this.changesInterval&&(clearInterval(this.changesInterval),this.changesInterval=null)},t.prototype.enableChangesWatcher=function(){var e=this;null!==this.changesInterval&&(console.warn("Changes watcher already running!",this),this.disableChangesWatcher()),this.changesInterval=window.setInterval(function(){e.detectChanges()&&(e.disableChangesWatcher(),e.isLockable()&&e.dependencies.lockService.fetchLock(e.rootItem))},3e3)},t.prototype.save=function(e,t,r,n){var o,s=this;return void 0===e&&(e=!1),void 0===t&&(t={}),this.isSaving?this.dependencies.errorHandler.reject():(this.isSaving=!0,this.detectChanges(),this.disableChangesWatcher(),(this.isLockable()?this.dependencies.lockService.fetchLock(this.rootItem):this.dependencies.promiseService.when()).then(function(){return s.eventHandler.executeCallbacks("onBeforeSave",function(e){return e(s)},e)},this.dependencies.errorHandler.reject).then(function(){return s.tabRequestParameters=Object(i.a)(Object(i.a)({},s.tabRequestParameters),t),s.parent.applyChangesFromChild(s,r,n)}).then(function(t){return o=t,s.tabRequestParameters={},s.isLockable()&&s.dependencies.lockService.clearLock(s.rootItem),s.hasChanges=!1,s.eventHandler.executeCallbacks("onSaveSuccess",function(e){return e(s,o)},e)},this.dependencies.errorHandler.reject).then(function(){return e||s.enableChangesWatcher(),s.isSaving=!1,o},this.dependencies.errorHandler.reject).catch(function(e){return s.isSaving=!1,s.dependencies.errorHandler.reject(e)}))},t.prototype.detectChanges=function(){return!!this.hasChanges||(this.itemHandler.detectChanges()?this.hasChanges=!0:this.hasChanges=!1)},t.prototype.clearItem=function(e){this.clearItemEntry(e.entry)},t.prototype.clearItemEntry=function(e){return this.itemHandler.clearItemEntry(e)},t.prototype.onBeforeSave=function(e,t,r,n){return this.eventHandler.registerCallback("onBeforeSave",e,t,r,n)},t.prototype.onSaveSuccess=function(e,t,r,n){return this.eventHandler.registerCallback("onSaveSuccess",e,t,r,n)},t.prototype.getModuleChanges=function(){if(void 0===this.rootItem)throw new Error("No root item for transaction cache "+this);return this.dependencies.moduleChangesCompilationFactory.construct(this).process()},t.prototype.updateItemIdMap=function(e,t){if(void 0!==t)for(var r in t){var n=t[r];void 0!==e[r]&&(e[n]=e[r],delete e[r])}},t.prototype.getAllLinkCollections=function(e,t,r){var n,i=this;return this.dependencies.apiRequestService.query(e,{},(n={},n[e]=["id"],n)).then(function(n){return i.getLinkCollections(e,n.links[e],t,r)},this.dependencies.errorHandler.reject)},t.prototype.getLinkCollectionsFromDef=function(e,t,r){var n=this;return this.cachedQueryHandler.__fetchLinkedCachedQueryItems(e,t,r.itemType,r.options).then(function(t){var i={};for(var o in t){var s=t[o],a=n.core.collectionEntryService.cloneOptions(r.options,{itemType:e,itemId:Number(o)});a.columns=s.requestColumns,i[o]=n.createCollectionResource(r.itemType,a,s.items)}return i},this.dependencies.errorHandler.reject)},t.prototype.getLinkCollections=function(e,t,r,n){var i=this,o=new c.a(n);return this.cachedQueryHandler.__fetchLinkedCachedQueryItems(e,t,r,o).then(function(t){var n={};for(var s in t){var a=t[s],c=i.core.collectionEntryService.cloneOptions(o,{itemType:e,itemId:Number(s)});c.columns=a.requestColumns,n[s]=i.createCollectionResource(r,c,a.items)}return n},this.dependencies.errorHandler.reject)},t.prototype.getCollectionFromDef=function(e){var t=this;return this.cachedQueryHandler.__fetchCachedQueryItem(e.itemType,e.options).then(function(r){return t.createCollectionResource(e.itemType,e.options,r.items)},this.dependencies.errorHandler.reject)},t.prototype.getCollection=function(e,t){var r=this;return this.cachedQueryHandler.__fetchCachedQueryItem(e,new c.a(t)).then(function(n){return r.createCollectionResource(e,t,n.items)},this.dependencies.errorHandler.reject)},t.prototype.getCollectionDef=function(e,t){return{itemType:e,options:new c.a(t)}},t.prototype.getLinkCollectionsDef=function(e,t,r){return{itemType:e,linkField:t,options:new c.a(r)}},t.prototype.getItemByState=function(e,t,r,n){void 0===r&&(r={});var i=this.dependencies.keyService.parseStateKey(t);if(null===i){var o=t;if(!this.dependencies.keyService.isLocalId(o)||void 0!==this.getLocalItemEntryByItemId(e,o))return this.getItemById(e,o,r,n)}else if(i.type===u.StateKeyType.Duplicate)return this.getDuplicateById(e,i.itemId,r,!1,n);return this.getNewResource(e,r,!1,n)},t.prototype.getDuplicateById=function(e,t,r,n,i){return void 0===r&&(r={}),void 0===r.templateOptions&&(r.templateOptions={}),void 0===r.templateOptions.item&&(r.templateOptions.item=t),this.getNewResourceWithId(e,this.dependencies.keyService.getLocalDuplicateId(),r,n,i)},t.prototype.getNewResourceWithId=function(e,t,r,n,i){var o=this;return void 0===n&&(n=!1),this.itemHandler.fetchNewItemEntry(e,t,new a.e(r)).then(function(r){for(var s,a={},c=0,u=r.created;c<u.length;c++){var l=u[c];l.itemType!==e||l.itemId!==t?(void 0===a[l.itemType]&&(a[l.itemType]=[]),a[l.itemType].push(l)):s=l}if(void 0===s)throw new Error("The ItemEntry with the requested ItemId was not in the template response");var h=o.createItemResource(s,i,!0);return n?{main:h,linked:o.processLinkedItems(a)}:h},this.dependencies.errorHandler.reject)},t.prototype.getNewResource=function(e,t,r,n){return void 0===t&&(t={}),this.getNewResourceWithId(e,this.dependencies.keyService.getLocalId(),t,r,n)},t.prototype.getItemsByQuery=function(e,t,r){var n=this;return void 0===r&&(r={}),this.cachedQueryHandler.__fetchCachedQueryItem(e,new c.a({query:t,parent:r.parent,columns:r.columns})).then(function(e){return n.createItemResources(e.items)},this.dependencies.errorHandler.reject)},t.prototype.getItemsById=function(e,t,r){var n=this;return void 0===r&&(r={}),this.itemHandler.fetchItemEntries(e,t,new a.e(r)).then(function(e){return n.createItemResources(e)},this.dependencies.errorHandler.reject)},t.prototype.getItemById=function(e,t,r,n){var i=this;return void 0===r&&(r={}),this.itemHandler.fetchItemEntry(e,t,new a.e(r)).then(function(e){return i.createItemResource(e,n)},this.dependencies.errorHandler.reject)},t.prototype.fetchTitle=function(e,t){return this.itemHandler.fetchTitle(e,t)},t.prototype.applyChangesFromChild=function(e,t,r){var n=this,i=e.getDelta();for(var o in i.moved){var s=i.moved[o];i.setItemUpdated(s.entry,{},null,s.to),delete i.moved[o]}for(var o in i.updated){s=i.updated[o];void 0===this.itemHandler.itemChanges[o]?this.itemHandler.itemChanges[o]=this.itemHandler.copyTransactionItemEntryChanges(e.itemHandler.itemChanges[o],s.entry):this.itemHandler.processItemEntryChanges(s,!0)}for(var o in i.created){s=i.created[o];this.itemHandler.entries.add(s.entry),e.itemHandler.entries.clear(s.entry);var a=this.itemHandler.itemChanges[s.entry.id]=this.itemHandler.copyTransactionItemEntryChanges(e.itemHandler.itemChanges[o],s.entry),c=this.dependencies.itemEntryService.getDisplayName(s.entry,a.changes);void 0!==c&&(a.changes.displayname=c)}for(var u in i.deleted){void 0===this.itemHandler.deletedItems[u]&&(this.itemHandler.deletedItems[u]=[]);for(var l=0,h=i.deleted[u];l<h.length;l++){var d=h[l];d.isLocal()||(this.itemHandler.entries.clear(d),this.itemHandler.deletedItems[u].push(d),this.clearItemError(d.id))}}return this.hasChanges=!0,this.expandItemsFromDelta(i).then(function(){return n.core.collectionMatcherFactory.constructCachedQueryProcessor(n,function(e){return n.cachedQueryHandler.getCachedQueryObjectsByItemType(e)}).processDelta(i).__removeFromAndAddToCachedQueries(!1,i)}).then(function(){return n.core.collectionMatcherFactory.constructCachedCollectionProcessor(n,function(e){return n.collectionHandler.collectionResources[e]}).processDelta(i).__removeFromAndAddToCollections(!1,i)}).then(function(){for(var t=0,r=n.children;t<r.length;t++){var o=r[t];o!==e&&o.applyChangesFromParent(i)}return void 0!==n.validator&&n.validator.validateTransaction(),i.itemIdConversionMap})},t.prototype.getLocalItemEntryChangesTuple=function(e){var t=this.getLocalItemEntry(e);if(void 0===t)throw new Error("Tried to get a local ItemEntry with entryId '"+e+"' but couldn't find it");return{entry:t,changes:this.itemHandler.itemChanges[e]}},t.prototype.getLocalItemEntry=function(e){var t=this.itemHandler.entries.getByEntryId(e);return void 0!==t?t:this.parent.getLocalItemEntry(e)},t.prototype.getLocalItemEntryByItemId=function(e,t){var r=this.itemHandler.entries.get(e,t);return void 0!==r?r:this.parent.getLocalItemEntryByItemId(e,t)},t.prototype.getDelta=function(){var e=this.dependencies.changesDeltaFactory.constructInternalDelta();for(var t in this.itemHandler.itemChanges){var r=this.getLocalItemEntryChangesTuple(Number(t));if(this.itemHandler.entries.contains(r.entry.itemType,r.entry.itemId)&&r.entry.isLocal())r.entry.itemId=r.changes.changes.id,e.setItemCreated(r.entry,r.changes.changes);else{var n=this.getParent(r.entry);if(null!==n){var i=this.getParent(r.entry,!0);this.dependencies.itemEntryService.matchParent(i,n)||e.setItemMoved(r.entry,n)}this.dependencies.apiFormatter.hasChanges(r.changes.initial,r.changes.changes,r.entry.columns.main)&&e.setItemUpdated(r.entry,r.changes.changes)}}for(var o in this.itemHandler.deletedItems)e.setItemsDeleted(this.itemHandler.deletedItems[o]);return e},t.prototype.createItemResource=function(e,t,r){return void 0===t&&(t=!1),t&&(this.rootItem=e),void 0===this.itemHandler.itemChanges[e.id]&&(this.itemHandler.itemChanges[e.id]={initial:this.getItemChangesRecursively(e.id),changes:this.getItemChangesRecursively(e.id)}),this.dependencies.itemResourceFactory.construct(e,this,r)},t.prototype.createItemResources=function(e){for(var t=[],r=0,n=e;r<n.length;r++){var i=n[r];void 0===this.itemHandler.itemChanges[i.id]&&(this.itemHandler.itemChanges[i.id]={initial:this.getItemChangesRecursively(i.id,!0),changes:this.getItemChangesRecursively(i.id,!0)});var o=this.dependencies.itemResourceFactory.construct(i,this);t.push(o)}return t},t.prototype.processLinkedItems=function(e){var t={};for(var r in e)t[r]=this.createItemResources(e[r]);return t},t.prototype.createCollectionResource=function(e,t,r){var n=this.dependencies.collectionResourceFactory.construct(e,t,this,r);return this.collectionHandler.addResource(n),n},t.prototype.getChangesFromItemChanges=function(e){return e.changes},t.prototype.expandItemsFromDelta=function(e){var t={},r={},n=function(e){void 0===t[e.itemType]&&(t[e.itemType]=[]),t[e.itemType].push(e)};for(var i in e.created)n(e.created[i].entry);for(var i in e.updated)n(e.updated[i].entry);for(var o in t){var s=this.cachedQueryHandler.cachedQueries[o];if(void 0!==s){var a=this.dependencies.requestColumnExpansionFactory.construct();for(var c in s){var u=s[c];a.expandWithRequestColumns(u.itemType,u.requestColumns)}r[o]=a.get()[o]}}var l=[];for(var o in r)l.push(this.itemHandler.expandLocalItemEntries(e,o,t[o],r[o],this.dependencies.columnCache.retrieve(o,r[o]).cached));return this.dependencies.promiseService.all(l)},t.prototype.clearGlobalError=function(e){var t=this,r=function(e){t.eventHandler.executeCallbacks("onClearGlobalError",function(t){return t(e)},!1)};if(void 0===e){for(var n in this.errors.global)r(n);this.errors.global={}}else r(e),delete this.errors.global[e];this._setIsValid()},t.prototype.clearItemError=function(e,t,r){var n,i,o=this,s=function(e,t,r){var n,i;o.eventHandler.executeCallbacks("onClearItemError",function(n){return n(e,t,r)},!1),void 0!==(null===(i=null===(n=o.errors.item[e])||void 0===n?void 0:n[t])||void 0===i?void 0:i[r])&&delete o.errors.item[e][t][r]};if(void 0===e){for(var a in this.errors.item){var c=this.errors.item[a];for(var u in c){var h=c[u];for(var d in h)s(Number(a),u,d)}}return this.errors.item={},void this._setIsValid()}if(void 0===t){c=this.errors.item[e];for(var u in c){h=c[u];for(var d in h)s(Number(e),u,d)}return delete this.errors.item[e],void this._setIsValid()}if(void 0!==this.errors.item[e]){if(void 0===r){h=this.errors.item[e][t];for(var d in h)s(Number(e),t,d);return delete this.errors.item[e][t],Object(l.j)(this.errors.item[e])||this.clearItemError(e),void this._setIsValid()}s(e,t,r),void 0!==(null===(i=null===(n=this.errors.item[e])||void 0===n?void 0:n[t])||void 0===i?void 0:i[r])&&delete this.errors.item[e][t][r],Object(l.j)(this.errors.item[e][t])||this.clearItemError(e,t),this._setIsValid()}else this._setIsValid()},t}(h.a)},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(9),i=r(18),o=function(){function e(e,t){this.dependencies=e,this.core=t,this.children=[]}return e.prototype.onChildDestroy=function(e){var t=this.children.indexOf(e);-1!==t&&this.children.splice(t,1)},e.prototype.getTransactionChain=function(){var e=[],t=this;do{e.push(t),t=t.parent}while(null!==t);return e},e.prototype.getCurrentItemEntryCache=function(){return this.itemHandler.entries},e.prototype.getParentFromFields=function(e,t){if(void 0===t)return null;if(null!==e.columns.link)return{itemType:e.columns.link.apiColumn.itemType,itemId:t[e.columns.link.id]};var r=e.columns.response[e.itemType];return void 0!==r.itemtype&&void 0!==r.item?{itemType:t.itemtype,itemId:t.item}:null},e.prototype._applyChangesDelta=function(e){var t=this,r=this.dependencies.changesDeltaFactory.constructInternalDelta(),o=this.dependencies.changesDeltaFactory.constructInternalDelta();for(var s in e._queryResults)for(var a in e._queryResults[s])r._setQueryResult(s,a,e._queryResults[s][a]),o._setQueryResult(s,a,e._queryResults[s][a]);var c=[],u=[];e.created.forEach(function(n){var i=t.getLocalItemEntryByItemId(n.columns.itemType,n.itemId);if(void 0!==i)return e.setItemUpdated(i,n.fields,t.core.columnExpansionFactory.construct(n.columns.itemType,!!n.columns.requestColumnsTrue||n.columns.request,n.columns.response).run(i.columns)),void e.created.remove(i.itemType,i.itemId);var s=t.itemHandler.createItemEntry(n),a=t.getChangesFromItemChanges(t.itemHandler.itemChanges[s.id]);c.push(s),r.setItemCreated(s,a),o.setItemCreated(s,a),u.push(function(e){return e.setItemDeleted(s)})});var l=function(t){var s=e.updated[t],a=h.itemHandler.processItemEntryChanges(s,!0,!1,!1,!0),c=a.previous,l=a.status;if(r.setItemUpdated(s.entry,s.changes.fields,s.changes.expandedColumns),l!==n.a.NO_CHANGES&&o.setItemUpdated(s.entry,s.changes.fields,s.changes.expandedColumns),l===n.a.CACHED&&u.push(function(e){return e.setItemUpdated(s.entry,c)}),null!==s.changes.parent&&(r.setItemMoved(s.entry,s.changes.parent),o.setItemMoved(s.entry,s.changes.parent)),h.itemHandler instanceof i.a){var d=h.itemHandler.deletedItems[s.entry.itemType];if(void 0===d)return"continue";var p=d.indexOf(s.entry);p>-1&&d.splice(p,1)}},h=this;for(var d in e.updated)l(d);return{result:{created:c,rollback:function(){for(var e=t.dependencies.changesDeltaFactory.construct(),r=0,n=u;r<n.length;r++){(0,n[r])(e)}return t.applyChangesDelta(e)}},matchingDelta:o,internalChangesDelta:r,rollbackFunctions:u}},e.prototype.fetchUpdatedDerivedValuesFromDelta=function(e){var t=[];for(var r in e.updated){var n=e.updated[r],i=[],o=this.itemHandler.itemChanges[n.entry.id];if(void 0!==o){for(var s=this.getChangesFromItemChanges(o),a=0,c=n.entry.columns.root;a<c.length;a++){var u=c[a];!n.changes.fields.hasOwnProperty(u.id)||n.changes.fields[u.id]===s[u.id]||void 0!==e.itemIdConversionMap[u.itemType]&&e.itemIdConversionMap[u.itemType][s[u.id]]===n.changes.fields[u.id]||i.push(u)}0!==i.length&&t.push(this.itemHandler.resolveDerivedValues([n.entry],i,e))}}return this.dependencies.promiseService.all(t)},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(1),i=function(){function e(e){this.itemEntryService=e,this.updated={},this.deleted={},this.itemIdConversionMap={},this._queryResults={}}return e.prototype._setQueryResult=function(e,t,r){void 0===this._queryResults[e]&&(this._queryResults[e]={}),this._queryResults[e][t]=r},e.prototype.setItemUpdated=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=null),void 0===this.updated[e.id]&&(this.updated[e.id]={entry:e,changes:{fields:{},expandedColumns:null,parent:n}});var i=this.updated[e.id];if(null!==n){var o=this.itemEntryService.getLinkFieldsByParent(n,e.itemType);for(var s in o)t[s]=o[s]}for(var a in t){var c=Object.getOwnPropertyDescriptor(t,a);void 0!==c?Object.defineProperty(i.changes.fields,a,c):i.changes.fields[a]=t[a]}return null!==r&&(i.changes.expandedColumns=r),t.hasOwnProperty("id")&&(void 0===this.itemIdConversionMap[e.itemType]&&(this.itemIdConversionMap[e.itemType]={}),this.itemIdConversionMap[e.itemType][e.itemId]=t.id),this},e.prototype.setItemDeleted=function(e){return this.setItemsDeleted([e])},e.prototype.setItemsDeleted=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];void 0===this.deleted[n.itemType]&&(this.deleted[n.itemType]=[]),this.deleted[n.itemType].indexOf(n)>-1||this.deleted[n.itemType].push(n)}return this},e.prototype.isEmpty=function(){return!Object(n.j)(this.updated)&&!Object(n.j)(this.deleted)},e}()},function(e,t,r){"use strict";r.r(t);var n=r(10);r.d(t,"RmCore",function(){return n.a}),r.d(t,"noop",function(){return n.c}),r.d(t,"identity",function(){return n.b});var i=r(4);r.d(t,"ALL_PERMISSIONS",function(){return i.a}),r.d(t,"COLUMN_SEPERATOR",function(){return i.b}),r.d(t,"RENDER_AS_SEPERATOR",function(){return i.g}),r.d(t,"NEW_PREFIX",function(){return i.f}),r.d(t,"DUPLICATE_PREFIX",function(){return i.d}),r.d(t,"NEW_KEYWORD",function(){return i.e}),r.d(t,"DUPLICATE_KEYWORD",function(){return i.c});var o=r(5);r.d(t,"ItemEntryOptions",function(){return o.e}),r.d(t,"ItemEntry",function(){return o.d}),r.d(t,"ItemResource",function(){return o.f}),r.d(t,"CollectionOptions",function(){return o.b}),r.d(t,"CollectionEntry",function(){return o.a}),r.d(t,"CollectionResource",function(){return o.c}),r.d(t,"Template",function(){return o.g});var s=r(32);for(var a in s)["RmCore","noop","identity","ALL_PERMISSIONS","COLUMN_SEPERATOR","RENDER_AS_SEPERATOR","NEW_PREFIX","DUPLICATE_PREFIX","NEW_KEYWORD","DUPLICATE_KEYWORD","ItemEntryOptions","ItemEntry","ItemResource","CollectionOptions","CollectionEntry","CollectionResource","Template","default"].indexOf(a)<0&&function(e){r.d(t,e,function(){return s[e]})}(a);var c=r(0);r.d(t,"ApiFormatter",function(){return c.b}),r.d(t,"ApiRequestService",function(){return c.c}),r.d(t,"ApiResponseProcessor",function(){return c.d}),r.d(t,"ChangesCompilation",function(){return c.f}),r.d(t,"ChangesProcessor",function(){return c.i}),r.d(t,"CollectionEntryService",function(){return c.j}),r.d(t,"CollectionMatcherCachedCollectionProcessor",function(){return c.k}),r.d(t,"CollectionResourceService",function(){return c.l}),r.d(t,"ColumnCache",function(){return c.m}),r.d(t,"ColumnExpansion",function(){return c.n}),r.d(t,"ColumnHandler",function(){return c.o}),r.d(t,"ColumnInfo",function(){return c.p}),r.d(t,"ColumnSet",function(){return c.q}),r.d(t,"ColumnSubsetCache",function(){return c.r}),r.d(t,"ColumnUtil",function(){return c.s}),r.d(t,"ConversionMapService",function(){return c.t}),r.d(t,"CreateRequest",function(){return c.u}),r.d(t,"ItemCache",function(){return c.x}),r.d(t,"ItemEntryService",function(){return c.z}),r.d(t,"KeyService",function(){return c.A}),r.d(t,"TransactionEventHandler",function(){return c.R}),r.d(t,"LockService",function(){return c.B}),r.d(t,"ModuleChangesCompilation",function(){return c.C}),r.d(t,"QueryMatcher",function(){return c.D}),r.d(t,"CONSTANTS",function(){return c.e}),r.d(t,"QueryParser",function(){return c.E}),r.d(t,"QueryService",function(){return c.F}),r.d(t,"RequestColumnExpansion",function(){return c.I}),r.d(t,"SocketMessageHandler",function(){return c.M}),r.d(t,"findIndex",function(){return c.ab}),r.d(t,"instantiateOptions",function(){return c.fb}),r.d(t,"shallowMerge",function(){return c.vb}),r.d(t,"hasProperties",function(){return c.db}),r.d(t,"getFirstProperty",function(){return c.bb}),r.d(t,"inArray",function(){return c.eb}),r.d(t,"filterArray",function(){return c.Z}),r.d(t,"emptyArray",function(){return c.W}),r.d(t,"pathExists",function(){return c.ub}),r.d(t,"createPath",function(){return c.V}),r.d(t,"getPath",function(){return c.cb}),r.d(t,"extend",function(){return c.Y}),r.d(t,"merge",function(){return c.tb}),r.d(t,"isObject",function(){return c.ob}),r.d(t,"isBlankObject",function(){return c.hb}),r.d(t,"isString",function(){return c.rb}),r.d(t,"isNumber",function(){return c.nb}),r.d(t,"isDate",function(){return c.jb}),r.d(t,"isArray",function(){return c.gb}),r.d(t,"isFunction",function(){return c.mb}),r.d(t,"isPromiseLike",function(){return c.pb}),r.d(t,"isRegExp",function(){return c.qb}),r.d(t,"isBoolean",function(){return c.ib}),r.d(t,"isElement",function(){return c.lb}),r.d(t,"isWindow",function(){return c.sb}),r.d(t,"isDefined",function(){return c.kb}),r.d(t,"equals",function(){return c.X}),r.d(t,"copy",function(){return c.U}),r.d(t,"AbstractCache",function(){return c.a}),r.d(t,"ServerCache",function(){return c.J}),r.d(t,"ServerItemHandler",function(){return c.L}),r.d(t,"ServerCachedQueryHandler",function(){return c.K}),r.d(t,"TransactionErrorLevel",function(){return c.Q}),r.d(t,"TransactionCache",function(){return c.N}),r.d(t,"TransactionItemHandler",function(){return c.S}),r.d(t,"TransactionCachedQueryHandler",function(){return c.O}),r.d(t,"TransactionCollectionHandler",function(){return c.P}),r.d(t,"TransactionValidator",function(){return c.T}),r.d(t,"ChangesDeltaBase",function(){return c.h}),r.d(t,"ChangesDelta",function(){return c.g}),r.d(t,"InternalChangesDelta",function(){return c.w}),r.d(t,"RequestBufferManager",function(){return c.H}),r.d(t,"RequestBuffer",function(){return c.G}),r.d(t,"ItemCreateService",function(){return c.y}),r.d(t,"CreatedChangesDelta",function(){return c.v});var u=r(7);r.d(t,"ApiResponseProcessorFactory",function(){return u.a}),r.d(t,"ChangesCompilationFactory",function(){return u.b}),r.d(t,"CollectionEntryFactory",function(){return u.e}),r.d(t,"CollectionMatcherFactory",function(){return u.f}),r.d(t,"CollectionResourceFactory",function(){return u.g}),r.d(t,"ColumnExpansionFactory",function(){return u.h}),r.d(t,"ColumnInfoFactory",function(){return u.i}),r.d(t,"ColumnSetFactory",function(){return u.j}),r.d(t,"ColumnSubsetCacheFactory",function(){return u.k}),r.d(t,"CreateRequestFactory",function(){return u.l}),r.d(t,"ItemCacheFactory",function(){return u.m}),r.d(t,"ItemEntryFactory",function(){return u.n}),r.d(t,"ItemResourceFactory",function(){return u.o}),r.d(t,"TransactionCacheFactory",function(){return u.u}),r.d(t,"ModuleChangesCompilationFactory",function(){return u.p}),r.d(t,"QueryMatcherFactory",function(){return u.q}),r.d(t,"QueryParserFactory",function(){return u.r}),r.d(t,"RequestColumnExpansionFactory",function(){return u.s}),r.d(t,"TemplateFactory",function(){return u.t}),r.d(t,"ChangesDeltaFactory",function(){return u.c}),r.d(t,"ChangesProcessorFactory",function(){return u.d});var l=r(8);for(var a in l)["RmCore","noop","identity","ALL_PERMISSIONS","COLUMN_SEPERATOR","RENDER_AS_SEPERATOR","NEW_PREFIX","DUPLICATE_PREFIX","NEW_KEYWORD","DUPLICATE_KEYWORD","ItemEntryOptions","ItemEntry","ItemResource","CollectionOptions","CollectionEntry","CollectionResource","Template","ApiFormatter","ApiRequestService","ApiResponseProcessor","ChangesCompilation","ChangesProcessor","CollectionEntryService","CollectionMatcherCachedCollectionProcessor","CollectionResourceService","ColumnCache","ColumnExpansion","ColumnHandler","ColumnInfo","ColumnSet","ColumnSubsetCache","ColumnUtil","ConversionMapService","CreateRequest","ItemCache","ItemEntryService","KeyService","TransactionEventHandler","LockService","ModuleChangesCompilation","QueryMatcher","CONSTANTS","QueryParser","QueryService","RequestColumnExpansion","SocketMessageHandler","findIndex","instantiateOptions","shallowMerge","hasProperties","getFirstProperty","inArray","filterArray","emptyArray","pathExists","createPath","getPath","extend","merge","isObject","isBlankObject","isString","isNumber","isDate","isArray","isFunction","isPromiseLike","isRegExp","isBoolean","isElement","isWindow","isDefined","equals","copy","AbstractCache","ServerCache","ServerItemHandler","ServerCachedQueryHandler","TransactionErrorLevel","TransactionCache","TransactionItemHandler","TransactionCachedQueryHandler","TransactionCollectionHandler","TransactionValidator","ChangesDeltaBase","ChangesDelta","InternalChangesDelta","RequestBufferManager","RequestBuffer","ItemCreateService","CreatedChangesDelta","ApiResponseProcessorFactory","ChangesCompilationFactory","CollectionEntryFactory","CollectionMatcherFactory","CollectionResourceFactory","ColumnExpansionFactory","ColumnInfoFactory","ColumnSetFactory","ColumnSubsetCacheFactory","CreateRequestFactory","ItemCacheFactory","ItemEntryFactory","ItemResourceFactory","TransactionCacheFactory","ModuleChangesCompilationFactory","QueryMatcherFactory","QueryParserFactory","RequestColumnExpansionFactory","TemplateFactory","ChangesDeltaFactory","ChangesProcessorFactory","default"].indexOf(a)<0&&function(e){r.d(t,e,function(){return l[e]})}(a)},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(3),i=r(13),o=function(e){function t(t,r,n,i,o,s){var a=e.call(this,n,i,o)||this;return a.apiRequestService=t,a.promiseService=r,a.getCollections=s,a.map={},a}return Object(n.b)(t,e),t.prototype.__removeFromAndAddToCollections=function(e,t){void 0===e&&(e=!1);var r=[],n=function(n){var s,a=o.map[n],c=o.groupItemEntries(a.matches);if(a.collectionResources.forEach(function(t){return t.removeItemResources(c.notFitting,e)}),a.collectionResources.forEach(function(t){return t.addItemResources(c.fitting,!1,e)}),c.maybe.length>0){if(o.transaction instanceof i.a)for(var u=0,l=c.maybe;u<l.length;u++){var h=l[u];o.transaction.itemHandler.detectEntryChanges(h.id)&&console.error("!! Trying to re-query 'maybe' matching results but one of the entries has changes, please report this to Martijn !!")}r.push(o.apiRequestService.query(a.itemType,a.query.object,(s={},s[a.itemType]=["id"],s)).then(function(e){void 0!==t&&t._setQueryResult(a.itemType,a.query.string,e.links[a.itemType]),a.collectionResources.forEach(function(t){return t.addItemResources(c.maybe.filter(function(t){return e.links[a.itemType].indexOf(t.itemId)>-1}))})}).then(function(){},function(){}))}},o=this;for(var s in this.map)n(s);return this.promiseService.all(r)},t.prototype._expand=function(e,t){var r=this.getCollections(e.itemType);for(var n in r){var i=r[n];if(0!==i.length){var o=i[0],s=o.entry.query,a=o.entry.itemType+"-"+n;void 0===this.map[a]&&(this.map[a]={itemType:e.itemType,query:o.entry.query,collectionResources:r[n],matches:{}});var c=this.map[a].matches;void 0===c[e.itemId]&&(c[e.itemId]={item:e,isMatch:t(e.itemType,s)})}}return this},t}(r(28).a)},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r(3),i=r(5),o=r(0),s=r(9),a=function(e){function t(t,r,n){var i=e.call(this,t.columnUtil,t.apiFormatter,t.itemEntryFactory,t.promiseService,t.errorHandler,t.requestColumnExpansionFactory,t.itemCacheFactory,r)||this;return i.dependencies=t,i.transaction=r,i.validator=n,i.deletedItems={},i.itemChanges={},i.fieldChangeCallbacks={},i}return Object(n.b)(t,e),t.prototype.registerFieldChangeCallback=function(e,t,r){Object(o.V)(this.fieldChangeCallbacks,[e,t],[{},[]]);var n=this.fieldChangeCallbacks[e][t];return n.push(r),function(){var e=n.indexOf(r);-1!==e&&n.splice(e,1)}},t.prototype.copyTransactionItemEntryChanges=function(e,t){return{initial:this.apiFormatter.copyFields(e.initial,{},t.columns.main),changes:this.apiFormatter.copyFields(e.changes,{},t.columns.main)}},t.prototype.createItemEntry=function(t){var r=e.prototype.createItemEntry.call(this,t),n=this.dependencies.itemEntryService.getLocalDefaultValues();for(var i in n)t.fields[i]=n[i];var o=this.apiFormatter.copyFields(t.fields,{},t.columns.main);return this.itemChanges[r.id]={initial:t.fields,changes:o},this.itemChanges[r.id].initial.id=r.itemId,this.itemChanges[r.id].changes.id=r.itemId,void 0!==this.validator&&this.validator.validateItem(r,t.fields,t.fields),r},t.prototype.formatRequest=function(e){var t=e.columns.main;return e.isLocal()?this.apiFormatter.formatRequestLocal(this.itemChanges[e.id].changes,t):this.apiFormatter.formatRequest(this.itemChanges[e.id].initial,this.itemChanges[e.id].changes,t)},t.prototype.detectChanges=function(){for(var e in this.entries.entriesByEntryId)return!0;for(var t in this.deletedItems)if(this.deletedItems[t].length>0)return!0;for(var r in this.itemChanges){if(this.detectEntryChanges(Number(r)))return!0}return!1},t.prototype.detectEntryChanges=function(e){var t=this.transaction.getLocalItemEntry(e),r=this.itemChanges[e];return void 0!==r&&this.apiFormatter.hasChanges(r.initial,r.changes,t.columns.main)},t.prototype.processItemEntryChanges=function(e,t,r,n,i){var o,a=this;void 0===t&&(t=!1),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1);var c=e.entry,u=e.changes;if(void 0===this.itemChanges[c.id]){if(!i)return{status:s.a.NOT_CACHED,previous:null};this.itemChanges[c.id]={initial:this.transaction.getItemChangesRecursively(c.id),changes:this.transaction.getItemChangesRecursively(c.id)}}if(null!==u.expandedColumns&&(c.columns=u.expandedColumns.merged),void 0!==u.fields.id){var l=c.itemId;c.itemId=u.fields.id,this.entries.updateItemId(c,l)}var h=this.itemChanges[c.id];if(!this.apiFormatter.hasChanges(u.fields,h.changes,c.columns.main,!0))return r&&this.apiFormatter.copyFields(u.fields,h.initial,c.columns.main),{status:s.a.NO_CHANGES,previous:null};var d=this.apiFormatter.copyFields(h.changes,{},c.columns.main);if(t?this.apiFormatter.copyFields(u.fields,h.changes,c.columns.main):this.apiFormatter.mergeCopyFields(h.initial,h.changes,u.fields,c.columns.main),r&&this.apiFormatter.copyFields(u.fields,h.initial,c.columns.main),void 0===u.fields.displayname){var p=this.dependencies.itemEntryService.getDisplayName(c,h.changes);void 0!==p&&(h.changes.displayname=p)}void 0!==this.validator&&this.validator.validateItem(c,h.changes,d);var m=null===(o=this.fieldChangeCallbacks[c.itemType])||void 0===o?void 0:o[c.itemId];if(void 0!==m)for(var f=0,y=m;f<y.length;f++){var v=y[f];try{v({itemEntry:c,compareField:function(e){return a.apiFormatter.compareFields(c.columns.response[c.itemType][e].type,h.changes[e],d[e])},fields:h.changes,isCalledAfterSocketUpdate:n,previous:d})}catch(e){this.dependencies.exceptionHandler(e)}}return{status:s.a.CACHED,previous:d}},t.prototype.cloneItemEntries=function(e,t,r,n){void 0===r&&(r={}),this.dependencies.conversionMapService.batchExpandConversionMap(t,r);for(var i=0,o=t;i<o.length;i++){var s=o[i];this.cloneItemEntry(e,s,r,n)}return[]},t.prototype.cloneItemEntry=function(e,t,r,n){void 0===r&&(r={});var i=this.transaction.getItemChangesRecursively(t.id),o=this.dependencies.conversionMapService.expandConversionMap(t,r),s=this.apiFormatter.copyFields(i,{},t.columns.main);return this.dependencies.conversionMapService.updateItemValues(s,s,t.columns.item,r),void 0!==n&&n(t.itemType,s),e._setItemCreated(o,s,t.columns),o},t.prototype.fetchItemEntriesByQuery=function(e,t,r){return this.transaction.getServerCache().itemHandler.fetchItemEntriesByQuery(e,t,r)},t.prototype.fetchItemEntry=function(e,t,r){var n=this;if(!this.dependencies.keyService.isLocalId(t))return this.transaction.getServerCache().itemHandler.fetchItemEntry(e,t,r);if(void 0===this.entries.get(e,t))return this.transaction.parent instanceof o.J?this.errorHandler.reject(this.dependencies.itemEntryService.createUnfoundLocalItemError(e)):this.transaction.parent.itemHandler.fetchItemEntry(e,t,r);r.columns=this.expandColumnsWithCachedQueryColumns(e,r.columns);var i=this.dependencies.changesDeltaFactory.construct(),s=this.dependencies.columnSubsetCacheFactory.construct(r.columns);return this.fetchLocalItemEntryData(i,e,t,s,r).then(function(e){return n.transaction.applyChangesDelta(i).then(function(){return e},n.errorHandler.reject)},this.errorHandler.reject)},t.prototype.fetchNewItemEntry=function(e,t,r){var n,i,o=this;return void 0!==this.entries.get(e,t)?this.errorHandler.reject(this.dependencies.itemEntryService.createExistingLocalItemError(e)):this.dependencies.templateCache.fetchTemplate(e,t,r.templateOptions,(n={},n[e]=r.columns,n),r.parent).then(function(n){if(void 0!==o.entries.get(e,t))return o.errorHandler.reject(o.dependencies.itemEntryService.createExistingLocalItemError(e));var i=o.dependencies.changesDeltaFactory.construct();return o.dependencies.itemCreateService.processTemplate(i,e,t,r.parent,n),o.transaction.applyChangesDelta(i)},this.errorHandler.reject).then(function(e){var t=(i=e).created.reduce(function(e,t){return e.hasOwnProperty(t.itemType)||(e[t.itemType]=[]),e[t.itemType].push(t),e},{}),r=o.transaction.createChangesDelta(),n=[];for(var s in t)n.push(o.resolveDerivedValues(t[s],t[s][0].columns.root,r));return o.promiseService.all(n)}).then(function(){return i})},t.prototype.fetchItemEntries=function(e,t,r){for(var n=[],i=[],o=0,s=t;o<s.length;o++){var a=s[o];this.dependencies.keyService.isLocalId(a)?i.push(a):n.push(a)}return this.promiseService.all({remote:this.transaction.getServerCache().itemHandler.fetchItemEntries(e,n,r),local:this.fetchLocalItemEntries(e,i,r)}).then(function(e){return e.remote.concat(e.local)})},t.prototype.fetchTitle=function(e,t){var r=this,n=this.dependencies.itemEntryService.getTitleField(e);return this.fetchItemEntry(e,t,new i.e({columns:[n]})).then(function(e){return r.transaction.getItemChangesRecursively(e.id,!1)[n]},this.errorHandler.reject)},t.prototype.resolveLocalItemEntry=function(e,t,r,n){var i=this;if(r.run(t.columns))return this.promiseService.when(t);var o=this.getColumnDifference(t,n.columns);return this.dependencies.columnHandler.fetch(t.itemType,o).then(function(r){return i.expandLocalItemEntries(e,t.itemType,[t],o,r)},this.errorHandler.reject).then(function(){return t},this.errorHandler.reject)},t.prototype.expandLocalItemEntries=function(e,t,r,n,i){if(0===r.length)return this.promiseService.when(r);for(var o=this.dependencies.columnExpansionFactory.construct(t,n,i),s=0,a=r;s<a.length;s++){var c=a[s],u=o.run(c.columns);null!==u&&this.expandLocalItemEntry(e,c,u)}return this.resolveDerivedValues(r,o.aggregateRootColumns(),e)},t.prototype.fetchLocalItemEntryData=function(e,t,r,n,i){var o=this.entries.get(t,r);return void 0===o?this.errorHandler.reject(this.dependencies.itemEntryService.createUnfoundLocalItemError(t)):this.resolveLocalItemEntry(e,o,n,i)},t.prototype.fetchLocalItemEntries=function(e,t,r){var n=this;r.columns=this.expandColumnsWithCachedQueryColumns(e,r.columns);for(var i=this.dependencies.changesDeltaFactory.construct(),s=this.dependencies.columnSubsetCacheFactory.construct(r.columns),a=[],c=[],u=0,l=t;u<l.length;u++){var h=l[u];if(void 0!==this.entries.get(e,h))a.push(this.fetchLocalItemEntryData(i,e,h,s,r));else{if(this.transaction.parent instanceof o.J)return this.errorHandler.reject(this.dependencies.itemEntryService.createUnfoundLocalItemError(e));c.push(h)}}if(c.length>0){if(this.transaction.parent instanceof o.J)throw new Error("Tried looking for local entries on the serverCache");a.push(this.transaction.parent.itemHandler.fetchLocalItemEntries(e,c,r))}return this.promiseService.all(a).then(function(){return n.transaction.applyChangesDelta(i).then(function(){return t.map(function(t){return n.transaction.getLocalItemEntryByItemId(e,t)})},n.errorHandler.reject)},this.errorHandler.reject)},t.prototype.getColumnDifference=function(e,t){return this.columnUtil.mergeRequestColumns(e.columns.request,t).difference},t.prototype.expandLocalItemEntry=function(e,t,r){var n=r.difference.main;if(t.columns=r.merged,0!==n.length){var i=this.getLocalValues(t,n);Object(o.db)(i)&&e.setItemUpdated(t,i,r)}},t.prototype.getLocalValues=function(e,t){for(var r=this.transaction.getParent(e),n=this.transaction.getChangesFromItemChanges(this.itemChanges[e.id]),i={},o=0,s=t;o<s.length;o++){var a=s[o],c=a.id;if(void 0===n[c]){var u=a.apiColumn.type;i[c]="link"===u&&null!==r?r.itemId:this.apiFormatter.getDefaultValue(u)}}return i},t}(s.b)},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(3),i=r(16),o=function(e){function t(t,r,n){var i=e.call(this,t.collectionEntryService,t.columnUtil,t.requestColumnExpansionFactory,t.promiseService,n)||this;return i.dependencies=t,i.itemHandler=r,i.transaction=n,i}return Object(n.b)(t,e),t.prototype.__fetchCachedQueryItem=function(e,t){var r=this.collectionEntryService.createQueryFromOptions(t);this.expandColumnsWithQueryColumns(e,t,r.object);var n=this.dependencies.columnSubsetCacheFactory.construct(t.columns);return this.__fetchItemEntriesByQueryData(e,t,n,r)},t.prototype.__expandCachedQuery=function(e,t){var r=this,n=this.columnUtil.mergeRequestColumns(e.requestColumns,t).difference;if(!0!==n&&0===n.length)return this.dependencies.promiseService.when(e);for(var i=e.itemType,o=[],s=[],a=[],c=0,u=e.items;c<u.length;c++){var l=u[c];l.isLocal()?s.push(l):a.push(l)}if(a.length>0&&o.push(this.transaction.getServerCache().cachedQueryHandler.__expandCachedQuery(e,t)),s.length>0){var h=this.dependencies.changesDeltaFactory.constructInternalDelta();o.push(this.dependencies.columnHandler.fetch(i,n).then(function(e){return r.itemHandler.expandLocalItemEntries(h,i,s,n,e)},this.dependencies.errorHandler.reject).then(function(){return r.transaction.applyChangesFromParent(h)},this.dependencies.errorHandler.reject))}return this.dependencies.promiseService.all(o).then(function(){return e.requestColumns=r.columnUtil.mergeRequestColumns(e.requestColumns,t).merged,e},this.dependencies.errorHandler.reject)},t.prototype.__addItemEntriesToCachedQueries=function(t,r,n){e.prototype.__addItemEntriesToCachedQueries.call(this,t,r,n,function(){return!1})},t.prototype.isLocal=function(e,t){var r=e.parent;return null===r?this.dependencies.queryService.containsLocalId(t):this.dependencies.keyService.isLocalId(r.itemId)},t.prototype.__fetchItemEntriesByQueryData=function(e,t,r,n){var o,s,a=this,c=null===(o=this.cachedQueries[e])||void 0===o?void 0:o[n.string];return void 0!==c?r.runWithRequestColumns(c.requestColumns)?c.promise:this.__expandCachedQuery(c,r.requestColumns).then(function(){return c},this.dependencies.errorHandler.reject):(this.isLocal(t,n.object)&&this.transaction.parent instanceof i.ServerCache?this.transaction.dependencies.columnHandler.fetch(e,r.requestColumns).then(function(){s=a.setCachedQuery(e,n,[],r.requestColumns)},this.dependencies.errorHandler.reject):this.transaction.parent.cachedQueryHandler.__fetchItemEntriesByQueryData(e,t,r,n).then(function(e){s=null===t.limit?a.setCachedQuery(e.itemType,e.query,e.items.slice(),e.requestColumns):e},this.dependencies.errorHandler.reject)).then(function(){for(var e=a.dependencies.collectionMatcherFactory.constructCachedQueryProcessor(a.transaction,function(e){return e===s.itemType?[s]:[]}),t=0,r=s.items;t<r.length;t++){var n=r[t];a.transaction.itemHandler.detectEntryChanges(n.id)&&e.expand(n,a.transaction.getItemChangesRecursively(n.id,!1))}for(var i=0,o=a.transaction.itemHandler.entries.getByItemType(s.itemType);i<o.length;i++){n=o[i];e.expand(n,a.transaction.getItemChangesRecursively(n.id,!1))}return e.__removeFromAndAddToCachedQueries(!1)},this.dependencies.errorHandler.reject).then(function(){return s.resolve(),s},function(e){return s.reject(e),a.dependencies.errorHandler.reject(e)})},t.prototype.__fetchLinkedCachedQueryItems=function(e,t,r,n){Object(i.isFunction)(t)&&(t=t());for(var o={},s=0,a=t;s<a.length;s++){var c=a[s],u=this.collectionEntryService.cloneOptions(n,{itemType:e,itemId:c}),l=this.collectionEntryService.createQueryFromOptions(u);this.expandColumnsWithQueryColumns(r,u,l.object);var h=this.dependencies.columnSubsetCacheFactory.construct(u.columns);o[c]=this.__fetchItemEntriesByQueryData(r,n,h,l)}return this.dependencies.promiseService.all(o)},t}(r(29).a)},function(e,t,r){"use strict";r.d(t,"a",function(){return s});var n=r(3),i=r(15),o=r(21),s=function(e){function t(t,r,n){var i=e.call(this,n)||this;return i.errorHandler=t,i.itemCreateService=r,i.created=new o.a,i}return Object(n.b)(t,e),t.prototype.setItemCreated=function(e,t){var r=this;return this.itemCreateService.createItemsFromValues(this,e,[t]).then(function(){return r},this.errorHandler.reject)},t.prototype.setItemsCreated=function(e,t){var r=this;return this.itemCreateService.createItemsFromValues(this,e,t).then(function(){return r},this.errorHandler.reject)},t.prototype._setItemCreated=function(e,t,r,n){void 0===n&&(n=null);var i={};if(null!==n)for(var o in i=this.itemEntryService.getLinkFieldsByParent(n,r.itemType))t[o]=i[o];var s=this.itemEntryService.getLocalDefaultValues();for(var o in s)t.hasOwnProperty(o)||(t[o]=s[o]);return this.created.add(e,t,r),this},t.prototype.setItemMoved=function(e,t){return this.setItemUpdated(e,{},null,t)},t.prototype.isEmpty=function(){return e.prototype.isEmpty.call(this)&&this.created.isEmpty()},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(1),i=function(){function e(){this.tuples={}}return e.prototype.remove=function(e,t){if(void 0===this.tuples[e])return!1;var r=Object(n.g)(this.tuples[e],function(e){return e.itemId==t});return-1!==r&&(this.tuples[e].splice(r,1),!0)},e.prototype.add=function(e,t,r){var n=r.itemType;void 0===this.tuples[n]&&(this.tuples[n]=[]),this.tuples[n].push({itemId:e,fields:t,columns:r})},e.prototype.isEmpty=function(){return!Object(n.j)(this.tuples)},e.prototype.forEach=function(e){for(var t in this.tuples)for(var r=this.tuples[t],n=0;n<r.length;n++)e(r[n],t,n)},e.prototype.contains=function(e){return void 0!==this.tuples[e]},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return s});var n=r(3),i=r(15),o=r(1),s=function(e){function t(t){var r=e.call(this,t)||this;return r.created={},r.moved={},r.itemIdConversionMap={},r}return Object(n.b)(t,e),t.prototype.setItemCreated=function(e,t){this.created[e.id]={entry:e,fields:t}},t.prototype.setItemMoved=function(e,t){this.moved[e.id]={entry:e,to:t}},t.prototype.isEmpty=function(){return e.prototype.isEmpty.call(this)&&!Object(o.j)(this.created)},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r,n,i,o){this.promiseLibrary=e,this.apiRequestService=t,this.requestColumnExpansionFactory=r,this.changesDeltaFactory=n,this.serverCache=i,this.itemType=o,this.deferred=this.promiseLibrary.defer(),this.requestColumnExpansion=this.requestColumnExpansionFactory.construct(),this.singleItemIds=[],this.queries={}}return e.prototype.containsId=function(e){return-1!==this.singleItemIds.indexOf(e)},e.prototype.containsQuery=function(e){return void 0!==this.queries[e]},e.prototype.addSingleItem=function(e,t){return this.requestColumnExpansion.expandWithRequestColumns(this.itemType,t),-1===this.singleItemIds.indexOf(e)&&this.singleItemIds.push(e),this.getPromise()},e.prototype.addQuery=function(e,t){return this.requestColumnExpansion.expandWithRequestColumns(this.itemType,t),void 0===this.queries[e[1]]&&(this.queries[e[1]]=e[0]),this.getPromise()},e.prototype.flush=function(){var e=this,t=[];for(var r in this.singleItemIds.length>0&&t.push({key:"id",comparator:"IN",value:this.singleItemIds}),this.queries)t.push(this.queries[r]);if(0===t.length)throw new Error("Tried to flush a RequestBuffer without singleItems or queries");var n,i=this.requestColumnExpansion.get();return this.apiRequestService.query(this.itemType,{conditions:t,operator:"OR"},i).then(function(t){n=t;var r=e.changesDeltaFactory.construct();if(0===e.singleItemIds.length&&!e.hasMultipleQueries()){var o=e.getFirstQueryString();void 0!==o&&r._setQueryResult(e.itemType,o,n.links[e.itemType])}return e.serverCache.processResponse(n,i,!1,!1,r)},function(t){return e.deferred.reject(t)}).then(function(){return e.deferred.resolve(n)},function(t){return e.deferred.reject(t)}),this.getPromise()},e.prototype.getPromise=function(){return this.deferred.promise},e.prototype.hasMultipleQueries=function(){var e=!0;for(var t in this.queries){if(!e)return!0;e=!1}return!1},e.prototype.getFirstQueryString=function(){for(var e in this.queries)return e},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r,n,i,o){this.columnSetFactory=e,this.conversionMapService=t,this.errorHandler=r,this.keyService=n,this.promiseService=i,this.templateCache=o}return e.prototype.createItemsFromValues=function(e,t,r,n){var i=this;if(void 0===n&&(n=null),0===r.length)return this.promiseService.when();for(var o=[],s=function(s){var c,u=s.hasOwnProperty("id")?s.id:a.keyService.getLocalId();o.push(a.templateCache.fetchTemplate(t,u,{},(c={},c[t]=Object.keys(r[0]),c),n).then(function(r){i.processTemplate(e,t,u,n,r,function(){return!0},function(e,r){if(e===t)for(var n in s)r[n]=s[n]})},a.errorHandler.reject))},a=this,c=0,u=r;c<u.length;c++){s(u[c])}return this.promiseService.all(o).then(function(){})},e.prototype.processTemplate=function(e,t,r,n,i,o,s){void 0===o&&(o=function(){return!0});var a=this.conversionMapService.createLocalConversionMap(t,r,!0,i.response),c=i.getFields();this.conversionMapService.updateItemValues(c,c,i.columns.item,a,n),void 0!==s&&s(t,c,a),e._setItemCreated(r,c,i.columns,n),this.processTemplateLinkItems(e,t,r,i,a,o,s)},e.prototype.processTemplateLinkItems=function(e,t,r,n,i,o,s){var a=this;void 0===o&&(o=function(){return!0});var c=n.response,u={},l=function(t,r,h){var d={itemType:t,itemId:r},p=c.items[t][h].links;for(var m in p)if(p.hasOwnProperty(m)){void 0===u[m]&&(u[m]=a.columnSetFactory.construct(m,!0,n.responseColumns));for(var f=0,y=p[m];f<y.length;f++){var v=y[f],g=c.fetchObject(m,v);if(o(m,g)){var C=i[m][v];a.conversionMapService.updateItemValues(g,g,u[m].item,i,d),void 0!==s&&s(m,g,i),e._setItemCreated(C,g,u[m],d),l(m,C,v)}}}};l(t,r,c.links[t][0])},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(20),i=r(22),o=function(){function e(e,t,r){this.errorHandler=e,this.itemEntryService=t,this.itemCreateService=r}return e.prototype.construct=function(){return new n.a(this.errorHandler,this.itemCreateService,this.itemEntryService)},e.prototype.constructInternalDelta=function(){return new i.a(this.itemEntryService)},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(0),i=function(){function e(e,t,r,n,i,o,s,a,c,u){this.changesDeltaFactory=e,this.apiRequestService=t,this.changesCompilationFactory=r,this.columnExpansionFactory=n,this.createRequestFactory=i,this.errorHandler=o,this.promiseService=s,this.requestColumnExpansionFactory=a,this.collectionEntryService=c,this.itemEntryService=u}return e.prototype.construct=function(e,t,r){return new n.i(this.changesDeltaFactory,this.apiRequestService,this.changesCompilationFactory,this.columnExpansionFactory,this.createRequestFactory,this.errorHandler,this.promiseService,this.requestColumnExpansionFactory,this.collectionEntryService,this.itemEntryService,e,t,r)},e}()},function(e,t,r){"use strict";var n=r(3),i=function(e){function t(t){return e.call(this,t)||this}return Object(n.b)(t,e),t.prototype.parseEmptyQuery=function(){return!0},t.prototype.parseSubQuery=function(e,t,r){return void 0===r&&(r=!1),!1},t.prototype.parseSubFieldQuery=function(e,t,r,n,i){return!1},t.prototype.parseSearchQuery=function(e,t){return!1},t.prototype.parseCustomQuery=function(e,t,r){return void 0===r&&(r=!1),!1},t.prototype.parseSimpleQuery=function(e,t,r,n){return!0},t.prototype.parseLinkedToQuery=function(e,t,r,n){return void 0===t&&(t={}),void 0===r&&(r=!1),void 0===n&&(n=!1),!0},t.prototype.parseComplexQuery=function(e,t,r){return this.parseConditions(e)},t.prototype.parseConditions=function(e){var t=this;return e.every(function(e){return t.parse(e)})},t}(r(2).c),o=r(23);r.d(t,"a",function(){return s});var s=function(){function e(e,t,r,n,i){this.promiseLibrary=e,this.apiRequestService=t,this.requestColumnExpansionFactory=r,this.keyService=n,this.changesDeltaFactory=i,this.pendingBufferMap={},this.pendingTrueBufferMap={}}return e.prototype.setServerCache=function(e){this.serverCache=e},e.prototype.fetchByIds=function(e,t,r){for(var n=0,i=t;n<i.length;n++){var o=i[n];this.fetchById(e,o,r)}return this.pendingBufferMap[e].getPromise()},e.prototype.fetchById=function(e,t,r){if(this.keyService.isLocalId(t))throw new Error("Unexpected local ItemId in RequestBufferManager.fetchById, for local ItemIds you should use RequestBufferManager.fetchByLocalId");var n;return!0===r?void 0===(n=this.pendingTrueBufferMap[e])?n=this.constructBuffer(e,this.pendingTrueBufferMap):console.log("Existing 'columns: true' RequestBuffer "+e+" at "+performance.now()+" by id"):void 0===(n=this.pendingBufferMap[e])?n=this.constructBuffer(e):console.log("Existing RequestBuffer "+e+" at "+performance.now()+" by id"),n.addSingleItem(t,r),n.getPromise()},e.prototype.fetchByQuery=function(e,t,r){var n;return new i(t[0]).parse()?(void 0===(n=this.pendingBufferMap[e])?n=this.constructBuffer(e):console.log("Existing RequestBuffer "+e+" at "+performance.now()+" with query"),n.addQuery(t,r),n.getPromise()):((n=this._constructBuffer(e)).addQuery(t,r),n.flush(),n.getPromise())},e.prototype.constructBuffer=function(e,t){void 0===t&&(t=this.pendingBufferMap);var r=t[e]=this._constructBuffer(e);return window.setTimeout(function(){r.flush(),delete t[e]},150),r},e.prototype._constructBuffer=function(e){return new o.a(this.promiseLibrary,this.apiRequestService,this.requestColumnExpansionFactory,this.changesDeltaFactory,this.serverCache,e)},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r){this.queryService=e,this.queryMatcherFactory=t,this.transaction=r}return e.prototype.expand=function(e,t){var r=this.queryMatcherFactory.construct(e.itemType,t,this.transaction.getParent(e));return this._expand(e,function(e,t){return r.matchQuery(t.object)})},e.prototype.processDelta=function(e){var t=this;for(var r in e.deleted)for(var n=0,i=e.deleted[r];n<i.length;n++){var o=i[n];this._expand(o,function(){return!1})}var s=function(t){var r=e.created[t],n=a.queryMatcherFactory.construct(r.entry.itemType,r.fields,a.transaction.getParent(r.entry));a._expand(r.entry,function(t,i){var o=e._queryResults[t];if(void 0!==o){var s=o[i.string];if(void 0!==s)return!r.entry.isLocal()&&-1!==s.indexOf(r.entry.itemId)}return n.matchQuery(i.object)})},a=this;for(var c in e.created)s(c);var u=function(r){var n=e.moved[r];l._expand(n.entry,function(e,r){return t.queryService.containsLinkedTo(r.object,n.to.itemType,n.to.itemId)})},l=this;for(var c in e.moved)u(c);var h=function(t){var r=e.updated[t],n={},i=d.transaction.getItemChangesRecursively(Number(t),!1),o=function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);void 0!==r?Object.defineProperty(n,t,r):n[t]=e[t]};for(var s in i)o(i,s);for(var s in r.changes.fields)o(r.changes.fields,s);var a=d.queryMatcherFactory.construct(r.entry.itemType,n,d.transaction.getParent(r.entry));d._expand(r.entry,function(t,n){var i=e._queryResults[t];if(void 0!==i){var o=i[n.string];if(void 0!==o)return!r.entry.isLocal()&&-1!==o.indexOf(r.entry.itemId)}return a.matchQuery(n.object)})},d=this;for(var c in e.updated)h(c);return this},e.prototype.groupItemEntries=function(e){var t=[],r=[],n=[];for(var i in e){var o=e[i],s=o.item,a=o.isMatch;!0===a?t.push(s):!1===a?r.push(s):n.push(s)}return{fitting:t,notFitting:r,maybe:n}},e}()},function(e,t,r){"use strict";var n=r(3),i=function(e){function t(t,r,n){var i=e.call(this,n)||this;return i.columnUtil=t,i.itemType=r,i}return Object(n.b)(t,e),t.prototype.parseEmptyQuery=function(){return[]},t.prototype.parseSubQuery=function(e,t,r){var n;return void 0===r&&(r=!1),[(n={},n[e]=this.parse(t),n)]},t.prototype.parseSubFieldQuery=function(e,t,r,n,i){return[]},t.prototype.parseSearchQuery=function(e,t){return[]},t.prototype.parseCustomQuery=function(e,t,r){return void 0===r&&(r=!1),[]},t.prototype.parseSimpleQuery=function(e,t,r,n){return[e]},t.prototype.parseLinkedToQuery=function(e,t,r,n){return void 0===t&&(t={}),void 0===r&&(r=!1),void 0===n&&(n=!1),this.columnUtil.getColumnsFromLink(e,this.itemType)},t.prototype.parseComplexQuery=function(e,t,r){return this.parseConditions(e)},t.prototype.parseConditions=function(e){var t=this;return e.reduce(function(e,r){return e.concat(t.parse(r))},[])},t}(r(2).c),o=r(1);r.d(t,"a",function(){return s});var s=function(){function e(e,t,r,n,i){this.collectionEntryService=e,this.columnUtil=t,this.requestColumnExpansionFactory=r,this.promiseService=n,this.transaction=i,this.cachedQueries={}}return e.prototype.setCachedQuery=function(e,t,r,n){void 0===this.cachedQueries[e]&&(this.cachedQueries[e]={});var i=this.promiseService.defer(),o=this.cachedQueries[e][t.string]={itemType:e,query:t,items:r,promise:i.promise,requestColumns:n,resolve:function(){i.resolve(o)},reject:function(e){i.reject(e)}};return o},e.prototype.getCachedQueryItems=function(e,t){var r,n;return null===(n=null===(r=this.cachedQueries[e])||void 0===r?void 0:r[t])||void 0===n?void 0:n.items},e.prototype.getCachedQueryObjectsByItemType=function(e){var t=[];if(void 0===this.cachedQueries[e])return t;for(var r in this.cachedQueries[e])t.push(this.cachedQueries[e][r]);return t},e.prototype.initCachedQuery=function(e,t,r){return this.setCachedQuery(e,t,[],r)},e.prototype.__addItemEntriesToCachedQueries=function(e,t,r,n){if(0!==r.length){var i=this.getCachedQueryItems(e,t.string);if(void 0!==i)for(var o=[],s=0,a=r;s<a.length;s++){var c=a[s];-1!==i.indexOf(c)||n(c)||(i.push(c),o.push(c))}}},e.prototype.__removeItemEntriesFromCachedQueries=function(e,t,r){if(0===r.length)return[];var n=this.getCachedQueryItems(e,t.string);return void 0===n?[]:this.collectionEntryService.filterArray(n,function(e){return!Object(o.k)(e,r)})},e.prototype.expandColumnsWithQueryColumns=function(e,t,r){var n=new i(this.columnUtil,e,r);if(t.queryColumns=n.parse(),!0!==t.columns){var o=this.requestColumnExpansionFactory.construct();o.expandWithRequestColumns(e,["id","permissions"]),o.expandWithRequestColumns(e,t.columns),o.expandWithRequestColumns(e,t.queryColumns),null!==t.limit&&o.expandWithRequestColumns(e,[t.limit.field]),t.columns=o.get()[e]}},e}()},function(e,t,r){"use strict";var n,i;r.d(t,"b",function(){return n}),r.d(t,"a",function(){return i}),function(e){e.New="new",e.Duplicate="duplicate"}(n||(n={})),function(e){e.ITEMTABLE="itemtable",e.DIRECT="direct"}(i||(i={}))},function(e,t){},function(e,t,r){"use strict";r.r(t);var n=r(33);for(var i in n)"default"!==i&&function(e){r.d(t,e,function(){return n[e]})}(i);var o=r(34);for(var i in o)"default"!==i&&function(e){r.d(t,e,function(){return o[e]})}(i);var s=r(35);for(var i in s)"default"!==i&&function(e){r.d(t,e,function(){return s[e]})}(i);var a=r(36);for(var i in a)"default"!==i&&function(e){r.d(t,e,function(){return a[e]})}(i);var c=r(37);for(var i in c)"default"!==i&&function(e){r.d(t,e,function(){return c[e]})}(i);var u=r(38);for(var i in u)"default"!==i&&function(e){r.d(t,e,function(){return u[e]})}(i);var l=r(39);for(var i in l)"default"!==i&&function(e){r.d(t,e,function(){return l[e]})}(i);var h=r(40);for(var i in h)"default"!==i&&function(e){r.d(t,e,function(){return h[e]})}(i);var d=r(41);for(var i in d)"default"!==i&&function(e){r.d(t,e,function(){return d[e]})}(i);var p=r(42);for(var i in p)"default"!==i&&function(e){r.d(t,e,function(){return p[e]})}(i);var m=r(43);for(var i in m)"default"!==i&&function(e){r.d(t,e,function(){return m[e]})}(i)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){}])});
16
+ var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)}},function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return i}),r.d(t,"g",function(){return o}),r.d(t,"f",function(){return s}),r.d(t,"d",function(){return a}),r.d(t,"e",function(){return c}),r.d(t,"c",function(){return u});var n="7",i=">",o=":",s="-1",a="-2",c="new-",u="dup-"},function(e,t,r){"use strict";var n=r(0),i=function(){return function(e){this.columns=!0,this.parent=null,this.templateOptions={},Object(n.fb)(this,e)}}(),o=0,s=function(){function e(e,t,r,n){this.factory=e,this.itemType=t,this.itemId=r,this.columns=n,this.id=++o,this.reloadQueued=!1}return e.prototype.queueReload=function(){return this.reloadQueued=!0,this},e.prototype.isLocal=function(){return this.factory.keyService.isLocalId(this.itemId)},e.prototype.isLockable=function(){if(this.isLocal())return!1;switch(this.itemType){case"Project":case"Materiaal":case"Contact":case"Medewerker":case"Voertuig":case"Template":return!0;default:return!1}},e.prototype.toJSON=function(){return{id:this.id,columns:this.columns}},e}(),a=function(){function e(e,t,r,n){this.factory=e,this.entry=t,this._isNew=r,this.transaction=n,this.columns=t.columns.response[t.columns.itemType],this.initial=this.transaction.itemHandler.itemChanges[t.id].initial,this.fields=n.itemHandler.itemChanges[t.id].changes,this.onConstruct()}return e.prototype.onConstruct=function(){},e.prototype.setFields=function(e){var t=this,r=this.columns;for(var n in e){void 0===r[n]&&console.warn("setFields: no column found for",n)}var i=this.transaction.createChangesDelta();return i.setItemUpdated(this.entry,e),this.transaction.applyChangesDelta(i).then(function(){return t},this.factory.errorHandler.reject)},e.prototype.copyFields=function(e){void 0===e&&(e={});var t=this.entry;return this.factory.apiFormatter.copyFields(this.fields,e,t.columns.main),e},e.prototype.getParent=function(e){return this.transaction.getParent(this.entry,e,this.fields)},e.prototype.callOnChange=function(e){var t,r=this,n=null===(t=this.transaction.itemHandler.fieldChangeCallbacks[this.entry.itemType])||void 0===t?void 0:t[this.entry.itemId];if(void 0!==n)for(var i=0,o=n;i<o.length;i++){var s=o[i];try{s({itemEntry:this.entry,compareField:function(t){return r.factory.apiFormatter.compareFields(r.entry.columns.response[r.entry.itemType][t].type,r.fields[t],e[t])},fields:this.fields,isCalledAfterSocketUpdate:!1,previous:e})}catch(e){this.factory.exceptionHandler(e)}}},e.prototype.compareItemField=function(e,t){var r=this.columns[e];if(void 0===r)throw new Error("Missing column in ItemResource.compareItemField");return this.factory.apiFormatter.compareFields(r.type,this.fields[e],t[e])},e.prototype.hasChanges=function(){return this.transaction.itemHandler.detectEntryChanges(this.entry.id)},e.prototype.setTransactionParameters=function(e){Object(n.V)(this.transaction.tabRequestParameters,[this.entry.itemType,this.entry.itemId],[{},e])},e.prototype.isNew=function(){return this._isNew},e.prototype.isLocal=function(){return this.entry.isLocal()},e.prototype.toJSON=function(){var e=[];for(var t in this.columns)e.push(t);return{columns:e,fields:this.fields,entry:this.entry}},e.prototype.getDerivedValue=function(e){return this.transaction.itemHandler.getDerivedValue(this.entry,e)},e.prototype.getDerivedValues=function(e){return this.transaction.itemHandler.getDerivedValues(this.entry,e)},e}(),c=r(11),u=0,l=function(){function e(e,t,r,n,i,o,s){this.collectionEntryService=e,this.queryService=t,this.columnSetFactory=r,this.keyService=n,this.columnCache=i,this.itemType=o,this.options=s,this.id=u++,this.parent=null,this.reloadQueued=!1,this.parent=s.parent,this.query=this.collectionEntryService.createQueryFromOptions(s);var a=this.columnCache.retrieve(o,s.columns);(!0===a.missing||a.missing.length>0)&&console.warn("Missing columns in CollectionEntry",a.missing),this.columns=this.columnSetFactory.construct(o,s.columns,a.cached)}return e.prototype.isLocal=function(){var e=this.parent;return null===e?this.queryService.containsLocalId(this.query.object):this.keyService.isLocalId(e.itemId)},e.prototype.queueReload=function(){this.reloadQueued=!0},e.prototype.expandColumns=function(e){var t=e.run(this.columns);null!==t&&(this.columns=t.merged,this.options.columns=this.columns.request)},e}(),h=r(10),d=function(){function e(e,t,r,n,i){this.factory=e,this.options=t,this.transaction=r,this.itemIdMap={},this.fieldChangeDeregFns={},this.onChangeCallbacks=[],this.onAddCallbacks=[],this.onRemoveCallbacks=[],this.removedItemIds=[],this.entry=this.factory.collectionEntryFactory.construct(n,this.options),this.columns=this.entry.columns.response,this.items=[],this.itemIdMap={},this.registerListeners(),this.addItemResources(i,!0),this.onConstruct()}return e.prototype.onConstruct=function(){},e.prototype.setLimit=function(e){var t=null===this.options.limit?null:this.options.limit.limit;if("number"==typeof e){if(null===this.options.limit)throw new Error("Tried to set a limit only using a number, but the collection didn't have a limit object yet");this.options.limit.limit=e}else this.options.limit=e;null===t&&null===this.options.limit||(null===t||t>this.options.limit.limit?this.limitAfterAdd(!1):t<this.options.limit.limit&&this.limitAfterRemove())},e.prototype.onAdd=function(e){return this.__registerCallback(this.onAddCallbacks,e)},e.prototype.onChange=function(e){return this.__registerCallback(this.onChangeCallbacks,e)},e.prototype.onRemove=function(e){return this.__registerCallback(this.onRemoveCallbacks,e)},e.prototype.__clear=function(){this.onAddCallbacks.length=0,this.onChangeCallbacks.length=0,this.onRemoveCallbacks.length=0},e.prototype.moveItems=function(e,t){return this.transaction.collectionHandler.moveItems(this.entry,t.entry,e)},e.prototype.removeItems=function(e){for(var t=this.factory.changesDeltaFactory.construct(),r=[],n=0,i=this.items;n<i.length;n++){var o=i[n].entry;-1!==e.indexOf(o.itemId)&&r.push(o)}return t.setItemsDeleted(r),this.transaction.applyChangesDelta(t)},e.prototype.removeItem=function(e){return this.removeItems([e])},e.prototype.addItems=function(e){var t=this,r=this.transaction.createChangesDelta();if(null!==this.entry.parent)for(var n=this.factory.itemEntryService.getLinkFieldsByParent(this.entry.parent,this.entry.itemType),i=0,o=e;i<o.length;i++){var s=o[i];for(var a in n)s[a]=n[a]}return r.setItemsCreated(this.entry.itemType,e).then(function(){return t.transaction.applyChangesDelta(r)})},e.prototype.addItem=function(e){return this.addItems([e])},e.prototype.getIdArray=function(){return this.items.map(function(e){return e.entry.itemId})},e.prototype.getItemById=function(e){return this.itemIdMap[e]},e.prototype.addItemResources=function(e,t,r){var n=this;if(void 0===t&&(t=!1),void 0===r&&(r=!1),0===e.length)return[];e=e.filter(function(e){return void 0===n.itemIdMap[e.itemId]});for(var i=this.transaction.createItemResources(e),o=0,s=i;o<s.length;o++){var a=s[o],c=a.entry.itemId;if(void 0===this.itemIdMap[c]){this.items.push(a),this.itemIdMap[c]=a;var u=this.removedItemIds.indexOf(c);u>-1&&this.removedItemIds.splice(u),this.fieldChangeDeregFns[a.entry.id]=this.transaction.registerFieldChangeCallback(a.entry.itemType,a.entry.itemId,function(e){n.callOnChange(e.itemEntry,e.compareField,e.fields,r,e.previous)})}}return this.limitAfterAdd(r,i),i.length>0&&(!t||this.options.callOnAddWithInitialItems)&&this.callOnAdd(i,t,r),i},e.prototype.removeItemResources=function(e,t){var r=this,i=[];return 0===e.length?i:(Object(n.Z)(this.items,function(t){for(var n=0,o=e;n<o.length;n++){var s=o[n];if(t.entry===s)return i.push(t),delete r.itemIdMap[s.itemId],r.fieldChangeDeregFns[s.id](),delete r.fieldChangeDeregFns[s.id],r.removedItemIds.push(s.itemId),!1}return!0}),0===i.length?i:(this.callOnRemove(i,t),this.limitAfterRemove(),i))},e.prototype.callOnAdd=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!1);try{for(var n=0,i=this.onAddCallbacks;n<i.length;n++){(0,i[n])({itemResources:e,collectionResource:this,isInitialCall:t,isCalledAfterSocketUpdate:r})}}catch(e){this.factory.exceptionHandler(e)}},e.prototype.callOnChange=function(e,t,r,n,i){try{for(var o=0,s=this.onChangeCallbacks;o<s.length;o++){(0,s[o])({itemEntry:e,compareField:t,fields:r,isCalledAfterSocketUpdate:n,previous:i})}}catch(e){this.factory.exceptionHandler(e)}},e.prototype.callOnRemove=function(e,t){try{for(var r=0,n=this.onRemoveCallbacks;r<n.length;r++){(0,n[r])({itemResources:e,collectionResource:this,isCalledAfterSocketUpdate:t})}}catch(e){this.factory.exceptionHandler(e)}},e.prototype.forEach=function(e){for(var t=0,r=this.items;t<r.length;t++){e(r[t])}},e.prototype.filter=function(e){for(var t=[],r=0,n=this.items;r<n.length;r++){var i=n[r];e(i)&&t.push(i)}return t},e.prototype.first=function(e){for(var t=0,r=this.items;t<r.length;t++){var n=r[t];if(e(n))return n}return null},e.prototype.some=function(e){return null!==this.first(e)},e.prototype.groupBy=function(e){var t=this.items,r={};if("string"==typeof e)for(var n=0,i=t;n<i.length;n++){if(void 0===(a=i[n]).entry.columns.response[this.entry.itemType][e])throw new Error("Trying to group on a column not in one of the items in this collection! (column '"+e+"', item "+a.entry.itemType+":"+a.entry.itemId+")");void 0===r[c=a.fields[e]]&&(r[c]=[]),r[c].push(a)}if("function"==typeof e)for(var o=0,s=t;o<s.length;o++){var a,c;null!==(c=e(a=s[o]))&&(void 0===r[c]&&(r[c]=[]),r[c].push(a))}return r},e.prototype.map=function(e){var t=this.items,r=t.length,n=new Array(r);if("string"==typeof e)for(var i=0;i<r;i++)n[i]=t[i].fields[e];if("function"==typeof e)for(i=0;i<r;i++)n[i]=e(t[i]);return n},e.prototype.reduce=function(e,t){for(var r=0,n=this.items;r<n.length;r++){t=e(n[r],t)}return t},e.prototype.clearResource=function(){for(var e in this.fieldChangeDeregFns)this.fieldChangeDeregFns[e](),delete this.fieldChangeDeregFns[e];this.transaction.clearCollectionResource(this)},e.prototype.registerListeners=function(){var e=this;this.onChangeCallbacks.push(function(t){t.compareField("id")||(e.itemIdMap[t.fields.id]=e.getItemById(t.previous.id),delete e.itemIdMap[t.previous.id])}),this.options.onAdd!==h.c&&this.onAddCallbacks.push(function(t){e.options.onAdd(t.itemResources,t.collectionResource,t.isInitialCall,t.isCalledAfterSocketUpdate)}),this.options.onRemove!==h.c&&this.onRemoveCallbacks.push(function(t){e.options.onRemove(t.itemResources,t.collectionResource,t.isCalledAfterSocketUpdate)}),this.options.onChange!==h.c&&this.onChangeCallbacks.push(function(t){return e.options.onChange(t)})},e.prototype.__registerCallback=function(e,t){return e.push(t),function(){var r=e.indexOf(t);r>-1&&e.splice(r,1)}},e.prototype.limitAfterRemove=function(){var e=this;null===this.options.limit||this.options.limit.limit<=this.items.length||this.transaction.cachedQueryHandler.__fetchCachedQueryItem(this.entry.itemType,new c.a({query:this.factory.queryService.addAndCondition(this.entry.query.object,this.factory.queryService.createNotIn(this.removedItemIds)),columns:this.entry.options.columns,parent:this.entry.parent,limit:this.entry.options.limit})).then(function(t){e.addItemResources(t.items)})},e.prototype.limitAfterAdd=function(e,t){var r=this.entry.options.limit;if(!(null===r||this.items.length<=r.limit)){this.items.sort(function(e,t){var n=e.fields[r.field]-t.fields[r.field];return void 0===r.order||"desc"===r.order?-n:n});for(var n=this.items.splice(r.limit,this.items.length-r.limit),i=0,o=n;i<o.length;i++){var s=o[i];if(this.fieldChangeDeregFns[s.entry.id](),delete this.itemIdMap[s.entry.itemId],delete this.fieldChangeDeregFns[s.entry.id],this.removedItemIds.push(s.entry.itemId),void 0!==t){var a=t.indexOf(s);a>-1&&t.splice(a,1)}}this.callOnRemove(n,e)}},e}(),p=function(){function e(e,t,r,n,i){this.itemType=t,this.response=r;var o=r.fetchColumnsObject();this.responseColumns=e.columnUtil.mergeResponseColumns(o,i).merged,this.columns=e.columnSetFactory.constructFromResponse(t,o),this.columns=this.columns.expand(n[t],!1,i).merged}return e.prototype.getFields=function(){var e=this.itemType;return this.response.fetchObject(e,this.response.links[e][0])},e}();r.d(t,"e",function(){return i}),r.d(t,"d",function(){return s}),r.d(t,"f",function(){return a}),r.d(t,"b",function(){return c.a}),r.d(t,"a",function(){return l}),r.d(t,"c",function(){return d}),r.d(t,"g",function(){return p})},function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(0),i=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e){return new n.d(this.apiFormatter,e)},e}(),o=function(){function e(){}return e.prototype.construct=function(e){return new n.f(e)},e}(),s=r(5),a=r(11),c=function(){function e(e,t,r,n,i){this.collectionEntryService=e,this.columnSetFactory=t,this.keyService=r,this.queryService=n,this.columnCache=i}return e.prototype.construct=function(e,t){return new s.a(this.collectionEntryService,this.queryService,this.columnSetFactory,this.keyService,this.columnCache,e,new a.a(t))},e}(),u=r(3),l=r(28),h=r(13),d=function(e){function t(t,r,n,i,o,s){var a=e.call(this,n,i,o)||this;return a.apiRequestService=t,a.promiseService=r,a.getQueries=s,a.map={},a}return Object(u.b)(t,e),t.prototype.__removeFromAndAddToCachedQueries=function(e,t){var r=this;void 0===e&&(e=!1);var n=[],i=function(e){var i,s=o.map[e],a=o.groupItemEntries(s.matches);if(o.transaction.cachedQueryHandler.__removeItemEntriesFromCachedQueries(s.itemType,s.query,a.notFitting),o.transaction.cachedQueryHandler.__addItemEntriesToCachedQueries(s.itemType,s.query,a.fitting),a.maybe.length>0){if(o.transaction instanceof h.a)for(var c=0,u=a.maybe;c<u.length;c++){var l=u[c];o.transaction.itemHandler.detectEntryChanges(l.id)&&console.error("!! Trying to re-query 'maybe' matching results but one of the entries has changes, please report this to Martijn !!")}n.push(o.apiRequestService.query(s.itemType,s.query.object,(i={},i[s.itemType]=["id"],i)).then(function(e){void 0!==t&&t._setQueryResult(s.itemType,s.query.string,e.links[s.itemType]),r.transaction.cachedQueryHandler.__addItemEntriesToCachedQueries(s.itemType,s.query,a.maybe.filter(function(t){return e.links[s.itemType].indexOf(t.itemId)>-1}))}).then(function(){},function(){}))}},o=this;for(var s in this.map)i(s);return this.promiseService.all(n)},t.prototype._expand=function(e,t){for(var r=0,n=this.getQueries(e.itemType);r<n.length;r++){var i=n[r],o=i.itemType+"-"+i.query.string;void 0===this.map[o]&&(this.map[o]={itemType:e.itemType,query:i.query,matches:{},cachedQuery:i});var s=this.map[o].matches;void 0===s[e.itemId]&&(s[e.itemId]={item:e,isMatch:t(e.itemType,i.query)})}return this},t}(l.a),p=r(17),m=function(){function e(e,t,r,n){this.queryMatcherFactory=e,this.queryService=t,this.apiRequestService=r,this.promiseService=n}return e.prototype.constructCachedCollectionProcessor=function(e,t){return new p.a(this.apiRequestService,this.promiseService,this.queryService,this.queryMatcherFactory,e,t)},e.prototype.constructCachedQueryProcessor=function(e,t){return new d(this.apiRequestService,this.promiseService,this.queryService,this.queryMatcherFactory,e,t)},e}(),f=function(){function e(e,t,r,n,i,o,s,a,c){this.errorHandler=e,this.exceptionHandler=t,this.keyService=r,this.promiseService=n,this.changesDeltaFactory=i,this.itemEntryService=o,this.collectionEntryFactory=s,this.queryService=a,this.columnSetFactory=c}return e.prototype.construct=function(e,t,r,n){return new s.c(this,new s.b(t),r,e,n)},e}(),y=function(){function e(e){this.columnInfoFactory=e}return e.prototype.construct=function(e,t,r){return new n.n(this.columnInfoFactory,e,t,r)},e}(),v=function(){function e(){}return e.prototype.construct=function(e,t){return new n.p(e,t)},e.prototype.constructFromRootMap=function(e,t){void 0===t&&(t=null);var r=[];for(var n in e){var i=e[n],o=this.construct(i.apiColumn,t),s=this.constructFromRootMap(i.children,o);s.length>0&&o.setChildren(o.apiColumn.itemType,s),r.push(o)}return r},e}(),g=function(){function e(e,t,r){this.columnHandler=e,this.columnUtil=t,this.columnInfoFactory=r}return e.prototype.constructStub=function(e,t){var r=new n.q(this.columnUtil,this,e);return r.request=t,r.requestColumnsTrue=!0===t,r},e.prototype.resolveStub=function(e,t,r,n){return void 0===r&&(r=!0),void 0===n&&(n=!0),e.requestColumnsTrue?this.processResponseColumns(e,t,r):this.processRequestColumns(e,t,r,n)},e.prototype.construct=function(e,t,r,n,i){return this.resolveStub(this.constructStub(e,t),r,n,i)},e.prototype.constructFromResponse=function(e,t,r){void 0===r&&(r=!0);var i=new n.q(this.columnUtil,this,e);return i.requestColumnsTrue=!1,this.processResponseColumns(i,t,r)},e.prototype.processResponseColumns=function(e,t,r){var n=e.itemType,i={};return e.response=t,this.expandRootColumnMapFromResponseColumns(n,t,i,r,{}),this.processColumnInfo(e,this.columnInfoFactory.constructFromRootMap(i),n),e.request=this.constructRequestColumnsFromRootColumnMap(i),e},e.prototype.constructRequestColumnsFromRootColumnMap=function(e){var t,r=[];for(var i in e){var o=e[i];Object(n.db)(o.children)?r.push(((t={})[i]=this.constructRequestColumnsFromRootColumnMap(o.children),t)):r.push(i)}return r},e.prototype.expandRootColumnMapFromResponseColumns=function(e,t,r,i,o){if(!0!==o[e])for(var s in o[e]=!0,t[e]){var a=t[e][s];if(void 0!==a&&(i&&this.columnHandler.setColumn(e,a),void 0===r[s]&&(r[s]={apiColumn:a,children:{}}),this.columnUtil.isItemColumn(a,!1))){var c=t[a.itemType];void 0!==c&&Object(n.db)(c)&&this.expandRootColumnMapFromResponseColumns(a.itemType,t,r[s].children,i,o)}}},e.prototype.processRequestColumns=function(e,t,r,n){var i=e.itemType,o={};return this.expandRootColumnMap(e.request,i,t,o,r),n&&this.expandRootColumnMap(["id"],i,t,o,r),e.response={},this.processColumnInfo(e,this.columnInfoFactory.constructFromRootMap(o),i),e},e.prototype.processColumnInfo=function(e,t,r){var n=e.response;void 0===n[r]&&(n[r]={});for(var i=0,o=t;i<o.length;i++){var s=o[i];n[r][s.id]=s.apiColumn,e.groupColumnInfo(s),s.isLeaf||this.processColumnInfo(e,s.children,s.itemType)}},e.prototype.expandRootColumnMap=function(e,t,r,n,i){for(var o=0,s=e;o<s.length;o++){var a=s[o],c=this.columnUtil.parseRequestColumn(a),u=c.id,l=c.children,h=void 0;void 0!==r[t]&&(h=r[t][u]),void 0!==h?(i&&(h=this.columnHandler.setColumn(t,h)),void 0===n[u]&&(n[u]={apiColumn:h,children:{}}),0!==l.length&&this.expandRootColumnMap(l,h.itemType,r,n[u].children,i)):console.warn("No api column for request column",u,"for itemType",t)}},e}(),C=function(){function e(e){this.columnUtil=e}return e.prototype.construct=function(e){return new n.r(this.columnUtil,e)},e}(),I=function(){function e(e,t,r){this.apiFormatter=e,this.keyService=t,this.requestColumnExpansionFactory=r}return e.prototype.construct=function(e,t,r){return new n.u(this.apiFormatter,this.keyService,this.requestColumnExpansionFactory,e,t,r)},e}(),b=function(){function e(e){this.queryMatcherFactory=e}return e.prototype.construct=function(e){return new n.x(this.queryMatcherFactory,e)},e}(),S=function(){function e(e,t,r,n,i,o){this.apiFormatter=e,this.columnSetFactory=t,this.exceptionHandler=r,this.itemEntryService=n,this.keyService=i,this.promiseService=o}return e.prototype.construct=function(e,t){return new s.d(this,t.itemType,e,t)},e}(),E=function(){function e(e,t,r,n,i){this.apiFormatter=e,this.errorHandler=t,this.promiseService=r,this.exceptionHandler=n,this.columnUtil=i}return e.prototype.construct=function(e,t,r){return void 0===r&&(r=!1),new s.f(this,e,r,t)},e}(),F=function(){function e(e,t){this.dependencies=e,this.core=t,this.serverCache=new n.J(this.dependencies,this.core)}return e.prototype.getById=function(e){var t=function(r){for(var n=0,i=r;n<i.length;n++){var o=i[n];if(o.id===e)return o;var s=t(o.children);if(void 0!==s)return s}};return t(this.serverCache.children)},e.prototype.construct=function(e,t){return this.serverCache.createChild(e,t)},e.prototype.getServerCache=function(){return this.serverCache},e}(),R=function(){function e(){}return e.prototype.construct=function(e){return new n.C(e)},e}(),q=function(){function e(e){this.apiFormatter=e}return e.prototype.construct=function(e,t,r){return new n.D(this.apiFormatter,e,t,r)},e}(),T=function(){function e(){}return e.prototype.construct=function(e){return new n.E(e)},e}(),H=function(){function e(e){this.columnUtil=e}return e.prototype.construct=function(){return new n.I(this.columnUtil)},e}(),M=function(){function e(e,t){this.columnSetFactory=e,this.columnUtil=t}return e.prototype.construct=function(e,t,r,n){return new s.g(this,e,t,r,n)},e}(),j=r(25),w=r(26);r.d(t,"a",function(){return i}),r.d(t,"b",function(){return o}),r.d(t,"e",function(){return c}),r.d(t,"f",function(){return m}),r.d(t,"g",function(){return f}),r.d(t,"h",function(){return y}),r.d(t,"i",function(){return v}),r.d(t,"j",function(){return g}),r.d(t,"k",function(){return C}),r.d(t,"l",function(){return I}),r.d(t,"m",function(){return b}),r.d(t,"n",function(){return S}),r.d(t,"o",function(){return E}),r.d(t,"u",function(){return F}),r.d(t,"p",function(){return R}),r.d(t,"q",function(){return q}),r.d(t,"r",function(){return T}),r.d(t,"s",function(){return H}),r.d(t,"t",function(){return M}),r.d(t,"c",function(){return j.a}),r.d(t,"d",function(){return w.a})},function(e,t,r){"use strict";r.r(t);var n=r(30);r.d(t,"StateKeyType",function(){return n.b}),r.d(t,"ApiLinkTreeType",function(){return n.a});var i=r(31);for(var o in i)["StateKeyType","ApiLinkTreeType","default"].indexOf(o)<0&&function(e){r.d(t,e,function(){return i[e]})}(o)},function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return s});var n,i=r(5),o=r(1);!function(e){e.CACHED="cached",e.NOT_CACHED="not_cached",e.NO_CHANGES="no_changes"}(n||(n={}));var s=function(){function e(e,t,r,n,i,o,s,a){this.columnUtil=e,this.apiFormatter=t,this.itemEntryFactory=r,this.promiseService=n,this.errorHandler=i,this.requestColumnExpansionFactory=o,this.transaction=a,this.entries=s.construct(this.transaction)}return e.prototype.getDerivedValues=function(e,t){for(var r=e,n=this.transaction.getChangesFromItemChanges(this.itemChanges[e.id]),i=0,o=t;i<o.length;i++){var s=o[i],a=r.columns.response[r.itemType][s];if(void 0===a)throw new Error("Column '"+s+"' not found on entry in ItemResource.getDerivedValue");if(null===a.itemType)throw new Error("Column '"+s+"' doesn't have children in ItemResource.getDerivedValue");var c=n[s];if(null===c)return;if(void 0===(r=this.transaction.getLocalItemEntryByItemId(a.itemType,c)))throw new Error("Derived itemEntry "+a.itemType+":"+c+" couldn't be found");n=this.transaction.getItemChangesRecursively(r.id,!1)}return n},e.prototype.getDerivedValue=function(e,t){"string"==typeof t&&(t=this.columnUtil.parseConfigColumn(t));var r=this.getDerivedValues(e,t.slice(0,-1));if(void 0!==r)return r[t[t.length-1]]},e.prototype.clearItemEntry=function(e){this.entries.clear(e),delete this.itemChanges[e.id]},e.prototype.fetchDerivedValuesByColumn=function(e,t,r){var n=this,s=t.children;if(0===s.length)return this.promiseService.when();var a=s[0];if(1===s.length&&"id"===a.apiColumn.type)throw new Error("You should use fields[columnId] instead of derived['columnId>id'] to get the id of a derived item");for(var c={},u=0,l=e;u<l.length;u++){var h=l[u];null!==(p=this.getItemIdByColumn(h,t,r))&&(void 0===c[p]&&(c[p]=[]),c[p].push(h))}if(!Object(o.j)(c))return this.promiseService.when();var d=[];for(var p in c)d.push(+p);for(var m=[],f=0,y=s;f<y.length;f++){var v=y[f];m.push(v.id)}return this.fetchItemEntries(t.itemType,d,new i.e({columns:m})).then(function(){return n.resolveDerivedValues(e,s,r)},this.errorHandler.reject)},e.prototype.resolveDerivedValues=function(e,t,r){for(var n=[],i=0,o=t;i<o.length;i++){var s=o[i];n.push(this.fetchDerivedValuesByColumn(e,s,r))}return this.promiseService.all(n).then(function(){return e},this.errorHandler.reject)},e.prototype.createItemEntry=function(e){var t=this.itemEntryFactory.construct(e.itemId,e.columns);return this.entries.add(t),t},e.prototype.getItemIdByColumn=function(e,t,r){if(0===t.level)return void 0!==r&&void 0!==r.updated[e.id]?r.updated[e.id].changes.fields[t.path]:this.transaction.getItemChangesRecursively(e.id)[t.path];var n=this.getItemIdByColumn(e,t.parent,r),i=this.transaction.getLocalItemEntryByItemId(t.parent.itemType,n);return void 0!==r&&void 0!==r.updated[i.id]?r.updated[i.id].changes.fields[t.id]:this.transaction.getItemChangesRecursively(i.id)[t.id]},e.prototype.expandColumnsWithCachedQueryColumns=function(e,t){var r=this.requestColumnExpansionFactory.construct();r.expandWithRequestColumns(e,["id","permissions"]),void 0!==t&&r.expandWithRequestColumns(e,t);for(var n=function(t){var n=t.cachedQueryHandler.cachedQueries[e];if(void 0!==n)for(var i in n){var o=n[i];r.expandWithRequestColumns(o.itemType,o.requestColumns)}},i=function(e){for(var t=0,r=e;t<r.length;t++){var o=r[t];n(o),i(o.children)}},o=0,s=this.transaction.getTransactionChain();o<s.length;o++){var a=s[o];n(a)}return i(this.transaction.children),r.get()[e]},e}()},function(e,t,r){"use strict";var n=r(0),i=r(24),o=r(27),s=r(1),a=function(){function e(e,t,r,n,i,o,s){this.columnUtil=e,this.promiseService=t,this.columnHandler=r,this.templateFactory=n,this.errorHandler=i,this.requestColumnExpansionFactory=o,this.apiRequestService=s,this.pendingTemplateBufferMap={},this.templates={}}return e.prototype.fetchTemplate=function(e,t,r,n,i){var o=this;void 0===r&&(r={}),void 0===n&&(n={}),void 0===i&&(i=null);var a=Object(s.j)(r),c=this.requestColumnExpansionFactory.construct();if(void 0!==n[e]&&c.expandWithRequestColumns(e,n[e]),c.expandWithRequestColumns(e,[{creator:["displayname"]},"created","permissions"]),null!==i&&c.expandWithRequestColumns(e,this.columnUtil.getColumnsFromLink("string"==typeof i?i:i.itemType,e)),n[e]=c.get()[e],!a){var u=this.templates[e];if(void 0!==u&&(null===e||this.columnUtil.responseColumnsAvailable(e,n[e],u.responseColumns)))return this.promiseService.when(u)}return this.promiseService.all({template:this.fetchTemplateById(e,t,r),additionalColumns:void 0===n[e]?{}:this.columnHandler.fetch(e,n[e])}).then(function(t){var r=t.template,i=o.templateFactory.construct(e,r,n,t.additionalColumns);return!a&&r.cacheable&&(o.templates[e]=i),i},this.errorHandler.reject)},e.prototype.fetchTemplateById=function(e,t,r){return void 0===t&&(t="no-id"),void 0===this.pendingTemplateBufferMap[e]||void 0===this.pendingTemplateBufferMap[e][t]?this.constructTemplateBuffer(e,t,r):this.pendingTemplateBufferMap[e][t]},e.prototype.constructTemplateBuffer=function(e,t,r){var n=this;return void 0===this.pendingTemplateBufferMap[e]&&(this.pendingTemplateBufferMap[e]={}),this.pendingTemplateBufferMap[e][t]=this.apiRequestService.template(e,r).then(function(r){return delete n.pendingTemplateBufferMap[e][t],r},function(){return delete n.pendingTemplateBufferMap[e][t],n.errorHandler.reject()})},e}(),c=r(7),u=r(25),l=r(26);r.d(t,"a",function(){return h}),r.d(t,"c",function(){return d}),r.d(t,"b",function(){return p});var h=function(){return function(e,t,r,s,h,p){this.version="6.3.10",this.noop=d;var m=new n.A,f=new n.b,y=new c.q(f),v=new c.r,g=new n.F(m),C=new n.l,I=new n.s(p),b=new c.s(I),S=new n.z(t,p),E=new c.a(f),F=new n.c(e,E),R=new c.f(y,g,F,h),q=new n.m(I),T=new n.o(F,r,h,q,I),H=new c.i,M=new c.h(H),j=new c.j(T,I,H),w=new c.k(I),k=new n.B(F,r,m,h),D=new c.t(j,I),x=new c.m(y),O=new c.o(f,r,h,s,I),Q=new a(I,h,T,D,r,b,F),_=new n.t(m),L=new i.a(j,_,r,m,h,Q),A=new u.a(r,S,L),P=new o.a(h,F,b,m,A),B=new c.n(f,j,s,S,m,h),U=new n.j(v,g),N=new c.e(U,j,m,g,q),V=new c.g(r,s,m,h,A,S,N,g,j),W=new c.l(f,m,b),Y=new c.b,J=new l.a(A,F,Y,M,W,r,h,b,U,S),K=new c.p,G=new c.u({apiFormatter:f,apiRequestService:F,authInterface:t,changesDeltaFactory:A,changesProcessorFactory:J,collectionEntryFactory:N,collectionEntryService:U,collectionMatcherFactory:R,collectionResourceFactory:V,columnCache:q,columnExpansionFactory:M,columnHandler:T,columnSetFactory:j,columnSubsetCacheFactory:w,columnUtil:I,conversionMapService:_,errorHandler:r,exceptionHandler:s,itemCacheFactory:x,itemCreateService:L,itemEntryFactory:B,itemEntryService:S,itemResourceFactory:O,keyService:m,linkTreeService:p,lockService:k,moduleChangesCompilationFactory:K,promiseService:h,queryMatcherFactory:y,queryParserFactory:v,queryService:g,requestBufferManager:P,requestColumnExpansionFactory:b,templateCache:Q},this);P.setServerCache(G.getServerCache());var z=new n.M(P,A,f,r,G,h,b,F,y);this.apiFormatter=f,this.apiRequestService=F,this.apiResponseProcessorFactory=E,this.changesCompilationFactory=Y,this.changesDeltaFactory=A,this.changesProcessorFactory=J,this.collectionEntryFactory=N,this.collectionEntryService=U,this.collectionMatcherFactory=R,this.collectionResourceFactory=V,this.collectionResourceService=C,this.columnCache=q,this.columnExpansionFactory=M,this.columnHandler=T,this.columnInfoFactory=H,this.columnSetFactory=j,this.columnSubsetCacheFactory=w,this.columnUtil=I,this.conversionMapService=_,this.createRequestFactory=W,this.itemCacheFactory=x,this.itemCreateService=L,this.itemEntryFactory=B,this.itemEntryService=S,this.itemResourceFactory=O,this.keyService=m,this.lockService=k,this.moduleChangesCompilationFactory=K,this.queryMatcherFactory=y,this.queryParserFactory=v,this.queryService=g,this.requestColumnExpansionFactory=b,this.socketMessageHandler=z,this.templateCache=Q,this.templateFactory=D,this.transactionCacheFactory=G}}();function d(){}function p(e){return e}},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(0),i=r(10),o=function(){return function(e){this.columns=[],this.query=null,this.queryColumns=[],this.parent=null,this.limit=null,this.onAdd=i.c,this.onRemove=i.c,this.onChange=i.c,this.custom=null,this.callOnAddWithInitialItems=!1,Object(n.fb)(this,e)}}()},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r){this.errorHandler=e,this.exceptionHandler=t,this.promiseService=r,this.callbacks={onBeforeSave:[],onSaveSuccess:[],onSetItemError:[],onClearItemError:[],onSetGlobalError:[],onClearGlobalError:[]}}return e.prototype.registerCallback=function(e,t,r,n,i){var o=this;return void 0===n&&(n="always"),void 0===i&&(i=100),this.getPriorityLevel(e,i)[t]={callback:r,condition:n},function(){delete o.getPriorityLevel(e,i)[t]}},e.prototype.executeCallbacks=function(e,t,r){for(var n=this.callbacks[e],i=r?"onClose":"skipOnClose",o=this.promiseService.when(),s=0,a=n;s<a.length;s++){var c=a[s];o=o.then(this.executeCallbacksPriorityLevel(c[1],i,t),this.errorHandler.reject)}return o},e.prototype.getPriorityLevel=function(e,t){for(var r,n=this.callbacks[e],i=0;i<n.length;i++){var o=n[i];if(!(o[0]<t))return o[0]===t?o[1]:(r={},n.splice(i,0,[t,r]),r)}return r={},n.push([t,r]),r},e.prototype.executeCallbacksPriorityLevel=function(e,t,r){var n=this;return function(){var i={};for(var o in e){var s=e[o];if(s.condition===t||"always"===s.condition)try{i[o]=r(s.callback)}catch(e){n.exceptionHandler(e)}}return n.promiseService.all(i)}},e}()},function(e,t,r){"use strict";r.d(t,"b",function(){return n}),r.d(t,"a",function(){return f});var n,i=r(3),o=r(0),s=r(10),a=r(5),c=r(11),u=r(8),l=r(1),h=r(14),d=r(9),p=r(19),m=r(12);!function(e){e.warning="warning",e.error="error"}(n||(n={}));var f=function(e){function t(t,r,n,i,s){var a=e.call(this,t,r)||this;return a.id=i,a.errors={item:{},global:{}},a.tabRequestParameters={},a.isSaving=!1,a.hasChanges=!1,a.changesInterval=null,a._isValid=!0,a.validator=void 0===s?void 0:s.construct(a),a.parent=n,a.itemHandler=new o.S(t,a,a.validator),a.cachedQueryHandler=new p.a(t,a.itemHandler,a),a.collectionHandler=new o.P(a.itemHandler,a.cachedQueryHandler,a.dependencies,a),a.eventHandler=new m.a(t.errorHandler,t.exceptionHandler,t.promiseService),a}return Object(i.b)(t,e),Object.defineProperty(t.prototype,"isValid",{get:function(){return(void 0===this.validator||!this.validator.isPending())&&this._isValid},enumerable:!0,configurable:!0}),t.prototype.createChild=function(e,r){var n=new t(this.dependencies,this.core,this,e,r);return this.children.push(n),n},t.prototype.destroy=function(){this.parent.onChildDestroy(this)},t.prototype.expandCollectionResource=function(e,t){var r,n=this,i=null===(r=this.cachedQueryHandler.cachedQueries[e.entry.itemType])||void 0===r?void 0:r[e.entry.query.string];return void 0===i?this.collectionHandler.expandCollectionResource(e,t):this.cachedQueryHandler.__expandCachedQuery(i,t).then(function(){e.entry.columns=n.dependencies.columnSetFactory.construct(i.itemType,i.requestColumns,n.dependencies.columnCache.retrieve(i.itemType,i.requestColumns).cached)},this.dependencies.errorHandler.reject)},t.prototype.expandCollectionResources=function(e,t,r){var n=this;if(!Object(l.j)(t))return this.dependencies.promiseService.when(t);var i=[],o=[];for(var s in t)for(var a=0,c=t[s].items;a<c.length;a++){var u=c[a];u.entry.isLocal()?i.push(u.entry):o.push(u.entry)}return(0===o.length?this.dependencies.columnHandler.fetch(e,r):this.getServerCache().itemHandler.extendItemEntries(e,o,r)).then(function(){if(0===i.length)return n.dependencies.promiseService.when();var t=n.createChangesDelta();return n.itemHandler.expandLocalItemEntries(t,e,i,r,n.dependencies.columnCache.retrieve(e,r).cached).then(function(){return n.applyChangesDelta(t)},n.dependencies.errorHandler.reject)},this.dependencies.errorHandler.reject).then(function(){var i,o=n.dependencies.columnExpansionFactory.construct(e,r,n.dependencies.columnCache.retrieve(e,r).cached);for(var s in t){var a=t[s].entry,c=null===(i=n.cachedQueryHandler.cachedQueries[a.itemType])||void 0===i?void 0:i[a.query.string];void 0!==c&&(c.requestColumns=n.dependencies.columnUtil.mergeRequestColumns(c.requestColumns,r).merged),a.expandColumns(o)}return t},this.dependencies.errorHandler.reject)},t.prototype.registerFieldChangeCallback=function(e,t,r){return this.itemHandler.registerFieldChangeCallback(e,t,r)},t.prototype.createChangesDelta=function(){return this.dependencies.changesDeltaFactory.construct()},t.prototype.getFirstErrorString=function(){for(var e in this.errors.global){if((s=this.errors.global[e]).level===n.error)return s.string}for(var t in this.errors.item){var r=this.errors.item[t];for(var i in r){var o=r[i];for(var e in o){var s;if((s=o[e]).level===n.error)return s.string}}}},t.prototype._setGlobalError=function(e,t,r,n){t?(this.errors.global[e]={string:r(),level:n},this.eventHandler.executeCallbacks("onSetGlobalError",function(t){return t(e,n)},!1),this._setIsValid()):this.clearGlobalError(e)},t.prototype._setItemError=function(e,t,r,n,i,s,a){n?(Object(o.V)(this.errors.item,[e,t,r],[{},{},{fieldString:i(),string:s(),level:a}]),this.eventHandler.executeCallbacks("onSetItemError",function(n){return n(e,t,r)},!1),this._setIsValid()):this.clearItemError(e,t,r)},t.prototype._setIsValid=function(){for(var e in this._isValid=!0,this.errors.global){if(this.errors.global[e].level===n.error)return void(this._isValid=!1)}for(var t in this.errors.item){var r=this.errors.item[t];for(var i in r){var o=r[i];for(var e in o){if(o[e].level===n.error)return void(this._isValid=!1)}}}},t.prototype.applyChangesFromParent=function(e,t,r){var n=this;void 0===t&&(t=!1),void 0===r&&(r=!1);var i=this.core.changesDeltaFactory.constructInternalDelta();for(var o in e.created){var s=e.created[o];i.setItemCreated(s.entry,s.fields)}for(var o in e.updated){s=e.updated[o];this.itemHandler.processItemEntryChanges(s,t,!0,r).status!==d.a.NO_CHANGES&&i.setItemUpdated(s.entry,s.changes.fields,s.changes.expandedColumns)}for(var a in e.deleted)for(var c=0,u=e.deleted[a];c<u.length;c++){var l=u[c];if(this.itemHandler.entries.clear(l),delete this.itemHandler.itemChanges[l.id],this.clearItemError(l.id),i.setItemDeleted(l),void 0!==this.itemHandler.deletedItems[l.itemType]){var h=this.itemHandler.deletedItems[l.itemType].indexOf(l);-1!==h&&this.itemHandler.deletedItems[l.itemType].splice(h,1)}}return this.core.collectionMatcherFactory.constructCachedQueryProcessor(this,function(e){return n.cachedQueryHandler.getCachedQueryObjectsByItemType(e)}).processDelta(i).__removeFromAndAddToCachedQueries(r,i).then(function(){return n.core.collectionMatcherFactory.constructCachedCollectionProcessor(n,function(e){return n.collectionHandler.collectionResources[e]}).processDelta(i).__removeFromAndAddToCollections(r,i)}).then(function(){for(var t=[],r=0,i=n.children;r<i.length;r++){var o=i[r];t.push(o.applyChangesFromParent(e))}return n.hasChanges=!1,n.detectChanges(),void 0!==n.validator&&(n.clearGlobalError(),n.validator.validateTransaction()),n.dependencies.promiseService.all(t).then(function(){},n.dependencies.promiseService.reject)})},t.prototype.applyChangesDelta=function(t){var r=this;return t.isEmpty()?this.dependencies.promiseService.when({created:[],rollback:s.c}):this.fetchUpdatedDerivedValuesFromDelta(t).then(function(){var n=e.prototype._applyChangesDelta.call(r,t),i=n.result,o=n.matchingDelta,s=n.internalChangesDelta,a=n.rollbackFunctions;for(var c in t.deleted)for(var u=function(e){r.itemHandler.entries.clear(e);var n=r.itemHandler.itemChanges[e.id];delete t.updated[e.id],delete r.itemHandler.itemChanges[e.id],s.setItemDeleted(e),o.setItemDeleted(e),r.clearItemError(e.id),a.push(function(t){t.setItemUpdated(e,n.changes)}),e.isLocal()||(void 0===r.itemHandler.deletedItems[e.itemType]&&(r.itemHandler.deletedItems[e.itemType]=[]),-1===r.itemHandler.deletedItems[e.itemType].indexOf(e)&&r.itemHandler.deletedItems[e.itemType].push(e))},l=0,h=t.deleted[c];l<h.length;l++){u(h[l])}return r.core.collectionMatcherFactory.constructCachedQueryProcessor(r,function(e){return r.cachedQueryHandler.getCachedQueryObjectsByItemType(e)}).processDelta(o).__removeFromAndAddToCachedQueries(!1,o).then(function(){return r.core.collectionMatcherFactory.constructCachedCollectionProcessor(r,function(e){return r.collectionHandler.collectionResources[e]}).processDelta(o).__removeFromAndAddToCollections(!1,o)}).then(function(){for(var e=0,t=r.children;e<t.length;e++){t[e].applyChangesFromParent(s)}return r.hasChanges=!1,r.detectChanges(),void 0!==r.validator&&r.validator.validateTransaction(),i})})},t.prototype.getServerCache=function(){return this.parent.getServerCache()},t.prototype.getParent=function(e,t,r){var n;if(void 0===t&&(t=!1),void 0!==r)n=r;else{var i=this.itemHandler.itemChanges[e.id];void 0!==i&&(n=i[t?"initial":"changes"])}if(void 0!==n){var o=this.getParentFromFields(e,n);if(null!==o)return o}return this.parent.getParent(e,t)},t.prototype.getCollectionChangesRecursively=function(e,t){var r,n=null===(r=this.cachedQueryHandler.cachedQueries[e])||void 0===r?void 0:r[t.string];if(void 0===n){if(void 0===(n=this.parent.getCollectionChangesRecursively(e,t)))return;this.cachedQueryHandler.setCachedQuery(e,t,n.items.slice(),!0===n.requestColumns||n.requestColumns.slice()).resolve()}return n},t.prototype.getItemChangesRecursively=function(e,t){void 0===t&&(t=!0);var r=this.itemHandler.itemChanges[e],n=this.getLocalItemEntry(e);return void 0!==r&&void 0!==n?t?this.dependencies.apiFormatter.copyFields(r.changes,{},n.columns.main):r.changes:this.parent.getItemChangesRecursively(e,t)},t.prototype.clearCollectionResource=function(e){return this.collectionHandler.clearResource(e)},t.prototype.isLockable=function(){return void 0!==this.rootItem&&this.rootItem.isLockable()},t.prototype.disableChangesWatcher=function(){null!==this.changesInterval&&(clearInterval(this.changesInterval),this.changesInterval=null)},t.prototype.enableChangesWatcher=function(){var e=this;null!==this.changesInterval&&(console.warn("Changes watcher already running!",this),this.disableChangesWatcher()),this.changesInterval=window.setInterval(function(){e.detectChanges()&&(e.disableChangesWatcher(),e.isLockable()&&e.dependencies.lockService.fetchLock(e.rootItem))},3e3)},t.prototype.save=function(e,t,r,n){var o,s=this;return void 0===e&&(e=!1),void 0===t&&(t={}),this.isSaving?this.dependencies.errorHandler.reject():(this.isSaving=!0,this.detectChanges(),this.disableChangesWatcher(),(this.isLockable()?this.dependencies.lockService.fetchLock(this.rootItem):this.dependencies.promiseService.when()).then(function(){return s.eventHandler.executeCallbacks("onBeforeSave",function(e){return e(s)},e)},this.dependencies.errorHandler.reject).then(function(){return s.tabRequestParameters=Object(i.a)(Object(i.a)({},s.tabRequestParameters),t),s.parent.applyChangesFromChild(s,r,n)}).then(function(t){return o=t,s.tabRequestParameters={},s.isLockable()&&s.dependencies.lockService.clearLock(s.rootItem),s.hasChanges=!1,s.eventHandler.executeCallbacks("onSaveSuccess",function(e){return e(s,o)},e)},this.dependencies.errorHandler.reject).then(function(){return e||s.enableChangesWatcher(),s.isSaving=!1,o},this.dependencies.errorHandler.reject).catch(function(e){return s.isSaving=!1,s.dependencies.errorHandler.reject(e)}))},t.prototype.detectChanges=function(){return!!this.hasChanges||(this.itemHandler.detectChanges()?this.hasChanges=!0:this.hasChanges=!1)},t.prototype.clearItem=function(e){this.clearItemEntry(e.entry)},t.prototype.clearItemEntry=function(e){return this.itemHandler.clearItemEntry(e)},t.prototype.onBeforeSave=function(e,t,r,n){return this.eventHandler.registerCallback("onBeforeSave",e,t,r,n)},t.prototype.onSaveSuccess=function(e,t,r,n){return this.eventHandler.registerCallback("onSaveSuccess",e,t,r,n)},t.prototype.getModuleChanges=function(){if(void 0===this.rootItem)throw new Error("No root item for transaction cache "+this);return this.dependencies.moduleChangesCompilationFactory.construct(this).process()},t.prototype.updateItemIdMap=function(e,t){if(void 0!==t)for(var r in t){var n=t[r];void 0!==e[r]&&(e[n]=e[r],delete e[r])}},t.prototype.getAllLinkCollections=function(e,t,r){var n,i=this;return this.dependencies.apiRequestService.query(e,{},(n={},n[e]=["id"],n)).then(function(n){return i.getLinkCollections(e,n.links[e],t,r)},this.dependencies.errorHandler.reject)},t.prototype.getLinkCollectionsFromDef=function(e,t,r){var n=this;return this.cachedQueryHandler.__fetchLinkedCachedQueryItems(e,t,r.itemType,r.options).then(function(t){var i={};for(var o in t){var s=t[o],a=n.core.collectionEntryService.cloneOptions(r.options,{itemType:e,itemId:Number(o)});a.columns=s.requestColumns,i[o]=n.createCollectionResource(r.itemType,a,s.items)}return i},this.dependencies.errorHandler.reject)},t.prototype.getLinkCollections=function(e,t,r,n){var i=this,o=new c.a(n);return this.cachedQueryHandler.__fetchLinkedCachedQueryItems(e,t,r,o).then(function(t){var n={};for(var s in t){var a=t[s],c=i.core.collectionEntryService.cloneOptions(o,{itemType:e,itemId:Number(s)});c.columns=a.requestColumns,n[s]=i.createCollectionResource(r,c,a.items)}return n},this.dependencies.errorHandler.reject)},t.prototype.getCollectionFromDef=function(e){var t=this;return this.cachedQueryHandler.__fetchCachedQueryItem(e.itemType,e.options).then(function(r){return t.createCollectionResource(e.itemType,e.options,r.items)},this.dependencies.errorHandler.reject)},t.prototype.getCollection=function(e,t){var r=this;return this.cachedQueryHandler.__fetchCachedQueryItem(e,new c.a(t)).then(function(n){return r.createCollectionResource(e,t,n.items)},this.dependencies.errorHandler.reject)},t.prototype.getCollectionDef=function(e,t){return{itemType:e,options:new c.a(t)}},t.prototype.getLinkCollectionsDef=function(e,t,r){return{itemType:e,linkField:t,options:new c.a(r)}},t.prototype.getItemByState=function(e,t,r,n){void 0===r&&(r={});var i=this.dependencies.keyService.parseStateKey(t);if(null===i){var o=t;if(!this.dependencies.keyService.isLocalId(o)||void 0!==this.getLocalItemEntryByItemId(e,o))return this.getItemById(e,o,r,n)}else if(i.type===u.StateKeyType.Duplicate)return this.getDuplicateById(e,i.itemId,r,!1,n);return this.getNewResource(e,r,!1,n)},t.prototype.getDuplicateById=function(e,t,r,n,i){return void 0===r&&(r={}),void 0===r.templateOptions&&(r.templateOptions={}),void 0===r.templateOptions.item&&(r.templateOptions.item=t),this.getNewResourceWithId(e,this.dependencies.keyService.getLocalDuplicateId(),r,n,i)},t.prototype.getNewResourceWithId=function(e,t,r,n,i){var o=this;return void 0===n&&(n=!1),this.itemHandler.fetchNewItemEntry(e,t,new a.e(r)).then(function(r){for(var s,a={},c=0,u=r.created;c<u.length;c++){var l=u[c];l.itemType!==e||l.itemId!==t?(void 0===a[l.itemType]&&(a[l.itemType]=[]),a[l.itemType].push(l)):s=l}if(void 0===s)throw new Error("The ItemEntry with the requested ItemId was not in the template response");var h=o.createItemResource(s,i,!0);return n?{main:h,linked:o.processLinkedItems(a)}:h},this.dependencies.errorHandler.reject)},t.prototype.getNewResource=function(e,t,r,n){return void 0===t&&(t={}),this.getNewResourceWithId(e,this.dependencies.keyService.getLocalId(),t,r,n)},t.prototype.getItemsByQuery=function(e,t,r){var n=this;return void 0===r&&(r={}),this.cachedQueryHandler.__fetchCachedQueryItem(e,new c.a({query:t,parent:r.parent,columns:r.columns})).then(function(e){return n.createItemResources(e.items)},this.dependencies.errorHandler.reject)},t.prototype.getItemsById=function(e,t,r){var n=this;return void 0===r&&(r={}),this.itemHandler.fetchItemEntries(e,t,new a.e(r)).then(function(e){return n.createItemResources(e)},this.dependencies.errorHandler.reject)},t.prototype.getItemById=function(e,t,r,n){var i=this;return void 0===r&&(r={}),this.itemHandler.fetchItemEntry(e,t,new a.e(r)).then(function(e){return i.createItemResource(e,n)},this.dependencies.errorHandler.reject)},t.prototype.fetchTitle=function(e,t){return this.itemHandler.fetchTitle(e,t)},t.prototype.applyChangesFromChild=function(e,t,r){var n=this,i=e.getDelta();for(var o in i.moved){var s=i.moved[o];i.setItemUpdated(s.entry,{},null,s.to),delete i.moved[o]}for(var o in i.updated){s=i.updated[o];void 0===this.itemHandler.itemChanges[o]?this.itemHandler.itemChanges[o]=this.itemHandler.copyTransactionItemEntryChanges(e.itemHandler.itemChanges[o],s.entry):this.itemHandler.processItemEntryChanges(s,!0)}for(var o in i.created){s=i.created[o];this.itemHandler.entries.add(s.entry),e.itemHandler.entries.clear(s.entry);var a=this.itemHandler.itemChanges[s.entry.id]=this.itemHandler.copyTransactionItemEntryChanges(e.itemHandler.itemChanges[o],s.entry),c=this.dependencies.itemEntryService.getDisplayName(s.entry,a.changes);void 0!==c&&(a.changes.displayname=c)}for(var u in i.deleted){void 0===this.itemHandler.deletedItems[u]&&(this.itemHandler.deletedItems[u]=[]);for(var l=0,h=i.deleted[u];l<h.length;l++){var d=h[l];d.isLocal()||(this.itemHandler.entries.clear(d),this.itemHandler.deletedItems[u].push(d),this.clearItemError(d.id))}}return this.hasChanges=!0,this.expandItemsFromDelta(i).then(function(){return n.core.collectionMatcherFactory.constructCachedQueryProcessor(n,function(e){return n.cachedQueryHandler.getCachedQueryObjectsByItemType(e)}).processDelta(i).__removeFromAndAddToCachedQueries(!1,i)}).then(function(){return n.core.collectionMatcherFactory.constructCachedCollectionProcessor(n,function(e){return n.collectionHandler.collectionResources[e]}).processDelta(i).__removeFromAndAddToCollections(!1,i)}).then(function(){for(var t=0,r=n.children;t<r.length;t++){var o=r[t];o!==e&&o.applyChangesFromParent(i)}return void 0!==n.validator&&n.validator.validateTransaction(),i.itemIdConversionMap})},t.prototype.getLocalItemEntryChangesTuple=function(e){var t=this.getLocalItemEntry(e);if(void 0===t)throw new Error("Tried to get a local ItemEntry with entryId '"+e+"' but couldn't find it");return{entry:t,changes:this.itemHandler.itemChanges[e]}},t.prototype.getLocalItemEntry=function(e){var t=this.itemHandler.entries.getByEntryId(e);return void 0!==t?t:this.parent.getLocalItemEntry(e)},t.prototype.getLocalItemEntryByItemId=function(e,t){var r=this.itemHandler.entries.get(e,t);return void 0!==r?r:this.parent.getLocalItemEntryByItemId(e,t)},t.prototype.getDelta=function(){var e=this.dependencies.changesDeltaFactory.constructInternalDelta();for(var t in this.itemHandler.itemChanges){var r=this.getLocalItemEntryChangesTuple(Number(t));if(this.itemHandler.entries.contains(r.entry.itemType,r.entry.itemId)&&r.entry.isLocal())r.entry.itemId=r.changes.changes.id,e.setItemCreated(r.entry,r.changes.changes);else{var n=this.getParent(r.entry);if(null!==n){var i=this.getParent(r.entry,!0);this.dependencies.itemEntryService.matchParent(i,n)||e.setItemMoved(r.entry,n)}this.dependencies.apiFormatter.hasChanges(r.changes.initial,r.changes.changes,r.entry.columns.main)&&e.setItemUpdated(r.entry,r.changes.changes)}}for(var o in this.itemHandler.deletedItems)e.setItemsDeleted(this.itemHandler.deletedItems[o]);return e},t.prototype.createItemResource=function(e,t,r){return void 0===t&&(t=!1),t&&(this.rootItem=e),void 0===this.itemHandler.itemChanges[e.id]&&(this.itemHandler.itemChanges[e.id]={initial:this.getItemChangesRecursively(e.id),changes:this.getItemChangesRecursively(e.id)}),this.dependencies.itemResourceFactory.construct(e,this,r)},t.prototype.createItemResources=function(e){for(var t=[],r=0,n=e;r<n.length;r++){var i=n[r];void 0===this.itemHandler.itemChanges[i.id]&&(this.itemHandler.itemChanges[i.id]={initial:this.getItemChangesRecursively(i.id,!0),changes:this.getItemChangesRecursively(i.id,!0)});var o=this.dependencies.itemResourceFactory.construct(i,this);t.push(o)}return t},t.prototype.processLinkedItems=function(e){var t={};for(var r in e)t[r]=this.createItemResources(e[r]);return t},t.prototype.createCollectionResource=function(e,t,r){var n=this.dependencies.collectionResourceFactory.construct(e,t,this,r);return this.collectionHandler.addResource(n),n},t.prototype.getChangesFromItemChanges=function(e){return e.changes},t.prototype.expandItemsFromDelta=function(e){var t={},r={},n=function(e){void 0===t[e.itemType]&&(t[e.itemType]=[]),t[e.itemType].push(e)};for(var i in e.created)n(e.created[i].entry);for(var i in e.updated)n(e.updated[i].entry);for(var o in t){var s=this.cachedQueryHandler.cachedQueries[o];if(void 0!==s){var a=this.dependencies.requestColumnExpansionFactory.construct();for(var c in s){var u=s[c];a.expandWithRequestColumns(u.itemType,u.requestColumns)}r[o]=a.get()[o]}}var l=[];for(var o in r)l.push(this.itemHandler.expandLocalItemEntries(e,o,t[o],r[o],this.dependencies.columnCache.retrieve(o,r[o]).cached));return this.dependencies.promiseService.all(l)},t.prototype.clearGlobalError=function(e){var t=this,r=function(e){t.eventHandler.executeCallbacks("onClearGlobalError",function(t){return t(e)},!1)};if(void 0===e){for(var n in this.errors.global)r(n);this.errors.global={}}else r(e),delete this.errors.global[e];this._setIsValid()},t.prototype.clearItemError=function(e,t,r){var n,i,o=this,s=function(e,t,r){var n,i;o.eventHandler.executeCallbacks("onClearItemError",function(n){return n(e,t,r)},!1),void 0!==(null===(i=null===(n=o.errors.item[e])||void 0===n?void 0:n[t])||void 0===i?void 0:i[r])&&delete o.errors.item[e][t][r]};if(void 0===e){for(var a in this.errors.item){var c=this.errors.item[a];for(var u in c){var h=c[u];for(var d in h)s(Number(a),u,d)}}return this.errors.item={},void this._setIsValid()}if(void 0===t){c=this.errors.item[e];for(var u in c){h=c[u];for(var d in h)s(Number(e),u,d)}return delete this.errors.item[e],void this._setIsValid()}if(void 0!==this.errors.item[e]){if(void 0===r){h=this.errors.item[e][t];for(var d in h)s(Number(e),t,d);return delete this.errors.item[e][t],Object(l.j)(this.errors.item[e])||this.clearItemError(e),void this._setIsValid()}s(e,t,r),void 0!==(null===(i=null===(n=this.errors.item[e])||void 0===n?void 0:n[t])||void 0===i?void 0:i[r])&&delete this.errors.item[e][t][r],Object(l.j)(this.errors.item[e][t])||this.clearItemError(e,t),this._setIsValid()}else this._setIsValid()},t}(h.a)},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(9),i=r(18),o=function(){function e(e,t){this.dependencies=e,this.core=t,this.children=[]}return e.prototype.onChildDestroy=function(e){var t=this.children.indexOf(e);-1!==t&&this.children.splice(t,1)},e.prototype.getTransactionChain=function(){var e=[],t=this;do{e.push(t),t=t.parent}while(null!==t);return e},e.prototype.getCurrentItemEntryCache=function(){return this.itemHandler.entries},e.prototype.getParentFromFields=function(e,t){if(void 0===t)return null;if(null!==e.columns.link)return{itemType:e.columns.link.apiColumn.itemType,itemId:t[e.columns.link.id]};var r=e.columns.response[e.itemType];return void 0!==r.itemtype&&void 0!==r.item?{itemType:t.itemtype,itemId:t.item}:null},e.prototype._applyChangesDelta=function(e){var t=this,r=this.dependencies.changesDeltaFactory.constructInternalDelta(),o=this.dependencies.changesDeltaFactory.constructInternalDelta();for(var s in e._queryResults)for(var a in e._queryResults[s])r._setQueryResult(s,a,e._queryResults[s][a]),o._setQueryResult(s,a,e._queryResults[s][a]);var c=[],u=[];e.created.forEach(function(n){var i=t.getLocalItemEntryByItemId(n.columns.itemType,n.itemId);if(void 0!==i)return e.setItemUpdated(i,n.fields,t.core.columnExpansionFactory.construct(n.columns.itemType,!!n.columns.requestColumnsTrue||n.columns.request,n.columns.response).run(i.columns)),void e.created.remove(i.itemType,i.itemId);var s=t.itemHandler.createItemEntry(n),a=t.getChangesFromItemChanges(t.itemHandler.itemChanges[s.id]);c.push(s),r.setItemCreated(s,a),o.setItemCreated(s,a),u.push(function(e){return e.setItemDeleted(s)})});var l=function(t){var s=e.updated[t],a=h.itemHandler.processItemEntryChanges(s,!0,!1,!1,!0),c=a.previous,l=a.status;if(r.setItemUpdated(s.entry,s.changes.fields,s.changes.expandedColumns),l!==n.a.NO_CHANGES&&o.setItemUpdated(s.entry,s.changes.fields,s.changes.expandedColumns),l===n.a.CACHED&&u.push(function(e){return e.setItemUpdated(s.entry,c)}),null!==s.changes.parent&&(r.setItemMoved(s.entry,s.changes.parent),o.setItemMoved(s.entry,s.changes.parent)),h.itemHandler instanceof i.a){var d=h.itemHandler.deletedItems[s.entry.itemType];if(void 0===d)return"continue";var p=d.indexOf(s.entry);p>-1&&d.splice(p,1)}},h=this;for(var d in e.updated)l(d);return{result:{created:c,rollback:function(){for(var e=t.dependencies.changesDeltaFactory.construct(),r=0,n=u;r<n.length;r++){(0,n[r])(e)}return t.applyChangesDelta(e)}},matchingDelta:o,internalChangesDelta:r,rollbackFunctions:u}},e.prototype.fetchUpdatedDerivedValuesFromDelta=function(e){var t=[];for(var r in e.updated){var n=e.updated[r],i=[],o=this.itemHandler.itemChanges[n.entry.id];if(void 0!==o){for(var s=this.getChangesFromItemChanges(o),a=0,c=n.entry.columns.root;a<c.length;a++){var u=c[a];!n.changes.fields.hasOwnProperty(u.id)||n.changes.fields[u.id]===s[u.id]||void 0!==e.itemIdConversionMap[u.itemType]&&e.itemIdConversionMap[u.itemType][s[u.id]]===n.changes.fields[u.id]||i.push(u)}0!==i.length&&t.push(this.itemHandler.resolveDerivedValues([n.entry],i,e))}}return this.dependencies.promiseService.all(t)},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(1),i=function(){function e(e){this.itemEntryService=e,this.updated={},this.deleted={},this.itemIdConversionMap={},this._queryResults={}}return e.prototype._setQueryResult=function(e,t,r){void 0===this._queryResults[e]&&(this._queryResults[e]={}),this._queryResults[e][t]=r},e.prototype.setItemUpdated=function(e,t,r,n){void 0===r&&(r=null),void 0===n&&(n=null),void 0===this.updated[e.id]&&(this.updated[e.id]={entry:e,changes:{fields:{},expandedColumns:null,parent:n}});var i=this.updated[e.id];if(null!==n){var o=this.itemEntryService.getLinkFieldsByParent(n,e.itemType);for(var s in o)t[s]=o[s]}for(var a in t){var c=Object.getOwnPropertyDescriptor(t,a);void 0!==c?Object.defineProperty(i.changes.fields,a,c):i.changes.fields[a]=t[a]}return null!==r&&(i.changes.expandedColumns=r),t.hasOwnProperty("id")&&(void 0===this.itemIdConversionMap[e.itemType]&&(this.itemIdConversionMap[e.itemType]={}),this.itemIdConversionMap[e.itemType][e.itemId]=t.id),this},e.prototype.setItemDeleted=function(e){return this.setItemsDeleted([e])},e.prototype.setItemsDeleted=function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];void 0===this.deleted[n.itemType]&&(this.deleted[n.itemType]=[]),this.deleted[n.itemType].indexOf(n)>-1||this.deleted[n.itemType].push(n)}return this},e.prototype.isEmpty=function(){return!Object(n.j)(this.updated)&&!Object(n.j)(this.deleted)},e}()},function(e,t,r){"use strict";r.r(t);var n=r(10);r.d(t,"RmCore",function(){return n.a}),r.d(t,"noop",function(){return n.c}),r.d(t,"identity",function(){return n.b});var i=r(4);r.d(t,"ALL_PERMISSIONS",function(){return i.a}),r.d(t,"COLUMN_SEPERATOR",function(){return i.b}),r.d(t,"RENDER_AS_SEPERATOR",function(){return i.g}),r.d(t,"NEW_PREFIX",function(){return i.f}),r.d(t,"DUPLICATE_PREFIX",function(){return i.d}),r.d(t,"NEW_KEYWORD",function(){return i.e}),r.d(t,"DUPLICATE_KEYWORD",function(){return i.c});var o=r(5);r.d(t,"ItemEntryOptions",function(){return o.e}),r.d(t,"ItemEntry",function(){return o.d}),r.d(t,"ItemResource",function(){return o.f}),r.d(t,"CollectionOptions",function(){return o.b}),r.d(t,"CollectionEntry",function(){return o.a}),r.d(t,"CollectionResource",function(){return o.c}),r.d(t,"Template",function(){return o.g});var s=r(32);for(var a in s)["RmCore","noop","identity","ALL_PERMISSIONS","COLUMN_SEPERATOR","RENDER_AS_SEPERATOR","NEW_PREFIX","DUPLICATE_PREFIX","NEW_KEYWORD","DUPLICATE_KEYWORD","ItemEntryOptions","ItemEntry","ItemResource","CollectionOptions","CollectionEntry","CollectionResource","Template","default"].indexOf(a)<0&&function(e){r.d(t,e,function(){return s[e]})}(a);var c=r(0);r.d(t,"ApiFormatter",function(){return c.b}),r.d(t,"ApiRequestService",function(){return c.c}),r.d(t,"ApiResponseProcessor",function(){return c.d}),r.d(t,"ChangesCompilation",function(){return c.f}),r.d(t,"ChangesProcessor",function(){return c.i}),r.d(t,"CollectionEntryService",function(){return c.j}),r.d(t,"CollectionMatcherCachedCollectionProcessor",function(){return c.k}),r.d(t,"CollectionResourceService",function(){return c.l}),r.d(t,"ColumnCache",function(){return c.m}),r.d(t,"ColumnExpansion",function(){return c.n}),r.d(t,"ColumnHandler",function(){return c.o}),r.d(t,"ColumnInfo",function(){return c.p}),r.d(t,"ColumnSet",function(){return c.q}),r.d(t,"ColumnSubsetCache",function(){return c.r}),r.d(t,"ColumnUtil",function(){return c.s}),r.d(t,"ConversionMapService",function(){return c.t}),r.d(t,"CreateRequest",function(){return c.u}),r.d(t,"ItemCache",function(){return c.x}),r.d(t,"ItemEntryService",function(){return c.z}),r.d(t,"KeyService",function(){return c.A}),r.d(t,"TransactionEventHandler",function(){return c.R}),r.d(t,"LockService",function(){return c.B}),r.d(t,"ModuleChangesCompilation",function(){return c.C}),r.d(t,"QueryMatcher",function(){return c.D}),r.d(t,"CONSTANTS",function(){return c.e}),r.d(t,"QueryParser",function(){return c.E}),r.d(t,"QueryService",function(){return c.F}),r.d(t,"RequestColumnExpansion",function(){return c.I}),r.d(t,"SocketMessageHandler",function(){return c.M}),r.d(t,"findIndex",function(){return c.ab}),r.d(t,"instantiateOptions",function(){return c.fb}),r.d(t,"shallowMerge",function(){return c.vb}),r.d(t,"hasProperties",function(){return c.db}),r.d(t,"getFirstProperty",function(){return c.bb}),r.d(t,"inArray",function(){return c.eb}),r.d(t,"filterArray",function(){return c.Z}),r.d(t,"emptyArray",function(){return c.W}),r.d(t,"pathExists",function(){return c.ub}),r.d(t,"createPath",function(){return c.V}),r.d(t,"getPath",function(){return c.cb}),r.d(t,"extend",function(){return c.Y}),r.d(t,"merge",function(){return c.tb}),r.d(t,"isObject",function(){return c.ob}),r.d(t,"isBlankObject",function(){return c.hb}),r.d(t,"isString",function(){return c.rb}),r.d(t,"isNumber",function(){return c.nb}),r.d(t,"isDate",function(){return c.jb}),r.d(t,"isArray",function(){return c.gb}),r.d(t,"isFunction",function(){return c.mb}),r.d(t,"isPromiseLike",function(){return c.pb}),r.d(t,"isRegExp",function(){return c.qb}),r.d(t,"isBoolean",function(){return c.ib}),r.d(t,"isElement",function(){return c.lb}),r.d(t,"isWindow",function(){return c.sb}),r.d(t,"isDefined",function(){return c.kb}),r.d(t,"equals",function(){return c.X}),r.d(t,"copy",function(){return c.U}),r.d(t,"AbstractCache",function(){return c.a}),r.d(t,"ServerCache",function(){return c.J}),r.d(t,"ServerItemHandler",function(){return c.L}),r.d(t,"ServerCachedQueryHandler",function(){return c.K}),r.d(t,"TransactionErrorLevel",function(){return c.Q}),r.d(t,"TransactionCache",function(){return c.N}),r.d(t,"TransactionItemHandler",function(){return c.S}),r.d(t,"TransactionCachedQueryHandler",function(){return c.O}),r.d(t,"TransactionCollectionHandler",function(){return c.P}),r.d(t,"TransactionValidator",function(){return c.T}),r.d(t,"ChangesDeltaBase",function(){return c.h}),r.d(t,"ChangesDelta",function(){return c.g}),r.d(t,"InternalChangesDelta",function(){return c.w}),r.d(t,"RequestBufferManager",function(){return c.H}),r.d(t,"RequestBuffer",function(){return c.G}),r.d(t,"ItemCreateService",function(){return c.y}),r.d(t,"CreatedChangesDelta",function(){return c.v});var u=r(7);r.d(t,"ApiResponseProcessorFactory",function(){return u.a}),r.d(t,"ChangesCompilationFactory",function(){return u.b}),r.d(t,"CollectionEntryFactory",function(){return u.e}),r.d(t,"CollectionMatcherFactory",function(){return u.f}),r.d(t,"CollectionResourceFactory",function(){return u.g}),r.d(t,"ColumnExpansionFactory",function(){return u.h}),r.d(t,"ColumnInfoFactory",function(){return u.i}),r.d(t,"ColumnSetFactory",function(){return u.j}),r.d(t,"ColumnSubsetCacheFactory",function(){return u.k}),r.d(t,"CreateRequestFactory",function(){return u.l}),r.d(t,"ItemCacheFactory",function(){return u.m}),r.d(t,"ItemEntryFactory",function(){return u.n}),r.d(t,"ItemResourceFactory",function(){return u.o}),r.d(t,"TransactionCacheFactory",function(){return u.u}),r.d(t,"ModuleChangesCompilationFactory",function(){return u.p}),r.d(t,"QueryMatcherFactory",function(){return u.q}),r.d(t,"QueryParserFactory",function(){return u.r}),r.d(t,"RequestColumnExpansionFactory",function(){return u.s}),r.d(t,"TemplateFactory",function(){return u.t}),r.d(t,"ChangesDeltaFactory",function(){return u.c}),r.d(t,"ChangesProcessorFactory",function(){return u.d});var l=r(8);for(var a in l)["RmCore","noop","identity","ALL_PERMISSIONS","COLUMN_SEPERATOR","RENDER_AS_SEPERATOR","NEW_PREFIX","DUPLICATE_PREFIX","NEW_KEYWORD","DUPLICATE_KEYWORD","ItemEntryOptions","ItemEntry","ItemResource","CollectionOptions","CollectionEntry","CollectionResource","Template","ApiFormatter","ApiRequestService","ApiResponseProcessor","ChangesCompilation","ChangesProcessor","CollectionEntryService","CollectionMatcherCachedCollectionProcessor","CollectionResourceService","ColumnCache","ColumnExpansion","ColumnHandler","ColumnInfo","ColumnSet","ColumnSubsetCache","ColumnUtil","ConversionMapService","CreateRequest","ItemCache","ItemEntryService","KeyService","TransactionEventHandler","LockService","ModuleChangesCompilation","QueryMatcher","CONSTANTS","QueryParser","QueryService","RequestColumnExpansion","SocketMessageHandler","findIndex","instantiateOptions","shallowMerge","hasProperties","getFirstProperty","inArray","filterArray","emptyArray","pathExists","createPath","getPath","extend","merge","isObject","isBlankObject","isString","isNumber","isDate","isArray","isFunction","isPromiseLike","isRegExp","isBoolean","isElement","isWindow","isDefined","equals","copy","AbstractCache","ServerCache","ServerItemHandler","ServerCachedQueryHandler","TransactionErrorLevel","TransactionCache","TransactionItemHandler","TransactionCachedQueryHandler","TransactionCollectionHandler","TransactionValidator","ChangesDeltaBase","ChangesDelta","InternalChangesDelta","RequestBufferManager","RequestBuffer","ItemCreateService","CreatedChangesDelta","ApiResponseProcessorFactory","ChangesCompilationFactory","CollectionEntryFactory","CollectionMatcherFactory","CollectionResourceFactory","ColumnExpansionFactory","ColumnInfoFactory","ColumnSetFactory","ColumnSubsetCacheFactory","CreateRequestFactory","ItemCacheFactory","ItemEntryFactory","ItemResourceFactory","TransactionCacheFactory","ModuleChangesCompilationFactory","QueryMatcherFactory","QueryParserFactory","RequestColumnExpansionFactory","TemplateFactory","ChangesDeltaFactory","ChangesProcessorFactory","default"].indexOf(a)<0&&function(e){r.d(t,e,function(){return l[e]})}(a)},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(3),i=r(13),o=function(e){function t(t,r,n,i,o,s){var a=e.call(this,n,i,o)||this;return a.apiRequestService=t,a.promiseService=r,a.getCollections=s,a.map={},a}return Object(n.b)(t,e),t.prototype.__removeFromAndAddToCollections=function(e,t){void 0===e&&(e=!1);var r=[],n=function(n){var s,a=o.map[n],c=o.groupItemEntries(a.matches);if(a.collectionResources.forEach(function(t){return t.removeItemResources(c.notFitting,e)}),a.collectionResources.forEach(function(t){return t.addItemResources(c.fitting,!1,e)}),c.maybe.length>0){if(o.transaction instanceof i.a)for(var u=0,l=c.maybe;u<l.length;u++){var h=l[u];o.transaction.itemHandler.detectEntryChanges(h.id)&&console.error("!! Trying to re-query 'maybe' matching results but one of the entries has changes, please report this to Martijn !!")}r.push(o.apiRequestService.query(a.itemType,a.query.object,(s={},s[a.itemType]=["id"],s)).then(function(e){void 0!==t&&t._setQueryResult(a.itemType,a.query.string,e.links[a.itemType]),a.collectionResources.forEach(function(t){return t.addItemResources(c.maybe.filter(function(t){return e.links[a.itemType].indexOf(t.itemId)>-1}))})}).then(function(){},function(){}))}},o=this;for(var s in this.map)n(s);return this.promiseService.all(r)},t.prototype._expand=function(e,t){var r=this.getCollections(e.itemType);for(var n in r){var i=r[n];if(0!==i.length){var o=i[0],s=o.entry.query,a=o.entry.itemType+"-"+n;void 0===this.map[a]&&(this.map[a]={itemType:e.itemType,query:o.entry.query,collectionResources:r[n],matches:{}});var c=this.map[a].matches;void 0===c[e.itemId]&&(c[e.itemId]={item:e,isMatch:t(e.itemType,s)})}}return this},t}(r(28).a)},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n=r(3),i=r(5),o=r(0),s=r(9),a=function(e){function t(t,r,n){var i=e.call(this,t.columnUtil,t.apiFormatter,t.itemEntryFactory,t.promiseService,t.errorHandler,t.requestColumnExpansionFactory,t.itemCacheFactory,r)||this;return i.dependencies=t,i.transaction=r,i.validator=n,i.deletedItems={},i.itemChanges={},i.fieldChangeCallbacks={},i}return Object(n.b)(t,e),t.prototype.registerFieldChangeCallback=function(e,t,r){Object(o.V)(this.fieldChangeCallbacks,[e,t],[{},[]]);var n=this.fieldChangeCallbacks[e][t];return n.push(r),function(){var e=n.indexOf(r);-1!==e&&n.splice(e,1)}},t.prototype.copyTransactionItemEntryChanges=function(e,t){return{initial:this.apiFormatter.copyFields(e.initial,{},t.columns.main),changes:this.apiFormatter.copyFields(e.changes,{},t.columns.main)}},t.prototype.createItemEntry=function(t){var r=e.prototype.createItemEntry.call(this,t),n=this.dependencies.itemEntryService.getLocalDefaultValues();for(var i in n)t.fields[i]=n[i];var o=this.apiFormatter.copyFields(t.fields,{},t.columns.main);return this.itemChanges[r.id]={initial:t.fields,changes:o},this.itemChanges[r.id].initial.id=r.itemId,this.itemChanges[r.id].changes.id=r.itemId,void 0!==this.validator&&this.validator.validateItem(r,t.fields,t.fields),r},t.prototype.formatRequest=function(e){var t=e.columns.main;return e.isLocal()?this.apiFormatter.formatRequestLocal(this.itemChanges[e.id].changes,t):this.apiFormatter.formatRequest(this.itemChanges[e.id].initial,this.itemChanges[e.id].changes,t)},t.prototype.detectChanges=function(){for(var e in this.entries.entriesByEntryId)return!0;for(var t in this.deletedItems)if(this.deletedItems[t].length>0)return!0;for(var r in this.itemChanges){if(this.detectEntryChanges(Number(r)))return!0}return!1},t.prototype.detectEntryChanges=function(e){var t=this.transaction.getLocalItemEntry(e),r=this.itemChanges[e];return void 0!==r&&this.apiFormatter.hasChanges(r.initial,r.changes,t.columns.main)},t.prototype.processItemEntryChanges=function(e,t,r,n,i){var o,a=this;void 0===t&&(t=!1),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1);var c=e.entry,u=e.changes;if(void 0===this.itemChanges[c.id]){if(!i)return{status:s.a.NOT_CACHED,previous:null};this.itemChanges[c.id]={initial:this.transaction.getItemChangesRecursively(c.id),changes:this.transaction.getItemChangesRecursively(c.id)}}if(null!==u.expandedColumns&&(c.columns=u.expandedColumns.merged),void 0!==u.fields.id){var l=c.itemId;c.itemId=u.fields.id,this.entries.updateItemId(c,l)}var h=this.itemChanges[c.id];if(!this.apiFormatter.hasChanges(u.fields,h.changes,c.columns.main,!0))return r&&this.apiFormatter.copyFields(u.fields,h.initial,c.columns.main),{status:s.a.NO_CHANGES,previous:null};var d=this.apiFormatter.copyFields(h.changes,{},c.columns.main);if(t?this.apiFormatter.copyFields(u.fields,h.changes,c.columns.main):this.apiFormatter.mergeCopyFields(h.initial,h.changes,u.fields,c.columns.main),r&&this.apiFormatter.copyFields(u.fields,h.initial,c.columns.main),void 0===u.fields.displayname){var p=this.dependencies.itemEntryService.getDisplayName(c,h.changes);void 0!==p&&(h.changes.displayname=p)}void 0!==this.validator&&this.validator.validateItem(c,h.changes,d);var m=null===(o=this.fieldChangeCallbacks[c.itemType])||void 0===o?void 0:o[c.itemId];if(void 0!==m)for(var f=0,y=m;f<y.length;f++){var v=y[f];try{v({itemEntry:c,compareField:function(e){return a.apiFormatter.compareFields(c.columns.response[c.itemType][e].type,h.changes[e],d[e])},fields:h.changes,isCalledAfterSocketUpdate:n,previous:d})}catch(e){this.dependencies.exceptionHandler(e)}}return{status:s.a.CACHED,previous:d}},t.prototype.cloneItemEntries=function(e,t,r,n){void 0===r&&(r={}),this.dependencies.conversionMapService.batchExpandConversionMap(t,r);for(var i=0,o=t;i<o.length;i++){var s=o[i];this.cloneItemEntry(e,s,r,n)}return[]},t.prototype.cloneItemEntry=function(e,t,r,n){void 0===r&&(r={});var i=this.transaction.getItemChangesRecursively(t.id),o=this.dependencies.conversionMapService.expandConversionMap(t,r),s=this.apiFormatter.copyFields(i,{},t.columns.main);return this.dependencies.conversionMapService.updateItemValues(s,s,t.columns.item,r),void 0!==n&&n(t.itemType,s),e._setItemCreated(o,s,t.columns),o},t.prototype.fetchItemEntriesByQuery=function(e,t,r){return this.transaction.getServerCache().itemHandler.fetchItemEntriesByQuery(e,t,r)},t.prototype.fetchItemEntry=function(e,t,r){var n=this;if(!this.dependencies.keyService.isLocalId(t))return this.transaction.getServerCache().itemHandler.fetchItemEntry(e,t,r);if(void 0===this.entries.get(e,t))return this.transaction.parent instanceof o.J?this.errorHandler.reject(this.dependencies.itemEntryService.createUnfoundLocalItemError(e)):this.transaction.parent.itemHandler.fetchItemEntry(e,t,r);r.columns=this.expandColumnsWithCachedQueryColumns(e,r.columns);var i=this.dependencies.changesDeltaFactory.construct(),s=this.dependencies.columnSubsetCacheFactory.construct(r.columns);return this.fetchLocalItemEntryData(i,e,t,s,r).then(function(e){return n.transaction.applyChangesDelta(i).then(function(){return e},n.errorHandler.reject)},this.errorHandler.reject)},t.prototype.fetchNewItemEntry=function(e,t,r){var n,i,o=this;return void 0!==this.entries.get(e,t)?this.errorHandler.reject(this.dependencies.itemEntryService.createExistingLocalItemError(e)):this.dependencies.templateCache.fetchTemplate(e,t,r.templateOptions,(n={},n[e]=r.columns,n),r.parent).then(function(n){if(void 0!==o.entries.get(e,t))return o.errorHandler.reject(o.dependencies.itemEntryService.createExistingLocalItemError(e));var i=o.dependencies.changesDeltaFactory.construct();return o.dependencies.itemCreateService.processTemplate(i,e,t,r.parent,n),o.transaction.applyChangesDelta(i)},this.errorHandler.reject).then(function(e){var t=(i=e).created.reduce(function(e,t){return e.hasOwnProperty(t.itemType)||(e[t.itemType]=[]),e[t.itemType].push(t),e},{}),r=o.transaction.createChangesDelta(),n=[];for(var s in t)n.push(o.resolveDerivedValues(t[s],t[s][0].columns.root,r));return o.promiseService.all(n)}).then(function(){return i})},t.prototype.fetchItemEntries=function(e,t,r){for(var n=[],i=[],o=0,s=t;o<s.length;o++){var a=s[o];this.dependencies.keyService.isLocalId(a)?i.push(a):n.push(a)}return this.promiseService.all({remote:this.transaction.getServerCache().itemHandler.fetchItemEntries(e,n,r),local:this.fetchLocalItemEntries(e,i,r)}).then(function(e){return e.remote.concat(e.local)})},t.prototype.fetchTitle=function(e,t){var r=this,n=this.dependencies.itemEntryService.getTitleField(e);return this.fetchItemEntry(e,t,new i.e({columns:[n]})).then(function(e){return r.transaction.getItemChangesRecursively(e.id,!1)[n]},this.errorHandler.reject)},t.prototype.resolveLocalItemEntry=function(e,t,r,n){var i=this;if(r.run(t.columns))return this.promiseService.when(t);var o=this.getColumnDifference(t,n.columns);return this.dependencies.columnHandler.fetch(t.itemType,o).then(function(r){return i.expandLocalItemEntries(e,t.itemType,[t],o,r)},this.errorHandler.reject).then(function(){return t},this.errorHandler.reject)},t.prototype.expandLocalItemEntries=function(e,t,r,n,i){if(0===r.length)return this.promiseService.when(r);for(var o=this.dependencies.columnExpansionFactory.construct(t,n,i),s=0,a=r;s<a.length;s++){var c=a[s],u=o.run(c.columns);null!==u&&this.expandLocalItemEntry(e,c,u)}return this.resolveDerivedValues(r,o.aggregateRootColumns(),e)},t.prototype.fetchLocalItemEntryData=function(e,t,r,n,i){var o=this.entries.get(t,r);return void 0===o?this.errorHandler.reject(this.dependencies.itemEntryService.createUnfoundLocalItemError(t)):this.resolveLocalItemEntry(e,o,n,i)},t.prototype.fetchLocalItemEntries=function(e,t,r){var n=this;r.columns=this.expandColumnsWithCachedQueryColumns(e,r.columns);for(var i=this.dependencies.changesDeltaFactory.construct(),s=this.dependencies.columnSubsetCacheFactory.construct(r.columns),a=[],c=[],u=0,l=t;u<l.length;u++){var h=l[u];if(void 0!==this.entries.get(e,h))a.push(this.fetchLocalItemEntryData(i,e,h,s,r));else{if(this.transaction.parent instanceof o.J)return this.errorHandler.reject(this.dependencies.itemEntryService.createUnfoundLocalItemError(e));c.push(h)}}if(c.length>0){if(this.transaction.parent instanceof o.J)throw new Error("Tried looking for local entries on the serverCache");a.push(this.transaction.parent.itemHandler.fetchLocalItemEntries(e,c,r))}return this.promiseService.all(a).then(function(){return n.transaction.applyChangesDelta(i).then(function(){return t.map(function(t){return n.transaction.getLocalItemEntryByItemId(e,t)})},n.errorHandler.reject)},this.errorHandler.reject)},t.prototype.getColumnDifference=function(e,t){return this.columnUtil.mergeRequestColumns(e.columns.request,t).difference},t.prototype.expandLocalItemEntry=function(e,t,r){var n=r.difference.main;if(t.columns=r.merged,0!==n.length){var i=this.getLocalValues(t,n);Object(o.db)(i)&&e.setItemUpdated(t,i,r)}},t.prototype.getLocalValues=function(e,t){for(var r=this.transaction.getParent(e),n=this.transaction.getChangesFromItemChanges(this.itemChanges[e.id]),i={},o=0,s=t;o<s.length;o++){var a=s[o],c=a.id;if(void 0===n[c]){var u=a.apiColumn.type;i[c]="link"===u&&null!==r?r.itemId:this.apiFormatter.getDefaultValue(u)}}return i},t}(s.b)},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(3),i=r(16),o=function(e){function t(t,r,n){var i=e.call(this,t.collectionEntryService,t.columnUtil,t.requestColumnExpansionFactory,t.promiseService,n)||this;return i.dependencies=t,i.itemHandler=r,i.transaction=n,i}return Object(n.b)(t,e),t.prototype.__fetchCachedQueryItem=function(e,t){var r=this.collectionEntryService.createQueryFromOptions(t);this.expandColumnsWithQueryColumns(e,t,r.object);var n=this.dependencies.columnSubsetCacheFactory.construct(t.columns);return this.__fetchItemEntriesByQueryData(e,t,n,r)},t.prototype.__expandCachedQuery=function(e,t){var r=this,n=this.columnUtil.mergeRequestColumns(e.requestColumns,t).difference;if(!0!==n&&0===n.length)return this.dependencies.promiseService.when(e);for(var i=e.itemType,o=[],s=[],a=[],c=0,u=e.items;c<u.length;c++){var l=u[c];l.isLocal()?s.push(l):a.push(l)}if(a.length>0&&o.push(this.transaction.getServerCache().cachedQueryHandler.__expandCachedQuery(e,t)),s.length>0){var h=this.dependencies.changesDeltaFactory.constructInternalDelta();o.push(this.dependencies.columnHandler.fetch(i,n).then(function(e){return r.itemHandler.expandLocalItemEntries(h,i,s,n,e)},this.dependencies.errorHandler.reject).then(function(){return r.transaction.applyChangesFromParent(h)},this.dependencies.errorHandler.reject))}return 0===a.length&&0===s.length&&o.push(this.transaction.core.columnHandler.fetch(i,n)),this.dependencies.promiseService.all(o).then(function(){return e.requestColumns=r.columnUtil.mergeRequestColumns(e.requestColumns,t).merged,e},this.dependencies.errorHandler.reject)},t.prototype.__addItemEntriesToCachedQueries=function(t,r,n){e.prototype.__addItemEntriesToCachedQueries.call(this,t,r,n,function(){return!1})},t.prototype.isLocal=function(e,t){var r=e.parent;return null===r?this.dependencies.queryService.containsLocalId(t):this.dependencies.keyService.isLocalId(r.itemId)},t.prototype.__fetchItemEntriesByQueryData=function(e,t,r,n){var o,s,a=this,c=null===(o=this.cachedQueries[e])||void 0===o?void 0:o[n.string];return void 0!==c?r.runWithRequestColumns(c.requestColumns)?c.promise:this.__expandCachedQuery(c,r.requestColumns).then(function(){return c},this.dependencies.errorHandler.reject):(this.isLocal(t,n.object)&&this.transaction.parent instanceof i.ServerCache?this.transaction.dependencies.columnHandler.fetch(e,r.requestColumns).then(function(){s=a.setCachedQuery(e,n,[],r.requestColumns)},this.dependencies.errorHandler.reject):this.transaction.parent.cachedQueryHandler.__fetchItemEntriesByQueryData(e,t,r,n).then(function(e){s=null===t.limit?a.setCachedQuery(e.itemType,e.query,e.items.slice(),e.requestColumns):e},this.dependencies.errorHandler.reject)).then(function(){for(var e=a.dependencies.collectionMatcherFactory.constructCachedQueryProcessor(a.transaction,function(e){return e===s.itemType?[s]:[]}),t=0,r=s.items;t<r.length;t++){var n=r[t];a.transaction.itemHandler.detectEntryChanges(n.id)&&e.expand(n,a.transaction.getItemChangesRecursively(n.id,!1))}for(var i=0,o=a.transaction.itemHandler.entries.getByItemType(s.itemType);i<o.length;i++){n=o[i];e.expand(n,a.transaction.getItemChangesRecursively(n.id,!1))}return e.__removeFromAndAddToCachedQueries(!1)},this.dependencies.errorHandler.reject).then(function(){return s.resolve(),s},function(e){return s.reject(e),a.dependencies.errorHandler.reject(e)})},t.prototype.__fetchLinkedCachedQueryItems=function(e,t,r,n){Object(i.isFunction)(t)&&(t=t());for(var o={},s=0,a=t;s<a.length;s++){var c=a[s],u=this.collectionEntryService.cloneOptions(n,{itemType:e,itemId:c}),l=this.collectionEntryService.createQueryFromOptions(u);this.expandColumnsWithQueryColumns(r,u,l.object);var h=this.dependencies.columnSubsetCacheFactory.construct(u.columns);o[c]=this.__fetchItemEntriesByQueryData(r,n,h,l)}return this.dependencies.promiseService.all(o)},t}(r(29).a)},function(e,t,r){"use strict";r.d(t,"a",function(){return s});var n=r(3),i=r(15),o=r(21),s=function(e){function t(t,r,n){var i=e.call(this,n)||this;return i.errorHandler=t,i.itemCreateService=r,i.created=new o.a,i}return Object(n.b)(t,e),t.prototype.setItemCreated=function(e,t){var r=this;return this.itemCreateService.createItemsFromValues(this,e,[t]).then(function(){return r},this.errorHandler.reject)},t.prototype.setItemsCreated=function(e,t){var r=this;return this.itemCreateService.createItemsFromValues(this,e,t).then(function(){return r},this.errorHandler.reject)},t.prototype._setItemCreated=function(e,t,r,n){void 0===n&&(n=null);var i={};if(null!==n)for(var o in i=this.itemEntryService.getLinkFieldsByParent(n,r.itemType))t[o]=i[o];var s=this.itemEntryService.getLocalDefaultValues();for(var o in s)t.hasOwnProperty(o)||(t[o]=s[o]);return this.created.add(e,t,r),this},t.prototype.setItemMoved=function(e,t){return this.setItemUpdated(e,{},null,t)},t.prototype.isEmpty=function(){return e.prototype.isEmpty.call(this)&&this.created.isEmpty()},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(1),i=function(){function e(){this.tuples={}}return e.prototype.remove=function(e,t){if(void 0===this.tuples[e])return!1;var r=Object(n.g)(this.tuples[e],function(e){return e.itemId==t});return-1!==r&&(this.tuples[e].splice(r,1),!0)},e.prototype.add=function(e,t,r){var n=r.itemType;void 0===this.tuples[n]&&(this.tuples[n]=[]),this.tuples[n].push({itemId:e,fields:t,columns:r})},e.prototype.isEmpty=function(){return!Object(n.j)(this.tuples)},e.prototype.forEach=function(e){for(var t in this.tuples)for(var r=this.tuples[t],n=0;n<r.length;n++)e(r[n],t,n)},e.prototype.contains=function(e){return void 0!==this.tuples[e]},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return s});var n=r(3),i=r(15),o=r(1),s=function(e){function t(t){var r=e.call(this,t)||this;return r.created={},r.moved={},r.itemIdConversionMap={},r}return Object(n.b)(t,e),t.prototype.setItemCreated=function(e,t){this.created[e.id]={entry:e,fields:t}},t.prototype.setItemMoved=function(e,t){this.moved[e.id]={entry:e,to:t}},t.prototype.isEmpty=function(){return e.prototype.isEmpty.call(this)&&!Object(o.j)(this.created)},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r,n,i,o){this.promiseLibrary=e,this.apiRequestService=t,this.requestColumnExpansionFactory=r,this.changesDeltaFactory=n,this.serverCache=i,this.itemType=o,this.deferred=this.promiseLibrary.defer(),this.requestColumnExpansion=this.requestColumnExpansionFactory.construct(),this.singleItemIds=[],this.queries={}}return e.prototype.containsId=function(e){return-1!==this.singleItemIds.indexOf(e)},e.prototype.containsQuery=function(e){return void 0!==this.queries[e]},e.prototype.addSingleItem=function(e,t){return this.requestColumnExpansion.expandWithRequestColumns(this.itemType,t),-1===this.singleItemIds.indexOf(e)&&this.singleItemIds.push(e),this.getPromise()},e.prototype.addQuery=function(e,t){return this.requestColumnExpansion.expandWithRequestColumns(this.itemType,t),void 0===this.queries[e[1]]&&(this.queries[e[1]]=e[0]),this.getPromise()},e.prototype.flush=function(){var e=this,t=[];for(var r in this.singleItemIds.length>0&&t.push({key:"id",comparator:"IN",value:this.singleItemIds}),this.queries)t.push(this.queries[r]);if(0===t.length)throw new Error("Tried to flush a RequestBuffer without singleItems or queries");var n,i=this.requestColumnExpansion.get();return this.apiRequestService.query(this.itemType,{conditions:t,operator:"OR"},i).then(function(t){n=t;var r=e.changesDeltaFactory.construct();if(0===e.singleItemIds.length&&!e.hasMultipleQueries()){var o=e.getFirstQueryString();void 0!==o&&r._setQueryResult(e.itemType,o,n.links[e.itemType])}return e.serverCache.processResponse(n,i,!1,!1,r)},function(t){return e.deferred.reject(t)}).then(function(){return e.deferred.resolve(n)},function(t){return e.deferred.reject(t)}),this.getPromise()},e.prototype.getPromise=function(){return this.deferred.promise},e.prototype.hasMultipleQueries=function(){var e=!0;for(var t in this.queries){if(!e)return!0;e=!1}return!1},e.prototype.getFirstQueryString=function(){for(var e in this.queries)return e},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r,n,i,o){this.columnSetFactory=e,this.conversionMapService=t,this.errorHandler=r,this.keyService=n,this.promiseService=i,this.templateCache=o}return e.prototype.createItemsFromValues=function(e,t,r,n){var i=this;if(void 0===n&&(n=null),0===r.length)return this.promiseService.when();for(var o=[],s=function(s){var c,u=s.hasOwnProperty("id")?s.id:a.keyService.getLocalId();o.push(a.templateCache.fetchTemplate(t,u,{},(c={},c[t]=Object.keys(r[0]),c),n).then(function(r){i.processTemplate(e,t,u,n,r,function(){return!0},function(e,r){if(e===t)for(var n in s)r[n]=s[n]})},a.errorHandler.reject))},a=this,c=0,u=r;c<u.length;c++){s(u[c])}return this.promiseService.all(o).then(function(){})},e.prototype.processTemplate=function(e,t,r,n,i,o,s){void 0===o&&(o=function(){return!0});var a=this.conversionMapService.createLocalConversionMap(t,r,!0,i.response),c=i.getFields();this.conversionMapService.updateItemValues(c,c,i.columns.item,a,n),void 0!==s&&s(t,c,a),e._setItemCreated(r,c,i.columns,n),this.processTemplateLinkItems(e,t,r,i,a,o,s)},e.prototype.processTemplateLinkItems=function(e,t,r,n,i,o,s){var a=this;void 0===o&&(o=function(){return!0});var c=n.response,u={},l=function(t,r,h){var d={itemType:t,itemId:r},p=c.items[t][h].links;for(var m in p)if(p.hasOwnProperty(m)){void 0===u[m]&&(u[m]=a.columnSetFactory.construct(m,!0,n.responseColumns));for(var f=0,y=p[m];f<y.length;f++){var v=y[f],g=c.fetchObject(m,v);if(o(m,g)){var C=i[m][v];a.conversionMapService.updateItemValues(g,g,u[m].item,i,d),void 0!==s&&s(m,g,i),e._setItemCreated(C,g,u[m],d),l(m,C,v)}}}};l(t,r,c.links[t][0])},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return o});var n=r(20),i=r(22),o=function(){function e(e,t,r){this.errorHandler=e,this.itemEntryService=t,this.itemCreateService=r}return e.prototype.construct=function(){return new n.a(this.errorHandler,this.itemCreateService,this.itemEntryService)},e.prototype.constructInternalDelta=function(){return new i.a(this.itemEntryService)},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(0),i=function(){function e(e,t,r,n,i,o,s,a,c,u){this.changesDeltaFactory=e,this.apiRequestService=t,this.changesCompilationFactory=r,this.columnExpansionFactory=n,this.createRequestFactory=i,this.errorHandler=o,this.promiseService=s,this.requestColumnExpansionFactory=a,this.collectionEntryService=c,this.itemEntryService=u}return e.prototype.construct=function(e,t,r){return new n.i(this.changesDeltaFactory,this.apiRequestService,this.changesCompilationFactory,this.columnExpansionFactory,this.createRequestFactory,this.errorHandler,this.promiseService,this.requestColumnExpansionFactory,this.collectionEntryService,this.itemEntryService,e,t,r)},e}()},function(e,t,r){"use strict";var n=r(3),i=function(e){function t(t){return e.call(this,t)||this}return Object(n.b)(t,e),t.prototype.parseEmptyQuery=function(){return!0},t.prototype.parseSubQuery=function(e,t,r){return void 0===r&&(r=!1),!1},t.prototype.parseSubFieldQuery=function(e,t,r,n,i){return!1},t.prototype.parseSearchQuery=function(e,t){return!1},t.prototype.parseCustomQuery=function(e,t,r){return void 0===r&&(r=!1),!1},t.prototype.parseSimpleQuery=function(e,t,r,n){return!0},t.prototype.parseLinkedToQuery=function(e,t,r,n){return void 0===t&&(t={}),void 0===r&&(r=!1),void 0===n&&(n=!1),!0},t.prototype.parseComplexQuery=function(e,t,r){return this.parseConditions(e)},t.prototype.parseConditions=function(e){var t=this;return e.every(function(e){return t.parse(e)})},t}(r(2).c),o=r(23);r.d(t,"a",function(){return s});var s=function(){function e(e,t,r,n,i){this.promiseLibrary=e,this.apiRequestService=t,this.requestColumnExpansionFactory=r,this.keyService=n,this.changesDeltaFactory=i,this.pendingBufferMap={},this.pendingTrueBufferMap={}}return e.prototype.setServerCache=function(e){this.serverCache=e},e.prototype.fetchByIds=function(e,t,r){for(var n=0,i=t;n<i.length;n++){var o=i[n];this.fetchById(e,o,r)}return this.pendingBufferMap[e].getPromise()},e.prototype.fetchById=function(e,t,r){if(this.keyService.isLocalId(t))throw new Error("Unexpected local ItemId in RequestBufferManager.fetchById, for local ItemIds you should use RequestBufferManager.fetchByLocalId");var n;return!0===r?void 0===(n=this.pendingTrueBufferMap[e])?n=this.constructBuffer(e,this.pendingTrueBufferMap):console.log("Existing 'columns: true' RequestBuffer "+e+" at "+performance.now()+" by id"):void 0===(n=this.pendingBufferMap[e])?n=this.constructBuffer(e):console.log("Existing RequestBuffer "+e+" at "+performance.now()+" by id"),n.addSingleItem(t,r),n.getPromise()},e.prototype.fetchByQuery=function(e,t,r){var n;return new i(t[0]).parse()?(void 0===(n=this.pendingBufferMap[e])?n=this.constructBuffer(e):console.log("Existing RequestBuffer "+e+" at "+performance.now()+" with query"),n.addQuery(t,r),n.getPromise()):((n=this._constructBuffer(e)).addQuery(t,r),n.flush(),n.getPromise())},e.prototype.constructBuffer=function(e,t){void 0===t&&(t=this.pendingBufferMap);var r=t[e]=this._constructBuffer(e);return window.setTimeout(function(){r.flush(),delete t[e]},150),r},e.prototype._constructBuffer=function(e){return new o.a(this.promiseLibrary,this.apiRequestService,this.requestColumnExpansionFactory,this.changesDeltaFactory,this.serverCache,e)},e}()},function(e,t,r){"use strict";r.d(t,"a",function(){return n});var n=function(){function e(e,t,r){this.queryService=e,this.queryMatcherFactory=t,this.transaction=r}return e.prototype.expand=function(e,t){var r=this.queryMatcherFactory.construct(e.itemType,t,this.transaction.getParent(e));return this._expand(e,function(e,t){return r.matchQuery(t.object)})},e.prototype.processDelta=function(e){var t=this;for(var r in e.deleted)for(var n=0,i=e.deleted[r];n<i.length;n++){var o=i[n];this._expand(o,function(){return!1})}var s=function(t){var r=e.created[t],n=a.queryMatcherFactory.construct(r.entry.itemType,r.fields,a.transaction.getParent(r.entry));a._expand(r.entry,function(t,i){var o=e._queryResults[t];if(void 0!==o){var s=o[i.string];if(void 0!==s)return!r.entry.isLocal()&&-1!==s.indexOf(r.entry.itemId)}return n.matchQuery(i.object)})},a=this;for(var c in e.created)s(c);var u=function(r){var n=e.moved[r];l._expand(n.entry,function(e,r){return t.queryService.containsLinkedTo(r.object,n.to.itemType,n.to.itemId)})},l=this;for(var c in e.moved)u(c);var h=function(t){var r=e.updated[t],n={},i=d.transaction.getItemChangesRecursively(Number(t),!1),o=function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);void 0!==r?Object.defineProperty(n,t,r):n[t]=e[t]};for(var s in i)o(i,s);for(var s in r.changes.fields)o(r.changes.fields,s);var a=d.queryMatcherFactory.construct(r.entry.itemType,n,d.transaction.getParent(r.entry));d._expand(r.entry,function(t,n){var i=e._queryResults[t];if(void 0!==i){var o=i[n.string];if(void 0!==o)return!r.entry.isLocal()&&-1!==o.indexOf(r.entry.itemId)}return a.matchQuery(n.object)})},d=this;for(var c in e.updated)h(c);return this},e.prototype.groupItemEntries=function(e){var t=[],r=[],n=[];for(var i in e){var o=e[i],s=o.item,a=o.isMatch;!0===a?t.push(s):!1===a?r.push(s):n.push(s)}return{fitting:t,notFitting:r,maybe:n}},e}()},function(e,t,r){"use strict";var n=r(3),i=function(e){function t(t,r,n){var i=e.call(this,n)||this;return i.columnUtil=t,i.itemType=r,i}return Object(n.b)(t,e),t.prototype.parseEmptyQuery=function(){return[]},t.prototype.parseSubQuery=function(e,t,r){var n;return void 0===r&&(r=!1),[(n={},n[e]=this.parse(t),n)]},t.prototype.parseSubFieldQuery=function(e,t,r,n,i){return[]},t.prototype.parseSearchQuery=function(e,t){return[]},t.prototype.parseCustomQuery=function(e,t,r){return void 0===r&&(r=!1),[]},t.prototype.parseSimpleQuery=function(e,t,r,n){return[e]},t.prototype.parseLinkedToQuery=function(e,t,r,n){return void 0===t&&(t={}),void 0===r&&(r=!1),void 0===n&&(n=!1),this.columnUtil.getColumnsFromLink(e,this.itemType)},t.prototype.parseComplexQuery=function(e,t,r){return this.parseConditions(e)},t.prototype.parseConditions=function(e){var t=this;return e.reduce(function(e,r){return e.concat(t.parse(r))},[])},t}(r(2).c),o=r(1);r.d(t,"a",function(){return s});var s=function(){function e(e,t,r,n,i){this.collectionEntryService=e,this.columnUtil=t,this.requestColumnExpansionFactory=r,this.promiseService=n,this.transaction=i,this.cachedQueries={}}return e.prototype.setCachedQuery=function(e,t,r,n){void 0===this.cachedQueries[e]&&(this.cachedQueries[e]={});var i=this.promiseService.defer(),o=this.cachedQueries[e][t.string]={itemType:e,query:t,items:r,promise:i.promise,requestColumns:n,resolve:function(){i.resolve(o)},reject:function(e){i.reject(e)}};return o},e.prototype.getCachedQueryItems=function(e,t){var r,n;return null===(n=null===(r=this.cachedQueries[e])||void 0===r?void 0:r[t])||void 0===n?void 0:n.items},e.prototype.getCachedQueryObjectsByItemType=function(e){var t=[];if(void 0===this.cachedQueries[e])return t;for(var r in this.cachedQueries[e])t.push(this.cachedQueries[e][r]);return t},e.prototype.initCachedQuery=function(e,t,r){return this.setCachedQuery(e,t,[],r)},e.prototype.__addItemEntriesToCachedQueries=function(e,t,r,n){if(0!==r.length){var i=this.getCachedQueryItems(e,t.string);if(void 0!==i)for(var o=[],s=0,a=r;s<a.length;s++){var c=a[s];-1!==i.indexOf(c)||n(c)||(i.push(c),o.push(c))}}},e.prototype.__removeItemEntriesFromCachedQueries=function(e,t,r){if(0===r.length)return[];var n=this.getCachedQueryItems(e,t.string);return void 0===n?[]:this.collectionEntryService.filterArray(n,function(e){return!Object(o.k)(e,r)})},e.prototype.expandColumnsWithQueryColumns=function(e,t,r){var n=new i(this.columnUtil,e,r);if(t.queryColumns=n.parse(),!0!==t.columns){var o=this.requestColumnExpansionFactory.construct();o.expandWithRequestColumns(e,["id","permissions"]),o.expandWithRequestColumns(e,t.columns),o.expandWithRequestColumns(e,t.queryColumns),null!==t.limit&&o.expandWithRequestColumns(e,[t.limit.field]),t.columns=o.get()[e]}},e}()},function(e,t,r){"use strict";var n,i;r.d(t,"b",function(){return n}),r.d(t,"a",function(){return i}),function(e){e.New="new",e.Duplicate="duplicate"}(n||(n={})),function(e){e.ITEMTABLE="itemtable",e.DIRECT="direct"}(i||(i={}))},function(e,t){},function(e,t,r){"use strict";r.r(t);var n=r(33);for(var i in n)"default"!==i&&function(e){r.d(t,e,function(){return n[e]})}(i);var o=r(34);for(var i in o)"default"!==i&&function(e){r.d(t,e,function(){return o[e]})}(i);var s=r(35);for(var i in s)"default"!==i&&function(e){r.d(t,e,function(){return s[e]})}(i);var a=r(36);for(var i in a)"default"!==i&&function(e){r.d(t,e,function(){return a[e]})}(i);var c=r(37);for(var i in c)"default"!==i&&function(e){r.d(t,e,function(){return c[e]})}(i);var u=r(38);for(var i in u)"default"!==i&&function(e){r.d(t,e,function(){return u[e]})}(i);var l=r(39);for(var i in l)"default"!==i&&function(e){r.d(t,e,function(){return l[e]})}(i);var h=r(40);for(var i in h)"default"!==i&&function(e){r.d(t,e,function(){return h[e]})}(i);var d=r(41);for(var i in d)"default"!==i&&function(e){r.d(t,e,function(){return d[e]})}(i);var p=r(42);for(var i in p)"default"!==i&&function(e){r.d(t,e,function(){return p[e]})}(i);var m=r(43);for(var i in m)"default"!==i&&function(e){r.d(t,e,function(){return m[e]})}(i)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){}])});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "6.3.8",
3
+ "version": "6.3.10",
4
4
  "description": "Rentman core functionalities",
5
5
  "main": "./dist/rm-core.js",
6
6
  "types": "./dist/types/index.d.ts",