import scrollIntoView from "../../../../../../scroll-into-view-if-needed@2.2.20/node_modules/scroll-into-view-if-needed/es/index.js";
import { isFunction } from "./is.js";
var __assign = globalThis && globalThis.__assign || function() {
  __assign = Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s)
        if (Object.prototype.hasOwnProperty.call(s, p))
          t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
function scrollIntoViewIfNeed(node, options) {
  if (node) {
    scrollIntoView(node, __assign({ block: "start", behavior: "instant", scrollMode: "if-needed" }, options));
    var height = node.offsetHeight;
    var scaleHeight = node.getBoundingClientRect().height;
    if (options && options.boundary && height !== scaleHeight) {
      var parentNode = isFunction(options.boundary) ? options.boundary(node) : options.boundary;
      parentNode.scrollTop = Math.round(parentNode.scrollTop * (height / scaleHeight));
    }
  }
}
export {
  scrollIntoViewIfNeed as default
};
//# sourceMappingURL=scrollIntoView.js.map
