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