import{j as V,c3 as ne,bH as N,cj as ae,ck as se,i as v,b7 as ue,aC as Z,p as F,aD as le,a3 as ie,aR as U,aH as P,an as z,a4 as re,cl as ce,aF as $}from"#entry";const M=Symbol.for("vuetify:layout"),X=Symbol.for("vuetify:layout-item"),K=1e3,pe=F({overlaps:{type:Array,default:()=>[]},fullHeight:Boolean},"layout"),fe=F({name:{type:String},order:{type:[Number,String],default:0},absolute:Boolean},"layout-item");function me(){const s=V(M);if(!s)throw new Error("[Vuetify] Could not find injected layout");return{getLayoutItem:s.getLayoutItem,mainRect:s.mainRect,mainStyles:s.mainStyles}}function ge(s){const u=V(M);if(!u)throw new Error("[Vuetify] Could not find injected layout");const d=s.id??`layout-item-${ne()}`,i=N("useLayoutItem");U(X,{id:d});const n=Z(!1);ae(()=>n.value=!0),se(()=>n.value=!1);const{layoutItemStyles:r,layoutItemScrimStyles:c}=u.register(i,{...s,active:v(()=>n.value?!1:s.active.value),id:d});return ue(()=>u.unregister(d)),{layoutItemStyles:r,layoutRect:u.layoutRect,layoutItemScrimStyles:c}}const ve=(s,u,d,i)=>{let n={top:0,left:0,right:0,bottom:0};const r=[{id:"",layer:{...n}}];for(const c of s){const f=u.get(c),g=d.get(c),R=i.get(c);if(!f||!g||!R)continue;const I={...n,[f.value]:parseInt(n[f.value],10)+(R.value?parseInt(g.value,10):0)};r.push({id:c,layer:I}),n=I}return r};function Ie(s){const u=V(M,null),d=v(()=>u?u.rootZIndex.value-100:K),i=re([]),n=z(new Map),r=z(new Map),c=z(new Map),f=z(new Map),g=z(new Map),{resizeRef:R,contentRect:I}=le(),q=v(()=>{const t=new Map,l=s.overlaps??[];for(const e of l.filter(a=>a.includes(":"))){const[a,o]=e.split(":");if(!i.value.includes(a)||!i.value.includes(o))continue;const m=n.get(a),p=n.get(o),S=r.get(a),L=r.get(o);!m||!p||!S||!L||(t.set(o,{position:m.value,amount:parseInt(S.value,10)}),t.set(a,{position:p.value,amount:-parseInt(L.value,10)}))}return t}),h=v(()=>{const t=[...new Set([...c.values()].map(e=>e.value))].sort((e,a)=>e-a),l=[];for(const e of t){const a=i.value.filter(o=>c.get(o)?.value===e);l.push(...a)}return ve(l,n,r,f)}),j=v(()=>!Array.from(g.values()).some(t=>t.value)),b=v(()=>h.value[h.value.length-1].layer),W=P(()=>({"--v-layout-left":$(b.value.left),"--v-layout-right":$(b.value.right),"--v-layout-top":$(b.value.top),"--v-layout-bottom":$(b.value.bottom),...j.value?void 0:{transition:"none"}})),x=v(()=>h.value.slice(1).map((t,l)=>{let{id:e}=t;const{layer:a}=h.value[l],o=r.get(e),m=n.get(e);return{id:e,...a,size:Number(o.value),position:m.value}})),E=t=>x.value.find(l=>l.id===t),Y=N("createLayout"),T=Z(!1);ie(()=>{T.value=!0}),U(M,{register:(t,l)=>{let{id:e,order:a,position:o,layoutSize:m,elementSize:p,active:S,disableTransitions:L,absolute:J}=l;c.set(e,a),n.set(e,o),r.set(e,m),f.set(e,S),L&&g.set(e,L);const k=ce(X,Y?.vnode).indexOf(t);k>-1?i.value.splice(k,0,e):i.value.push(e);const B=v(()=>x.value.findIndex(w=>w.id===e)),O=v(()=>d.value+h.value.length*2-B.value*2),Q=v(()=>{const w=o.value==="left"||o.value==="right",A=o.value==="right",te=o.value==="bottom",C=p.value??m.value,oe=C===0?"%":"px",D={[o.value]:0,zIndex:O.value,transform:`translate${w?"X":"Y"}(${(S.value?0:-(C===0?100:C))*(A||te?-1:1)}${oe})`,position:J.value||d.value!==K?"absolute":"fixed",...j.value?void 0:{transition:"none"}};if(!T.value)return D;const y=x.value[B.value],H=q.value.get(e);return H&&(y[H.position]+=H.amount),{...D,height:w?`calc(100% - ${y.top}px - ${y.bottom}px)`:p.value?`${p.value}px`:void 0,left:A?void 0:`${y.left}px`,right:A?`${y.right}px`:void 0,top:o.value!=="bottom"?`${y.top}px`:void 0,bottom:o.value!=="top"?`${y.bottom}px`:void 0,width:w?p.value?`${p.value}px`:void 0:`calc(100% - ${y.left}px - ${y.right}px)`}}),ee=v(()=>({zIndex:O.value-1}));return{layoutItemStyles:Q,layoutItemScrimStyles:ee,zIndex:O}},unregister:t=>{c.delete(t),n.delete(t),r.delete(t),f.delete(t),g.delete(t),i.value=i.value.filter(l=>l!==t)},mainRect:b,mainStyles:W,getLayoutItem:E,items:x,layoutRect:I,rootZIndex:d});const _=P(()=>["v-layout",{"v-layout--full-height":s.fullHeight}]),G=P(()=>({zIndex:u?d.value:void 0,position:u?"relative":void 0,overflow:u?"hidden":void 0}));return{layoutClasses:_,layoutStyles:G,getLayoutItem:E,items:x,layoutRect:I,layoutRef:R}}export{pe as a,me as b,Ie as c,fe as m,ge as u};
