(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{detectAndDismissPopupCandidates:()=>y,elementsByHigherZIndex:()=>a,elementsInFrontCount:()=>I,fireClickEvent:()=>h,fireDoubleClickEvent:()=>f,fireRightClickEvent:()=>g,getAllElementsAbove:()=>v,getOverlappingElements:()=>p});const n=750,o="auto",i=.95,r=["close","dismiss","exit","not at this time","no thanks","no, thanks","i, agree","i agree"],s=[{attributeName:"className",matchFunction:c},{attributeName:"name",matchFunction:c},{attributeName:"id",matchFunction:c},{attributeName:"href",matchFunction:c},{attributeName:"innerText",matchFunction:function(e,t){const n=new RegExp(`\\b${t}\\b`);return!!e.toLowerCase().match(n)}}];function a(e){return Array.from(document.querySelectorAll("body *")).reduce((t,n)=>{const o=parseFloat(globalThis.getComputedStyle(n).zIndex),i="number"==typeof e?e:parseFloat(e);return!Number.isNaN(o)&&o>=i&&(t.has(o)?t.get(o).push(n):t.set(o,[n])),t},new Map)}function l(e){const t=e=>void 0===e||"html"===e.tagName.toLowerCase();let n=e;for(;!t(n);){const e=globalThis.getComputedStyle(n).zIndex;if(e&&e!==o)return parseInt(e,10);n=(null==n?void 0:n.parentElement)?n.parentElement:void 0}return 0}function u(e){let t=[e];return Array.from(e.children).forEach(e=>{t=t.concat(u(e))}),t}function c(e,t){return e.toLowerCase().includes(t)}function d(e){const t=[];return e.forEach(e=>{const n=[],o=[];e.elements.forEach(e=>{var t,a;((null==e?void 0:e.offsetParent)||"SVG"===(null===(t=e.tagName)||void 0===t?void 0:t.toUpperCase()))&&(["BUTTON","A","DIV","SVG"].includes(null===(a=e.tagName)||void 0===a?void 0:a.toUpperCase())&&function(e){let t=0;return s.forEach(n=>{r.forEach(o=>{e.getAttribute(n.attributeName)&&n.matchFunction(e.getAttribute(n.attributeName),o)&&(t+=1)})}),t}(e)&&!o.includes(e)?o.push(e):function(e){if(e.getBoundingClientRect){const t=e.getBoundingClientRect(),n=t.width/globalThis.innerWidth,o=t.height/globalThis.innerHeight;return n>i&&o>i}return!1}(e)&&n.push(e))}),t.push({zIndex:e.zIndex,actionableElements:o,domCovering:n,dismissedStatus:!1,elementsInFront:0})}),t}function m(e,t,n=!1){const o=e.getBoundingClientRect(),i=o.height/2,r=n?1:o.width/2,s="contextmenu"===t?2:0,a=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:o.left+r,screenY:o.top+i,clientX:e.clientLeft+r,clientY:e.clientTop+i,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:s,relatedTarget:void 0});e.dispatchEvent(a)}function f(e){h(e,!1),h(e,!1),m(e,"dblclick")}function h(e,t=!1){m(e,"click",t)}function g(e,t=!1){m(e,"contextmenu",t)}function p(e){const{x:t,y:n}={x:(o=e.getBoundingClientRect()).left+o.width/2,y:o.top+o.height/2};var o;const i=document.elementsFromPoint(t,n),r=i.findIndex(t=>t===e);return r?i.slice(0,r):[]}function b(e){return new Promise(t=>setTimeout(t,e))}function v(e,t){if(0===t.length)return[];const n=l(e),o=Math.min(...null==t?void 0:t.map(e=>l(e)));if(o<=n)return[];const i=a(o),r=Array.from(i).map(([e,t])=>({zIndex:e,elements:t.flatMap(u).reverse()}));return r.sort((e,t)=>t.zIndex-e.zIndex),r}async function y(e){try{let t=p(e);const o=t.length;if(0===o)return{elementsInFront:0,dismissedStatus:!1};const i=async function(t,i){for(const r of t)if(h(r,i),await b(n),p(e).length<o)return!0;return!1};let r=v(e,t);const s=d(r);for(const e of s){let t=await i(e.domCovering,!0);if(t||(t=await i(e.actionableElements,!1)),t)return{dismissedStatus:!0,elementsInFront:0}}t=p(e),r=v(e,t);const a=d(r),l=a.length?a[0]:{zIndex:0,elementsInFront:0,dismissedStatus:!1,domCovering:[],actionableElements:[]};return l.elementsInFront=t.length,l.dismissedStatus=!1,{dismissedStatus:l.dismissedStatus,elementsInFront:l.elementsInFront}}catch(e){return{elementsInFront:0,dismissedStatus:!1,error:e.toString()}}}function I(e){return p(e).length}window.popupDismissal=t})();