import{s as E}from"./chunk-DZLz74EQ.js";import{c as P}from"./jotai-DDOP7CKM.js";import{t as R}from"./react-BcIddLXZ.js";import{n as B,t as G}from"./jsx-runtime-DvsdsEjx.js";import{t as J}from"./cn-C5VTNYKf.js";import{t as K}from"./createLucideIcon-DA8ZBm4D.js";import{t as L}from"./useCellActionButton-punTL7e0.js";import{a as U,n as V,o as W,t as Q}from"./tooltip-BQKXsEoT.js";import{d as X}from"./alert-dialog-DM1h8RhU.js";import{a as Y,i as Z}from"./renderShortcut-GP8-boTA.js";import{i as H,r as $,t as O}from"./popover-BM0PuIZH.js";import{a as ee,c as le,i as te,o as se,r as re,t as ae,u as oe}from"./command-BqJiTpIC.js";import{n as ne}from"./focus-NSCHuycv.js";var ie=K("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),q=E(B(),1),b=E(R(),1),l=E(G(),1);const z=b.memo(b.forwardRef((i,r)=>{let e=(0,q.c)(35),s,a,n;e[0]===i?(s=e[1],a=e[2],n=e[3]):({children:s,showTooltip:n,...a}=i,e[0]=i,e[1]=s,e[2]=a,e[3]=n);let m=n===void 0?!0:n,[c,y]=(0,b.useState)(!1),v;e[4]===Symbol.for("react.memo_cache_sentinel")?(v=()=>y(!1),e[4]=v):v=e[4];let M=v,g;e[5]===a?g=e[6]:(g={cell:a,closePopover:M},e[5]=a,e[6]=g);let d=L(g),A=X(),N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=()=>({toggle:()=>y(ce)}),e[7]=N):N=e[7],(0,b.useImperativeHandle)(r,N);let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=(0,l.jsx)(ee,{placeholder:"Search actions...",className:"h-6 m-1"}),e[8]=_):_=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,l.jsx)(re,{children:"No results"}),e[9]=w):w=e[9];let h;if(e[10]!==d){let o;e[12]===d.length?o=e[13]:(o=(u,I)=>(0,l.jsxs)(b.Fragment,{children:[(0,l.jsx)(te,{children:u.map(t=>{let T=(0,l.jsxs)("div",{className:"flex items-center flex-1",children:[t.icon&&(0,l.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:t.icon}),(0,l.jsx)("div",{className:"flex-1",children:t.label}),(0,l.jsxs)("div",{className:"shrink-0 text-sm",children:[t.hotkey&&Z(t.hotkey),t.rightElement]})]});return t.tooltip&&(T=(0,l.jsx)(Q,{content:t.tooltip,delayDuration:100,children:T})),(0,l.jsx)(se,{className:J(t.disabled&&"opacity-50!"),onSelect:()=>{t.disableClick||t.disabled||(t.handle(),y(!1))},variant:t.variant,children:T},t.label)})},I),I<d.length-1&&(0,l.jsx)(le,{})]},I),e[12]=d.length,e[13]=o),h=d.map(o),e[10]=d,e[11]=h}else h=e[11];let p;e[14]===h?p=e[15]:(p=(0,l.jsxs)(ae,{children:[_,(0,l.jsxs)(oe,{children:[w,h]})]}),e[14]=h,e[15]=p);let S;e[16]!==A||e[17]!==p?(S=(0,l.jsx)($,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...A,children:p}),e[16]=A,e[17]=p,e[18]=S):S=e[18];let x=S;if(!m){let o;e[19]===s?o=e[20]:(o=(0,l.jsx)(H,{asChild:!0,children:s}),e[19]=s,e[20]=o);let u;return e[21]!==x||e[22]!==c||e[23]!==o?(u=(0,l.jsxs)(O,{open:c,onOpenChange:y,children:[o,x]}),e[21]=x,e[22]=c,e[23]=o,e[24]=u):u=e[24],u}let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=(0,l.jsx)(V,{tabIndex:-1,children:Y("cell.cellActions")}),e[25]=C):C=e[25];let D=!c&&C,f;e[26]===s?f=e[27]:(f=(0,l.jsx)(W,{children:(0,l.jsx)(H,{className:"flex",children:s})}),e[26]=s,e[27]=f);let j;e[28]!==D||e[29]!==f?(j=(0,l.jsxs)(U,{delayDuration:200,disableHoverableContent:!0,children:[D,f]}),e[28]=D,e[29]=f,e[30]=j):j=e[30];let k;return e[31]!==x||e[32]!==c||e[33]!==j?(k=(0,l.jsxs)(O,{open:c,onOpenChange:y,children:[j,x]}),e[31]=x,e[32]=c,e[33]=j,e[34]=k):k=e[34],k})),F=b.memo(i=>{let r=(0,q.c)(5),{children:e,cellId:s}=i,a;r[0]===s?a=r[1]:(a=ne(s),r[0]=s,r[1]=a);let n=P(a);if(!n)return null;let m;return r[2]!==e||r[3]!==n?(m=(0,l.jsx)(z,{showTooltip:!1,...n,children:e}),r[2]=e,r[3]=n,r[4]=m):m=r[4],m});F.displayName="ConnectionCellActionsDropdown";function ce(i){return!i}export{F as n,ie as r,z as t};
