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