text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.scrollIntoView=t()}(this,function(){"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e}).apply(this,arguments)}var t,o=function(e){return null!=e&&"object"==typeof e&&1===e.nodeType},i=function(e,t){return"Y"===t?e.clientHeight<e.scrollHeight:"X"===t&&e.clientWidth<e.scrollWidth},n=function(e,t){var o=window.getComputedStyle(e,null)["overflow"+t];return"visible"!==o&&"clip"!==o},l=function(e,t,o,i,n,l){return i<e&&n>t||i>e&&n<t?0:i<e&&l<o||n>t&&l>o?i-e:n>t&&l<o||i<e&&l>o?n-t:0};return function(r,c){void 0===c&&(c=!0);var f={};void 0===t&&(t="scrollBehavior"in document.documentElement.style),!0===c||null===c?f={block:"start",inline:"nearest"}:!1===c?f={block:"end",inline:"nearest"}:c===Object(c)&&(f=0===Object.keys(c).length?{block:"start",inline:"nearest"}:e({block:"center",inline:"nearest"},c));var s=f,a=s.behavior,u=void 0===a?"auto":a,h=function(e,t){if(null==e)return{};var o,i,n={},l=Object.keys(e);for(i=0;i<l.length;i++)o=l[i],t.indexOf(o)>=0||(n[o]=e[o]);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)o=r[i],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(s,["behavior"]),d=function(t,r){void 0===r&&(r={});var c=e({scrollMode:"always",block:"center",inline:"nearest"},r),f=c.scrollMode,s=c.block,a=c.inline,u=c.boundary,h="function"==typeof u?u:function(e){return e!==u};if(!o(t))throw new Error("Element is required in scrollIntoView");for(var d,p,w=t.getBoundingClientRect(),v=document.documentElement,g=[];o(d=t.parentNode)&&h(t);)(i(p=d,"Y")&&n(p,"Y")||i(p,"X")&&n(p,"X")||d===v)&&g.push(d),t=d;var b,m,y=window.visualViewport?window.visualViewport.width:v.clientWidth,O=window.visualViewport?window.visualViewport.height:v.clientHeight,T=window.scrollX||window.pageXOffset,L=window.scrollY||window.pageYOffset;return"if-needed"===f&&g.every(function(e){var t=e.getBoundingClientRect();if(w.top<t.top)return!1;if(w.bottom>t.bottom)return!1;if(e===v){if(w.bottom>O)return!1;if(w.left>y)return!1}return!0})?[]:g.map(function(e){var t=e.getBoundingClientRect(),o=0,i=0;if("start"===s)if(b||(b=w.top),v===e)o=L+b;else{var n=Math.min(b-t.top,e.scrollHeight-e.clientHeight-e.scrollTop);o=e.scrollTop+n,b-=o-e.scrollTop}if("center"===s)if(b||(b=w.top+w.height/2),v===e)o=L+b-e.clientHeight/2;else{var r=0-Math.min(t.top+t.height/2-b,e.scrollTop);o=e.scrollTop+r,b+=e.scrollTop-o}if("end"===s)if(b||(b=w.bottom),v===e)o=L+b-e.clientHeight;else{var c=0-Math.min(t.bottom-b,e.scrollTop);o=e.scrollTop+c,b+=e.scrollTop-o}if("nearest"===s)if(b||(b=w.top),v===e){var f=l(L,L+O,O,L+b,L+b+w.height,w.height);o=L+f}else{var u=l(t.top,t.bottom,t.height,b,b+w.height,w.height);o=e.scrollTop+u,b-=u}if("start"===a)if(m||(m=w.left),v===e)i=T+m;else{var h=Math.min(m-t.left,e.scrollHeight-e.clientLeft-e.scrollLeft);i=e.scrollLeft+h,m-=i-e.scrollLeft}if("center"===a)if(m||(m=w.left+w.width/2),v===e)i=T+m-e.clientWidth/2;else{var d=0-Math.min(t.left+t.width/2-m,e.scrollLeft);i=e.scrollLeft+d,m+=e.scrollLeft-i}if("end"===a)if(m||(m=w.right),v===e)i=T+m-e.clientWidth;else{var p=0-Math.min(t.right-m,e.scrollLeft);i=e.scrollLeft+p,m+=e.scrollLeft-i}if("nearest"===a)if(m||(m=w.left),v===e){var g=l(T,T+y,y,T+m,T+m+w.width,w.width);i=T+g}else{var j=l(t.left,t.right,t.width,m,m+w.width,w.width);i=e.scrollLeft+j,m-=j}return{el:e,top:o,left:i}})}(r,h);if("function"==typeof u)return u(d);d.forEach(function(e){var o=e.el,i=e.top,n=e.left;o.scroll&&t?o.scroll({top:i,left:n,behavior:u}):o===document.documentElement?window.scrollTo(n,i):(o.scrollTop=i,o.scrollLeft=n)})}});
  