import{e as E,f,p as u,pa as C,r as g,sa as p}from"./chunk-IYD54RT7.js";var m=class{};function k(i){return i&&typeof i.connect=="function"&&!(i instanceof E)}var S=class extends m{constructor(e){super(),this._data=e}connect(){return g(this._data)?this._data:u(this._data)}disconnect(){}},d=function(i){return i[i.REPLACED=0]="REPLACED",i[i.INSERTED=1]="INSERTED",i[i.MOVED=2]="MOVED",i[i.REMOVED=3]="REMOVED",i}(d||{}),v=new p("_ViewRepeater"),V=class{applyChanges(e,t,s,n,h){e.forEachOperation((c,_,r)=>{let l,o;if(c.previousIndex==null){let a=s(c,_,r);l=t.createEmbeddedView(a.templateRef,a.context,a.index),o=d.INSERTED}else r==null?(t.remove(_),o=d.REMOVED):(l=t.get(_),t.move(l,r),o=d.MOVED);h&&h({context:l?.context,operation:o,record:c})})}detach(){}},T=class{constructor(){this.viewCacheSize=20,this._viewCache=[]}applyChanges(e,t,s,n,h){e.forEachOperation((c,_,r)=>{let l,o;if(c.previousIndex==null){let a=()=>s(c,_,r);l=this._insertView(a,r,t,n(c)),o=l?d.INSERTED:d.REPLACED}else r==null?(this._detachAndCacheView(_,t),o=d.REMOVED):(l=this._moveView(_,r,t,n(c)),o=d.MOVED);h&&h({context:l?.context,operation:o,record:c})})}detach(){for(let e of this._viewCache)e.destroy();this._viewCache=[]}_insertView(e,t,s,n){let h=this._insertViewFromCache(t,s);if(h){h.context.$implicit=n;return}let c=e();return s.createEmbeddedView(c.templateRef,c.context,c.index)}_detachAndCacheView(e,t){let s=t.detach(e);this._maybeCacheView(s,t)}_moveView(e,t,s,n){let h=s.get(e);return s.move(h,t),h.context.$implicit=n,h}_maybeCacheView(e,t){if(this._viewCache.length<this.viewCacheSize)this._viewCache.push(e);else{let s=t.indexOf(e);s===-1?e.destroy():t.remove(s)}}_insertViewFromCache(e,t){let s=this._viewCache.pop();return s&&t.insert(s,e),s||null}},D=class{get selected(){return this._selected||(this._selected=Array.from(this._selection.values())),this._selected}constructor(e=!1,t,s=!0,n){this._multiple=e,this._emitChanges=s,this.compareWith=n,this._selection=new Set,this._deselectedToEmit=[],this._selectedToEmit=[],this.changed=new f,t&&t.length&&(e?t.forEach(h=>this._markSelected(h)):this._markSelected(t[0]),this._selectedToEmit.length=0)}select(...e){this._verifyValueAssignment(e),e.forEach(s=>this._markSelected(s));let t=this._hasQueuedChanges();return this._emitChangeEvent(),t}deselect(...e){this._verifyValueAssignment(e),e.forEach(s=>this._unmarkSelected(s));let t=this._hasQueuedChanges();return this._emitChangeEvent(),t}setSelection(...e){this._verifyValueAssignment(e);let t=this.selected,s=new Set(e);e.forEach(h=>this._markSelected(h)),t.filter(h=>!s.has(this._getConcreteValue(h,s))).forEach(h=>this._unmarkSelected(h));let n=this._hasQueuedChanges();return this._emitChangeEvent(),n}toggle(e){return this.isSelected(e)?this.deselect(e):this.select(e)}clear(e=!0){this._unmarkAll();let t=this._hasQueuedChanges();return e&&this._emitChangeEvent(),t}isSelected(e){return this._selection.has(this._getConcreteValue(e))}isEmpty(){return this._selection.size===0}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}_hasQueuedChanges(){return!!(this._deselectedToEmit.length||this._selectedToEmit.length)}_getConcreteValue(e,t){if(this.compareWith){t=t??this._selection;for(let s of t)if(this.compareWith(e,s))return s;return e}else return e}};var b=(()=>{let e=class e{constructor(){this._listeners=[]}notify(s,n){for(let h of this._listeners)h(s,n)}listen(s){return this._listeners.push(s),()=>{this._listeners=this._listeners.filter(n=>s!==n)}}ngOnDestroy(){this._listeners=[]}};e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=C({token:e,factory:e.\u0275fac,providedIn:"root"});let i=e;return i})();export{m as a,k as b,S as c,d,v as e,V as f,T as g,D as h,b as i};
