import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t}from"./jsx-runtime-CiQ1k8xo.js";import{t as n}from"./react-dom-CvzHKZGB.js";import{t as r}from"./browser-sidebar-manager-BtbIv4P0.js";var i=e(t(),1),a=e(n(),1);function o({bounds:e,browserTabId:t,children:n,conversationId:o,hostKind:s,initialUrl:c,isVisible:l,scale:u,webviewRef:d,windowZoom:f}){let p=(0,i.useRef)(null),m=(0,i.useRef)(t),h=(0,i.useRef)(o),g=(0,i.useRef)(c),_=(0,i.useSyncExternalStore)(e=>r.subscribe(e),()=>r.getCursorOverlayHost(o,t),()=>null);return(m.current!==t||h.current!==o)&&(m.current=t,h.current=o,g.current=c),(0,i.useLayoutEffect)(()=>{let e=r.getRetainedWebview(o,t,g.current,{hostKind:s});return p.current=e,()=>{e.detach(d),p.current===e&&(p.current=null)}},[t,o,s,d]),(0,i.useLayoutEffect)(()=>{p.current?.sync({bounds:e,isVisible:l,scale:u,windowZoom:f},d)},[e,t,o,l,u,d,f]),_==null||n==null?null:(0,a.createPortal)(n,_)}export{o as t};
//# sourceMappingURL=browser-sidebar-retained-webview-Bk8mrLmX.js.map