Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

2.0 KB
Raw Blame
import{s as e}from"./style-iIgYFplF.js";function t(e,{box:t=`bounding`,overflow:n=`none`}={}){let r=e.getBoundingClientRect(),i=t===`layout`&&e.offsetWidth||r.width,a=t===`layout`&&e.offsetHeight||r.height;return(n===`width`||n===`both`)&&(i=Math.max(i,e.scrollWidth)),(n===`height`||n===`both`)&&(a=Math.max(a,e.scrollHeight)),{width:i,height:a}}function n(e,t){let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&t.clientX>=n.left&&t.clientX<n.right&&t.clientY>=n.top&&t.clientY<n.bottom}function r(n,r={}){let{styles:i,...a}=r,o=()=>t(n,a);return i?e(n,i,o):o()}function i(e){let t=getComputedStyle(e);return{inlineStart:Number.parseFloat(t.paddingInlineStart)||0,inlineEnd:Number.parseFloat(t.paddingInlineEnd)||0,blockStart:Number.parseFloat(t.paddingBlockStart)||0,blockEnd:Number.parseFloat(t.paddingBlockEnd)||0}}function a(e){return e.inlineStart+e.inlineEnd}function o(e){return e.blockStart+e.blockEnd}function s(e){let t=getComputedStyle(e);return{x:Number.parseFloat(t.paddingLeft)||0,y:Number.parseFloat(t.paddingTop)||0}}function c(e){if(e.length===0)return{width:0,height:0};let t=Math.max(...e.map(({offsetLeft:e,size:t})=>e+t.width)),n=e[0].offsetTop;return{width:t,height:e.some(({offsetTop:e})=>e!==n)?Math.max(...e.map(({offsetTop:e,size:t})=>e+t.height)):e.reduce((e,{size:t})=>e+t.height,0)}}function l(e,{children:t,includePadding:n=!1,maxWidth:l=null,measure:u=(e,t)=>r(e,t===void 0?void 0:{styles:{width:`${t}px`}}),resolveSize:d=c}={}){let f=[...t??Array.from(e.children).filter(e=>e instanceof HTMLElement)].filter(e=>!e.hidden),p=n?i(e):{inlineStart:0,inlineEnd:0,blockStart:0,blockEnd:0},m=a(p),h=o(p),g=n?s(e):{x:0,y:0};if(f.length===0)return{width:m,height:h};let _=e=>f.map(t=>({element:t,size:u(t,e),offsetLeft:t.offsetLeft-g.x,offsetTop:t.offsetTop-g.y})),v=_(),y=d(v).width+m,b=l===null?y:Math.min(y,Math.max(0,l));return b<y&&(v=_(Math.max(0,b-m))),{width:b,height:d(v).height+h}}export{n as a,a as i,i as n,r as o,t as r,l as s,o as t};
//# sourceMappingURL=layout-DqqwqjPS.js.map