import{t as o}from"./invariant-awXiPaF0.js";function l(n,t,r){return Math.min(Math.max(n,t),r)}function a(n,t){let r=[...n];return r.splice(t,1),r}function c(n,t,r){t=l(t,0,n.length);let e=[...n];return e.splice(t,0,r),e}function p(n,t,r){let e=[...n],[i]=e.splice(t,1);return e.splice(r,0,i),e}function h(n,t,r){if(n.length===0)return r;t=l(t,0,n.length);let e=[...n];return e.splice(t,0,...r),e}function s(n,t){if(n===t)return!0;if(n.length!==t.length)return!1;for(let r=0,e=n.length;r<e;r++)if(n[r]!==t[r])return!1;return!0}const g={EMPTY:[],zip:(n,t)=>(o(n.length===t.length,"Arrays must be the same length"),n.map((r,e)=>[r,t[e]]))};function d(n,t){if(!n)return[t];let r=n.indexOf(t);if(r===-1)return[...n,t];let e=[...n];return e.splice(r,1),e}function m(n,t){let r=[],e=new Set;for(let i of n){let u=t(i);e.has(u)||(e.add(u),r.push(i))}return r}function y(n,t){let r=new Map;for(let e of n){let i=t(e);r.set(i,e)}return[...r.values()]}function M(n,t,r){return t===0?0:n===null?r==="up"?0:t-1:r==="up"?(n+1)%t:(n-1+t)%t}function v(n){let t,r=!1;return function(...e){return r||(r=!0,t=n.apply(this,e)),t}}function w(n){let t,r,e,i=!1;return function(...u){if(r===void 0||!s(u,r)){try{t=n.apply(this,u),i=!1,e=void 0}catch(f){i=!0,e=f}r=u}if(i)throw e;return t}}export{c as a,s as c,m as d,y as f,a as i,d as l,v as n,h as o,l as p,g as r,p as s,w as t,M as u};
