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