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