import{r as l}from"./compute-scroll-into-view-Bl8rNFhg.js";const f=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function b(e,t){if(!e.isConnected||!(n=>{let o=n;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(e))return;const r=(n=>{const o=window.getComputedStyle(n);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((n=>typeof n=="object"&&typeof n.behavior=="function")(t))return t.behavior(l(e,t));const a=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:n,top:o,left:i}of l(e,f(t))){const s=o-r.top+r.bottom,c=i-r.left+r.right;n.scroll({top:s,left:c,behavior:a})}}export{b as e};
