import{d as e,n as t,t as n}from"./objectSpread2-DtFdQpqy.js";import{a as r,n as i}from"./preload-helper-EQ20WQt-.js";import{l as a,o}from"./prop-types-DdDwMzX7.js";import{ct as s,ot as c,pt as l}from"./poll-UAe1CGVf.js";import{t as u}from"./classnames-CFUb2mE1.js";import{t as d}from"./useSelectableClick-5cftXmb3.js";var f=e(r()),p=e(u()),m={closeButton:`_comp_alt_text_badge__closeButton`},h=i();t();var g=[0,4],_={strategy:`fixed`},v=({description:e,className:t})=>{let r=a(),i=(0,f.useId)(),u=`${i}-popover`,v=`${i}-title`,y=(0,f.useRef)(null),b=(0,f.useRef)(null),[x,S]=(0,f.useState)(!1),C=(0,f.useCallback)(()=>{S(e=>!e),setTimeout(()=>{var e;(e=b.current)==null||e.focus()},0)},[S]),w=(0,f.useCallback)(()=>{var e;S(!1),(e=y.current)==null||e.focus()},[S]),[T,E]=d(w);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`button`,{type:`button`,ref:y,className:(0,p.default)(`media-gallery__alt__label`,t),onClick:C,"aria-expanded":x,"aria-controls":u,"aria-haspopup":`dialog`,children:`ALT`}),(0,h.jsx)(c,{rootClose:!0,onHide:w,show:x,target:y,placement:`top-end`,flip:!0,offset:g,popperConfig:_,children:({props:t})=>(0,h.jsx)(`div`,n(n({},t),{},{className:`hover-card-controller`,children:(0,h.jsxs)(`div`,{className:`info-tooltip dropdown-animation`,role:`dialog`,"aria-labelledby":v,ref:b,id:u,onMouseDown:T,onMouseUp:E,tabIndex:0,children:[(0,h.jsx)(`h4`,{id:v,children:(0,h.jsx)(o,{id:`alt_text_badge.title`,defaultMessage:`Alt text`})}),(0,h.jsx)(s,{title:r.formatMessage({id:`lightbox.close`,defaultMessage:`Close`}),icon:`close`,iconComponent:l,onClick:w,className:m.closeButton}),(0,h.jsx)(`p`,{children:e})]})}))})]})};export{v as t};
//# sourceMappingURL=alt_text_badge-BD3QsP2d.js.map