import{D as O,c6 as D,x as E,n as S,H as w,g as A,i as K,v as T}from"./react-dom-C0IJc3nR.js";import{d as U}from"./index-CjmGjyN8.js";import{h as t,j as u}from"./codemirror-core-DIzFijqu.js";import{C as _}from"./chunk-M3MASYO7-BtOvSeRL.js";function k(n){const[f,d]=O(n,D.variantKeys),{ref:C,as:i,children:s,avatar:a,startContent:l,endContent:o,onClose:r,classNames:e,className:h,...v}=f,b=i||"div",g=U(C),V=E(e==null?void 0:e.base,h),p=!!r,B=n.variant==="dot",{focusProps:y,isFocusVisible:x}=S(),N=t.useMemo(()=>typeof s=="string"&&(s==null?void 0:s.length)===1,[s]),P=t.useMemo(()=>!!a||!!l,[a,l]),$=t.useMemo(()=>!!o||p,[o,p]),m=t.useMemo(()=>D({...d,hasStartContent:P,hasEndContent:$,isOneChar:N,isCloseable:p,isCloseButtonFocusVisible:x}),[w(d),x,P,$,N,p]),{pressProps:F}=A({isDisabled:!!(n!=null&&n.isDisabled),onPress:r}),R=()=>({ref:g,className:m.base({class:V}),...v}),I=()=>({role:"button",tabIndex:0,className:m.closeButton({class:e==null?void 0:e.closeButton}),"aria-label":"close chip",...K(F,y)}),H=c=>t.isValidElement(c)?t.cloneElement(c,{className:m.avatar({class:e==null?void 0:e.avatar})}):null,j=c=>t.isValidElement(c)?t.cloneElement(c,{className:E("max-h-[80%]",c.props.className)}):null;return{Component:b,children:s,slots:m,classNames:e,isDot:B,isCloseable:p,startContent:H(a)||j(l),endContent:j(o),getCloseButtonProps:I,getChipProps:R}}var M=T((n,f)=>{const{Component:d,children:C,slots:i,classNames:s,isDot:a,isCloseable:l,startContent:o,endContent:r,getCloseButtonProps:e,getChipProps:h}=k({...n,ref:f}),v=t.useMemo(()=>a&&!o?u.jsx("span",{className:i.dot({class:s==null?void 0:s.dot})}):o,[i,o,a]),b=t.useMemo(()=>l?u.jsx("span",{...e(),children:r||u.jsx(_,{})}):r,[r,l,e]);return u.jsxs(d,{...h(),children:[v,u.jsx("span",{className:i.content({class:s==null?void 0:s.content}),children:C}),b]})});M.displayName="HeroUI.Chip";var L=M;export{L as c};
