import e from"./browser.prod.js";import t from"./domObjects.prod.js";import n from"./is.prod.js";import*as o from"./window.prod.js";export function nodeContains(e,t){if(e.contains)return e.contains(t);for(;t;){if(t===e)return!0;t=t.parentNode}return!1}export function closest(e,t){for(;n.element(e);){if(matchesSelector(e,t))return e;e=parentNode(e)}return null}export function parentNode(e){let t=e.parentNode;if(n.docFrag(t)){for(;(t=t.host)&&n.docFrag(t););return t}return t}export function matchesSelector(t,n){return o.window!==o.realWindow&&(n=n.replace(/\/deep\//g," ")),t[e.prefixedMatchesSelector](n)}const r=e=>e.parentNode||e.host;export function indexOfDeepestElement(e){let n,c=[];for(let f=0;f=(parseInt(o.getWindow(u).getComputedStyle(u).zIndex,10)||0)&&(n=f);continue}let a;if(c=c.length?c:i(m),m instanceof t.HTMLElement&&s instanceof t.SVGElement&&!(s instanceof t.SVGSVGElement)){if(s===d)continue;a=s.ownerSVGElement}else a=s;const g=i(a,m.ownerDocument);let h=0;for(;g[h]&&g[h]===c[h];)h++;const x=[g[h-1],g[h],c[h]];let w=x[0].lastChild;for(;w;){if(w===x[1]){n=f,c=g;break}if(w===x[2])break;w=w.previousSibling}}var l,u;return n}function i(e,t){const n=[];let o,i=e;for(;(o=r(i))&&i!==t&&o!==i.ownerDocument;)n.unshift(i),i=o;return n}export function matchesUpTo(e,t,o){for(;n.element(e);){if(matchesSelector(e,t))return!0;if((e=parentNode(e))===o)return matchesSelector(e,t)}return!1}export function getActualElement(e){return e.correspondingUseElement||e}export function getScrollXY(e){return{x:(e=e||o.window).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}export function getElementClientRect(e){const n=e instanceof t.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return n&&{left:n.left,right:n.right,top:n.top,bottom:n.bottom,width:n.width||n.right-n.left,height:n.height||n.bottom-n.top}}export function getElementRect(t){const n=getElementClientRect(t);if(!e.isIOS7&&n){const e=getScrollXY(o.getWindow(t));n.left+=e.x,n.right+=e.x,n.top+=e.y,n.bottom+=e.y}return n}export function getPath(e){const t=[];for(;e;)t.push(e),e=parentNode(e);return t}export function trySelector(e){return!!n.string(e)&&(t.document.querySelector(e),!0)} //# sourceMappingURL=domUtils.prod.js.map