import{r as e}from"./rolldown-runtime-CpWojdLp.js";import{n as t,t as n}from"./jsx-runtime-B6e-FjZo.js";import{Ar as r,Ht as i,gn as a,hr as o,in as s}from"./app-figJB8d1.js";var c=r(),l=n();function u(e){let t=(0,c.c)(19),{count:n,onClear:r,children:o,noun:s}=e,{t:u,tChoice:d}=i();if(n===0)return null;let f=`${s}s`,p;t[0]!==n||t[1]!==s||t[2]!==f||t[3]!==d?(p=d(`:count :noun selected|:count :nouns selected`,n,{count:n,noun:s,nouns:f}),t[0]=n,t[1]=s,t[2]=f,t[3]=d,t[4]=p):p=t[4];let m=p,h;t[5]===u?h=t[6]:(h=u(`Clear selection`),t[5]=u,t[6]=h);let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,l.jsx)(a,{className:`size-3.5`}),t[7]=g):g=t[7];let _;t[8]!==r||t[9]!==h?(_=(0,l.jsx)(`button`,{type:`button`,onClick:r,"aria-label":h,className:`inline-flex size-6 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground`,children:g}),t[8]=r,t[9]=h,t[10]=_):_=t[10];let v;t[11]===m?v=t[12]:(v=(0,l.jsx)(`span`,{className:`text-sm font-medium`,children:m}),t[11]=m,t[12]=v);let y;t[13]===o?y=t[14]:(y=(0,l.jsx)(`div`,{className:`flex items-center gap-2`,children:o}),t[13]=o,t[14]=y);let b;return t[15]!==_||t[16]!==v||t[17]!==y?(b=(0,l.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-4 z-40 flex justify-center px-4`,children:(0,l.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-3 rounded-full border bg-card px-4 py-2 shadow-lg`,children:[_,v,y]})}),t[15]=_,t[16]=v,t[17]=y,t[18]=b):b=t[18],b}function d(e){let t=(0,c.c)(11),{confirmMessage:n,onConfirm:r,label:a}=e,{t:u}=i(),d=s(),f;t[0]!==a||t[1]!==u?(f=a??u(`Delete`),t[0]=a,t[1]=u,t[2]=f):f=t[2];let p=f,m;t[3]!==d||t[4]!==n||t[5]!==r||t[6]!==p?(m=async()=>{await d({message:n,confirmLabel:p,danger:!0})&&r()},t[3]=d,t[4]=n,t[5]=r,t[6]=p,t[7]=m):m=t[7];let h;return t[8]!==m||t[9]!==p?(h=(0,l.jsx)(o,{type:`button`,variant:`destructive`,size:`sm`,onClick:m,children:p}),t[8]=m,t[9]=p,t[10]=h):h=t[10],h}var f=e(t(),1);function p(){let e=(0,c.c)(19),[t,n]=(0,f.useState)(m),r=(0,f.useRef)(null),i=t.size,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{n(new Set),r.current=null},e[0]=a):a=e[0];let o=a,s;e[1]===t?s=e[2]:(s=e=>t.has(e),e[1]=t,e[2]=s);let l=s,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(e,t)=>{n(n=>{let i=new Set(n),a=r.current;if(t?.shiftKey&&a&&a!==e&&t.pageIds?.length){let o=t.pageIds,s=o.indexOf(a),c=o.indexOf(e);if(s!==-1&&c!==-1){let[t,a]=s<c?[s,c]:[c,s],l=!n.has(e);for(let e=t;e<=a;e++)l?i.add(o[e]):i.delete(o[e]);return r.current=e,i}}return i.has(e)?i.delete(e):i.add(e),r.current=e,i})},e[3]=u):u=e[3];let d=u,p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{n(t=>{let n=new Set(t);return e.forEach(e=>n.add(e)),n})},e[4]=p):p=e[4];let h=p,g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{n(t=>{let n=new Set(t);return e.forEach(e=>n.delete(e)),n})},e[5]=g):g=e[5];let _=g,v;e[6]===t?v=e[7]:(v=e=>e.length>0&&e.every(e=>t.has(e)),e[6]=t,e[7]=v);let y=v,b;e[8]===t?b=e[9]:(b=e=>e.some(e=>t.has(e)),e[8]=t,e[9]=b);let x=b,S;e[10]===t?S=e[11]:(S=e=>{e.length>0&&e.every(e=>t.has(e))?_(e):h(e)},e[10]=t,e[11]=S);let C=S,w;return e[12]!==y||e[13]!==l||e[14]!==t||e[15]!==i||e[16]!==x||e[17]!==C?(w={selected:t,size:i,clear:o,isSelected:l,toggle:d,selectAll:h,deselectAll:_,togglePage:C,allOnPageSelected:y,someOnPageSelected:x},e[12]=y,e[13]=l,e[14]=t,e[15]=i,e[16]=x,e[17]=C,e[18]=w):w=e[18],w}function m(){return new Set}export{u as n,d as r,p as t};