import{aS as I,w as p}from"./app-BgLa5dit.js";const b={reorder(o,i,r){if(i===r)return{reorderedItems:o,reorderRequest:null};const n=p.moveItem(o,i,r),a=r<o.length-1?n[r+1].id:null,d={sourceMemberId:n[r].id,destinationMemberId:a};return{reorderedItems:n,reorderRequest:d}},updateState(o,i,r){const n=[],a=I.deepClone(r),d=[o];let e=r[o];const l=!!e&&!!e.data&&e.data.length;for(;e&&Array.isArray(e.data);){n.push(...e.data);const t=e.pagination&&e.pagination.cursors&&e.pagination.cursors.next,c=!!t&&`${o}:${t}`;e=t&&r[c],e&&d.push(c)}if(!n.length)return r;const m=p.findIndex(n,t=>t.id===i.sourceMemberId);let s=[...n];const u=s.splice(m,1),g=i.destinationMemberId?p.findIndex(s,t=>t.id===i.destinationMemberId):s.length;return s.splice(g,0,u[0]),s=s.map(t=>({id:t.id})),d.forEach(t=>{const c=s.splice(0,l);a[t].data=c}),a}};export{b as R};
//# sourceMappingURL=D9gPss28.chunk.js.map
