import{compute as a}from"../../../../compute-scroll-into-view@3.1.1/node_modules/compute-scroll-into-view/dist/index.mjs";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 d(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(a(e,t));const l=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:n,top:o,left:s}of a(e,f(t))){const i=o-r.top+r.bottom,c=s-r.left+r.right;n.scroll({top:i,left:c,behavior:l})}}export{d as default};
