import{n as a,o as b,q as u}from"./chunk-ZYAGUDC2.js";import{a as j}from"./chunk-2M7Q7RS4.js";import{ja as S,l as r,na as I,s as p}from"./chunk-EJ5TQG27.js";import{g as d}from"./chunk-NZN5XTIE.js";var y=(()=>{let e=class e{constructor(l){this.payload=l}};e.type="[Selection] ListObjectsInUpload";let t=e;return t})(),f=(()=>{let e=class e{constructor(){}};e.type="[Selection] Next";let t=e;return t})(),x=(()=>{let e=class e{constructor(){}};e.type="[Selection] Previous";let t=e;return t})(),h=(()=>{let e=class e{constructor(){}};e.type="[Selection] Clear";let t=e;return t})();var v={objects:[],selectedIndex:0},s,c=(s=class{static objects(e){return e.objects}static currentIndex(e){return e.selectedIndex}static selectedObject(e){return e.objects[e.selectedIndex]}constructor(e){this.apiService=e}listObjectsInUpload(e,o){return d(this,null,function*(){let l=yield p(this.apiService.listKlicNetworkObjects(o.payload.uploadId,o.payload)),i=l;if(o.payload.includeTodos===!0){let n=yield p(this.apiService.listTodosInArea(o.payload.uploadId,o.payload));i=[...l,...n]}if(o.payload.includeOtherActiveUploadsInProject===!0){let n=yield p(this.apiService.listOtherActiveUploadsInProject(o.payload.uploadId,o.payload));i=[...i,...n]}let m=i.sort((n,O)=>n.bestandLocatie!==null&&n.bestandLocatie!==void 0?-1:1);e.setState({objects:m,selectedIndex:0})})}nextSelection(e){return d(this,null,function*(){let o=e.getState().selectedIndex,l=e.getState().objects;e.patchState({selectedIndex:Math.min(l.length-1,o+1)})})}previousSelection(e){return d(this,null,function*(){let o=e.getState().selectedIndex;e.patchState({selectedIndex:Math.max(0,o-1)})})}clearSelection(e){e.setState({objects:[],selectedIndex:0})}},s.\u0275fac=function(o){return new(o||s)(I(j))},s.\u0275prov=S({token:s,factory:s.\u0275fac}),s);r([a(y)],c.prototype,"listObjectsInUpload",null);r([a(f)],c.prototype,"nextSelection",null);r([a(x)],c.prototype,"previousSelection",null);r([a(h)],c.prototype,"clearSelection",null);r([u([c])],c,"objects",null);r([u([c])],c,"currentIndex",null);r([u([c])],c,"selectedObject",null);c=r([b({name:"selection",defaults:v})],c);export{y as a,f as b,x as c,h as d,c as e};
//# sourceMappingURL=chunk-ISOGAKRC.js.map