1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{L as t,T as n}from"./use-style-config-Cs7dMIO8.js";import{t as r}from"./context-DbXazS-O.js";import{t as i}from"./use-safe-layout-effect-B1FoBK2R.js";import{O as a}from"./es-CUpWD2GL.js";var o=e(t(),1),s=n(),[c,l]=r({strict:!1,name:`PortalManagerContext`});function u(e){let{children:t,zIndex:n}=e;return(0,s.jsx)(c,{value:{zIndex:n},children:t})}u.displayName=`PortalManager`;var d=e(a(),1),[f,p]=r({strict:!1,name:`PortalContext`}),m=`chakra-portal`,h=`.chakra-portal`,g=e=>(0,s.jsx)(`div`,{className:`chakra-portal-zIndex`,style:{position:`absolute`,zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),_=e=>{let{appendToParentPortal:t,children:n}=e,[r,a]=(0,o.useState)(null),c=(0,o.useRef)(null),[,u]=(0,o.useState)({});(0,o.useEffect)(()=>u({}),[]);let h=p(),_=l();i(()=>{if(!r)return;let e=r.ownerDocument,n=t?h??e.body:e.body;if(!n)return;c.current=e.createElement(`div`),c.current.className=m,n.appendChild(c.current),u({});let i=c.current;return()=>{n.contains(i)&&n.removeChild(i)}},[r]);let v=_?.zIndex?(0,s.jsx)(g,{zIndex:_?.zIndex,children:n}):n;return c.current?(0,d.createPortal)((0,s.jsx)(f,{value:c.current,children:v}),c.current):(0,s.jsx)(`span`,{ref:e=>{e&&a(e)}})},v=e=>{let{children:t,containerRef:n,appendToParentPortal:r}=e,a=n.current,c=a??(typeof window<`u`?document.body:void 0),l=(0,o.useMemo)(()=>{let e=a?.ownerDocument.createElement(`div`);return e&&(e.className=m),e},[a]),[,u]=(0,o.useState)({});return i(()=>u({}),[]),i(()=>{if(l&&c)return c.appendChild(l),()=>{c.removeChild(l)}},[l,c]),c&&l?(0,d.createPortal)((0,s.jsx)(f,{value:r?l:null,children:t}),l):null};function y(e){let{containerRef:t,...n}={appendToParentPortal:!0,...e};return t?(0,s.jsx)(v,{containerRef:t,...n}):(0,s.jsx)(_,{...n})}y.className=m,y.selector=h,y.displayName=`Portal`;export{u as n,y as t}; 2//# sourceMappingURL=portal-BbkPC-aQ.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.