import{d as k,bU as A,r as l,cz as L,s as B,b_ as $,h as C,aV as I,aY as S,i as v,o as r,f as g,e as f,b as h,n as E,l as p,u as a,aq as M,c as T,cA as W,cB as D,cC as c,ap as N}from"./Bxv1kRJt.js";const R={key:1,"of-hidden":"","max-h-screen":""},X=k({__name:"PanelFloating",props:{isOpen:{type:Boolean},isFixed:{type:Boolean},storageKey:{}},setup(b){const t=b,s=$(),u=A(),d=l(!1),m=l(0),w=l(0),F=l(0),n=l(L),y=B(()=>`${s.value.position}: ${n.value}px`);function O(e){d.value=!0,m.value=e.clientX,w.value=n.value,F.value=s.value.width||0,document.addEventListener("mousemove",z),document.addEventListener("mouseup",_)}function z(e){if(d.value){const i=e.clientX-m.value;if(s.value.position!=="right"){const o=Math.max(c,F.value+i);s.value.width=o,s.value.defaultFrameSize=o,n.value=Math.max(c,w.value+i)}else{const o=Math.max(c,window.innerWidth-i);s.value.width=o,s.value.defaultFrameSize=o,n.value=Math.max(c,window.innerWidth-m.value-i-50)}}}function _(){d.value&&(d.value=!1,document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",_))}function x(){t.isOpen?(!s.value.panelOpen||s.value.panelOpen?.length===0)&&(n.value=t.isFixed?0:s.value.width||D,s.value.panelOpen=t.storageKey):s.value.panelOpen=void 0}return C(()=>[t.isOpen,t.isFixed],()=>{x()},{immediate:!0}),I(()=>{x()}),S(()=>{s.value.panelOpen=void 0}),(e,i)=>(r(),v("div",{relative:"","h-full":"",grid:"",class:E([a(s).position==="right"&&"flex-row-reverse",e.isOpen&&a(u)&&!e.isFixed?"grid-cols-[auto_1fr]":"w-full"])},[g("div",{style:p(e.isOpen&&a(u)&&`width: ${a(n)}px`),class:E(["of-auto!",e.isFixed&&"hidden"])},[h(e.$slots,"default",{},void 0,!0)],6),e.isOpen&&!e.isFixed&&a(u)?(r(),v("div",{key:0,class:"unpress-resize-handle unpress-resize-handle-vertical",style:p(a(y)),onMousedown:M(O,["prevent"])},null,36)):f("",!0),e.isOpen||e.isFixed?(r(),v("div",R,[a(u)?h(e.$slots,"panel",{key:0},void 0,!0):(r(),T(W,{key:1,to:"#floating-panel"},[g("div",{style:p(`width: ${a(n)}px`),"h-screen":"","border-base":"","bg-base":"","border-r":"",class:"translate-x-[-1px]"},[h(e.$slots,"panel",{},void 0,!0)],4),e.isOpen&&!e.isFixed?(r(),v("div",{key:0,class:"unpress-resize-handle unpress-resize-handle-vertical translate-x-[-1px]",style:p(a(y)),onMousedown:M(O,["prevent"])},null,36)):f("",!0)]))])):f("",!0)],2))}}),P=N(X,[["__scopeId","data-v-41cca711"]]);export{P as _};
