import{n as e,s as t}from"./rolldown-runtime-Czos8NxU.js";import{El as n,Xs as r,nc as i,tc as a,vl as o}from"./app-initial~app-main~worktree-init-v2-page~appgen-settings-page~page~appgen-publication-ter~fzo5ij6p-BKVLyD1q.js";import{Ku as s,Lx as c,Ob as l,Rx as u,ag as d,cg as f,dg as p,fg as m,kb as h,lg as g,ng as _,og as v,pg as y,qu as b,rg as x,sg as S,ug as C}from"./app-initial~app-main~onboarding-page-CNHnOMz8.js";import{Wn as w}from"./app-initial~app-main~remote-conversation-page~new-thread-panel-page~onboarding-page~project~okyna5mq-CgvyzQvO.js";import{Qo as T,Zo as E,as as D,nx as O,rx as k,ts as A}from"./app-initial~app-main~new-thread-panel-page-BZHGOlMi.js";function j({header:e,banner:t,children:n,className:r,bodyClassName:i,containerRef:a,tabIndex:o,...s}){return(0,N.jsxs)(`div`,{ref:(0,M.useCallback)(e=>{if(typeof a==`function`){a(e);return}a!=null&&(a.current=e)},[a]),className:O(`relative flex h-full flex-col`,r),tabIndex:o,...s,children:[(0,N.jsx)(`div`,{className:`sticky top-0 z-10`,children:e}),(0,N.jsx)(`div`,{className:O(`flex min-h-0 flex-1 flex-col`,i),children:(0,N.jsxs)(`div`,{className:`relative mx-auto flex min-h-0 w-full flex-1 flex-col`,children:[t,(0,N.jsx)(`div`,{className:`min-h-0 flex-1`,children:n})]})})]})}var M,N,P,F,I=e((()=>{k(),M=t(n(),1),N=o(),P=`px-toolbar`,F=O(`mx-auto w-full max-w-(--thread-content-max-width)`,P)}));function L({children:e,onPointerDownOutside:t}){let n=a(A),r=(0,z.useContext)(s),o=i(h.activeTab$),c=i(u),l=i(m),f=i(p),b=i(g),w=(0,z.useRef)(null),E=(0,z.useRef)(null),D=(0,z.useRef)(0),[k,j]=(0,z.useState)(102),M=t!=null,N=!T(o)||!c||l,P=R(N,f),I=S(k),L=N?I:0,H=P!==`hidden`,U=P===`visible`,W=P===`entering`||P===`exiting`,G=W?b:L;D.current=G;let K=(0,z.useEffectEvent)(()=>{t?.()}),q=(0,z.useCallback)(()=>{let e=w.current,t=Math.max(102,e?.offsetHeight??0);j(e=>e===t?e:t);let i=r==null||e==null?0:Math.max(0,r.offsetWidth-e.offsetLeft-e.offsetWidth);n.get(C)!==i&&n.set(C,i)},[r,n]);if((0,z.useLayoutEffect)(()=>()=>{d(n),n.get(g)!==0&&n.set(g,0),n.get(C)!==0&&n.set(C,0)},[n]),(0,z.useLayoutEffect)(()=>{if(!H){n.get(C)!==0&&n.set(C,0);return}q();let e=w.current;if(e==null||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(q);return t.observe(e),r!=null&&t.observe(r),()=>{t.disconnect()}},[r,q,n,H]),(0,z.useLayoutEffect)(()=>{if(!(!H||r==null))return r.style.setProperty(_,`${k}px`),r.style.setProperty(x,`${D.current}px`),()=>{r.style.removeProperty(_),r.style.removeProperty(x)}},[r,k,H]),(0,z.useLayoutEffect)(()=>{P===`entering`?y(n,L,{direction:`enter`,shouldAnimate:!0}):W||y(n,L)},[P,W,n,L]),(0,z.useLayoutEffect)(()=>{!H||r==null||r.style.setProperty(x,`${G}px`)},[r,H,G]),(0,z.useEffect)(()=>{if(!M||!U)return;let e=e=>{let t=e.target;t instanceof Node&&(E.current?.contains(t)||K())};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[M,U]),!H)return null;let J=(0,V.jsx)(`div`,{"aria-hidden":!U,"data-testid":`right-panel-composer-overlay`,onAnimationEnd:e=>{e.currentTarget===e.target&&P===`entering`&&v(n,`entering`)},onTransitionEnd:e=>{e.currentTarget===e.target&&P===`exiting`&&v(n,`exiting`)},className:O(`pointer-events-none absolute inset-x-0 z-[42] transition-opacity duration-[120ms] motion-reduce:transition-none`,P===`entering`&&`right-panel-composer-overlay-enter opacity-100`,P===`visible`&&`opacity-100 ease-in`,P===`exiting`&&`opacity-0 ease-out`),style:{bottom:`var(--app-shell-bottom-panel-height, 0px)`,transform:`translateY(calc(${I}px - var(${x}, 0px)))`},children:(0,V.jsx)(`div`,{ref:w,"data-right-panel-composer-overlay-content":`true`,className:O(F,`pb-6`),children:(0,V.jsx)(`div`,{ref:E,className:U?`pointer-events-auto`:`pointer-events-none`,children:e})})});return r==null?J:(0,B.createPortal)(J,r)}function R(e,t){return e?t===`entering`?`entering`:`visible`:t===`exiting`?`exiting`:`hidden`}var z,B,V,H=e((()=>{k(),r(),z=t(n(),1),B=t(w(),1),b(),c(),l(),D(),f(),E(),I(),V=o()}));export{I as a,j as i,H as n,F as r,L as t};
//# sourceMappingURL=app-initial~app-main~remote-conversation-page~appgen-library-page~local-conversation-page-CfMUdpO1.js.map