import{n as e,s as t}from"./rolldown-runtime-BG2f4sTM.js";import{$1 as n,C8 as r,Dvt as i,M_t as a,Mvt as o,Nvt as s,O_t as c,P_t as l,TU as u,U0 as d,Ylt as f,Zlt as p,c0 as m,cO as h,d0 as g,e0 as _,fgt as v,g0 as y,gZ as b,hZ as x,kU as S,l0 as C,lO as w,npt as T,o0 as E,t0 as D,u0 as O,ygt as k}from"./app-initial-BHB6SClA.js";function A(e){let t=(0,F.c)(23),{browserUseTabIdsKey:i,conversationId:o}=e,s=a(r,o),c=l(n.activeTab$),d=l(D.activeTab$),f=l(m),p=l(E),h,_;t[0]===p?(h=t[1],_=t[2]):(h=e=>p.on(`change`,e),_=()=>p.get(),t[0]=p,t[1]=h,t[2]=_);let v=(0,I.useSyncExternalStore)(h,_,M),y=l(O),b=l(g),x=l(C),S,w;t[3]===x?(S=t[4],w=t[5]):(S=e=>x.on(`change`,e),w=()=>x.get(),t[3]=x,t[4]=S,t[5]=w);let T=(0,I.useSyncExternalStore)(S,w,j),A=f||v>0,P=y&&b||T>0,R;t[6]!==c||t[7]!==d||t[8]!==o||t[9]!==A||t[10]!==P?(R=new Set(u(o,{bottom:c,right:d},{bottom:A,right:P})),t[6]=c,t[7]=d,t[8]=o,t[9]=A,t[10]=P,t[11]=R):R=t[11];let z=R;if(!s&&z.size>0)return null;let B,V;if(t[12]!==i||t[13]!==o||t[14]!==z){V=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[17]===z?e=t[18]:(e=e=>!z.has(e),t[17]=z,t[18]=e);let n=i.split(`\0`).map(k).filter(e);if(n.length===0){V=null;break bb0}let r;t[19]===o?r=t[20]:(r=e=>(0,L.jsx)(N,{browserTabId:e,conversationId:o},e),t[19]=o,t[20]=r),B=n.map(r)}t[12]=i,t[13]=o,t[14]=z,t[15]=B,t[16]=V}else B=t[15],V=t[16];if(V!==Symbol.for(`react.early_return_sentinel`))return V;let H;return t[21]===B?H=t[22]:(H=(0,L.jsx)(L.Fragment,{children:B}),t[21]=B,t[22]=H),H}function j(){return 0}function M(){return 0}function N(e){let t=(0,F.c)(8),{browserTabId:n,conversationId:r}=e,i=p(),a=(0,I.useRef)(null),o;t[0]!==n||t[1]!==r?(o=()=>x.getSnapshot(r,n),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=(0,I.useSyncExternalStore)(x.subscribe,o,P);if(s!=null&&s.tabType!==v.WEB)return null;let c=s==null||s.url.length===0?`about:blank`:s.url,l;return t[3]!==n||t[4]!==r||t[5]!==c||t[6]!==i?(l=(0,L.jsx)(h,{bounds:null,browserTabId:n,conversationId:r,hostKind:`hidden-browser-use`,initialUrl:c,isVisible:!1,scale:1,shouldBootstrapWhenHidden:!0,shouldPaint:!1,webviewRef:a,windowZoom:i}),t[3]=n,t[4]=r,t[5]=c,t[6]=i,t[7]=l):l=t[7],l}function P(){return null}var F,I,L;e((()=>{F=o(),c(),T(),I=t(s(),1),f(),_(),y(),S(),d(),b(),w(),L=i()}))();export{A as HiddenBrowserUseWebviewHost};
//# sourceMappingURL=browser-sidebar-hidden-browser-use-webview-host-Bj3LlACo.js.map