Sami Marreed
feat: docker-v1 with optimized frontend
0646b18
var Se=Object.defineProperty;var Re=(F,_,O)=>_ in F?Se(F,_,{enumerable:!0,configurable:!0,writable:!0,value:O}):F[_]=O;var S=(F,_,O)=>Re(F,typeof _!="symbol"?_+"":_,O);var content=(function(){"use strict";function F(A){return A}typeof Symbol.dispose!="symbol"&&Object.defineProperty(Symbol,"dispose",{configurable:!1,enumerable:!1,writable:!1,value:Symbol.for("dispose")}),typeof Symbol.asyncDispose!="symbol"&&Object.defineProperty(Symbol,"asyncDispose",{configurable:!1,enumerable:!1,writable:!1,value:Symbol.for("asyncDispose")});function _(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var O={exports:{}},ae=O.exports,te;function le(){return te||(te=1,(function(A){(function(e,t){A.exports?A.exports=t():e.log=t()})(ae,function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},g=null;function s(b,E){var p=b[E];if(typeof p.bind=="function")return p.bind(b);try{return Function.prototype.bind.call(p,b)}catch{return function(){return Function.prototype.apply.apply(p,[b,arguments])}}}function f(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function w(b){return b==="debug"&&(b="log"),typeof console===t?!1:b==="trace"&&n?f:console[b]!==void 0?s(console,b):console.log!==void 0?s(console,"log"):e}function d(){for(var b=this.getLevel(),E=0;E<i.length;E++){var p=i[E];this[p]=E<b?e:this.methodFactory(p,b,this.name)}if(this.log=this.debug,typeof console===t&&b<this.levels.SILENT)return"No console available for logging"}function m(b){return function(){typeof console!==t&&(d.call(this),this[b].apply(this,arguments))}}function h(b,E,p){return w(b)||m.apply(this,arguments)}function y(b,E){var p=this,I,L,T,M="loglevel";typeof b=="string"?M+=":"+b:typeof b=="symbol"&&(M=void 0);function k(o){var u=(i[o]||"silent").toUpperCase();if(!(typeof window===t||!M)){try{window.localStorage[M]=u;return}catch{}try{window.document.cookie=encodeURIComponent(M)+"="+u+";"}catch{}}}function P(){var o;if(!(typeof window===t||!M)){try{o=window.localStorage[M]}catch{}if(typeof o===t)try{var u=window.document.cookie,C=encodeURIComponent(M),v=u.indexOf(C+"=");v!==-1&&(o=/^([^;]+)/.exec(u.slice(v+C.length+1))[1])}catch{}return p.levels[o]===void 0&&(o=void 0),o}}function a(){if(!(typeof window===t||!M)){try{window.localStorage.removeItem(M)}catch{}try{window.document.cookie=encodeURIComponent(M)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function c(o){var u=o;if(typeof u=="string"&&p.levels[u.toUpperCase()]!==void 0&&(u=p.levels[u.toUpperCase()]),typeof u=="number"&&u>=0&&u<=p.levels.SILENT)return u;throw new TypeError("log.setLevel() called with invalid level: "+o)}p.name=b,p.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},p.methodFactory=E||h,p.getLevel=function(){return T??L??I},p.setLevel=function(o,u){return T=c(o),u!==!1&&k(T),d.call(p)},p.setDefaultLevel=function(o){L=c(o),P()||p.setLevel(o,!1)},p.resetLevel=function(){T=null,a(),d.call(p)},p.enableAll=function(o){p.setLevel(p.levels.TRACE,o)},p.disableAll=function(o){p.setLevel(p.levels.SILENT,o)},p.rebuild=function(){if(g!==p&&(I=c(g.getLevel())),d.call(p),g===p)for(var o in r)r[o].rebuild()},I=c(g?g.getLevel():"WARN");var l=P();l!=null&&(T=c(l)),d.call(p)}g=new y,g.getLogger=function(E){if(typeof E!="symbol"&&typeof E!="string"||E==="")throw new TypeError("You must supply a name when creating a logger.");var p=r[E];return p||(p=r[E]=new y(E,g.methodFactory)),p};var D=typeof window!==t?window.log:void 0;return g.noConflict=function(){return typeof window!==t&&window.log===g&&(window.log=D),g},g.getLoggers=function(){return r},g.default=g,g})})(O)),O.exports}var ce=le();const X=_(ce);var z={exports:{}},ge=z.exports,ne;function de(){return ne||(ne=1,(function(A){(function(e,t){A.exports?A.exports=t():e.prefix=t(e)})(ge,function(e){var t=function(d){for(var m=1,h=arguments.length,y;m<h;m++)for(y in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],y)&&(d[y]=arguments[m][y]);return d},n={template:"[%t] %l:",levelFormatter:function(d){return d.toUpperCase()},nameFormatter:function(d){return d||"root"},timestampFormatter:function(d){return d.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},i,r={},g=function(d){if(!d||!d.getLogger)throw new TypeError("Argument is not a root logger");i=d},s=function(d,m){if(!d||!d.setLevel)throw new TypeError("Argument is not a logger");var h=d.methodFactory,y=d.name||"",D=r[y]||r[""]||n;function b(E,p,I){var L=h(E,p,I),T=r[I]||r[""],M=T.template.indexOf("%t")!==-1,k=T.template.indexOf("%l")!==-1,P=T.template.indexOf("%n")!==-1;return function(){for(var a="",c=arguments.length,l=Array(c),o=0;o<c;o++)l[o]=arguments[o];if(y||!r[I]){var u=T.timestampFormatter(new Date),C=T.levelFormatter(E),v=T.nameFormatter(I);T.format?a+=T.format(C,v,u):(a+=T.template,M&&(a=a.replace(/%t/,u)),k&&(a=a.replace(/%l/,C)),P&&(a=a.replace(/%n/,v))),l.length&&typeof l[0]=="string"?l[0]=a+" "+l[0]:l.unshift(a)}L.apply(void 0,l)}}return r[y]||(d.methodFactory=b),m=m||{},m.template&&(m.format=void 0),r[y]=t({},D,m),d.setLevel(d.getLevel()),i||d.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),d},f={reg:g,apply:s},w;return e&&(w=e.prefix,f.noConflict=function(){return e.prefix===f&&(e.prefix=w),f}),f})})(z)),z.exports}var ue=de();const ie=_(ue);class he{constructor(){S(this,"xpathCache",new WeakMap)}getXPathTree(e,t=!0){if(this.xpathCache.has(e))return this.xpathCache.get(e);const n=[];let i=e;for(;i&&i.nodeType===Node.ELEMENT_NODE&&!(t&&(i.parentNode instanceof ShadowRoot||i.parentNode instanceof HTMLIFrameElement));){const g=this.getElementPosition(i),s=i.nodeName.toLowerCase(),f=g>0?`[${g}]`:"";n.unshift(`${s}${f}`),i=i.parentNode}const r=n.join("/");return this.xpathCache.set(e,r),r}clearCache(){this.xpathCache=new WeakMap}getElementPosition(e){if(!e.parentElement)return 0;const t=e.nodeName.toLowerCase(),n=Array.from(e.parentElement.children).filter(r=>r.nodeName.toLowerCase()===t);return n.length===1?0:n.indexOf(e)+1}}const J="playwright-highlight-container";class me{constructor(){S(this,"boundingRects",new WeakMap);S(this,"clientRects",new WeakMap);S(this,"computedStyles",new WeakMap);S(this,"clearCache",()=>{this.boundingRects=new WeakMap,this.clientRects=new WeakMap,this.computedStyles=new WeakMap})}getCachedBoundingRect(e){if(!e)return null;if(this.boundingRects.has(e))return this.boundingRects.get(e)||null;const t=e.getBoundingClientRect();return t&&this.boundingRects.set(e,t),t}getCachedComputedStyle(e){if(!e)return null;if(this.computedStyles.has(e))return this.computedStyles.get(e)||null;const t=window.getComputedStyle(e);return t&&this.computedStyles.set(e,t),t}getCachedClientRects(e){if(!e)return null;if(this.clientRects.has(e))return this.clientRects.get(e)||null;const t=e.getClientRects();return t&&this.clientRects.set(e,t),t}}class fe{highlightElement(e,t,n=null){if(!e)return t;const i=[];let r=null,g=20,s=16,f=null;try{let w=document.getElementById(J);w||(w=document.createElement("div"),w.id=J,w.style.position="fixed",w.style.pointerEvents="none",w.style.top="0",w.style.left="0",w.style.width="100%",w.style.height="100%",w.style.zIndex="2147483647",w.style.backgroundColor="transparent",document.body.appendChild(w));const d=e.getClientRects();if(!d||d.length===0)return t;const m=["#FF0000","#00FF00","#0000FF","#FFA500","#800080","#008080","#FF69B4","#4B0082","#FF4500","#2E8B57","#DC143C","#4682B4"],h=t%m.length,y=m[h],D=y+"1A";let b={x:0,y:0};if(n){const l=n.getBoundingClientRect();b.x=l.left,b.y=l.top}const E=document.createDocumentFragment();for(const l of d){if(l.width===0||l.height===0)continue;const o=document.createElement("div");o.style.position="fixed",o.style.border=`2px solid ${y}`,o.style.backgroundColor=D,o.style.pointerEvents="none",o.style.boxSizing="border-box";const u=l.top+b.y,C=l.left+b.x;o.style.top=`${u}px`,o.style.left=`${C}px`,o.style.width=`${l.width}px`,o.style.height=`${l.height}px`,E.appendChild(o),i.push({element:o,initialRect:l})}const p=d[0];r=document.createElement("div"),r.className="playwright-highlight-label",r.style.position="fixed",r.style.background=y,r.style.color="white",r.style.padding="1px 4px",r.style.borderRadius="4px",r.style.fontSize=`${Math.min(12,Math.max(8,p.height/2))}px`;const I=e.getAttribute("dom-tree-id");r.textContent=I||t.toString(),g=r.offsetWidth>0?r.offsetWidth:g,s=r.offsetHeight>0?r.offsetHeight:s;const L=p.top+b.y,T=p.left+b.x;let M=L+2,k=T+p.width-g-2;(p.width<g+4||p.height<s+4)&&(M=L-s-2,k=T+p.width-g,k<b.x&&(k=T)),M=Math.max(0,Math.min(M,window.innerHeight-s)),k=Math.max(0,Math.min(k,window.innerWidth-g)),r.style.top=`${M}px`,r.style.left=`${k}px`,E.appendChild(r);const c=((l,o)=>{let u=0;return((...C)=>{const v=performance.now();if(!(v-u<o))return u=v,l(...C)})})(()=>{const l=e.getClientRects();let o={x:0,y:0};if(n){const u=n.getBoundingClientRect();o.x=u.left,o.y=u.top}if(i.forEach((u,C)=>{if(C<l.length){const v=l[C],x=v.top+o.y,N=v.left+o.x;u.element.style.top=`${x}px`,u.element.style.left=`${N}px`,u.element.style.width=`${v.width}px`,u.element.style.height=`${v.height}px`,u.element.style.display=v.width===0||v.height===0?"none":"block"}else u.element.style.display="none"}),l.length<i.length)for(let u=l.length;u<i.length;u++)i[u].element.style.display="none";if(r&&l.length>0){const u=l[0],C=u.top+o.y,v=u.left+o.x;let x=C+2,N=v+u.width-g-2;(u.width<g+4||u.height<s+4)&&(x=C-s-2,N=v+u.width-g,N<o.x&&(N=v)),x=Math.max(0,Math.min(x,window.innerHeight-s)),N=Math.max(0,Math.min(N,window.innerWidth-g)),r.style.top=`${x}px`,r.style.left=`${N}px`,r.style.display="block"}else r&&(r.style.display="none")},16);return window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),f=()=>{window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c),i.forEach(l=>l.element.remove()),r&&r.remove()},w.appendChild(E),t+1}finally{if(f){const w=window;(w._highlightCleanupFunctions=w._highlightCleanupFunctions||[]).push(f)}}}}class pe{constructor(e,t,n,i=0){this.domCache=e,this.nodeHelper=t,this.xPathBuilder=n,this.viewportExpansion=i}collect(e){var g;const t="__CUGA_DOM_TREE_ID_COUNTER";let n;const i=e.getAttribute("dom-tree-id");if(i){const s=i.match(/(\d+)(?!.*\d)/);if(s){n=parseInt(s[1],10);const f=window[t]??0;n>f&&(window[t]=n)}else{const f=(window[t]??0)+1;window[t]=f,n=f}}else{const s=(window[t]??0)+1;window[t]=s,n=s;try{e.setAttribute("dom-tree-id",String(n))}catch{}}if(e===document.body)return{tagName:"body",xpath:"/body",domTreeId:n,children:[],attributes:{"dom-tree-id":String(n)}};const r={tagName:e.tagName.toLowerCase(),attributes:{},xpath:this.xPathBuilder.getXPathTree(e,!0),domTreeId:n,children:[],shadowRoot:!!e.shadowRoot};if(r.attributes["dom-tree-id"]=i??String(n),this.isInteractiveCandidate(e)||e.tagName.toLowerCase()==="iframe"||e.tagName.toLowerCase()==="body"){const s=((g=e.getAttributeNames)==null?void 0:g.call(e))||[];for(const f of s){const w=e.getAttribute(f);r.attributes[f]=w}}if(e.nodeType===Node.ELEMENT_NODE&&(r.isVisible=this.nodeHelper.isElementVisible(e),r.isVisible)){r.isTopElement=this.isTopElement(e);const s=e.getAttribute("role"),f=s==="menu"||s==="menubar"||s==="listbox";(r.isTopElement||f)&&(r.isInteractive=this.nodeHelper.isInteractiveElement(e))}return r}isTopElement(e){if(this.viewportExpansion===-1)return!0;const t=this.domCache.getCachedClientRects(e);if(!t||t.length===0)return!1;let n=!1;for(const w of t)if(w.width>0&&w.height>0&&!(w.bottom<-this.viewportExpansion||w.top>window.innerHeight+this.viewportExpansion||w.right<-this.viewportExpansion||w.left>window.innerWidth+this.viewportExpansion)){n=!0;break}if(!n)return!1;if(e.ownerDocument!==window.document)return!0;const r=e.getRootNode();if(r instanceof ShadowRoot){const w=t[Math.floor(t.length/2)].left+t[Math.floor(t.length/2)].width/2,d=t[Math.floor(t.length/2)].top+t[Math.floor(t.length/2)].height/2;try{const m=r.elementFromPoint(w,d);if(!m)return!1;let h=m;for(;h&&h!==r;){if(h===e)return!0;h=h.parentElement}return!1}catch{return!0}}const g=5,s=t[Math.floor(t.length/2)];return[{x:s.left+s.width/2,y:s.top+s.height/2},{x:s.left+g,y:s.top+g},{x:s.right-g,y:s.bottom-g}].some(({x:w,y:d})=>{try{const m=document.elementFromPoint(w,d);if(!m)return!1;let h=m;for(;h&&h!==document.documentElement;){if(h===e)return!0;h=h.parentElement}return!1}catch{return!0}})}isInteractiveCandidate(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e.tagName.toLowerCase();return new Set(["a","button","input","select","textarea","details","summary","label"]).has(t)?!0:e.hasAttribute("onclick")||e.hasAttribute("role")||e.hasAttribute("tabindex")||e.hasAttribute("aria-")||e.hasAttribute("data-action")||e.getAttribute("contenteditable")==="true"}isTextNodeVisible(e){try{if(this.viewportExpansion===-1){const s=e.parentElement;if(!s)return!1;try{return s.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0})}catch{const w=window.getComputedStyle(s);return w.display!=="none"&&w.visibility!=="hidden"&&w.opacity!=="0"}}const t=document.createRange();t.selectNodeContents(e);const n=t.getClientRects();if(!n||n.length===0)return!1;let i=!1,r=!1;for(const s of n)if(s.width>0&&s.height>0&&(i=!0,!(s.bottom<-this.viewportExpansion||s.top>window.innerHeight+this.viewportExpansion||s.right<-this.viewportExpansion||s.left>window.innerWidth+this.viewportExpansion))){r=!0;break}if(!i||!r)return!1;const g=e.parentElement;if(!g)return!1;try{return g.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0})}catch{const f=window.getComputedStyle(g);return f.display!=="none"&&f.visibility!=="hidden"&&f.opacity!=="0"}}catch(t){return console.warn("Error checking text node visibility:",t),!1}}}class Ae{constructor(e){this.domCache=e}isElementAccepted(e){if(!e||!e.tagName)return!1;const t=new Set(["body","div","main","article","section","nav","header","footer"]),n=e.tagName.toLowerCase();return t.has(n)?!0:!new Set(["svg","script","style","link","meta","noscript","template"]).has(n)}isInteractiveElement(e){var D,b;if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e.tagName.toLowerCase(),n=this.domCache.getCachedComputedStyle(e),i=new Set(["pointer","move","text","grab","grabbing","cell","copy","alias","all-scroll","col-resize","context-menu","crosshair","e-resize","ew-resize","help","n-resize","ne-resize","nesw-resize","ns-resize","nw-resize","nwse-resize","row-resize","s-resize","se-resize","sw-resize","vertical-text","w-resize","zoom-in","zoom-out"]),r=new Set(["not-allowed","no-drop","wait","progress","initial","inherit"]);function g(E){return E.tagName.toLowerCase()==="html"?!1:!!(n!=null&&n.cursor&&i.has(n.cursor))}if(g(e))return!0;const f=new Set(["a","button","input","select","textarea","details","summary","label","option","optgroup","fieldset","legend"]),w=new Set(["disabled","readonly"]);if(f.has(t)){if(n!=null&&n.cursor&&r.has(n.cursor))return!1;for(const E of w)if(e.hasAttribute(E)||e.getAttribute(E)==="true"||e.getAttribute(E)==="")return!1;return!(e.disabled||e.readOnly||e.inert)}const d=e.getAttribute("role"),m=e.getAttribute("aria-role");if(e.getAttribute("contenteditable")==="true"||e.isContentEditable||e.classList&&(e.classList.contains("button")||e.classList.contains("dropdown-toggle")||e.getAttribute("data-index")||e.getAttribute("data-toggle")==="dropdown"||e.getAttribute("aria-haspopup")==="true"))return!0;const h=new Set(["button","menu","menubar","menuitem","menuitemradio","menuitemcheckbox","radio","checkbox","tab","switch","slider","spinbutton","combobox","searchbox","textbox","listbox","option","scrollbar"]);if(f.has(t)||d&&h.has(d)||m&&h.has(m))return!0;try{if(typeof window.getEventListeners=="function"){const I=window.getEventListeners(e),L=["click","mousedown","mouseup","dblclick"];for(const T of L)if(I[T]&&I[T].length>0)return!0}const E=((b=(D=e==null?void 0:e.ownerDocument)==null?void 0:D.defaultView)==null?void 0:b.getEventListenersForNode)||window.getEventListenersForNode;if(typeof E=="function"){const I=E(e),L=["click","mousedown","mouseup","keydown","keyup","submit","change","input","focus","blur"];for(const T of L)for(const M of I)if(M.type===T)return!0}const p=["onclick","onmousedown","onmouseup","ondblclick"];for(const I of p)if(e.hasAttribute(I)||typeof e[I]=="function")return!0}catch{}return!1}isElementVisible(e){const t=this.domCache.getCachedComputedStyle(e);return e.offsetWidth>0&&e.offsetHeight>0&&(t==null?void 0:t.visibility)!=="hidden"&&(t==null?void 0:t.display)!=="none"}}class we{constructor(e,t,n,i=0,r=-1,g=!0){S(this,"highlightIndex");this.elementHighlighter=e,this.nodeHelper=t,this.domCache=n,this.viewportExpansion=i,this.focusHighlightIndex=r,this.doHighlightElements=g,this.highlightIndex=0}highlight(e){const t=[],n=this.findActiveListbox(e);for(const{node:i,nodeData:r,parentIFrame:g}of e){if(this.isTextNode(r)||!this.isElementNode(i)||n&&!this.isListboxRelatedElement(i,n))continue;let s=i.parentElement&&t.includes(i.parentElement)||!1;this.handleHighlighting(r,i,g,s)&&t.push(i)}}handleHighlighting(e,t,n,i){if(!e.isInteractive)return!1;let r=!1;return i?this.isElementDistinctInteraction(t)?r=!0:r=!1:r=!0,r&&(e.isInViewport=this.isInExpandedViewport(t),e.isInViewport||this.viewportExpansion===-1)?(e.highlightIndex=this.highlightIndex++,this.doHighlightElements?(this.focusHighlightIndex>=0?this.focusHighlightIndex===e.highlightIndex&&this.elementHighlighter.highlightElement(t,e.highlightIndex,n):this.elementHighlighter.highlightElement(t,e.highlightIndex,n),!0):!1):!1}isInExpandedViewport(e){if(this.viewportExpansion===-1)return!0;const t=e.getClientRects();if(!t||t.length===0){const n=this.domCache.getCachedBoundingRect(e);return!n||n.width===0||n.height===0?!1:!(n.bottom<-this.viewportExpansion||n.top>window.innerHeight+this.viewportExpansion||n.right<-this.viewportExpansion||n.left>window.innerWidth+this.viewportExpansion)}for(const n of t)if(!(n.width===0||n.height===0)&&!(n.bottom<-this.viewportExpansion||n.top>window.innerHeight+this.viewportExpansion||n.right<-this.viewportExpansion||n.left>window.innerWidth+this.viewportExpansion))return!0;return!1}isTextNode(e){return"type"in e&&e.type==="TEXT_NODE"}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isHeuristicallyInteractive(e){if(!e||e.nodeType!==Node.ELEMENT_NODE||!this.nodeHelper.isElementVisible(e))return!1;const t=e.hasAttribute("role")||e.hasAttribute("tabindex")||e.hasAttribute("onclick")||typeof e.onclick=="function",n=/\b(btn|clickable|menu|item|entry|link)\b/i.test(e.className||""),i=!!e.closest('button,a,[role="button"],.menu,.dropdown,.list,.toolbar'),r=[...e.children].some(s=>this.nodeHelper.isElementVisible(s)),g=e.parentElement&&e.parentElement.isSameNode(document.body);return(this.nodeHelper.isInteractiveElement(e)||t||n)&&r&&i&&!g}isElementDistinctInteraction(e){var g,s;const t=new Set(["button","link","menuitem","menuitemradio","menuitemcheckbox","radio","checkbox","tab","switch","slider","spinbutton","combobox","searchbox","textbox","listbox","option","scrollbar"]),n=new Set(["a","button","input","select","textarea","summary","details","label","option"]);if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const i=e.tagName.toLowerCase(),r=e.getAttribute("role");if(i==="iframe"||n.has(i)||r&&t.has(r)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.hasAttribute("data-testid")||e.hasAttribute("data-cy")||e.hasAttribute("data-test")||e.hasAttribute("onclick")||typeof e.onclick=="function")return!0;try{const f=((s=(g=e==null?void 0:e.ownerDocument)==null?void 0:g.defaultView)==null?void 0:s.getEventListenersForNode)||window.getEventListenersForNode;if(typeof f=="function"){const d=f(e),m=["click","mousedown","mouseup","keydown","keyup","submit","change","input","focus","blur"];for(const h of m)for(const y of d)if(y.type===h)return!0}if(["onmousedown","onmouseup","onkeydown","onkeyup","onsubmit","onchange","oninput","onfocus","onblur"].some(d=>e.hasAttribute(d)))return!0}catch{}return!!this.isHeuristicallyInteractive(e)}findActiveListbox(e){for(const{node:t,nodeData:n}of e){if(!this.isElementNode(t)||this.isTextNode(n))continue;const i=t;if(i.getAttribute("role")==="listbox"&&n.isVisible&&n.isInViewport!==!1)return i}return null}isListboxRelatedElement(e,t){return e===t?!1:!!(t.contains(e)||e.getAttribute("role")==="option")}}class be{constructor(e,t,n,i,r){S(this,"DOM_HASH_MAP",{});S(this,"collectedNodes",[]);S(this,"ID",{current:0});this.domCache=e,this.nodeValidator=t,this.nodeCollector=n,this.pageHighlighter=i,this.viewportExpansion=r}buildDomTree(){const e=this.buildDomTreeRecursive(document.body);this.pageHighlighter.highlight(this.collectedNodes);const t=structuredClone(this.DOM_HASH_MAP);return this.resetState(),{rootId:e,map:t}}buildDomTreeRecursive(e,t){var s,f,w;if(g())return null;if(e===document.body){const d=this.nodeCollector.collect(document.body);for(const h of e.childNodes){const y=this.buildDomTreeRecursive(h);y&&d.children.push(y)}const m=`${this.ID.current++}`;return this.DOM_HASH_MAP[m]=d,this.collectedNodes.push({node:e,nodeData:d}),m}if(e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.TEXT_NODE)return null;if(e.nodeType===Node.TEXT_NODE){const d=(s=e.textContent)==null?void 0:s.trim();if(!d)return null;const m=e.parentElement;if(!m||m.tagName.toLowerCase()==="script")return null;const h=`${this.ID.current++}`;return this.DOM_HASH_MAP[h]={type:"TEXT_NODE",text:d,isVisible:this.isTextNodeVisible(e)},h}const n=e;if(e.nodeType===Node.ELEMENT_NODE&&!this.isElementAccepted(n))return null;if(this.viewportExpansion!==-1&&!n.shadowRoot){const d=this.domCache.getCachedBoundingRect(n),m=this.domCache.getCachedComputedStyle(n),h=m&&(m.position==="fixed"||m.position==="sticky"),y=n.offsetWidth>0||n.offsetHeight>0;if(!d||!h&&!y&&(d.bottom<-this.viewportExpansion||d.top>window.innerHeight+this.viewportExpansion||d.right<-this.viewportExpansion||d.left>window.innerWidth+this.viewportExpansion))return null}const i=this.nodeCollector.collect(n);if(n.tagName){const d=n.tagName.toLowerCase();if(d==="iframe")try{const m=n.contentDocument||((f=n.contentWindow)==null?void 0:f.document);if(m)for(const h of m.childNodes){const y=this.buildDomTreeRecursive(h,n);y&&i.children.push(y)}}catch(m){console.warn("Unable to access iframe:",m)}else if(n.isContentEditable||n.getAttribute("contenteditable")==="true"||n.id==="tinymce"||n.classList.contains("mce-content-body")||d==="body"&&((w=n.getAttribute("data-id"))!=null&&w.startsWith("mce_")))for(const m of n.childNodes){const h=this.buildDomTreeRecursive(m,t);h&&i.children.push(h)}else{if(n.shadowRoot)for(const m of n.shadowRoot.childNodes){const h=this.buildDomTreeRecursive(m,t);h&&i.children.push(h)}for(const m of n.childNodes){const h=this.buildDomTreeRecursive(m,t);h&&i.children.push(h)}}}if(i.tagName==="a"&&i.children.length===0&&!i.attributes.href){const d=this.domCache.getCachedBoundingRect(n);if(!(d&&d.width>0&&d.height>0||n.offsetWidth>0||n.offsetHeight>0))return null}const r=`${this.ID.current++}`;return this.DOM_HASH_MAP[r]=i,this.collectedNodes.push({node:e,nodeData:i,parentIFrame:t}),r;function g(){return!e||e.id===J||e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.TEXT_NODE}}isTextNodeVisible(e){return this.nodeCollector.isTextNodeVisible(e)}isElementAccepted(e){return this.nodeValidator.isElementAccepted(e)}resetState(){this.ID={current:0},this.collectedNodes=[],this.DOM_HASH_MAP={}}}const xe=A=>{const{doHighlightElements:e=!0,focusHighlightIndex:t=-1,viewportExpansion:n=0}=A,i=new me,r=new fe,g=new he,s=new Ae(i),f=new pe(i,s,g,n),w=new we(r,s,i,n,t,e),m=new be(i,s,f,w,n).buildDomTree();return i.clearCache(),g.clearCache(),m};class ye{constructor(){S(this,"isRunning",!1);S(this,"currentResult",null);S(this,"messageListener",null)}start(){var e;if(this.isRunning){console.warn("⚠️ DOMTreeModule is already running");return}console.log("🚀 Starting DOMTreeModule...",{window:!!window,document:!!document,location:(e=window.location)==null?void 0:e.href,readyState:document.readyState}),this.isRunning=!0,this.messageListener=t=>{this.handleMessage(t)},window.addEventListener("message",this.messageListener),console.log("📨 Message listener added"),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{console.log("📄 DOM loaded, exposing API..."),this.exposeGlobalAPI()}):(console.log("📄 DOM already ready, exposing API..."),this.exposeGlobalAPI()),console.log("✅ DOMTreeModule startup complete")}stop(){if(!this.isRunning){console.warn("DOMTreeModule is not running");return}console.log("Stopping DOMTreeModule"),this.isRunning=!1,this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null),this.clearHighlights(),this.removeGlobalAPI(),console.log("DOMTreeModule stopped successfully")}handleMessage(e){if(e.source!==window)return;const{data:t}=e;if(!(!t||typeof t!="object"))switch(t.type){case"DOM_TREE_ANALYZE":this.handleAnalyzeCommand(t.args||{});break;case"DOM_TREE_HIGHLIGHT":this.handleHighlightCommand(t.args||{});break;case"DOM_TREE_CLEAR_HIGHLIGHTS":this.clearHighlights();break;case"DOM_TREE_GET_RESULT":this.sendCurrentResult();break}}handleAnalyzeCommand(e){try{const t=this.analyzePage(e);this.currentResult=t,window.postMessage({type:"DOM_TREE_ANALYZE_RESULT",result:t,success:!0},"*"),console.log("DOM analysis completed:",{totalNodes:Object.keys(t.map).length,rootId:t.rootId})}catch(t){console.error("DOM analysis failed:",t),window.postMessage({type:"DOM_TREE_ANALYZE_RESULT",error:t instanceof Error?t.message:"Unknown error",success:!1},"*")}}handleHighlightCommand(e){try{const t=this.analyzePage({...e,doHighlightElements:!0});this.currentResult=t,window.postMessage({type:"DOM_TREE_HIGHLIGHT_RESULT",result:t,success:!0},"*"),console.log("DOM highlighting completed")}catch(t){console.error("DOM highlighting failed:",t),window.postMessage({type:"DOM_TREE_HIGHLIGHT_RESULT",error:t instanceof Error?t.message:"Unknown error",success:!1},"*")}}sendCurrentResult(){window.postMessage({type:"DOM_TREE_CURRENT_RESULT",result:this.currentResult,success:!0},"*")}analyzePage(e={}){return e.doHighlightElements&&this.clearHighlights(),xe(e)}clearHighlights(){const e=document.getElementById("playwright-highlight-container");e&&e.remove();const t=window;t._highlightCleanupFunctions&&Array.isArray(t._highlightCleanupFunctions)&&(t._highlightCleanupFunctions.forEach(n=>{try{n()}catch(i){console.warn("Error calling highlight cleanup function:",i)}}),t._highlightCleanupFunctions=[])}getCurrentResult(){return this.currentResult}isModuleRunning(){return this.isRunning}exposeGlobalAPI(){const e={analyzePage:t=>this.analyzePage(t),clearHighlights:()=>this.clearHighlights(),getCurrentResult:()=>this.getCurrentResult(),isRunning:()=>this.isModuleRunning(),debug:{moduleInstance:this,exposedAt:new Date().toISOString(),context:"content-script"}};try{window.DOMTreeAPI=e,window.CUGA_DOMTreeAPI=e,console.log("✅ DOMTreeAPI exposed successfully",{window:!!window,globalAPI:!!e,DOMTreeAPI:!!window.DOMTreeAPI,timestamp:new Date().toISOString()}),window.dispatchEvent(new CustomEvent("DOMTreeAPI:ready",{detail:{api:e}}))}catch(t){console.error("❌ Failed to expose DOMTreeAPI:",t)}}removeGlobalAPI(){delete window.DOMTreeAPI}}const U="dom-tree-id",re="data-browsergym-setofmarks",se="data-browsergym-visibility";class Ee{constructor(){S(this,"elementIdCounter",0);S(this,"isInitialized",!1)}start(){console.log("Starting FrameMarkElements module..."),this.initialize()}stop(){console.log("Stopping FrameMarkElements module..."),this.cleanup()}initialize(){this.isInitialized||(this.setupMessageListener(),this.setupPageUnloadListener(),this.exportToWindow(),this.isInitialized=!0,console.log("CUGA Chrome Extension: Content script loaded and ready"))}cleanup(){this.unmarkElements(),this.elementIdCounter=0,this.isInitialized=!1}generateElementId(e){const t=e?e+":"+this.elementIdCounter:this.elementIdCounter.toString();return this.elementIdCounter++,t}isElementVisible(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=window.getComputedStyle(e),n=e.getBoundingClientRect();return t.display!=="none"&&t.visibility!=="hidden"&&t.opacity!=="0"&&n.width>0&&n.height>0}calculateVisibility(e){if(!this.isElementVisible(e))return 0;const t=window.getComputedStyle(e),n=e.getBoundingClientRect();let i=parseFloat(t.opacity)||1;return n.width*n.height<100&&(i*=.5),n.top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)||(i*=.3),Math.min(1,Math.max(0,i))}shouldMarkElement(e,t){if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const n=e.tagName.toLowerCase();return t==="all"?!0:["a","button","input","textarea","select","option","form","label","fieldset","legend","img","video","audio","canvas","svg","div","span","p","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","tr","td","th","tbody","thead","tfoot","nav","header","footer","section","article","aside","main","details","summary","dialog","menu","menuitem"].includes(n)}markElements(e,t,n){const i=[];try{const r=document.querySelectorAll("*");for(const s of r)try{if(!this.shouldMarkElement(s,n))continue;if(!s.hasAttribute(t)){const d=this.generateElementId(e);s.setAttribute(t,d)}const f=this.calculateVisibility(s);s.setAttribute(se,f.toString()),this.isElementInteractive(s)&&s.setAttribute(re,"1"),this.storeDynamicProperties(s)}catch(f){i.push(`Failed to mark element ${s.tagName}: ${f.message}`)}const g=document.querySelectorAll("iframe, frame");for(const s of g)try{if(!s.getAttribute(t)){const f=this.generateElementId(e);s.setAttribute(t,f)}}catch(f){i.push(`Failed to mark iframe: ${f.message}`)}}catch(r){i.push(`General marking error: ${r.message}`)}return i}isElementInteractive(e){const t=e.tagName.toLowerCase();if(["a","button","input","textarea","select","option","details","summary","dialog","menu","menuitem"].includes(t)||e.onclick||e.getAttribute("onclick")||e.style.cursor==="pointer")return!0;const r=e.getAttribute("role");return r!==null&&["button","link","menuitem","option","radio","checkbox","slider","spinbutton","textbox","combobox","listbox"].includes(r)}storeDynamicProperties(e){var n;const t=e.tagName.toLowerCase();try{if(["input","textarea","select"].includes(t))if(t==="input"){const i=e;i.type==="checkbox"||i.type==="radio"?e.setAttribute("data-browsergym-checked",i.checked.toString()):e.setAttribute("data-browsergym-value",i.value||"")}else{const i=e;e.setAttribute("data-browsergym-value",i.value||"")}if(t==="option"){const i=e;e.setAttribute("data-browsergym-selected",i.selected.toString())}if(["button","a","label"].includes(t)){const i=((n=e.textContent)==null?void 0:n.trim())||"";i&&e.setAttribute("data-browsergym-text",i)}}catch(i){console.warn(`Failed to store dynamic properties for ${t}:`,i)}}unmarkElements(){try{const e=document.querySelectorAll(`[${U}]`);for(const t of e){t.removeAttribute(se),t.removeAttribute(re);const n=["data-browsergym-checked","data-browsergym-value","data-browsergym-selected","data-browsergym-text"];for(const i of n)t.removeAttribute(i)}this.elementIdCounter=0}catch(e){console.warn("Failed to unmark elements:",e)}}getFocusedElementBid(){try{const e=n=>{const i=n.activeElement;return i?i.shadowRoot?e(i.shadowRoot):i:null},t=e(document);return t&&t.getAttribute(U)||""}catch(e){return console.warn("Failed to get focused element BID:",e),""}}extractPageContent(){try{return document.body.innerHTML||""}catch(e){return console.warn("Failed to extract page content:",e),""}}extractPageContentAsText(){try{return document.body.textContent||""}catch(e){return console.warn("Failed to extract page content as text:",e),""}}exportToWindow(){typeof window<"u"&&(window.browserGymContentScript={markElements:this.markElements.bind(this),unmarkElements:this.unmarkElements.bind(this),getFocusedElementBid:this.getFocusedElementBid.bind(this),extractPageContent:this.extractPageContent.bind(this),extractPageContentAsText:this.extractPageContentAsText.bind(this),isElementVisible:this.isElementVisible.bind(this),calculateVisibility:this.calculateVisibility.bind(this)})}setupMessageListener(){globalThis.chrome.runtime.onMessage.addListener((e,t,n)=>{var i,r,g,s,f;try{switch(e.type){case"ping":n({type:"pong",timestamp:Date.now()});break;case"mark_elements":this.unmarkElements();const w=this.markElements(e.data.frameId||"",e.data.bidAttribute||U,e.data.tagsToMark||"standard_html");n({type:"success",warnings:w});break;case"unmark_elements":this.unmarkElements(),n({type:"success"});break;case"get_focused_element_bid":const d=this.getFocusedElementBid();n({type:"success",data:d});break;case"get_element_rect":{try{const h=document.querySelector(`[${U}="${e.bid}"]`);if(!h)throw new Error(`Element with dom-tree-id '${e.bid}' not found`);const y=h.getBoundingClientRect();n({type:"success",data:{left:y.left,top:y.top,right:y.right,bottom:y.bottom,width:y.width,height:y.height}})}catch(h){n({type:"error",message:h.message})}break}case"extract_page_content":const m=(i=e.data)!=null&&i.asText?this.extractPageContentAsText():this.extractPageContent();n({type:"success",data:m});break;case"extract_dom_tree":try{const h=window.DOMTreeAPI||window.CUGA_DOMTreeAPI;if(!h)throw new Error("DOM Tree API not available");const y=h.analyzePage({doHighlightElements:((r=e.data)==null?void 0:r.doHighlightElements)||!1,focusHighlightIndex:((g=e.data)==null?void 0:g.focusHighlightIndex)||-1,viewportExpansion:((s=e.data)==null?void 0:s.viewportExpansion)||0,debugMode:((f=e.data)==null?void 0:f.debugMode)||!1});n({type:"success",data:y})}catch(h){n({type:"error",message:h.message})}break;case"server_disconnected":console.log("CUGA Chrome Extension: Server disconnected, removing element marks"),this.unmarkElements(),n({type:"success"});break;case"select_option":{(async()=>{try{const{bid:h,options:y}=e;await this.performSelectOption(h,y),n({type:"success"})}catch(h){n({type:"error",message:h.message})}})();break}case"add_animation":{const h=()=>{const I=document.createElement("style");I.id="ai-animation-styles",I.textContent=`
@keyframes pulse {
0% { opacity: 0.6; transform: scale(1); }
50% { opacity: 1; transform: scale(1.03); }
100% { opacity: 0.6; transform: scale(1); }
}
@keyframes glowing {
0% { box-shadow: 0 0 3px 2px rgba(138, 43, 226, 0.4); }
50% { box-shadow: 0 0 10px 5px rgba(138, 43, 226, 0.8); }
100% { box-shadow: 0 0 3px 2px rgba(138, 43, 226, 0.4); }
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.ai-highlight {
position: absolute;
z-index: 9998;
border: 2px solid #8a2be2;
border-radius: 4px;
pointer-events: none;
animation: glowing 1.8s infinite ease-in-out;
background-color: rgba(138, 43, 226, 0.05);
}
.ai-icon {
position: absolute;
z-index: 9999;
background-size: contain;
background-repeat: no-repeat;
width: 28px;
height: 28px;
pointer-events: none;
}
.ai-typing-icon {
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTcgMTJINyIgc3Ryb2tlPSIjOGEyYmUyIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0xMiA3TDEyIDE3IiBzdHJva2U9IiM4YTJiZTIiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+");
animation: pulse 1.5s infinite ease-in-out;
}
.ai-loading-icon {
border: 3px solid rgba(138, 43, 226, 0.3);
border-radius: 50%;
border-top: 3px solid #8a2be2;
animation: rotate 1s linear infinite;
}
.ai-success-icon {
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMjAgNkw5IDE3TDQgMTIiIHN0cm9rZT0iIzhhMmJlMiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=");
animation: pulse 1.5s infinite ease-in-out;
}
.ai-banner {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: linear-gradient(135deg, #9c27b0, #673ab7);
color: white;
padding: 10px 18px;
border-radius: 20px;
font-family: system-ui, -apple-system, sans-serif;
font-size: 14px;
font-weight: 500;
z-index: 10000;
animation: pulse 1.5s infinite ease-in-out;
pointer-events: none;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}
.ai-focus-outline {
position: absolute;
z-index: 9997;
pointer-events: none;
border-radius: 4px;
box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.15);
}
`,document.head.appendChild(I)},y=(I,L,T)=>{h();const M=document.querySelector(`[dom-tree-id="${I}"]`);if(!M)return{success:!1,message:"Element not found"};const k=M.getBoundingClientRect(),P=Math.random().toString(36).substr(2,6),a=document.createElement("div");a.id=`ai-highlight-${P}`,a.className="ai-highlight",a.style.left=`${window.scrollX+k.x-3}px`,a.style.top=`${window.scrollY+k.y-3}px`,a.style.width=`${k.width+6}px`,a.style.height=`${k.height+6}px`,document.body.appendChild(a);const c=document.createElement("div");c.id=`ai-focus-outline-${P}`,c.className="ai-focus-outline",c.style.left=`${window.scrollX+k.x-5}px`,c.style.top=`${window.scrollY+k.y-5}px`,c.style.width=`${k.width+10}px`,c.style.height=`${k.height+10}px`,document.body.appendChild(c);const l=document.createElement("div");l.id=`ai-icon-${P}`,l.className=`ai-icon ai-${L}-icon`,l.style.left=`${window.scrollX+k.x+k.width+8}px`,l.style.top=`${window.scrollY+k.y+(k.height-28)/2}px`,document.body.appendChild(l);const o=document.createElement("div");return o.id=`ai-banner-${P}`,o.className="ai-banner",o.textContent=T,document.body.appendChild(o),setTimeout(()=>{[a,c,l,o].forEach(u=>{u&&(u.style.transition="opacity 0.5s ease-out",u.style.opacity="0")}),setTimeout(()=>{[a,c,l,o].forEach(u=>u&&u.remove())},500)},5e3),{success:!0}};console.log("CUGA Chrome Extension: Adding animation to element",e.bid);const{bid:D,iconType:b,bannerText:E}=e,p=y(D,b,E);n(p);break}default:n({type:"error",message:`Unknown request type: ${e.type}`})}}catch(w){n({type:"error",message:w.message})}return!0})}setupPageUnloadListener(){window.addEventListener("beforeunload",()=>{console.log("CUGA Chrome Extension: Page unloading, removing element marks"),this.unmarkElements()})}async performSelectOption(e,t){if(!document.querySelector(`[dom-tree-id="${e}"]`))throw new Error(`Element with dom-tree-id '${e}' not found`);console.error("Select command not implemented yet")}}const ve={matches:["<all_urls>"],allFrames:!0,main(){console.log("Hello content."),ie.reg(X),ie.apply(X,{template:"[%t] %l %n:"}),X.enableAll();const A=[new Ee,new ye];for(const e of A)e.start()}};var V={exports:{}},Ce=V.exports,oe;function Te(){return oe||(oe=1,(function(A,e){(function(t,n){n(A)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Ce,function(t){var n,i;if(!((i=(n=globalThis.chrome)==null?void 0:n.runtime)!=null&&i.id))throw new Error("This script should only be loaded in a browser extension.");if(typeof globalThis.browser>"u"||Object.getPrototypeOf(globalThis.browser)!==Object.prototype){const r="The message port closed before a response was received.",g=s=>{const f={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(f).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class w extends WeakMap{constructor(c,l=void 0){super(l),this.createItem=c}get(c){return this.has(c)||this.set(c,this.createItem(c)),super.get(c)}}const d=a=>a&&typeof a=="object"&&typeof a.then=="function",m=(a,c)=>(...l)=>{s.runtime.lastError?a.reject(new Error(s.runtime.lastError.message)):c.singleCallbackArg||l.length<=1&&c.singleCallbackArg!==!1?a.resolve(l[0]):a.resolve(l)},h=a=>a==1?"argument":"arguments",y=(a,c)=>function(o,...u){if(u.length<c.minArgs)throw new Error(`Expected at least ${c.minArgs} ${h(c.minArgs)} for ${a}(), got ${u.length}`);if(u.length>c.maxArgs)throw new Error(`Expected at most ${c.maxArgs} ${h(c.maxArgs)} for ${a}(), got ${u.length}`);return new Promise((C,v)=>{if(c.fallbackToNoCallback)try{o[a](...u,m({resolve:C,reject:v},c))}catch(x){console.warn(`${a} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,x),o[a](...u),c.fallbackToNoCallback=!1,c.noCallback=!0,C()}else c.noCallback?(o[a](...u),C()):o[a](...u,m({resolve:C,reject:v},c))})},D=(a,c,l)=>new Proxy(c,{apply(o,u,C){return l.call(u,a,...C)}});let b=Function.call.bind(Object.prototype.hasOwnProperty);const E=(a,c={},l={})=>{let o=Object.create(null),u={has(v,x){return x in a||x in o},get(v,x,N){if(x in o)return o[x];if(!(x in a))return;let R=a[x];if(typeof R=="function")if(typeof c[x]=="function")R=D(a,a[x],c[x]);else if(b(l,x)){let $=y(x,l[x]);R=D(a,a[x],$)}else R=R.bind(a);else if(typeof R=="object"&&R!==null&&(b(c,x)||b(l,x)))R=E(R,c[x],l[x]);else if(b(l,"*"))R=E(R,c[x],l["*"]);else return Object.defineProperty(o,x,{configurable:!0,enumerable:!0,get(){return a[x]},set($){a[x]=$}}),R;return o[x]=R,R},set(v,x,N,R){return x in o?o[x]=N:a[x]=N,!0},defineProperty(v,x,N){return Reflect.defineProperty(o,x,N)},deleteProperty(v,x){return Reflect.deleteProperty(o,x)}},C=Object.create(a);return new Proxy(C,u)},p=a=>({addListener(c,l,...o){c.addListener(a.get(l),...o)},hasListener(c,l){return c.hasListener(a.get(l))},removeListener(c,l){c.removeListener(a.get(l))}}),I=new w(a=>typeof a!="function"?a:function(l){const o=E(l,{},{getContent:{minArgs:0,maxArgs:0}});a(o)}),L=new w(a=>typeof a!="function"?a:function(l,o,u){let C=!1,v,x=new Promise(W=>{v=function(H){C=!0,W(H)}}),N;try{N=a(l,o,v)}catch(W){N=Promise.reject(W)}const R=N!==!0&&d(N);if(N!==!0&&!R&&!C)return!1;const $=W=>{W.then(H=>{u(H)},H=>{let ee;H&&(H instanceof Error||typeof H.message=="string")?ee=H.message:ee="An unexpected error occurred",u({__mozWebExtensionPolyfillReject__:!0,message:ee})}).catch(H=>{console.error("Failed to send onMessage rejected reply",H)})};return $(R?N:x),!0}),T=({reject:a,resolve:c},l)=>{s.runtime.lastError?s.runtime.lastError.message===r?c():a(new Error(s.runtime.lastError.message)):l&&l.__mozWebExtensionPolyfillReject__?a(new Error(l.message)):c(l)},M=(a,c,l,...o)=>{if(o.length<c.minArgs)throw new Error(`Expected at least ${c.minArgs} ${h(c.minArgs)} for ${a}(), got ${o.length}`);if(o.length>c.maxArgs)throw new Error(`Expected at most ${c.maxArgs} ${h(c.maxArgs)} for ${a}(), got ${o.length}`);return new Promise((u,C)=>{const v=T.bind(null,{resolve:u,reject:C});o.push(v),l.sendMessage(...o)})},k={devtools:{network:{onRequestFinished:p(I)}},runtime:{onMessage:p(L),onMessageExternal:p(L),sendMessage:M.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:M.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},P={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return f.privacy={network:{"*":P},services:{"*":P},websites:{"*":P}},E(s,k,f)};t.exports=g(chrome)}else t.exports=globalThis.browser})})(V)),V.exports}var Ie=Te();const G=_(Ie);function j(A,...e){}const Me={debug:(...A)=>j(console.debug,...A),log:(...A)=>j(console.log,...A),warn:(...A)=>j(console.warn,...A),error:(...A)=>j(console.error,...A)},Y=class Y extends Event{constructor(e,t){super(Y.EVENT_NAME,{}),this.newUrl=e,this.oldUrl=t}};S(Y,"EVENT_NAME",Q("wxt:locationchange"));let q=Y;function Q(A){var e;return`${(e=G==null?void 0:G.runtime)==null?void 0:e.id}:content:${A}`}function ke(A){let e,t;return{run(){e==null&&(t=new URL(location.href),e=A.setInterval(()=>{let n=new URL(location.href);n.href!==t.href&&(window.dispatchEvent(new q(n,t)),t=n)},1e3))}}}const B=class B{constructor(e,t){S(this,"isTopFrame",window.self===window.top);S(this,"abortController");S(this,"locationWatcher",ke(this));S(this,"receivedMessageIds",new Set);this.contentScriptName=e,this.options=t,this.abortController=new AbortController,this.isTopFrame?(this.listenForNewerScripts({ignoreFirstEvent:!0}),this.stopOldScripts()):this.listenForNewerScripts()}get signal(){return this.abortController.signal}abort(e){return this.abortController.abort(e)}get isInvalid(){return G.runtime.id==null&&this.notifyInvalidated(),this.signal.aborted}get isValid(){return!this.isInvalid}onInvalidated(e){return this.signal.addEventListener("abort",e),()=>this.signal.removeEventListener("abort",e)}block(){return new Promise(()=>{})}setInterval(e,t){const n=setInterval(()=>{this.isValid&&e()},t);return this.onInvalidated(()=>clearInterval(n)),n}setTimeout(e,t){const n=setTimeout(()=>{this.isValid&&e()},t);return this.onInvalidated(()=>clearTimeout(n)),n}requestAnimationFrame(e){const t=requestAnimationFrame((...n)=>{this.isValid&&e(...n)});return this.onInvalidated(()=>cancelAnimationFrame(t)),t}requestIdleCallback(e,t){const n=requestIdleCallback((...i)=>{this.signal.aborted||e(...i)},t);return this.onInvalidated(()=>cancelIdleCallback(n)),n}addEventListener(e,t,n,i){var r;t==="wxt:locationchange"&&this.isValid&&this.locationWatcher.run(),(r=e.addEventListener)==null||r.call(e,t.startsWith("wxt:")?Q(t):t,n,{...i,signal:this.signal})}notifyInvalidated(){this.abort("Content script context invalidated"),Me.debug(`Content script "${this.contentScriptName}" context invalidated`)}stopOldScripts(){window.postMessage({type:B.SCRIPT_STARTED_MESSAGE_TYPE,contentScriptName:this.contentScriptName,messageId:Math.random().toString(36).slice(2)},"*")}verifyScriptStartedEvent(e){var r,g,s;const t=((r=e.data)==null?void 0:r.type)===B.SCRIPT_STARTED_MESSAGE_TYPE,n=((g=e.data)==null?void 0:g.contentScriptName)===this.contentScriptName,i=!this.receivedMessageIds.has((s=e.data)==null?void 0:s.messageId);return t&&n&&i}listenForNewerScripts(e){let t=!0;const n=i=>{if(this.verifyScriptStartedEvent(i)){this.receivedMessageIds.add(i.data.messageId);const r=t;if(t=!1,r&&(e!=null&&e.ignoreFirstEvent))return;this.notifyInvalidated()}};addEventListener("message",n),this.onInvalidated(()=>removeEventListener("message",n))}};S(B,"SCRIPT_STARTED_MESSAGE_TYPE",Q("wxt:content-script-started"));let K=B;function Pe(){}function Z(A,...e){}const Ne={debug:(...A)=>Z(console.debug,...A),log:(...A)=>Z(console.log,...A),warn:(...A)=>Z(console.warn,...A),error:(...A)=>Z(console.error,...A)};return(async()=>{try{const{main:A,...e}=ve,t=new K("content",e);return await A(t)}catch(A){throw Ne.error('The content script "content" crashed on startup!',A),A}})()})();
content;