System.register(["rxjs","@angular/core"],(function(e){"use strict";var t,s,i,n,c,h;return{setters:[function(e){t=e.ConnectableObservable,s=e.isObservable,i=e.of,n=e.Subject},function(e){c=e,e.Injectable,h=e.InjectionToken}],execute:function(){e({getMultipleValuesInSingleSelectionError:l,isDataSource:function(e){return e&&"function"==typeof e.connect&&!(e instanceof t)}});class r{}e("DataSource",r);e("ArrayDataSource",class extends r{constructor(e){super(),this._data=e}connect(){return s(this._data)?this._data:i(this._data)}disconnect(){}});e("_DisposeViewRepeaterStrategy",class{applyChanges(e,t,s,i,n){e.forEachOperation(((e,i,c)=>{let h,r;if(null==e.previousIndex){const n=s(e,i,c);h=t.createEmbeddedView(n.templateRef,n.context,n.index),r=1}else null==c?(t.remove(i),r=3):(h=t.get(i),t.move(h,c),r=2);n&&n({context:h?.context,operation:r,record:e})}))}detach(){}});e("_RecycleViewRepeaterStrategy",class{constructor(){this.viewCacheSize=20,this._viewCache=[]}applyChanges(e,t,s,i,n){e.forEachOperation(((e,c,h)=>{let r,l;if(null==e.previousIndex){const n=()=>s(e,c,h);r=this._insertView(n,h,t,i(e)),l=r?1:0}else null==h?(this._detachAndCacheView(c,t),l=3):(r=this._moveView(c,h,t,i(e)),l=2);n&&n({context:r?.context,operation:l,record:e})}))}detach(){for(const e of this._viewCache)e.destroy();this._viewCache=[]}_insertView(e,t,s,i){const n=this._insertViewFromCache(t,s);if(n)return void(n.context.$implicit=i);const c=e();return s.createEmbeddedView(c.templateRef,c.context,c.index)}_detachAndCacheView(e,t){const s=t.detach(e);this._maybeCacheView(s,t)}_moveView(e,t,s,i){const n=s.get(e);return s.move(n,t),n.context.$implicit=i,n}_maybeCacheView(e,t){if(this._viewCache.length<this.viewCacheSize)this._viewCache.push(e);else{const s=t.indexOf(e);-1===s?e.destroy():t.remove(s)}}_insertViewFromCache(e,t){const s=this._viewCache.pop();return s&&t.insert(s,e),s||null}});function l(){return Error("Cannot pass multiple values into SelectionModel with single-value mode.")}e("SelectionModel",class{get selected(){return this._selected||(this._selected=Array.from(this._selection.values())),this._selected}constructor(e=!1,t,s=!0,i){this._multiple=e,this._emitChanges=s,this.compareWith=i,this._selection=new Set,this._deselectedToEmit=[],this._selectedToEmit=[],this.changed=new n,t&&t.length&&(e?t.forEach((e=>this._markSelected(e))):this._markSelected(t[0]),this._selectedToEmit.length=0)}select(...e){this._verifyValueAssignment(e),e.forEach((e=>this._markSelected(e)));const t=this._hasQueuedChanges();return this._emitChangeEvent(),t}deselect(...e){this._verifyValueAssignment(e),e.forEach((e=>this._unmarkSelected(e)));const t=this._hasQueuedChanges();return this._emitChangeEvent(),t}setSelection(...e){this._verifyValueAssignment(e);const t=this.selected,s=new Set(e);e.forEach((e=>this._markSelected(e))),t.filter((e=>!s.has(e))).forEach((e=>this._unmarkSelected(e)));const i=this._hasQueuedChanges();return this._emitChangeEvent(),i}toggle(e){return this.isSelected(e)?this.deselect(e):this.select(e)}clear(e=!0){this._unmarkAll();const t=this._hasQueuedChanges();return e&&this._emitChangeEvent(),t}isSelected(e){return this._selection.has(this._getConcreteValue(e))}isEmpty(){return 0===this._selection.size}hasValue(){return!this.isEmpty()}sort(e){this._multiple&&this.selected&&this._selected.sort(e)}isMultipleSelection(){return this._multiple}_emitChangeEvent(){this._selected=null,(this._selectedToEmit.length||this._deselectedToEmit.length)&&(this.changed.next({source:this,added:this._selectedToEmit,removed:this._deselectedToEmit}),this._deselectedToEmit=[],this._selectedToEmit=[])}_markSelected(e){e=this._getConcreteValue(e),this.isSelected(e)||(this._multiple||this._unmarkAll(),this.isSelected(e)||this._selection.add(e),this._emitChanges&&this._selectedToEmit.push(e))}_unmarkSelected(e){e=this._getConcreteValue(e),this.isSelected(e)&&(this._selection.delete(e),this._emitChanges&&this._deselectedToEmit.push(e))}_unmarkAll(){this.isEmpty()||this._selection.forEach((e=>this._unmarkSelected(e)))}_verifyValueAssignment(e){e.length>1&&this._multiple,0}_hasQueuedChanges(){return!(!this._deselectedToEmit.length&&!this._selectedToEmit.length)}_getConcreteValue(e){if(this.compareWith){for(let t of this._selection)if(this.compareWith(e,t))return t;return e}return e}});class o{constructor(){this._listeners=[]}notify(e,t){for(let s of this._listeners)s(e,t)}listen(e){return this._listeners.push(e),()=>{this._listeners=this._listeners.filter((t=>e!==t))}}ngOnDestroy(){this._listeners=[]}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275prov=c.\u0275\u0275defineInjectable({token:o,factory:o.\u0275fac,providedIn:"root"})}}e("UniqueSelectionDispatcher",o);e("_VIEW_REPEATER_STRATEGY",new h("_ViewRepeater"))}}}));
