import{V as N,W as V,_ as A,b as x,a as B,f as q,c as z,s as G}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{c as J,u as K}from"./popper-BVOCD5jc.js";import{r as t}from"./index-NdkWRN8K.js";import{j as S}from"./jsx-runtime-CnH95YSl.js";import{o as D}from"./ownerDocument-DW-IO8s5.js";import{P as Q}from"./Portal-C6D59xAE.js";import{u as F}from"./useIsFocusVisible-DH0qxT5e.js";import{u as X}from"./getReactElementRef-DsIevm5t.js";function Y(o){return N("MuiPopper",o)}V("MuiPopper",["root"]);const Z=["anchorEl","children","direction","disablePortal","modifiers","open","placement","popperOptions","popperRef","slotProps","slots","TransitionProps","ownerState"],oo=["anchorEl","children","container","direction","disablePortal","keepMounted","modifiers","open","placement","popperOptions","popperRef","style","transition","slotProps","slots"];function eo(o,e){if(e==="ltr")return o;switch(o){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return o}}function k(o){return typeof o=="function"?o():o}function to(o){return o.nodeType!==void 0}const ro=o=>{const{classes:e}=o;return q({root:["root"]},Y,e)},no={},so=t.forwardRef(function(e,h){var n;const{anchorEl:s,children:p,direction:y,disablePortal:d,modifiers:i,open:R,placement:f,popperOptions:l,popperRef:E,slotProps:b={},slots:w={},TransitionProps:a}=e,M=A(e,Z),v=t.useRef(null),T=F(v,h),r=t.useRef(null),c=F(r,E),u=t.useRef(c);B(()=>{u.current=c},[c]),t.useImperativeHandle(E,()=>r.current,[]);const m=eo(f,y),[P,U]=t.useState(m),[O,_]=t.useState(k(s));t.useEffect(()=>{r.current&&r.current.forceUpdate()}),t.useEffect(()=>{s&&_(k(s))},[s]),B(()=>{if(!O||!R)return;const I=C=>{U(C.placement)};let j=[{name:"preventOverflow",options:{altBoundary:d}},{name:"flip",options:{altBoundary:d}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:C})=>{I(C)}}];i!=null&&(j=j.concat(i)),l&&l.modifiers!=null&&(j=j.concat(l.modifiers));const W=J(O,v.current,x({placement:m},l,{modifiers:j}));return u.current(W),()=>{W.destroy(),u.current(null)}},[O,d,i,R,l,m]);const $={placement:P};a!==null&&($.TransitionProps=a);const H=ro(e),g=(n=w.root)!=null?n:"div",L=X({elementType:g,externalSlotProps:b.root,externalForwardedProps:M,additionalProps:{role:"tooltip",ref:T},ownerState:e,className:H.root});return S.jsx(g,x({},L,{children:typeof p=="function"?p($):p}))}),po=t.forwardRef(function(e,h){const{anchorEl:n,children:s,container:p,direction:y="ltr",disablePortal:d=!1,keepMounted:i=!1,modifiers:R,open:f,placement:l="bottom",popperOptions:E=no,popperRef:b,style:w,transition:a=!1,slotProps:M={},slots:v={}}=e,T=A(e,oo),[r,c]=t.useState(!0),u=()=>{c(!1)},m=()=>{c(!0)};if(!i&&!f&&(!a||r))return null;let P;if(p)P=p;else if(n){const _=k(n);P=_&&to(_)?D(_).body:D(null).body}const U=!f&&i&&(!a||r)?"none":void 0,O=a?{in:f,onEnter:u,onExited:m}:void 0;return S.jsx(Q,{disablePortal:d,container:P,children:S.jsx(so,x({anchorEl:n,direction:y,disablePortal:d,modifiers:R,ref:h,open:a?!r:f,placement:l,popperOptions:E,popperRef:b,slotProps:M,slots:v},T,{style:x({position:"fixed",top:0,left:0,display:U},w),TransitionProps:O,children:s}))})}),io=["anchorEl","component","components","componentsProps","container","disablePortal","keepMounted","modifiers","open","placement","popperOptions","popperRef","transition","slots","slotProps"],lo=G(po,{name:"MuiPopper",slot:"Root",overridesResolver:(o,e)=>e.root})({}),Eo=t.forwardRef(function(e,h){var n;const s=K(),p=z({props:e,name:"MuiPopper"}),{anchorEl:y,component:d,components:i,componentsProps:R,container:f,disablePortal:l,keepMounted:E,modifiers:b,open:w,placement:a,popperOptions:M,popperRef:v,transition:T,slots:r,slotProps:c}=p,u=A(p,io),m=(n=r==null?void 0:r.root)!=null?n:i==null?void 0:i.Root,P=x({anchorEl:y,container:f,disablePortal:l,keepMounted:E,modifiers:b,open:w,placement:a,popperOptions:M,popperRef:v,transition:T},u);return S.jsx(lo,x({as:d,direction:s==null?void 0:s.direction,slots:{root:m},slotProps:c??R},P,{ref:h}))});export{Eo as P};
