function t(t){let r;return function(t){const{enableMultipleSelection:r,listItems:o,dragItem:i,moveToFinal:s,targetIndex:u}=t;if(!r)return!1;const a=n(o);return!(a.length<=1||!a.includes(i.index)||!e(a)||!s&&a.includes(u))}(t)?r=function(t){const{listItems:e,moveToFinal:r,targetIndex:o}=t,i=e.filter((t=>t.selected)),s=n(e),u=Math.min(...s),a=Math.max(...s),l=i.length,c=[...e];if(c.splice(u,l),r)c.push(...i);else{let t=o>a?Math.max(0,o-l):o;c.splice(t,0,...i)}return c}(t):(r=function(t){const{listItems:e,dragItem:n,targetIndex:r,moveToFinal:o}=t,i=[...e];if(i.splice(n.index,1),o)i.push(n.item);else{const t=r>n.index?Math.max(0,r-1):r;i.splice(t,0,n.item)}return i}(t),t.clearSelection()),r}function e(t){if(0===t.length)return!1;const e=[...t].sort(((t,e)=>t-e));for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]+1)return!1;return!0}function n(t){return t.reduce(((t,e,n)=>(e.selected&&t.push(n),t)),[])}export{e as i,t as p}