Files
dot-files/GitHub Desktop-dev/extensions/lhdoppojpmngadmnindnejefpokejbdd/highlighter.js
klein panic 2bcc806b8b first commit
2024-09-29 01:05:25 -04:00

2 lines
22 KiB
JavaScript
Executable File

function t(t,o=!0){const e=t.ownerDocument.defaultView,i=e===window.top;let n=t,r=n.getBoundingClientRect(),l=!1;for(;n.parentElement&&(!r.height||!r.width);)l=!0,n=n.parentElement,r=n.getBoundingClientRect();const a=e.getComputedStyle(n)||{};let s=e.frameElement,h=r,p=h.top+(i?e.pageYOffset:0),c=h.left+(i?e.pageXOffset:0),d=p,g=c;if(s)for(d=h.top,g=h.left,p=h.top,c=h.left;s&&o;){const{frameElement:t,pageYOffset:o,pageXOffset:e}=s.ownerDocument.defaultView,i=s.ownerDocument.defaultView===window.top,n=window.getComputedStyle(s),r=Math.max(parseFloat(n.borderLeftWidth),0),l=Math.max(parseFloat(n.borderTopWidth),0);h=s.getBoundingClientRect(),d+=h.top+l+(i?o:0),g+=h.left+r+(i?e:0),s=t}const m=e.frameElement?{top:d-window.pageYOffset,left:g-window.pageXOffset,height:r.height,width:r.width}:r,f=function(t,o=window.visualViewport||{width:window.innerWidth,height:window.innerWidth}){return{top:t.top+t.height<0,bottom:t.top>o.height,left:t.left+t.width<0,right:t.left>o.width}}(m),u=function(t,o={height:document.documentElement.scrollHeight,width:document.documentElement.scrollWidth}){return{top:t.top+t.height+(window.scrollY||window.pageYOffset)<0,bottom:t.top>o.height,left:t.left+t.width+(window.scrollX||window.pageXOffset)<0,right:t.left>o.width}}(m),b=t=>+t?.replace("px","")||0,{height:w,width:x}=e.visualViewport||{width:e.innerWidth,height:e.innerHeight};return{hidden:l,offViewport:f.top||f.bottom||f.left||f.right,offscreen:u.top||u.bottom||u.left||u.right,offscreenTop:u.top,offscreenBottom:u.bottom,offscreenLeft:u.left,offscreenRight:u.right,fullscreen:d<=0&&g<=0&&r.width>=x&&r.height>=w,top:d,left:g,offsetTop:p,offsetLeft:c,width:r.width,height:r.height,margin:{top:b(a.marginTop),right:b(a.marginRight),bottom:b(a.marginBottom),left:b(a.marginLeft)},border:{top:b(a.borderTopWidth),right:b(a.borderRightWidth),bottom:b(a.borderBottomWidth),left:b(a.borderLeftWidth)},padding:{top:b(a.paddingTop),right:b(a.paddingRight),bottom:b(a.paddingBottom),left:b(a.paddingLeft)}}}const o=new Map,e=t=>1===t.length?t[0]:t;var i={sanitize:t=>l().commons.text.sanitize(t),sanitizeContext:r,isValidLang(t){const o=l();return!!t&&o.utils.isValidLang(t)},hasContent(t){const o=l(t),e=f(o,t);return!!e&&o.commons.dom.hasContentVirtual(e)},getRequiredContext(t){const o=l();return t?o.commons.aria.requiredContext(t):[]},isOffscreen:(...t)=>e(t.map(h)),isHidden:(...t)=>e(t.map(p)),isVisible:(t,o=!1)=>!!t.ownerDocument.defaultView&&e(function(t,o){const e=l(t,o);o&&(e.teardown(),e.setup());return e.commons.dom.isVisible(t,!1,!0)}(t,o)),isSRVisible:(...t)=>e(t.map(c)),name:(...t)=>e(t.map(s)),isOpaque:(...t)=>e(t.map(u)),getRoleType:(...t)=>e(t.map(d)),getRole:(...t)=>e(t.map(g)),getContrast:(...t)=>e(t.map(m)),runContrastAnalysis:t=>async function(t){const o=l();w();try{const e=(await o.run(Array.isArray(t)?t.map(r):r(t),{runOnly:["color-contrast"],restoreScroll:!0,pingWaitTime:5e3,resultTypes:["violations"]}))?.violations?.[0]?.nodes;return e?.map?.((t=>{const o=t.any[0],e=["fgColor","bgColor","contrastRatio","expectedContrastRatio"],i=parseInt(o.data.fontSize.split(" ")[0]),n="bold"===o.data.fontWeight;return{data:{...Object.fromEntries(Object.entries(o.data).filter((([t])=>e.includes(t)))),fontSize:i,isBold:n},selector:t.target}}))||[]}catch(t){console.error(t)}finally{n(document.body)}return[]}(t),isWidgetRole:t=>l().commons.aria.lookupTable.rolesOfType.widget.includes(t),isFocusable:(...t)=>e(t.map(b)),getTabbableElements:t=>function(t){const o=l(t,!0),e=f(o,t);return o.commons.dom.getTabbableElements(e).map((({actualNode:t})=>t))}(t),getFlattenedTree:n,getSource:t=>new(l().utils.DqElement)(t).source,getSelector(t){const o=l();return o._selectorData||(o._selectorData=o.utils.getSelectorData(o.utils.getFlattenedTree())),o.utils.getSelector(t)},getElementStack(t,o=!0){const e=l();return o&&(e.teardown(),e.setup()),e.commons.dom.getElementStack(t)},idrefs:(t,o)=>l(t).commons.dom.idrefs(t,o),table:{isRowHeader:t=>l(t).commons.table.isRowHeader(t),isColumnHeader:t=>l(t).commons.table.isColumnHeader(t),toGrid(t){const o=l(t);return o.teardown(),o.setup(),o.commons.table.toGrid(t)},isDataTable:t=>l(t).commons.table.isDataTable(t),getCellPosition:(t,o)=>l(t).commons.table.getCellPosition(t,o),traverse(t,o,e,i){if(!e[0]?.[0])return;return l(e[0][0]).commons.table.traverse(t,o,e,i)}},setupTrees:function(){w(),o.clear()},cleanupTrees:w,isAxeSetUp:t=>!!l(t)._tree};function n(t){const e=l(),i=e.utils.getFlattenedTree(t.ownerDocument);return o.set(e,i),i}function r(t){if(!t.ownerDocument||t.ownerDocument===document)return t;const o=l();o._selectorData=o.utils.getSelectorData(o.utils.getFlattenedTree());const e=[o.utils.getSelector(t)];let i=t.ownerDocument.defaultView.frameElement;for(;i;)e.unshift(o.utils.getSelector(i)),i=i.contentWindow.parent.frameElement;return e.flat()}function l(t=document.documentElement,e=!1){const i=t.ownerDocument,n=i.defaultView;if(!n)throw new ReferenceError("no context was found for this node");const r=n.axe;if(!r)throw new ReferenceError("axe was not found in this context");const l=o.get(r)?.[0];return(e||!o.has(r)||l&&!r.utils.getNodeFromTree(l,t))&&o.set(r,r.utils.getFlattenedTree(i)),r}function a(t){return!!l(t).utils.getNodeFromTree(t)}function s(t){const o=l(t),e=f(o,t);return e?o.commons.text.accessibleTextVirtual(e):""}function h(t){return l(t).commons.dom.isOffscreen(t)}function p(t){return l(t).commons.utils.isHidden(t)}function c(t){return l(t).commons.dom.isVisible(t,!0,!1)}function d(t){const o=l(t),e=function(t){return l(t).commons.aria.implicitRole(t)}(t),i=o.commons.aria.lookupTable.role[e];return i&&i.type}function g(t){const o=l(t);return a(t)?o.commons.aria.getRole(t):null}function m(t){const o=l(t);let e;try{const i=o.commons.color.getForegroundColor(t),n=o.commons.color.getBackgroundColor(t);e=o.commons.color.getContrast(n,i)}catch(t){console.error(t)}return e}function f(t,e){let i=o.get(t);return i||(i=t.utils.getFlattenedTree(e.ownerDocument),o.set(t,i)),t.utils.getNodeFromTree(i[0],e)}function u(t){return l(t).commons.dom.isOpaque(t)}function b(t){const o=l(t);return a(t)?o.commons.dom.isFocusable(t):void 0}function w(){o.forEach(((t,e)=>{e.teardown(),o.delete(e)}))}const{getRole:x,getContrast:y,name:v,isHidden:M}=i;function L(t){const o=new Map;try{const e=function(t){const o=y(t);if(!o)return;return{name:"Contrast",value:`\n <span class="contrast-aa">AA</span> ${Math.floor(100*o)/100}\n ${o<4.5?'<svg overflow="visible" preserveAspectRatio="none" viewBox="0 0 24 24" width="14" height="14"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31A7.902 7.902 0 0112 20zm6.31-3.1L7.1 5.69A7.902 7.902 0 0112 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z" vector-effect="non-scaling-stroke" fill="#d93251"></path></svg>':'<svg overflow="visible" preserveAspectRatio="none" viewBox="0 0 24 24" width="14" height="14"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" vector-effect="non-scaling-stroke" fill="#32a852"></path></svg>'}\n `}}(t),i=function(t){const o=x(t);if(o)return{name:"Role",value:o}}(t),n=i&&function(t){const o=v(t);return{name:"Accessible Text",value:M(t)?"<em>hidden</em>":o||"<em>empty</em>"}}(t);[e,i,n].filter(Boolean).forEach((({name:t,value:e})=>{o.set(t,e)}))}catch(t){console.error(t)}return o}const T=document.createElement("template");T.innerHTML='\n <style>\n :host{--high-contrast-color-outline:#c11bde;--high-contrast-color-shadow:#e267ff}.theme--high-contrast{border:3px solid var(--high-contrast-color-outline);box-shadow:0 0 10px 4px var(--high-contrast-color-shadow);max-width:calc(100% - 6px);padding:3px;transform:translate(-6px,-6px)}.theme--high-contrast.highlight--fullpage{border:3px solid var(--high-contrast-color-outline);bottom:0!important;left:0!important;position:fixed!important;right:0!important;top:0!important;transform:none}.theme--high-contrast:not(.highlight--offscreen):not(.highlight--fullpage)+#tooltip.tooltip--bottom{transform:translateY(6px)}.theme--high-contrast:not(.highlight--offscreen):not(.highlight--fullpage)+#tooltip.tooltip--top{transform:translateY(-6px)}.theme--devtools{--theme--border-color:#ffff3273;--theme--margin-color:#ff960080;--theme--padding-color:#23b45059;--theme--content-color:#1e3cff66}.theme--devtools.highlight--fullpage{bottom:0!important;left:0!important;position:fixed!important;right:0!important;top:0!important;transform:none}.theme--selection:before{border:3px dashed var(--high-contrast-color-outline);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.theme--selection.highlight--page{border:3px dashed var(--high-contrast-color-outline);bottom:0!important;left:0!important;position:fixed!important;right:0!important;top:0!important;transform:none}.theme--selection.highlight--page:before{display:none}.theme--selected:before{border:3px solid var(--high-contrast-color-outline);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.theme--selected.highlight--page{border:3px solid var(--high-contrast-color-outline);bottom:0!important;left:0!important;position:fixed!important;right:0!important;top:0!important;transform:none}.theme--selected.highlight--page:before{display:none}:host{--badge-color-outline:#3c7aae}.theme--badge:before{border:3px solid var(--badge-color-outline);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.theme--badge:after{align-items:center;background-color:var(--badge-color-outline);border:3px solid #fff;color:#fff;content:var(--axe-highlight-badge-content,counter(badge));counter-reset:badge var(--axe-highlight-counter);display:flex;font-family:monospace;font-size:13px;font-weight:500;height:1.5em;justify-content:center;left:3px;min-width:1.5em;position:absolute;top:3px}.theme--ml:before{border:3px solid var(--high-contrast-color-outline);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.theme--ml:after{background-image:url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjkiIGhlaWdodD0iMjkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMTQuNSIgY3k9IjE0LjUiIHI9IjEzLjUiIGZpbGw9IiMwYjE0MWMiIHN0cm9rZT0iI2Q0ZGRlMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBhdGggZD0iTTYuMjMgMTIuNThoLjkydjUuNTFoLS45MmEuOTEuOTEgMCAwIDEtLjkyLS45MVYxMy41YS45Mi45MiAwIDAgMSAuOTItLjkyem0xNC43LTEuMzhWMTlhMS44NCAxLjg0IDAgMCAxLTEuODQgMS44NEg5LjkxQTEuODQgMS44NCAwIDAgMSA4LjA3IDE5di03LjhhMi4yOSAyLjI5IDAgMCAxIDIuMjktMi4yOWgzLjIyVjcuMDdhLjkyLjkyIDAgMCAxIDEuODQgMHYxLjg0aDMuMjJhMi4yOSAyLjI5IDAgMCAxIDIuMjkgMi4yOXptLTggMi4zYTEuMTUgMS4xNSAwIDEgMC0xLjE1IDEuMTUgMS4xNSAxLjE1IDAgMCAwIDEuMTUtMS4xNXptLS4yMyAzLjY4aC0xLjg4di45MWgxLjg0em0yLjc2IDBoLTEuODh2LjkxaDEuODR6bTMtMy42OGExLjE1IDEuMTUgMCAxIDAtMS4xNSAxLjE1IDEuMTYgMS4xNiAwIDAgMCAxLjE1LTEuMTV6bS0uMjMgMy42OGgtMS44OXYuOTFoMS44NHptNS41MS0zLjY4djMuNjhhLjkyLjkyIDAgMCAxLS45Mi45MWgtLjkydi01LjUxaC45MmEuOTIuOTIgMCAwIDEgLjkyLjkyeiIgZmlsbD0iIzc2Y2ZlOCIvPjwvc3ZnPg==");background-repeat:no-repeat;content:"";height:29px;left:-5px;position:absolute;top:-5px;width:29px}\n :host{--base-font-size:12px;height:0!important;left:0!important;opacity:1!important;pointer-events:none!important;position:absolute!important;top:0!important;width:100%!important}:host(.highlight--hide){display:none!important}#axe-highlight{display:flex;flex:1;pointer-events:none;position:absolute;z-index:2147483647}#border{border-color:var(--theme--border-color,#0000)}#border,#margin{border-style:solid;display:flex;flex:1}#margin{border-color:var(--theme--margin-color,#0000)}#content{background-clip:content-box;background-color:var(--theme--content-color,#0000);border-color:var(--theme--padding-color,#0000);border-style:solid;box-sizing:border-box;display:flex;flex:1;height:100%;width:100%}\n :host{--tooltip-background-color:#f9f9f9;--tooltip-border-color:#333;--tooltip-shadow-color:#0003;--tooltip-tag-name-color:#2e40a0;--tooltip-tag-identifier-color:#c53406;--tooltip-text-color:#02101a;--tooltip-label-color:#666;--tooltip-text-accent-color:#4d4d4d}#tooltip{background:var(--tooltip-background-color);border:3px solid var(--tooltip-border-color);border-radius:3px;box-shadow:0 0 6px var(--tooltip-shadow-color);color:var(--tooltip-text-color);font-family:monospace;font-size:var(--base-font-size);margin:.5rem 0;max-width:20rem;padding:.6rem;position:absolute;white-space:nowrap;z-index:2147483647}#tooltip p{margin:0}#tooltip svg{height:13px;margin-bottom:-2px;width:13px}#tooltip:after,#tooltip:before{border:.5rem solid #0000;border-bottom:.5rem solid var(--tooltip-background-color);border-top:none;content:"";display:block;position:absolute}#tooltip:after{top:0;transform:translateY(1px) translateY(-100%);z-index:2}#tooltip:before{border-bottom:.5rem solid var(--tooltip-border-color);top:0;transform:translateY(-3px) translateY(-100%);z-index:1}#tooltip.tooltip--top:before{top:100%;transform:rotate(180deg) translateY(-3px)}#tooltip.tooltip--top:after{top:100%;transform:rotate(180deg) translateY(1px)}#tooltip.tooltip--right{margin-right:-1.3rem}#tooltip.tooltip--right:after,#tooltip.tooltip--right:before{right:.6rem}#tooltip.tooltip--left:after,#tooltip.tooltip--left:before{left:.6rem}#tooltip.tooltip--fullscreen{bottom:auto!important;left:10px!important;margin:0;position:fixed!important;top:10px!important;transform:none}#tooltip.tooltip--fullscreen:after,#tooltip.tooltip--fullscreen:before{display:none}#tag{display:grid;grid-template-columns:max-content auto 1fr min-content}#tag-name{color:var(--tooltip-tag-name-color)}#tag-identifier{-webkit-line-clamp:3;-webkit-box-orient:vertical;color:var(--tooltip-tag-identifier-color);display:-webkit-box;overflow:hidden;white-space:normal}#tag-visibility{color:var(--tooltip-text-accent-color);font-style:italic;margin-left:1em}#tag-offscreen{margin-left:1em}#tag-dimensions{color:var(--tooltip-text-accent-color);font-family:monospace;justify-self:right;margin-left:1em}#hidden-eye{position:relative}#hidden-eye:before{background-color:#02101a;border:1px solid #fff;content:"";display:block;height:1px;left:-1px;position:absolute;top:7px;transform:rotate(-45deg);width:16px;z-index:1}#accessible-text{color:var(--tooltip-text-accent-color);white-space:normal}#attributes{grid-column-gap:1rem;grid-row-gap:.2rem;align-items:center;border-top:1px solid #ccc;display:grid;font-family:sans-serif;grid-auto-rows:minmax(1.6em,auto);grid-template-columns:1fr auto;margin:.6rem 0 0;padding:.6rem 0 0}#attributes dd,#attributes dl{margin:0}#attributes dt{color:var(--tooltip-label-color)}#attributes dd{-webkit-line-clamp:3;-webkit-box-orient:vertical;justify-self:right;text-align:right;white-space:normal}.contrast-aa{border:1px solid #4d4d4d;color:#4d4d4d;display:inline-block;font-family:monospace;font-size:9px;line-height:1em;padding:2px;vertical-align:text-bottom}#tooltip.tooltip--offscreen.tooltip--top{margin-bottom:1.2rem}#tooltip.tooltip--offscreen.tooltip--right{margin-right:.6rem}#tooltip.tooltip--offscreen.tooltip--left{margin-left:.6rem}#tooltip.tooltip--offscreen.tooltip--right:before{top:.6rem;transform:rotate(90deg) translateY(-24px)}#tooltip.tooltip--offscreen.tooltip--right:after{top:.6rem;transform:rotate(90deg) translateY(-20px)}#tooltip.tooltip--offscreen.tooltip--left:before{top:.6rem;transform:rotate(-90deg) translateY(-24px)}#tooltip.tooltip--offscreen.tooltip--left:after{top:.6rem;transform:rotate(-90deg) translateY(-20px)}\n </style>\n <style id="position"></style>\n <div id="axe-highlight" class="theme--high-contrast">\n <div id="margin">\n <div id="border">\n <div id="content"></div>\n </div>\n </div>\n </div>\n <div id="tooltip" style="display: none"></div>\n';const E="tooltip--top",I="tooltip--bottom",j="tooltip--left",D="tooltip--right",A="tooltip--fullscreen",C={fullpage:"highlight--fullpage",offscreen:"highlight--offscreen"},k="highlight--hide",S=320,O=({top:t,right:o,bottom:e,left:i})=>`\n border-top-width: ${Math.max(t,0)}px;\n border-right-width: ${Math.max(o,0)}px;\n border-bottom-width: ${Math.max(e,0)}px;\n border-left-width: ${Math.max(i,0)}px;\n `.replace(/[\s\n]/g,""),Y="axe-highlighter";const z=new class{constructor(){this.target=new EventTarget}on(t,o){this.target.addEventListener(t,o)}remove(t,o){this.target.removeEventListener(t,o)}emit(t){this.target.dispatchEvent(new CustomEvent(t))}},H=function(t,o){let e;return function(...i){e||(e=setTimeout((()=>{t(...i),e=null}),o))}}(z.emit.bind(z),50),R=t=>{"selection"!==t.theme&&t.theme&&H("highlighter:change")};class ${static tagName="axe-highlighter";constructor(o,e=null){if(!o)return;const i=o.ownerDocument||document;let n;this.target=o,this.selector=e,this.axeHighlighter=i.createElement($.tagName);try{n=this.axeHighlighter.attachShadow({mode:"open"})}catch(t){n=this.axeHighlighter.shadowRoot}this.axeHighlighter.style.setProperty("--axe-highlight-counter",N.size+1),n.appendChild(T.content.cloneNode(!0)),this.position=n.getElementById("position"),this.highlight=n.getElementById("axe-highlight"),this.tooltip=n.getElementById("tooltip"),this.cachedLayout=o.layout||t(o)}updatePosition(){const{target:o}=this;if(!o.isConnected&&!o.frameId)return;const{width:e,height:i,margin:n,border:r,padding:l,hidden:a,offViewport:s,offscreen:h,fullscreen:p}=this.cachedLayout=o.layout||t(o);let{top:c,left:d}=this.cachedLayout;const{position:g}=this,{height:m,width:f,pageTop:u,pageLeft:b}=window.visualViewport||{width:window.innerWidth,height:window.innerHeight,pageTop:window.pageYOffset,pageLeft:window.pageXOffset},w=c+i/2>m/2+u,x=d>f-320+b,y=this.axeHighlighter.offsetParent;if(y&&"static"!==getComputedStyle(y).getPropertyValue("position")){const t=y.getBoundingClientRect();c-=t.top+u,d-=t.left+b}g.textContent=`\n #axe-highlight {\n top: ${c-Math.max(n.top,0)}px;\n left: ${d-Math.max(n.left,0)}px;\n }\n\n #tooltip {\n top: ${w?"auto":`${i+(c+Math.max(n.bottom,0))}px`};\n bottom: ${w?-(c-Math.max(n.top,0))+"px":"auto"};\n left: ${x?"auto":`${d}px`};\n right: ${x?f-d+"px":"auto"};\n }\n\n #margin {\n ${O(n)}\n height: ${i}px;\n width: ${e}px;\n }\n\n #border {\n ${O(r)}\n }\n\n #content {\n ${O(l)}\n }\n `;let v=s&&!p,M=h&&!p;if(o.frameId&&o.layout){const{layout:t}=o;v=t.top+t.height<u||t.top>u+m}this.highlight.classList.toggle(C.fullpage,p),this.highlight.classList.toggle(C.offscreen,v||M),this.showTooltip({offViewport:v,offscreen:M,showTooltip:!!M||this.options.showTooltip,hidden:a,flipY:w,flipX:x})}setTheme(t,o){const{classList:e}=this.highlight;e.remove(...e),e.add(`theme--${t}`);const{badgeContent:i}=o;i&&this.axeHighlighter.style.setProperty("--axe-highlight-badge-content",`'${i}'`),this.theme=t,R(this)}setOptions(t){this.options=t}showTooltip({hidden:t=!1,offViewport:o=!1,offscreen:e=!1,showTooltip:i=!1,flipX:n=!1,flipY:r=!1}={}){const{target:l,tooltip:a,cachedLayout:s,options:h}=this,{showMetadata:p}=h;if(!i)return a.innerHTML="",void(a.style.display="none");const{offscreenTop:c=!1,offscreenLeft:d=!1,offscreenBottom:g=!1,offscreenRight:m=!1,top:f,left:u,height:b,width:w,fullscreen:x}=s,y=f-(window.scrollY||window.pageYOffset)+"px",v=u-(window.scrollX||window.pageXOffset)+"px",M=l.tagName.toLowerCase(),T=l.getAttribute?.("id")||l.attributes?.id,C=Array.from(l.classList).join("."),k=T?`#${T}`:C.length?`.${C}`:"";!p||this.checks||l.frameId||(this.checks=L(l));const S=this.checks&&Array.from(this.checks.entries()).map((([t,o])=>`<dt>${t}</dt><dd>${o}</dd>`));a.innerHTML=`\n <div id="tag">\n <strong id="tag-name">${M}</strong><span id="tag-identifier">${k}</span>\n ${t?'<span id="tag-visibility">(hidden)</span>':""}\n <span id="tag-dimensions">${parseFloat(w.toFixed(2))} x ${parseFloat(b.toFixed(2))}</span>\n </div>\n ${S&&S.length?`<dl id="attributes">${S.join("")}</d>`:""}\n `,a.style.display="block";let O=I;requestAnimationFrame((()=>{e?(this.tooltip.style.position="fixed",c?(this.tooltip.style.top="0",this.tooltip.style.bottom="auto",O=I):(this.tooltip.style.top=y,this.tooltip.style.bottom="auto"),g&&(this.tooltip.style.bottom="0",this.tooltip.style.top="auto",O=E),d?(this.tooltip.style.left="0",this.tooltip.style.right="auto",O=j):(this.tooltip.style.left=v,this.tooltip.style.right="auto"),m&&(this.tooltip.style.right="0",this.tooltip.style.left="auto",O=D)):(o?(this.tooltip.style.position="fixed",r?(this.tooltip.style.top="auto",this.tooltip.style.bottom="0"):this.tooltip.style.top="0"):(this.tooltip.style.position="",this.tooltip.style.top="",this.tooltip.style.bottom=""),r&&(O=E),O+=` ${n?D:j}`),a.classList.toggle(A,x),a.classList.remove(E,I,j,D),a.classList.add(...O.split(" "))}))}hide(){this.axeHighlighter.classList.add("highlight--hide"),R(this)}show(){this.axeHighlighter.classList.remove("highlight--hide"),R(this)}scrollIntoView({behavior:t="smooth"}={}){const o={block:"center",behavior:t,inline:"nearest"};this.target?.scrollIntoView?.(o)}destroy(){this.axeHighlighter.parentNode?.removeChild(this.axeHighlighter),N.delete(this.target),R(this)}}const N=new Map,V=t=>Array.from(N.keys()).find((o=>o.selector?.flat().join()===t.selector?.flat().join())),F=t=>N.has(t)||!(!t.selector||!V(t));let W=!1,B=!1;function P(){B||(window.requestAnimationFrame((()=>{N.forEach((t=>t.updatePosition())),B=!1})),B=!0)}function X(){Array.from(N.values()).forEach((t=>t.destroy()))}function Z(){Array.from(N.values()).forEach((t=>t.show()))}function G(){Array.from(N.values()).forEach((t=>t.hide()))}function U(t,o=null){let e=null;return W||(window.addEventListener("resize",P),window.addEventListener("scroll",P,!0),window.addEventListener("beforeunload",(()=>{window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)})),W=!0),{highlight:function({theme:i="high-contrast",themeOptions:n={},showMetadata:r=!0,showTooltip:l=!0}={}){const a=N.get(t),s=V(t);if(e=a||new $(t,o),e.setTheme(i,n),e.setOptions({showTooltip:l,showMetadata:r}),s&&t.selector){N.get(s).destroy()}return a||(N.set(t,e),document.body.appendChild(e.axeHighlighter)),R(this||{theme:i}),e.updatePosition(),e},destroy:function(){e&&(e.destroy(),e=null)},scrollIntoView:t=>e?.scrollIntoView(t)}}export{S as TOOLTIP_MAX_WIDTH,X as clearHighlights,U as createHighlighter,z as emitter,V as findExistingHighlighterNode,G as hideHighlights,k as highlightHidden,C as highlightPosition,F as highlighterExists,N as highlighters,Z as showHighlights,Y as tagName,P as updateHighlighters};