extension-develop 3.17.0 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/0~dev-server.mjs +660 -59
  2. package/dist/0~rspack-config.mjs +867 -881
  3. package/dist/0~zip.mjs +39 -10
  4. package/dist/45.mjs +39 -0
  5. package/dist/946.mjs +142 -36
  6. package/dist/962.mjs +299 -250
  7. package/dist/bridge.mjs +228 -0
  8. package/dist/extension-js-devtools/chrome/content_scripts/content-0.js +2 -2
  9. package/dist/extension-js-devtools/chrome/pages/centralized-logger.js +1 -1
  10. package/dist/extension-js-devtools/chrome/pages/welcome.js +2 -2
  11. package/dist/extension-js-devtools/chrome/scripts/logger-client.js +1 -1
  12. package/dist/extension-js-devtools/chromium/content_scripts/content-0.js +2 -2
  13. package/dist/extension-js-devtools/chromium/pages/centralized-logger.js +1 -1
  14. package/dist/extension-js-devtools/chromium/pages/welcome.js +2 -2
  15. package/dist/extension-js-devtools/chromium/scripts/logger-client.js +1 -1
  16. package/dist/extension-js-devtools/edge/content_scripts/content-0.js +2 -2
  17. package/dist/extension-js-devtools/edge/pages/centralized-logger.js +1 -1
  18. package/dist/extension-js-devtools/edge/pages/welcome.js +2 -2
  19. package/dist/extension-js-devtools/edge/scripts/logger-client.js +1 -1
  20. package/dist/extension-js-devtools/extension-js/chrome/events.ndjson +2 -0
  21. package/dist/extension-js-devtools/extension-js/chrome/ready.json +16 -0
  22. package/dist/extension-js-devtools/extension-js/chromium/events.ndjson +2 -0
  23. package/dist/extension-js-devtools/extension-js/chromium/ready.json +16 -0
  24. package/dist/extension-js-devtools/extension-js/edge/events.ndjson +2 -0
  25. package/dist/extension-js-devtools/extension-js/edge/ready.json +16 -0
  26. package/dist/extension-js-devtools/extension-js/firefox/events.ndjson +2 -0
  27. package/dist/extension-js-devtools/extension-js/firefox/ready.json +16 -0
  28. package/dist/extension-js-devtools/firefox/content_scripts/content-0.js +2 -2
  29. package/dist/extension-js-devtools/firefox/pages/centralized-logger.js +1 -1
  30. package/dist/extension-js-devtools/firefox/pages/welcome.js +2 -2
  31. package/dist/extension-js-devtools/firefox/scripts/logger-client.js +1 -1
  32. package/dist/extension-js-theme/extension-js/chrome/events.ndjson +2 -0
  33. package/dist/extension-js-theme/extension-js/chrome/ready.json +16 -0
  34. package/dist/extension-js-theme/extension-js/chromium/events.ndjson +2 -0
  35. package/dist/extension-js-theme/extension-js/chromium/ready.json +16 -0
  36. package/dist/extension-js-theme/extension-js/edge/events.ndjson +2 -0
  37. package/dist/extension-js-theme/extension-js/edge/ready.json +16 -0
  38. package/dist/extension-js-theme/extension-js/firefox/events.ndjson +4 -0
  39. package/dist/extension-js-theme/extension-js/firefox/ready.json +16 -0
  40. package/dist/feature-scripts-content-script-wrapper.js +19 -2
  41. package/dist/feature-scripts-content-script-wrapper.mjs +19 -2
  42. package/package.json +14 -5
  43. package/runtime/process-shim.cjs +49 -0
@@ -1 +1 @@
1
- (()=>{"use strict";var t={},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var a=e[o]={exports:{}};return t[o](a,a.exports,r),a.exports}var o="scripts/logger-client.ts",n="scripts/logger-client.ts",a="831980a1",i=[],u="object"==typeof globalThis&&globalThis?globalThis.__EXTENSIONJS_DEV_REINJECT__||(globalThis.__EXTENSIONJS_DEV_REINJECT__={}):{},s=[];function c(t){return"function"==typeof t&&s.push(t),t}function l(t,e,r){try{return}catch(t){}}function d(){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;for(var t=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),e=0;e<t.length;e++){var r=t[e];if(r&&"function"==typeof r.getAttribute){var o=String(r.getAttribute("data-extjs-reinject-owner")||"");if(o&&o===String(n||"")){var i=String(r.getAttribute("data-extjs-reinject-build")||""),u=String(a||"");if(!i||!u||i!==u){try{var s=document.documentElement;s&&"function"==typeof s.setAttribute&&(s.setAttribute("data-extjs-debug-stage","cleanup-known-roots"),s.setAttribute("data-extjs-debug-last-removal","cleanup-known-roots"),s.setAttribute("data-extjs-debug-last-removal-key",String(n||"")),s.setAttribute("data-extjs-debug-last-removal-source","cleanup-known-roots"),s.setAttribute("data-extjs-debug-last-removed-node-tag",String(r.tagName||"").toLowerCase()))}catch(t){}try{r.remove()}catch(t){}}}}}}catch(t){}}try{"object"==typeof globalThis&&globalThis&&(globalThis.__EXTENSIONJS_registerCleanup=c,globalThis.registerCleanup=c)}catch(t){}try{!function(){try{if("object"!=typeof globalThis||!globalThis||globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__||"function"!=typeof MutationObserver||"u"<typeof document)return;var t=document.documentElement||document.body||document;if(!t)return;var e=new MutationObserver(function(t){try{for(var e=String(n||""),r=0;r<t.length;r++)for(var o=Array.from(t[r].removedNodes||[]),a=0;a<o.length;a++){var i=o[a],u=function(t){try{if(!t||1!==t.nodeType)return null;if("function"==typeof t.getAttribute&&String(t.getAttribute("data-extjs-reinject-owner")||"")===e)return t;if("function"==typeof t.querySelector)return t.querySelector('[data-extjs-reinject-owner="'+e.replace(/"/g,'\\"')+'"]')}catch(t){}return null}(i);if(u&&"function"==typeof u.getAttribute){var s=String(u.getAttribute("data-extjs-reinject-owner")||"");if(s&&s===e){var c=document.documentElement;c&&"function"==typeof c.setAttribute&&(c.getAttribute("data-extjs-debug-last-removal")||c.setAttribute("data-extjs-debug-last-removal","mutation-observer"),c.getAttribute("data-extjs-debug-last-removal-key")||c.setAttribute("data-extjs-debug-last-removal-key",s),c.getAttribute("data-extjs-debug-last-removal-source")||c.setAttribute("data-extjs-debug-last-removal-source","mutation-observer"),c.getAttribute("data-extjs-debug-last-removed-node-tag")||c.setAttribute("data-extjs-debug-last-removed-node-tag",String(i.tagName||"").toLowerCase()),c.getAttribute("data-extjs-debug-last-removed-node-id")||c.setAttribute("data-extjs-debug-last-removed-node-id",String(i.id||"")),c.getAttribute("data-extjs-debug-last-removed-node-class")||c.setAttribute("data-extjs-debug-last-removed-node-class",String(i.className||"")),c.getAttribute("data-extjs-debug-last-removed-node-direct")||c.setAttribute("data-extjs-debug-last-removed-node-direct",String(i===u)),c.getAttribute("data-extjs-debug-last-removal-ready-state")||c.setAttribute("data-extjs-debug-last-removal-ready-state",String(document.readyState||"")),c.getAttribute("data-extjs-debug-last-removal-url")||c.setAttribute("data-extjs-debug-last-removal-url",String(location.href||"")),c.setAttribute("data-extjs-debug-stage","root-removed-observed"));return}}}}catch(t){}});e.observe(t,{childList:!0,subtree:!0}),globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__=e}catch(t){}}()}catch(t){}try{!function(){try{if("object"!=typeof globalThis||!globalThis||globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__)return;var t=function(t,e,r){try{var o=document.documentElement;if(!o||"function"!=typeof o.setAttribute)return;var a=null;if(e&&1===e.nodeType&&("function"==typeof e.getAttribute&&String(e.getAttribute("data-extjs-reinject-owner")||"")===String(n||"")?a=e:"function"==typeof e.querySelector&&(a=e.querySelector('[data-extjs-reinject-owner="'+String(n||"").replace(/"/g,'\\"')+'"]'))),!a)return;o.setAttribute("data-extjs-debug-stage","dom-api-removal"),o.setAttribute("data-extjs-debug-last-removal",t),o.setAttribute("data-extjs-debug-last-removal-source",t),o.setAttribute("data-extjs-debug-last-removal-key",String(n||"")),o.setAttribute("data-extjs-debug-last-removed-node-tag",String(e&&e.tagName||"").toLowerCase()),o.setAttribute("data-extjs-debug-last-removed-node-id",String(e&&e.id||"")),o.setAttribute("data-extjs-debug-last-removed-node-class",String(e&&e.className||"")),o.setAttribute("data-extjs-debug-last-removed-node-direct",String(e===a)),o.setAttribute("data-extjs-debug-last-removal-ready-state",String(document.readyState||"")),o.setAttribute("data-extjs-debug-last-removal-url",String(location.href||"")),o.setAttribute("data-extjs-debug-last-removal-parent-tag",String(r&&r.tagName||"").toLowerCase())}catch(t){}};try{var e=Node.prototype.removeChild;"function"==typeof e&&(Node.prototype.removeChild=function(r){return t("Node.removeChild",r,this),e.call(this,r)})}catch(t){}try{var r=Element.prototype.replaceChildren;"function"==typeof r&&(Element.prototype.replaceChildren=function(){try{for(var e=Array.from(this.childNodes||[]),o=0;o<e.length;o++)t("Element.replaceChildren",e[o],this)}catch(t){}return r.apply(this,arguments)})}catch(t){}globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__=!0}catch(t){}}()}catch(t){}try{!function(t){try{if("u"<typeof document)return;var e=document.documentElement;if(!e||"function"!=typeof e.getAttribute||"function"!=typeof e.setAttribute)return;var r=Number(e.getAttribute("data-extjs-debug-execution-count")||"0"),o=Number.isFinite(r)?r+1:1,a=[];try{a=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])'))}catch(t){}e.setAttribute("data-extjs-debug-execution-count",String(o)),e.setAttribute("data-extjs-debug-last-execution-stage",String(t||"")),e.setAttribute("data-extjs-debug-last-execution-key",String(n||"")),e.setAttribute("data-extjs-debug-existing-root-count-before-cleanup",String(a.length))}catch(t){}}("bootstrap")}catch(t){}var g=u[n],b=function(t){try{if(!t)return 0;if("function"==typeof t&&"number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("object"==typeof t){if("number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("number"==typeof t.generation)return t.generation;if("function"==typeof t.cleanup&&"number"==typeof t.cleanup.__extjsGeneration)return t.cleanup.__extjsGeneration}}catch(t){}return 0}(g);try{!function(){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;for(var t=Array.from(document.querySelectorAll('[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),e=0;e<t.length;e++){var r=t[e];if(r&&"function"==typeof r.getAttribute&&!String(r.getAttribute("data-extjs-reinject-owner")||""))try{r.remove()}catch(t){}}}catch(t){}}()}catch(t){}try{var f="function"==typeof g?g:g&&"function"==typeof g.cleanup?g.cleanup:null;if("function"==typeof f){try{var m=document.documentElement;m&&"function"==typeof m.setAttribute&&(m.setAttribute("data-extjs-debug-stage","previous-cleanup"),m.setAttribute("data-extjs-debug-last-removal","previous-cleanup"),m.setAttribute("data-extjs-debug-last-removal-key",String(n||"")),m.setAttribute("data-extjs-debug-last-removal-source","previous-cleanup"))}catch(t){}f()}}catch(t){}try{d()}catch(t){}function y(){try{var t="";try{"object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL?t=String(globalThis.browser.runtime.getURL("/")):"object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL&&(t=String(globalThis.chrome.runtime.getURL("/")))}catch(t){}if(!t)try{"object"==typeof document&&document&&document.documentElement&&(t=String(document.documentElement.getAttribute("data-extjs-extension-base")||""))}catch(t){}if(!t)return!1;"/"!==t.charAt(t.length-1)&&(t+="/");try{r.p=t}catch(t){}try{r.b=t}catch(t){}return!0}catch(t){}return!1}try{if(!y()){var h=0,p=function(){try{if(y())return}catch(t){}h++<50&&setTimeout(p,100)};p()}}catch(t){}try{b=(Number(b)||0)+1}catch(t){}try{l(n,Number(b)||0,"executed")}catch(t){}try{!function(){try{if(0!==String(o||"").indexOf("content_scripts/content-")||"u"<typeof document||"function"!=typeof fetch)return;var t=Array.from(new Set((Array.isArray(i)?i:[]).concat([function(t){try{if("object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL)return globalThis.browser.runtime.getURL(t);if("object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL)return globalThis.chrome.runtime.getURL(t)}catch(t){}try{var e="object"==typeof globalThis&&globalThis&&globalThis.__EXTJS_EXTENSION_BASE__?String(globalThis.__EXTJS_EXTENSION_BASE__):"";if(!e&&"object"==typeof document&&document&&document.documentElement&&(e=String(document.documentElement.getAttribute("data-extjs-extension-base")||"")),!e)return"";return e.replace(/\/+$/,"/")+String(t||"").replace(/^\/+/,"")}catch(t){}return""}(o+".css")]).filter(function(t){return"string"==typeof t&&t.trim().length>0})));if(!t.length)return;var e="",r=null,a=0,u=function(){try{for(var i=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),s=0;s<i.length;s++){var c=i[s];if(c&&c.shadowRoot&&"function"==typeof c.getAttribute){var l=String(c.getAttribute("data-extjs-reinject-owner")||"");if((!l||l===String(n||""))&&(!(!l&&String(c.getAttribute("data-extjs-reinject-key")||""))||String(c.getAttribute("data-extjs-reinject-key")||"")===String(o||""))){var d=c.shadowRoot,g=Array.from(d.querySelectorAll("style")).some(function(t){return t&&"true"!==t.getAttribute("data-extjs-bundle-css")&&String(t.textContent||"").trim().length>0}),b=d.querySelector('style[data-extjs-bundle-css="true"]');if(g){b&&b.parentNode&&b.parentNode.removeChild(b);return}if("string"==typeof e&&e.trim()){b||((b=document.createElement("style")).setAttribute("data-extjs-bundle-css","true"),b.setAttribute("data-extjs-reinject-key",String(n||"")),d.insertBefore(b,d.firstChild||null)),String(b.textContent||"")!==e&&(b.textContent=e);return}}}}}catch(t){}a++<20&&(!r&&(r||(r=(function e(r){return r>=t.length?Promise.resolve(""):fetch(t[r]).then(function(t){return t&&t.ok?t.text():""}).catch(function(){return""}).then(function(t){return"string"==typeof t&&t.trim().length>0?t:e(r+1)})})(0).then(function(t){e="string"==typeof t?t:"";try{setTimeout(u,0)}catch(t){}return e}).catch(function(){return""}))),setTimeout(u,250))};u()}catch(t){}}()}catch(t){}try{u[n]={cleanup:function(){try{!function(t){try{if(!Array.isArray(t))return;for(var e=t.length-1;e>=0;e--)try{"function"==typeof t[e]&&t[e]()}catch(t){}}catch(t){}}(s)}catch(t){}try{d()}catch(t){}try{l(n,Number(b)||0,"cleaned")}catch(t){}},generation:Number(b)||0,build:a}}catch(t){}})();
1
+ (()=>{"use strict";var t={},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}var o="scripts/logger-client.ts",n="scripts/logger-client.ts",i="831980a1",c=[],a="object"==typeof globalThis&&globalThis?globalThis.__EXTENSIONJS_DEV_REINJECT__||(globalThis.__EXTENSIONJS_DEV_REINJECT__={}):{},u=[];function l(t){return"function"==typeof t&&u.push(t),t}function s(t,e,r){try{return}catch(t){}}function f(){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;for(var t=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),e=0;e<t.length;e++){var r=t[e];if(r&&"function"==typeof r.getAttribute){var o=String(r.getAttribute("data-extjs-reinject-owner")||"");if(o&&o===String(n||"")){var c=String(r.getAttribute("data-extjs-reinject-build")||""),a=String(i||"");if(!c||!a||c!==a){try{var u=document.documentElement;u&&"function"==typeof u.setAttribute&&(u.setAttribute("data-extjs-debug-stage","cleanup-known-roots"),u.setAttribute("data-extjs-debug-last-removal","cleanup-known-roots"),u.setAttribute("data-extjs-debug-last-removal-key",String(n||"")),u.setAttribute("data-extjs-debug-last-removal-source","cleanup-known-roots"),u.setAttribute("data-extjs-debug-last-removed-node-tag",String(r.tagName||"").toLowerCase()))}catch(t){}try{r.remove()}catch(t){}}}}}}catch(t){}}try{"object"==typeof globalThis&&globalThis&&(globalThis.__EXTENSIONJS_registerCleanup=l,globalThis.registerCleanup=l)}catch(t){}var g=a[n],h=function(t){try{if(!t)return 0;if("function"==typeof t&&"number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("object"==typeof t){if("number"==typeof t.__extjsGeneration)return t.__extjsGeneration;if("number"==typeof t.generation)return t.generation;if("function"==typeof t.cleanup&&"number"==typeof t.cleanup.__extjsGeneration)return t.cleanup.__extjsGeneration}}catch(t){}return 0}(g);try{!function(){try{if("u"<typeof document||"function"!=typeof document.querySelectorAll)return;for(var t=Array.from(document.querySelectorAll('[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),e=0;e<t.length;e++){var r=t[e];if(r&&"function"==typeof r.getAttribute&&!String(r.getAttribute("data-extjs-reinject-owner")||""))try{r.remove()}catch(t){}}}catch(t){}}()}catch(t){}try{var b="function"==typeof g?g:g&&"function"==typeof g.cleanup?g.cleanup:null;"function"==typeof b&&b()}catch(t){}try{f()}catch(t){}function y(){try{var t="";try{"object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL?t=String(globalThis.browser.runtime.getURL("/")):"object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL&&(t=String(globalThis.chrome.runtime.getURL("/")))}catch(t){}if(!t)try{"object"==typeof document&&document&&document.documentElement&&(t=String(document.documentElement.getAttribute("data-extjs-extension-base")||""))}catch(t){}if(!t)return!1;"/"!==t.charAt(t.length-1)&&(t+="/");try{r.p=t}catch(t){}try{r.b=t}catch(t){}return!0}catch(t){}return!1}try{if(!y()){var m=0,d=function(){try{if(y())return}catch(t){}m++<50&&setTimeout(d,100)};d()}}catch(t){}try{h=(Number(h)||0)+1}catch(t){}try{s(n,Number(h)||0,"executed")}catch(t){}try{!function(){try{if(0!==String(o||"").indexOf("content_scripts/content-")||"u"<typeof document||"function"!=typeof fetch)return;var t=Array.from(new Set((Array.isArray(c)?c:[]).concat([function(t){try{if("object"==typeof globalThis&&globalThis&&globalThis.browser&&globalThis.browser.runtime&&"function"==typeof globalThis.browser.runtime.getURL)return globalThis.browser.runtime.getURL(t);if("object"==typeof globalThis&&globalThis&&globalThis.chrome&&globalThis.chrome.runtime&&"function"==typeof globalThis.chrome.runtime.getURL)return globalThis.chrome.runtime.getURL(t)}catch(t){}try{var e="object"==typeof globalThis&&globalThis&&globalThis.__EXTJS_EXTENSION_BASE__?String(globalThis.__EXTJS_EXTENSION_BASE__):"";if(!e&&"object"==typeof document&&document&&document.documentElement&&(e=String(document.documentElement.getAttribute("data-extjs-extension-base")||"")),!e)return"";return e.replace(/\/+$/,"/")+String(t||"").replace(/^\/+/,"")}catch(t){}return""}(o+".css")]).filter(function(t){return"string"==typeof t&&t.trim().length>0})));if(!t.length)return;var e="",r=null,i=0,a=function(){try{for(var c=Array.from(document.querySelectorAll('#extension-root,[data-extension-root]:not([data-extension-root="extension-js-devtools"])')),u=0;u<c.length;u++){var l=c[u];if(l&&l.shadowRoot&&"function"==typeof l.getAttribute){var s=String(l.getAttribute("data-extjs-reinject-owner")||"");if((!s||s===String(n||""))&&(!(!s&&String(l.getAttribute("data-extjs-reinject-key")||""))||String(l.getAttribute("data-extjs-reinject-key")||"")===String(o||""))){var f=l.shadowRoot,g=Array.from(f.querySelectorAll("style")).some(function(t){return t&&"true"!==t.getAttribute("data-extjs-bundle-css")&&String(t.textContent||"").trim().length>0}),h=f.querySelector('style[data-extjs-bundle-css="true"]');if(g){h&&h.parentNode&&h.parentNode.removeChild(h);return}if("string"==typeof e&&e.trim()){h||((h=document.createElement("style")).setAttribute("data-extjs-bundle-css","true"),h.setAttribute("data-extjs-reinject-key",String(n||"")),f.insertBefore(h,f.firstChild||null)),String(h.textContent||"")!==e&&(h.textContent=e);return}}}}}catch(t){}i++<20&&(!r&&(r||(r=(function e(r){return r>=t.length?Promise.resolve(""):fetch(t[r]).then(function(t){return t&&t.ok?t.text():""}).catch(function(){return""}).then(function(t){return"string"==typeof t&&t.trim().length>0?t:e(r+1)})})(0).then(function(t){e="string"==typeof t?t:"";try{setTimeout(a,0)}catch(t){}return e}).catch(function(){return""}))),setTimeout(a,250))};a()}catch(t){}}()}catch(t){}try{a[n]={cleanup:function(){try{!function(t){try{if(!Array.isArray(t))return;for(var e=t.length-1;e>=0;e--)try{"function"==typeof t[e]&&t[e]()}catch(t){}}catch(t){}}(u)}catch(t){}try{f()}catch(t){}try{s(n,Number(h)||0,"cleaned")}catch(t){}},generation:Number(h)||0,build:i}}catch(t){}})();
@@ -0,0 +1,2 @@
1
+ {"type":"compile_start","ts":"2026-05-28T21:29:06.646Z","command":"start","browser":"chrome"}
2
+ {"type":"compile_success","ts":"2026-05-28T21:29:06.673Z","command":"start","browser":"chrome","durationMs":28,"errorCount":0}
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "command": "start",
4
+ "browser": "chrome",
5
+ "runId": "mpq09t1b-nyo4hhol",
6
+ "startedAt": "2026-05-28T21:29:06.623Z",
7
+ "distPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/dist/chrome",
8
+ "manifestPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/manifest.json",
9
+ "port": null,
10
+ "controlPort": null,
11
+ "status": "ready",
12
+ "pid": 2918,
13
+ "ts": "2026-05-28T21:29:06.673Z",
14
+ "compiledAt": "2026-05-28T21:29:06.673Z",
15
+ "errors": []
16
+ }
@@ -0,0 +1,2 @@
1
+ {"type":"compile_start","ts":"2026-05-28T21:29:06.030Z","command":"start","browser":"chromium"}
2
+ {"type":"compile_success","ts":"2026-05-28T21:29:06.058Z","command":"start","browser":"chromium","durationMs":29,"errorCount":0}
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "command": "start",
4
+ "browser": "chromium",
5
+ "runId": "mpq09sk9-1kb5qlsq",
6
+ "startedAt": "2026-05-28T21:29:06.009Z",
7
+ "distPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/dist/chromium",
8
+ "manifestPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/manifest.json",
9
+ "port": null,
10
+ "controlPort": null,
11
+ "status": "ready",
12
+ "pid": 2880,
13
+ "ts": "2026-05-28T21:29:06.059Z",
14
+ "compiledAt": "2026-05-28T21:29:06.059Z",
15
+ "errors": []
16
+ }
@@ -0,0 +1,2 @@
1
+ {"type":"compile_start","ts":"2026-05-28T21:29:07.881Z","command":"start","browser":"edge"}
2
+ {"type":"compile_success","ts":"2026-05-28T21:29:07.908Z","command":"start","browser":"edge","durationMs":28,"errorCount":0}
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "command": "start",
4
+ "browser": "edge",
5
+ "runId": "mpq09tzo-xdncmlcr",
6
+ "startedAt": "2026-05-28T21:29:07.860Z",
7
+ "distPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/dist/edge",
8
+ "manifestPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/manifest.json",
9
+ "port": null,
10
+ "controlPort": null,
11
+ "status": "ready",
12
+ "pid": 2994,
13
+ "ts": "2026-05-28T21:29:07.908Z",
14
+ "compiledAt": "2026-05-28T21:29:07.908Z",
15
+ "errors": []
16
+ }
@@ -0,0 +1,4 @@
1
+ {"type":"compile_start","ts":"2026-05-28T21:29:07.266Z","command":"start","browser":"firefox"}
2
+ {"type":"compile_success","ts":"2026-05-28T21:29:07.294Z","command":"start","browser":"firefox","durationMs":28,"errorCount":0}
3
+ {"type":"compile_start","ts":"2026-05-28T21:29:24.499Z","command":"start","browser":"firefox"}
4
+ {"type":"compile_success","ts":"2026-05-28T21:29:24.530Z","command":"start","browser":"firefox","durationMs":31,"errorCount":0}
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "command": "start",
4
+ "browser": "firefox",
5
+ "runId": "mpq0a6t5-1sgsrt09",
6
+ "startedAt": "2026-05-28T21:29:24.473Z",
7
+ "distPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/dist/firefox",
8
+ "manifestPath": "/home/runner/work/extension.js/extension.js/extensions/extension-js-theme/manifest.json",
9
+ "port": null,
10
+ "controlPort": null,
11
+ "status": "ready",
12
+ "pid": 4183,
13
+ "ts": "2026-05-28T21:29:24.530Z",
14
+ "compiledAt": "2026-05-28T21:29:24.530Z",
15
+ "errors": []
16
+ }
@@ -114,6 +114,23 @@ function hasDefaultExport(source, resourcePath, compilation) {
114
114
  return fallback;
115
115
  }
116
116
  }
117
+ const __EXTENSIONJS_manifestParseCache = new Map();
118
+ function readManifestCached(manifestPath) {
119
+ try {
120
+ const stat = fs.statSync(manifestPath);
121
+ const key = `${stat.mtimeMs}:${stat.size}`;
122
+ const cached = __EXTENSIONJS_manifestParseCache.get(manifestPath);
123
+ if (cached && cached.key === key) return cached.manifest;
124
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
125
+ __EXTENSIONJS_manifestParseCache.set(manifestPath, {
126
+ key,
127
+ manifest
128
+ });
129
+ return manifest;
130
+ } catch {
131
+ return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
132
+ }
133
+ }
117
134
  function contentScriptWrapper(source) {
118
135
  const options = this.getOptions();
119
136
  validate(schema, options, {
@@ -125,7 +142,7 @@ function contentScriptWrapper(source) {
125
142
  const manifestDir = path.dirname(manifestPath);
126
143
  const packageJsonPath = findNearestPackageJsonSync(manifestPath);
127
144
  const packageJsonDir = packageJsonPath ? path.dirname(packageJsonPath) : manifestDir;
128
- const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
145
+ const manifest = readManifestCached(manifestPath);
129
146
  const isProd = 'production' === String(options && options.mode || '').toLowerCase();
130
147
  const rewrittenSource = String(source);
131
148
  const declaredContentJsAbsEntries = [];
@@ -166,7 +183,7 @@ function contentScriptWrapper(source) {
166
183
  const cssAssetSpecifiers = collectStyleAssetSpecifiers(rewrittenSource);
167
184
  const cssAssetUrlsInline = `var __EXTENSIONJS_BUNDLE_CSS_URLS=[${cssAssetSpecifiers.map((specifier)=>`(function(){ try { return String(new URL(${escapeCodeString(JSON.stringify(specifier))}, import.meta.url)); } catch (error) { return ""; } })()`).join(',')}];\n`;
168
185
  const bundleCssHydrationInline = `function __EXTENSIONJS_runtimeGetURL(path){\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") return globalThis.browser.runtime.getURL(path);\n if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") return globalThis.chrome.runtime.getURL(path);\n } catch (error) {}\n try {\n var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";\n if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n if (!base) return "";\n return base.replace(/\\/+\$/, "/") + String(path || "").replace(/^\\/+/, "");\n } catch (error) {}\n return "";\n}\nfunction __EXTENSIONJS_scheduleBundleCssHydration(){\n try {\n if (String(__EXTENSIONJS_BUNDLE_KEY || "").indexOf(${JSON.stringify(CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX)}) !== 0) return;\n if (typeof document === "undefined" || typeof fetch !== "function") return;\n var cssUrls = Array.from(new Set((Array.isArray(__EXTENSIONJS_BUNDLE_CSS_URLS) ? __EXTENSIONJS_BUNDLE_CSS_URLS : []).concat([__EXTENSIONJS_runtimeGetURL(__EXTENSIONJS_BUNDLE_KEY + ".css")]).filter(function(value){ return typeof value === "string" && value.trim().length > 0; })));\n if (!cssUrls.length) return;\n var cssText = "";\n var cssPromise = null;\n var readCss = function(){\n if (cssPromise) return cssPromise;\n cssPromise = (function fetchCandidate(index){\n if (index >= cssUrls.length) return Promise.resolve("");\n return fetch(cssUrls[index]).then(function(response){\n if (!response || !response.ok) return "";\n return response.text();\n }).catch(function(){\n return "";\n }).then(function(text){\n if (typeof text === "string" && text.trim().length > 0) return text;\n return fetchCandidate(index + 1);\n });\n })(0).then(function(text){\n cssText = typeof text === "string" ? text : "";\n try { setTimeout(tick, 0); } catch (error) {}\n return cssText;\n }).catch(function(){ return ""; });\n return cssPromise;\n };\n var tries = 0;\n var tick = function(){\n try {\n var hosts = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < hosts.length; i++) {\n var host = hosts[i];\n if (!host || !host.shadowRoot || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n if (!hostOwner && String(host.getAttribute("data-extjs-reinject-key") || "") && String(host.getAttribute("data-extjs-reinject-key") || "") !== String(__EXTENSIONJS_BUNDLE_KEY || "")) continue;\n var sr = host.shadowRoot;\n var styles = Array.from(sr.querySelectorAll("style"));\n var hasUserStyle = styles.some(function(styleEl){\n return styleEl && styleEl.getAttribute("data-extjs-bundle-css") !== "true" && String(styleEl.textContent || "").trim().length > 0;\n });\n var injected = sr.querySelector("style[data-extjs-bundle-css=\\"true\\"]");\n if (hasUserStyle) {\n if (injected && injected.parentNode) injected.parentNode.removeChild(injected);\n return;\n }\n if (typeof cssText === "string" && cssText.trim()) {\n if (!injected) {\n injected = document.createElement("style");\n injected.setAttribute("data-extjs-bundle-css", "true");\n injected.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n sr.insertBefore(injected, sr.firstChild || null);\n }\n if (String(injected.textContent || "") !== cssText) injected.textContent = cssText;\n return;\n }\n }\n } catch (error) {}\n if (tries++ < 20) {\n if (!cssPromise) readCss();\n setTimeout(tick, 250);\n }\n };\n tick();\n } catch (error) {}\n}\n`;
169
- const bootstrap = `var __EXTENSIONJS_BUNDLE_KEY=${JSON.stringify(bundleKey)};\nvar __EXTENSIONJS_REINJECT_KEY=${JSON.stringify(reinjectKey)};\nvar __EXTENSIONJS_REINJECT_BUILD_TOKEN=${JSON.stringify(buildToken)};\nvar __EXTENSIONJS_DEV_MARKERS_ENABLED=${JSON.stringify(!isProd)};\n${cssAssetUrlsInline}var __EXTENSIONJS_REINJECT_REGISTRY=(typeof globalThis==="object" && globalThis ? (globalThis.__EXTENSIONJS_DEV_REINJECT__ || (globalThis.__EXTENSIONJS_DEV_REINJECT__={})) : {});\nvar __EXTENSIONJS_REGISTERED_CLEANUPS=[];\nfunction __EXTENSIONJS_readReinjectGeneration(entry){\n try {\n if (!entry) return 0;\n if (typeof entry === "function" && typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry === "object") {\n if (typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry.generation === "number") return entry.generation;\n if (typeof entry.cleanup === "function" && typeof entry.cleanup.__extjsGeneration === "number") return entry.cleanup.__extjsGeneration;\n }\n } catch (error) {}\n return 0;\n}\nfunction __EXTENSIONJS_runCleanups(list){\n try {\n if (!Array.isArray(list)) return;\n for (var i = list.length - 1; i >= 0; i--) {\n try { if (typeof list[i] === "function") list[i](); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_registerCleanup(fn){\n if (typeof fn === "function") __EXTENSIONJS_REGISTERED_CLEANUPS.push(fn);\n return fn;\n}\nfunction __EXTENSIONJS_setReinjectMarker(key, generation, status){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED || typeof document === "undefined") return;\n var root = document.body || document.documentElement;\n if (!root) return;\n var marker = null;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var i = 0; i < markers.length; i++) {\n var current = markers[i];\n if (current && typeof current.getAttribute === "function" && current.getAttribute("data-extjs-reinject-key") === key) { marker = current; break; }\n }\n } catch (error) {}\n if (!marker && typeof document.createElement === "function") {\n marker = document.createElement("div");\n marker.setAttribute("data-extjs-reinject-marker", "true");\n marker.setAttribute("hidden", "");\n marker.setAttribute("aria-hidden", "true");\n try { marker.style.display = "none"; } catch (error) {}\n root.appendChild(marker);\n }\n if (!marker) return;\n marker.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n marker.setAttribute("data-extjs-reinject-generation", String(generation));\n marker.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n marker.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try { marker.textContent = String(__EXTENSIONJS_BUNDLE_KEY || key || "") + ":" + String(generation) + ":" + String(status || "mounted"); } catch (error) {}\n try {\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n var ownedRootCount = 0;\n for (var j = 0; j < roots.length; j++) {\n var host = roots[j];\n if (!host || typeof host.setAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n ownedRootCount++;\n host.setAttribute("data-extjs-reinject-owner", String(__EXTENSIONJS_REINJECT_KEY || ""));\n host.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n host.setAttribute("data-extjs-reinject-generation", String(generation));\n host.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n host.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try {\n if (!host.__extjsDebugRemovePatched) {\n host.__extjsDebugRemovePatched = true;\n var __extjsOriginalRemove = typeof host.remove === "function" ? host.remove.bind(host) : null;\n if (__extjsOriginalRemove) {\n host.remove = function(){\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "root-remove-called");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "remove()");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "patched-host-remove");\n }\n } catch (error) {}\n return __extjsOriginalRemove();\n };\n }\n }\n } catch (error) {}\n }\n try {\n marker.setAttribute("data-extjs-debug-stage", String(status || ""));\n marker.setAttribute("data-extjs-debug-root-count", String(roots.length));\n marker.setAttribute("data-extjs-debug-owned-root-count", String(ownedRootCount));\n marker.setAttribute("data-extjs-debug-marker-count", String(markers.length));\n } catch (error) {}\n } catch (error) {}\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-last-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n pageRoot.setAttribute("data-extjs-last-reinject-generation", String(generation));\n pageRoot.setAttribute("data-extjs-last-reinject-status", String(status || "mounted"));\n pageRoot.setAttribute("data-extjs-last-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", marker.getAttribute("data-extjs-debug-stage") || String(status || ""));\n pageRoot.setAttribute("data-extjs-debug-root-count", marker.getAttribute("data-extjs-debug-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-owned-root-count", marker.getAttribute("data-extjs-debug-owned-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-marker-count", marker.getAttribute("data-extjs-debug-marker-count") || "0");\n }\n } catch (error) {}\n } catch (error) {}\n}\nfunction __EXTENSIONJS_debugObserveOwnedRootRemoval(){\n try {\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__) return;\n if (typeof MutationObserver !== "function" || typeof document === "undefined") return;\n var target = document.documentElement || document.body || document;\n if (!target) return;\n var observer = new MutationObserver(function(records){\n try {\n var ownedKey = String(__EXTENSIONJS_REINJECT_KEY || "");\n var findOwnedRoot = function(node){\n try {\n if (!node || node.nodeType !== 1) return null;\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === ownedKey) return node;\n if (typeof node.querySelector === "function") {\n return node.querySelector("[data-extjs-reinject-owner=\\"" + ownedKey.replace(/"/g, "\\\\\\"") + "\\"]");\n }\n } catch (error) {}\n return null;\n };\n for (var r = 0; r < records.length; r++) {\n var removedNodes = Array.from(records[r].removedNodes || []);\n for (var n = 0; n < removedNodes.length; n++) {\n var node = removedNodes[n];\n var ownedRoot = findOwnedRoot(node);\n if (!ownedRoot || typeof ownedRoot.getAttribute !== "function") continue;\n var owner = String(ownedRoot.getAttribute("data-extjs-reinject-owner") || "");\n if (!owner || owner !== ownedKey) continue;\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal")) pageRoot.setAttribute("data-extjs-debug-last-removal", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-key")) pageRoot.setAttribute("data-extjs-debug-last-removal-key", owner);\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-source")) pageRoot.setAttribute("data-extjs-debug-last-removal-source", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-tag")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node.tagName || "").toLowerCase());\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-id")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node.id || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-class")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node.className || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-direct")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-ready-state")) pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-url")) pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", "root-removed-observed");\n }\n return;\n }\n }\n } catch (error) {}\n });\n observer.observe(target, { childList: true, subtree: true });\n globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__ = observer;\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupKnownRoots(){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (!hostOwner || hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n // Build-aware: only remove hosts owned by us whose build token does NOT\n // match the current bundle. Fresh roots from the current mount carry\n // the active build token and must be preserved; orphans from a prior\n // build (e.g. the old isolated world after \`chrome.runtime.reload\`)\n // carry stale tokens and should be cleared so we never end up with two\n // hosts owned by the same key.\n var hostBuild = String(host.getAttribute("data-extjs-reinject-build") || "");\n var currentBuild = String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || "");\n if (hostBuild && currentBuild && hostBuild === currentBuild) continue;\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(host.tagName || "").toLowerCase());\n }\n } catch (error) {}\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupOrphanRoots(){\n try {\n // At bundle execution start, before this run has mounted anything, any\n // \`data-extension-root\` host without \`data-extjs-reinject-owner\` is an\n // orphan from a prior session that died before \`setReinjectMarker\`\n // could tag it (typically: the previous isolated world was destroyed\n // by a \`chrome.runtime.reload\` mid-mount, or its \`whenReady\`-deferred\n // \`apply\` never fired). We have not created our own root yet, so any\n // untagged host we touch here is by definition NOT from this run.\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner) continue;\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_composeCleanup(primaryCleanup){\n return function(){\n try { if (typeof primaryCleanup === "function") primaryCleanup(); } catch (error) {}\n try { __EXTENSIONJS_runCleanups(__EXTENSIONJS_REGISTERED_CLEANUPS); } catch (error) {}\n try { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "cleaned"); } catch (error) {}\n };\n}\nfunction __EXTENSIONJS_recordExecutionSnapshot(stage){\n try {\n if (typeof document === "undefined") return;\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.getAttribute !== "function" || typeof pageRoot.setAttribute !== "function") return;\n var currentCount = Number(pageRoot.getAttribute("data-extjs-debug-execution-count") || "0");\n var nextCount = Number.isFinite(currentCount) ? currentCount + 1 : 1;\n var roots = [];\n try { roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])")); } catch (error) {}\n pageRoot.setAttribute("data-extjs-debug-execution-count", String(nextCount));\n pageRoot.setAttribute("data-extjs-debug-last-execution-stage", String(stage || ""));\n pageRoot.setAttribute("data-extjs-debug-last-execution-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-existing-root-count-before-cleanup", String(roots.length));\n } catch (error) {}\n}\nfunction __EXTENSIONJS_patchDomRemovalApis(){\n try {\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__) return;\n var record = function(source, node, parent){\n try {\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.setAttribute !== "function") return;\n var ownedRoot = null;\n if (node && node.nodeType === 1) {\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === String(__EXTENSIONJS_REINJECT_KEY || "")) ownedRoot = node;\n else if (typeof node.querySelector === "function") ownedRoot = node.querySelector("[data-extjs-reinject-owner=\\"" + String(__EXTENSIONJS_REINJECT_KEY || "").replace(/"/g, "\\\\\\"") + "\\"]");\n }\n if (!ownedRoot) return;\n pageRoot.setAttribute("data-extjs-debug-stage", "dom-api-removal");\n pageRoot.setAttribute("data-extjs-debug-last-removal", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node && node.tagName || "").toLowerCase());\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node && node.id || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node && node.className || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-parent-tag", String(parent && parent.tagName || "").toLowerCase());\n } catch (error) {}\n };\n try {\n var originalRemoveChild = Node.prototype.removeChild;\n if (typeof originalRemoveChild === "function") {\n Node.prototype.removeChild = function(child){\n record("Node.removeChild", child, this);\n return originalRemoveChild.call(this, child);\n };\n }\n } catch (error) {}\n try {\n var originalReplaceChildren = Element.prototype.replaceChildren;\n if (typeof originalReplaceChildren === "function") {\n Element.prototype.replaceChildren = function(){\n try {\n var existing = Array.from(this.childNodes || []);\n for (var i = 0; i < existing.length; i++) record("Element.replaceChildren", existing[i], this);\n } catch (error) {}\n return originalReplaceChildren.apply(this, arguments);\n };\n }\n } catch (error) {}\n globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__ = true;\n } catch (error) {}\n}\ntry {\n if (typeof globalThis === "object" && globalThis) {\n globalThis.__EXTENSIONJS_registerCleanup = __EXTENSIONJS_registerCleanup;\n globalThis.registerCleanup = __EXTENSIONJS_registerCleanup;\n }\n} catch (error) {}\ntry { __EXTENSIONJS_debugObserveOwnedRootRemoval(); } catch (error) {}\ntry { __EXTENSIONJS_patchDomRemovalApis(); } catch (error) {}\ntry { __EXTENSIONJS_recordExecutionSnapshot("bootstrap"); } catch (error) {}\nvar __EXTENSIONJS_previousEntry=__EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY];\nvar __EXTENSIONJS_REINJECT_GENERATION=__EXTENSIONJS_readReinjectGeneration(__EXTENSIONJS_previousEntry);\n// Sweep untagged orphans (prior-session roots that died before tagging)\n// before any further cleanup runs. Safe here because our mount has not\n// produced any roots yet — any untagged host is by definition not ours.\ntry { __EXTENSIONJS_cleanupOrphanRoots(); } catch (error) {}\ntry {\n var __EXTENSIONJS_previousCleanup=typeof __EXTENSIONJS_previousEntry === "function" ? __EXTENSIONJS_previousEntry : (__EXTENSIONJS_previousEntry && typeof __EXTENSIONJS_previousEntry.cleanup === "function" ? __EXTENSIONJS_previousEntry.cleanup : null);\n if (typeof __EXTENSIONJS_previousCleanup === "function") {\n try {\n var __extjsPageRoot = document.documentElement;\n if (__extjsPageRoot && typeof __extjsPageRoot.setAttribute === "function") {\n __extjsPageRoot.setAttribute("data-extjs-debug-stage", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-source", "previous-cleanup");\n }\n } catch (error) {}\n __EXTENSIONJS_previousCleanup();\n }\n} catch (error) {}\ntry { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\nfunction __EXTENSIONJS_syncAssetBase(){\n try {\n var base = "";\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") base = String(globalThis.browser.runtime.getURL("/"));\n else if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") base = String(globalThis.chrome.runtime.getURL("/"));\n } catch (error) {}\n if (!base) {\n try {\n if (typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n } catch (error) {}\n }\n if (!base) return false;\n if (base.charAt(base.length - 1) !== "/") base += "/";\n if (typeof __webpack_require__ === "function" || typeof __webpack_require__ === "object") {\n try { __webpack_require__.p = base; } catch (error) {}\n try { __webpack_require__.b = base; } catch (error) {}\n }\n return true;\n } catch (error) {}\n return false;\n}\ntry {\n if (!__EXTENSIONJS_syncAssetBase()) {\n var __EXTENSIONJS_assetBaseRetries = 0;\n var __EXTENSIONJS_retryAssetBase = function(){\n try {\n if (__EXTENSIONJS_syncAssetBase()) return;\n } catch (error) {}\n if (__EXTENSIONJS_assetBaseRetries++ < 50) setTimeout(__EXTENSIONJS_retryAssetBase, 100);\n };\n __EXTENSIONJS_retryAssetBase();\n }\n} catch (error) {}\n`;
186
+ const bootstrap = `var __EXTENSIONJS_BUNDLE_KEY=${JSON.stringify(bundleKey)};\nvar __EXTENSIONJS_REINJECT_KEY=${JSON.stringify(reinjectKey)};\nvar __EXTENSIONJS_REINJECT_BUILD_TOKEN=${JSON.stringify(buildToken)};\nvar __EXTENSIONJS_DEV_MARKERS_ENABLED=${JSON.stringify(!isProd)};\n${cssAssetUrlsInline}var __EXTENSIONJS_REINJECT_REGISTRY=(typeof globalThis==="object" && globalThis ? (globalThis.__EXTENSIONJS_DEV_REINJECT__ || (globalThis.__EXTENSIONJS_DEV_REINJECT__={})) : {});\nvar __EXTENSIONJS_REGISTERED_CLEANUPS=[];\nfunction __EXTENSIONJS_readReinjectGeneration(entry){\n try {\n if (!entry) return 0;\n if (typeof entry === "function" && typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry === "object") {\n if (typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry.generation === "number") return entry.generation;\n if (typeof entry.cleanup === "function" && typeof entry.cleanup.__extjsGeneration === "number") return entry.cleanup.__extjsGeneration;\n }\n } catch (error) {}\n return 0;\n}\nfunction __EXTENSIONJS_runCleanups(list){\n try {\n if (!Array.isArray(list)) return;\n for (var i = list.length - 1; i >= 0; i--) {\n try { if (typeof list[i] === "function") list[i](); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_registerCleanup(fn){\n if (typeof fn === "function") __EXTENSIONJS_REGISTERED_CLEANUPS.push(fn);\n return fn;\n}\nfunction __EXTENSIONJS_setReinjectMarker(key, generation, status){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED || typeof document === "undefined") return;\n var root = document.body || document.documentElement;\n if (!root) return;\n var marker = null;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var i = 0; i < markers.length; i++) {\n var current = markers[i];\n if (current && typeof current.getAttribute === "function" && current.getAttribute("data-extjs-reinject-key") === key) { marker = current; break; }\n }\n } catch (error) {}\n if (!marker && typeof document.createElement === "function") {\n marker = document.createElement("div");\n marker.setAttribute("data-extjs-reinject-marker", "true");\n marker.setAttribute("hidden", "");\n marker.setAttribute("aria-hidden", "true");\n try { marker.style.display = "none"; } catch (error) {}\n root.appendChild(marker);\n }\n if (!marker) return;\n marker.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n marker.setAttribute("data-extjs-reinject-generation", String(generation));\n marker.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n marker.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try { marker.textContent = String(__EXTENSIONJS_BUNDLE_KEY || key || "") + ":" + String(generation) + ":" + String(status || "mounted"); } catch (error) {}\n try {\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n var ownedRootCount = 0;\n for (var j = 0; j < roots.length; j++) {\n var host = roots[j];\n if (!host || typeof host.setAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n ownedRootCount++;\n host.setAttribute("data-extjs-reinject-owner", String(__EXTENSIONJS_REINJECT_KEY || ""));\n host.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n host.setAttribute("data-extjs-reinject-generation", String(generation));\n host.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n host.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try {\n if (!host.__extjsDebugRemovePatched) {\n host.__extjsDebugRemovePatched = true;\n var __extjsOriginalRemove = typeof host.remove === "function" ? host.remove.bind(host) : null;\n if (__extjsOriginalRemove) {\n host.remove = function(){\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "root-remove-called");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "remove()");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "patched-host-remove");\n }\n } catch (error) {}\n return __extjsOriginalRemove();\n };\n }\n }\n } catch (error) {}\n }\n try {\n marker.setAttribute("data-extjs-debug-stage", String(status || ""));\n marker.setAttribute("data-extjs-debug-root-count", String(roots.length));\n marker.setAttribute("data-extjs-debug-owned-root-count", String(ownedRootCount));\n marker.setAttribute("data-extjs-debug-marker-count", String(markers.length));\n } catch (error) {}\n } catch (error) {}\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-last-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n pageRoot.setAttribute("data-extjs-last-reinject-generation", String(generation));\n pageRoot.setAttribute("data-extjs-last-reinject-status", String(status || "mounted"));\n pageRoot.setAttribute("data-extjs-last-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", marker.getAttribute("data-extjs-debug-stage") || String(status || ""));\n pageRoot.setAttribute("data-extjs-debug-root-count", marker.getAttribute("data-extjs-debug-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-owned-root-count", marker.getAttribute("data-extjs-debug-owned-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-marker-count", marker.getAttribute("data-extjs-debug-marker-count") || "0");\n }\n } catch (error) {}\n } catch (error) {}\n}\nfunction __EXTENSIONJS_debugObserveOwnedRootRemoval(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__) return;\n if (typeof MutationObserver !== "function" || typeof document === "undefined") return;\n var target = document.documentElement || document.body || document;\n if (!target) return;\n var observer = new MutationObserver(function(records){\n try {\n var ownedKey = String(__EXTENSIONJS_REINJECT_KEY || "");\n var findOwnedRoot = function(node){\n try {\n if (!node || node.nodeType !== 1) return null;\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === ownedKey) return node;\n if (typeof node.querySelector === "function") {\n return node.querySelector("[data-extjs-reinject-owner=\\"" + ownedKey.replace(/"/g, "\\\\\\"") + "\\"]");\n }\n } catch (error) {}\n return null;\n };\n for (var r = 0; r < records.length; r++) {\n var removedNodes = Array.from(records[r].removedNodes || []);\n for (var n = 0; n < removedNodes.length; n++) {\n var node = removedNodes[n];\n var ownedRoot = findOwnedRoot(node);\n if (!ownedRoot || typeof ownedRoot.getAttribute !== "function") continue;\n var owner = String(ownedRoot.getAttribute("data-extjs-reinject-owner") || "");\n if (!owner || owner !== ownedKey) continue;\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal")) pageRoot.setAttribute("data-extjs-debug-last-removal", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-key")) pageRoot.setAttribute("data-extjs-debug-last-removal-key", owner);\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-source")) pageRoot.setAttribute("data-extjs-debug-last-removal-source", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-tag")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node.tagName || "").toLowerCase());\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-id")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node.id || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-class")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node.className || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-direct")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-ready-state")) pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-url")) pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", "root-removed-observed");\n }\n return;\n }\n }\n } catch (error) {}\n });\n observer.observe(target, { childList: true, subtree: true });\n globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__ = observer;\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupKnownRoots(){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (!hostOwner || hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n // Build-aware: only remove hosts owned by us whose build token does NOT\n // match the current bundle. Fresh roots from the current mount carry\n // the active build token and must be preserved; orphans from a prior\n // build (e.g. the old isolated world after \`chrome.runtime.reload\`)\n // carry stale tokens and should be cleared so we never end up with two\n // hosts owned by the same key.\n var hostBuild = String(host.getAttribute("data-extjs-reinject-build") || "");\n var currentBuild = String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || "");\n if (hostBuild && currentBuild && hostBuild === currentBuild) continue;\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(host.tagName || "").toLowerCase());\n }\n } catch (error) {}\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupOrphanRoots(){\n try {\n // At bundle execution start, before this run has mounted anything, any\n // \`data-extension-root\` host without \`data-extjs-reinject-owner\` is an\n // orphan from a prior session that died before \`setReinjectMarker\`\n // could tag it (typically: the previous isolated world was destroyed\n // by a \`chrome.runtime.reload\` mid-mount, or its \`whenReady\`-deferred\n // \`apply\` never fired). We have not created our own root yet, so any\n // untagged host we touch here is by definition NOT from this run.\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner) continue;\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_composeCleanup(primaryCleanup){\n return function(){\n try { if (typeof primaryCleanup === "function") primaryCleanup(); } catch (error) {}\n try { __EXTENSIONJS_runCleanups(__EXTENSIONJS_REGISTERED_CLEANUPS); } catch (error) {}\n try { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "cleaned"); } catch (error) {}\n };\n}\nfunction __EXTENSIONJS_recordExecutionSnapshot(stage){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof document === "undefined") return;\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.getAttribute !== "function" || typeof pageRoot.setAttribute !== "function") return;\n var currentCount = Number(pageRoot.getAttribute("data-extjs-debug-execution-count") || "0");\n var nextCount = Number.isFinite(currentCount) ? currentCount + 1 : 1;\n var roots = [];\n try { roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])")); } catch (error) {}\n pageRoot.setAttribute("data-extjs-debug-execution-count", String(nextCount));\n pageRoot.setAttribute("data-extjs-debug-last-execution-stage", String(stage || ""));\n pageRoot.setAttribute("data-extjs-debug-last-execution-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-existing-root-count-before-cleanup", String(roots.length));\n } catch (error) {}\n}\nfunction __EXTENSIONJS_patchDomRemovalApis(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__) return;\n var record = function(source, node, parent){\n try {\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.setAttribute !== "function") return;\n var ownedRoot = null;\n if (node && node.nodeType === 1) {\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === String(__EXTENSIONJS_REINJECT_KEY || "")) ownedRoot = node;\n else if (typeof node.querySelector === "function") ownedRoot = node.querySelector("[data-extjs-reinject-owner=\\"" + String(__EXTENSIONJS_REINJECT_KEY || "").replace(/"/g, "\\\\\\"") + "\\"]");\n }\n if (!ownedRoot) return;\n pageRoot.setAttribute("data-extjs-debug-stage", "dom-api-removal");\n pageRoot.setAttribute("data-extjs-debug-last-removal", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node && node.tagName || "").toLowerCase());\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node && node.id || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node && node.className || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-parent-tag", String(parent && parent.tagName || "").toLowerCase());\n } catch (error) {}\n };\n try {\n var originalRemoveChild = Node.prototype.removeChild;\n if (typeof originalRemoveChild === "function") {\n Node.prototype.removeChild = function(child){\n record("Node.removeChild", child, this);\n return originalRemoveChild.call(this, child);\n };\n }\n } catch (error) {}\n try {\n var originalReplaceChildren = Element.prototype.replaceChildren;\n if (typeof originalReplaceChildren === "function") {\n Element.prototype.replaceChildren = function(){\n try {\n var existing = Array.from(this.childNodes || []);\n for (var i = 0; i < existing.length; i++) record("Element.replaceChildren", existing[i], this);\n } catch (error) {}\n return originalReplaceChildren.apply(this, arguments);\n };\n }\n } catch (error) {}\n globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__ = true;\n } catch (error) {}\n}\ntry {\n if (typeof globalThis === "object" && globalThis) {\n globalThis.__EXTENSIONJS_registerCleanup = __EXTENSIONJS_registerCleanup;\n globalThis.registerCleanup = __EXTENSIONJS_registerCleanup;\n }\n} catch (error) {}\n// Dev-only DOM instrumentation. Gated so production content scripts never\n// install a whole-document MutationObserver, monkey-patch Node.prototype\n// removal APIs, or write data-extjs-debug-* attributes onto the host page.\nif (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try { __EXTENSIONJS_debugObserveOwnedRootRemoval(); } catch (error) {}\n try { __EXTENSIONJS_patchDomRemovalApis(); } catch (error) {}\n try { __EXTENSIONJS_recordExecutionSnapshot("bootstrap"); } catch (error) {}\n}\nvar __EXTENSIONJS_previousEntry=__EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY];\nvar __EXTENSIONJS_REINJECT_GENERATION=__EXTENSIONJS_readReinjectGeneration(__EXTENSIONJS_previousEntry);\n// Sweep untagged orphans (prior-session roots that died before tagging)\n// before any further cleanup runs. Safe here because our mount has not\n// produced any roots yet — any untagged host is by definition not ours.\ntry { __EXTENSIONJS_cleanupOrphanRoots(); } catch (error) {}\ntry {\n var __EXTENSIONJS_previousCleanup=typeof __EXTENSIONJS_previousEntry === "function" ? __EXTENSIONJS_previousEntry : (__EXTENSIONJS_previousEntry && typeof __EXTENSIONJS_previousEntry.cleanup === "function" ? __EXTENSIONJS_previousEntry.cleanup : null);\n if (typeof __EXTENSIONJS_previousCleanup === "function") {\n if (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try {\n var __extjsPageRoot = document.documentElement;\n if (__extjsPageRoot && typeof __extjsPageRoot.setAttribute === "function") {\n __extjsPageRoot.setAttribute("data-extjs-debug-stage", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-source", "previous-cleanup");\n }\n } catch (error) {}\n }\n __EXTENSIONJS_previousCleanup();\n }\n} catch (error) {}\ntry { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\nfunction __EXTENSIONJS_syncAssetBase(){\n try {\n var base = "";\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") base = String(globalThis.browser.runtime.getURL("/"));\n else if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") base = String(globalThis.chrome.runtime.getURL("/"));\n } catch (error) {}\n if (!base) {\n try {\n if (typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n } catch (error) {}\n }\n if (!base) return false;\n if (base.charAt(base.length - 1) !== "/") base += "/";\n if (typeof __webpack_require__ === "function" || typeof __webpack_require__ === "object") {\n try { __webpack_require__.p = base; } catch (error) {}\n try { __webpack_require__.b = base; } catch (error) {}\n }\n return true;\n } catch (error) {}\n return false;\n}\ntry {\n if (!__EXTENSIONJS_syncAssetBase()) {\n var __EXTENSIONJS_assetBaseRetries = 0;\n var __EXTENSIONJS_retryAssetBase = function(){\n try {\n if (__EXTENSIONJS_syncAssetBase()) return;\n } catch (error) {}\n if (__EXTENSIONJS_assetBaseRetries++ < 50) setTimeout(__EXTENSIONJS_retryAssetBase, 100);\n };\n __EXTENSIONJS_retryAssetBase();\n }\n} catch (error) {}\n`;
170
187
  const runtimeInline = `function __EXTENSIONJS_whenReady(runAt, cb){\n try {\n if (typeof document === 'undefined') { cb(); return function(){} }\n if (runAt === 'document_start') { cb(); return function(){} }\n var isDone = false;\n function isReady(){\n if (runAt === 'document_end') return document.readyState === 'interactive' || document.readyState === 'complete';\n if (runAt === 'document_idle') return document.readyState === 'complete';\n return document.readyState === 'complete';\n }\n if (isReady()) { cb(); return function(){} }\n var onReady = function(){\n try {\n if (isDone) return;\n if (isReady()) { isDone = true; document.removeEventListener('readystatechange', onReady); cb(); }\n } catch (error) {}\n };\n document.addEventListener('readystatechange', onReady);\n return function(){ try { if (!isDone) document.removeEventListener('readystatechange', onReady); } catch (error) {} };\n } catch (error) { try { cb(); } catch (ignored) {} return function(){} }\n}\n${bundleCssHydrationInline}function __EXTENSIONJS_mount(mount, runAt){\n var cleanup = function(){};\n var cancelReady = function(){};\n if (typeof mount !== "function") {\n try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n return __EXTENSIONJS_composeCleanup(null);\n }\n function apply(){\n try {\n var nextCleanup = mount();\n cleanup = __EXTENSIONJS_composeCleanup(nextCleanup);\n __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1;\n try { cleanup.__extjsGeneration = __EXTENSIONJS_REINJECT_GENERATION; cleanup.__extjsKey = __EXTENSIONJS_REINJECT_KEY; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, __EXTENSIONJS_REINJECT_GENERATION, "mounted"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n } catch (error) {\n try { console.warn("[extension.js] content script default export failed to run", error); } catch (ignored) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "mount-error"); } catch (ignored) {}\n }\n }\n function unmount(){ try { cancelReady && cancelReady(); } catch (error) {} try { if (typeof cleanup === 'function') cleanup(); } catch (error) {} }\n cancelReady = __EXTENSIONJS_whenReady(runAt, apply);\n return unmount;\n}\n`;
171
188
  if (!hasDefaultExport(rewrittenSource, this.resourcePath, compilation)) return `var __EXTJS_WRAPPER_KIND="FS3_INLINE";\n${bootstrap}${runtimeInline}${rewrittenSource}\ntry { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\ntry { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\ntry { __EXTENSIONJS_scheduleBundleCssHydration() } catch (error) {}\ntry { __EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY] = { cleanup: __EXTENSIONJS_composeCleanup(null), generation: Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, build: __EXTENSIONJS_REINJECT_BUILD_TOKEN }; } catch (error) {}\n`;
172
189
  const replaced = rewrittenSource.replace(/\bexport\s+default\b/, 'const __EXTENSIONJS_default__ =');
@@ -114,6 +114,23 @@ function hasDefaultExport(source, resourcePath, compilation) {
114
114
  return fallback;
115
115
  }
116
116
  }
117
+ const __EXTENSIONJS_manifestParseCache = new Map();
118
+ function readManifestCached(manifestPath) {
119
+ try {
120
+ const stat = fs.statSync(manifestPath);
121
+ const key = `${stat.mtimeMs}:${stat.size}`;
122
+ const cached = __EXTENSIONJS_manifestParseCache.get(manifestPath);
123
+ if (cached && cached.key === key) return cached.manifest;
124
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
125
+ __EXTENSIONJS_manifestParseCache.set(manifestPath, {
126
+ key,
127
+ manifest
128
+ });
129
+ return manifest;
130
+ } catch {
131
+ return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
132
+ }
133
+ }
117
134
  function contentScriptWrapper(source) {
118
135
  const options = this.getOptions();
119
136
  validate(schema, options, {
@@ -125,7 +142,7 @@ function contentScriptWrapper(source) {
125
142
  const manifestDir = path.dirname(manifestPath);
126
143
  const packageJsonPath = findNearestPackageJsonSync(manifestPath);
127
144
  const packageJsonDir = packageJsonPath ? path.dirname(packageJsonPath) : manifestDir;
128
- const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
145
+ const manifest = readManifestCached(manifestPath);
129
146
  const isProd = 'production' === String(options && options.mode || '').toLowerCase();
130
147
  const rewrittenSource = String(source);
131
148
  const declaredContentJsAbsEntries = [];
@@ -166,7 +183,7 @@ function contentScriptWrapper(source) {
166
183
  const cssAssetSpecifiers = collectStyleAssetSpecifiers(rewrittenSource);
167
184
  const cssAssetUrlsInline = `var __EXTENSIONJS_BUNDLE_CSS_URLS=[${cssAssetSpecifiers.map((specifier)=>`(function(){ try { return String(new URL(${escapeCodeString(JSON.stringify(specifier))}, import.meta.url)); } catch (error) { return ""; } })()`).join(',')}];\n`;
168
185
  const bundleCssHydrationInline = `function __EXTENSIONJS_runtimeGetURL(path){\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") return globalThis.browser.runtime.getURL(path);\n if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") return globalThis.chrome.runtime.getURL(path);\n } catch (error) {}\n try {\n var base = (typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) ? String(globalThis.__EXTJS_EXTENSION_BASE__) : "";\n if (!base && typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n if (!base) return "";\n return base.replace(/\\/+\$/, "/") + String(path || "").replace(/^\\/+/, "");\n } catch (error) {}\n return "";\n}\nfunction __EXTENSIONJS_scheduleBundleCssHydration(){\n try {\n if (String(__EXTENSIONJS_BUNDLE_KEY || "").indexOf(${JSON.stringify(CANONICAL_CONTENT_SCRIPT_ENTRY_PREFIX)}) !== 0) return;\n if (typeof document === "undefined" || typeof fetch !== "function") return;\n var cssUrls = Array.from(new Set((Array.isArray(__EXTENSIONJS_BUNDLE_CSS_URLS) ? __EXTENSIONJS_BUNDLE_CSS_URLS : []).concat([__EXTENSIONJS_runtimeGetURL(__EXTENSIONJS_BUNDLE_KEY + ".css")]).filter(function(value){ return typeof value === "string" && value.trim().length > 0; })));\n if (!cssUrls.length) return;\n var cssText = "";\n var cssPromise = null;\n var readCss = function(){\n if (cssPromise) return cssPromise;\n cssPromise = (function fetchCandidate(index){\n if (index >= cssUrls.length) return Promise.resolve("");\n return fetch(cssUrls[index]).then(function(response){\n if (!response || !response.ok) return "";\n return response.text();\n }).catch(function(){\n return "";\n }).then(function(text){\n if (typeof text === "string" && text.trim().length > 0) return text;\n return fetchCandidate(index + 1);\n });\n })(0).then(function(text){\n cssText = typeof text === "string" ? text : "";\n try { setTimeout(tick, 0); } catch (error) {}\n return cssText;\n }).catch(function(){ return ""; });\n return cssPromise;\n };\n var tries = 0;\n var tick = function(){\n try {\n var hosts = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < hosts.length; i++) {\n var host = hosts[i];\n if (!host || !host.shadowRoot || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n if (!hostOwner && String(host.getAttribute("data-extjs-reinject-key") || "") && String(host.getAttribute("data-extjs-reinject-key") || "") !== String(__EXTENSIONJS_BUNDLE_KEY || "")) continue;\n var sr = host.shadowRoot;\n var styles = Array.from(sr.querySelectorAll("style"));\n var hasUserStyle = styles.some(function(styleEl){\n return styleEl && styleEl.getAttribute("data-extjs-bundle-css") !== "true" && String(styleEl.textContent || "").trim().length > 0;\n });\n var injected = sr.querySelector("style[data-extjs-bundle-css=\\"true\\"]");\n if (hasUserStyle) {\n if (injected && injected.parentNode) injected.parentNode.removeChild(injected);\n return;\n }\n if (typeof cssText === "string" && cssText.trim()) {\n if (!injected) {\n injected = document.createElement("style");\n injected.setAttribute("data-extjs-bundle-css", "true");\n injected.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n sr.insertBefore(injected, sr.firstChild || null);\n }\n if (String(injected.textContent || "") !== cssText) injected.textContent = cssText;\n return;\n }\n }\n } catch (error) {}\n if (tries++ < 20) {\n if (!cssPromise) readCss();\n setTimeout(tick, 250);\n }\n };\n tick();\n } catch (error) {}\n}\n`;
169
- const bootstrap = `var __EXTENSIONJS_BUNDLE_KEY=${JSON.stringify(bundleKey)};\nvar __EXTENSIONJS_REINJECT_KEY=${JSON.stringify(reinjectKey)};\nvar __EXTENSIONJS_REINJECT_BUILD_TOKEN=${JSON.stringify(buildToken)};\nvar __EXTENSIONJS_DEV_MARKERS_ENABLED=${JSON.stringify(!isProd)};\n${cssAssetUrlsInline}var __EXTENSIONJS_REINJECT_REGISTRY=(typeof globalThis==="object" && globalThis ? (globalThis.__EXTENSIONJS_DEV_REINJECT__ || (globalThis.__EXTENSIONJS_DEV_REINJECT__={})) : {});\nvar __EXTENSIONJS_REGISTERED_CLEANUPS=[];\nfunction __EXTENSIONJS_readReinjectGeneration(entry){\n try {\n if (!entry) return 0;\n if (typeof entry === "function" && typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry === "object") {\n if (typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry.generation === "number") return entry.generation;\n if (typeof entry.cleanup === "function" && typeof entry.cleanup.__extjsGeneration === "number") return entry.cleanup.__extjsGeneration;\n }\n } catch (error) {}\n return 0;\n}\nfunction __EXTENSIONJS_runCleanups(list){\n try {\n if (!Array.isArray(list)) return;\n for (var i = list.length - 1; i >= 0; i--) {\n try { if (typeof list[i] === "function") list[i](); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_registerCleanup(fn){\n if (typeof fn === "function") __EXTENSIONJS_REGISTERED_CLEANUPS.push(fn);\n return fn;\n}\nfunction __EXTENSIONJS_setReinjectMarker(key, generation, status){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED || typeof document === "undefined") return;\n var root = document.body || document.documentElement;\n if (!root) return;\n var marker = null;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var i = 0; i < markers.length; i++) {\n var current = markers[i];\n if (current && typeof current.getAttribute === "function" && current.getAttribute("data-extjs-reinject-key") === key) { marker = current; break; }\n }\n } catch (error) {}\n if (!marker && typeof document.createElement === "function") {\n marker = document.createElement("div");\n marker.setAttribute("data-extjs-reinject-marker", "true");\n marker.setAttribute("hidden", "");\n marker.setAttribute("aria-hidden", "true");\n try { marker.style.display = "none"; } catch (error) {}\n root.appendChild(marker);\n }\n if (!marker) return;\n marker.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n marker.setAttribute("data-extjs-reinject-generation", String(generation));\n marker.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n marker.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try { marker.textContent = String(__EXTENSIONJS_BUNDLE_KEY || key || "") + ":" + String(generation) + ":" + String(status || "mounted"); } catch (error) {}\n try {\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n var ownedRootCount = 0;\n for (var j = 0; j < roots.length; j++) {\n var host = roots[j];\n if (!host || typeof host.setAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n ownedRootCount++;\n host.setAttribute("data-extjs-reinject-owner", String(__EXTENSIONJS_REINJECT_KEY || ""));\n host.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n host.setAttribute("data-extjs-reinject-generation", String(generation));\n host.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n host.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try {\n if (!host.__extjsDebugRemovePatched) {\n host.__extjsDebugRemovePatched = true;\n var __extjsOriginalRemove = typeof host.remove === "function" ? host.remove.bind(host) : null;\n if (__extjsOriginalRemove) {\n host.remove = function(){\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "root-remove-called");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "remove()");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "patched-host-remove");\n }\n } catch (error) {}\n return __extjsOriginalRemove();\n };\n }\n }\n } catch (error) {}\n }\n try {\n marker.setAttribute("data-extjs-debug-stage", String(status || ""));\n marker.setAttribute("data-extjs-debug-root-count", String(roots.length));\n marker.setAttribute("data-extjs-debug-owned-root-count", String(ownedRootCount));\n marker.setAttribute("data-extjs-debug-marker-count", String(markers.length));\n } catch (error) {}\n } catch (error) {}\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-last-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n pageRoot.setAttribute("data-extjs-last-reinject-generation", String(generation));\n pageRoot.setAttribute("data-extjs-last-reinject-status", String(status || "mounted"));\n pageRoot.setAttribute("data-extjs-last-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", marker.getAttribute("data-extjs-debug-stage") || String(status || ""));\n pageRoot.setAttribute("data-extjs-debug-root-count", marker.getAttribute("data-extjs-debug-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-owned-root-count", marker.getAttribute("data-extjs-debug-owned-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-marker-count", marker.getAttribute("data-extjs-debug-marker-count") || "0");\n }\n } catch (error) {}\n } catch (error) {}\n}\nfunction __EXTENSIONJS_debugObserveOwnedRootRemoval(){\n try {\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__) return;\n if (typeof MutationObserver !== "function" || typeof document === "undefined") return;\n var target = document.documentElement || document.body || document;\n if (!target) return;\n var observer = new MutationObserver(function(records){\n try {\n var ownedKey = String(__EXTENSIONJS_REINJECT_KEY || "");\n var findOwnedRoot = function(node){\n try {\n if (!node || node.nodeType !== 1) return null;\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === ownedKey) return node;\n if (typeof node.querySelector === "function") {\n return node.querySelector("[data-extjs-reinject-owner=\\"" + ownedKey.replace(/"/g, "\\\\\\"") + "\\"]");\n }\n } catch (error) {}\n return null;\n };\n for (var r = 0; r < records.length; r++) {\n var removedNodes = Array.from(records[r].removedNodes || []);\n for (var n = 0; n < removedNodes.length; n++) {\n var node = removedNodes[n];\n var ownedRoot = findOwnedRoot(node);\n if (!ownedRoot || typeof ownedRoot.getAttribute !== "function") continue;\n var owner = String(ownedRoot.getAttribute("data-extjs-reinject-owner") || "");\n if (!owner || owner !== ownedKey) continue;\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal")) pageRoot.setAttribute("data-extjs-debug-last-removal", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-key")) pageRoot.setAttribute("data-extjs-debug-last-removal-key", owner);\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-source")) pageRoot.setAttribute("data-extjs-debug-last-removal-source", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-tag")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node.tagName || "").toLowerCase());\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-id")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node.id || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-class")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node.className || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-direct")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-ready-state")) pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-url")) pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", "root-removed-observed");\n }\n return;\n }\n }\n } catch (error) {}\n });\n observer.observe(target, { childList: true, subtree: true });\n globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__ = observer;\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupKnownRoots(){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (!hostOwner || hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n // Build-aware: only remove hosts owned by us whose build token does NOT\n // match the current bundle. Fresh roots from the current mount carry\n // the active build token and must be preserved; orphans from a prior\n // build (e.g. the old isolated world after \`chrome.runtime.reload\`)\n // carry stale tokens and should be cleared so we never end up with two\n // hosts owned by the same key.\n var hostBuild = String(host.getAttribute("data-extjs-reinject-build") || "");\n var currentBuild = String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || "");\n if (hostBuild && currentBuild && hostBuild === currentBuild) continue;\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(host.tagName || "").toLowerCase());\n }\n } catch (error) {}\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupOrphanRoots(){\n try {\n // At bundle execution start, before this run has mounted anything, any\n // \`data-extension-root\` host without \`data-extjs-reinject-owner\` is an\n // orphan from a prior session that died before \`setReinjectMarker\`\n // could tag it (typically: the previous isolated world was destroyed\n // by a \`chrome.runtime.reload\` mid-mount, or its \`whenReady\`-deferred\n // \`apply\` never fired). We have not created our own root yet, so any\n // untagged host we touch here is by definition NOT from this run.\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner) continue;\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_composeCleanup(primaryCleanup){\n return function(){\n try { if (typeof primaryCleanup === "function") primaryCleanup(); } catch (error) {}\n try { __EXTENSIONJS_runCleanups(__EXTENSIONJS_REGISTERED_CLEANUPS); } catch (error) {}\n try { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "cleaned"); } catch (error) {}\n };\n}\nfunction __EXTENSIONJS_recordExecutionSnapshot(stage){\n try {\n if (typeof document === "undefined") return;\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.getAttribute !== "function" || typeof pageRoot.setAttribute !== "function") return;\n var currentCount = Number(pageRoot.getAttribute("data-extjs-debug-execution-count") || "0");\n var nextCount = Number.isFinite(currentCount) ? currentCount + 1 : 1;\n var roots = [];\n try { roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])")); } catch (error) {}\n pageRoot.setAttribute("data-extjs-debug-execution-count", String(nextCount));\n pageRoot.setAttribute("data-extjs-debug-last-execution-stage", String(stage || ""));\n pageRoot.setAttribute("data-extjs-debug-last-execution-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-existing-root-count-before-cleanup", String(roots.length));\n } catch (error) {}\n}\nfunction __EXTENSIONJS_patchDomRemovalApis(){\n try {\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__) return;\n var record = function(source, node, parent){\n try {\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.setAttribute !== "function") return;\n var ownedRoot = null;\n if (node && node.nodeType === 1) {\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === String(__EXTENSIONJS_REINJECT_KEY || "")) ownedRoot = node;\n else if (typeof node.querySelector === "function") ownedRoot = node.querySelector("[data-extjs-reinject-owner=\\"" + String(__EXTENSIONJS_REINJECT_KEY || "").replace(/"/g, "\\\\\\"") + "\\"]");\n }\n if (!ownedRoot) return;\n pageRoot.setAttribute("data-extjs-debug-stage", "dom-api-removal");\n pageRoot.setAttribute("data-extjs-debug-last-removal", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node && node.tagName || "").toLowerCase());\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node && node.id || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node && node.className || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-parent-tag", String(parent && parent.tagName || "").toLowerCase());\n } catch (error) {}\n };\n try {\n var originalRemoveChild = Node.prototype.removeChild;\n if (typeof originalRemoveChild === "function") {\n Node.prototype.removeChild = function(child){\n record("Node.removeChild", child, this);\n return originalRemoveChild.call(this, child);\n };\n }\n } catch (error) {}\n try {\n var originalReplaceChildren = Element.prototype.replaceChildren;\n if (typeof originalReplaceChildren === "function") {\n Element.prototype.replaceChildren = function(){\n try {\n var existing = Array.from(this.childNodes || []);\n for (var i = 0; i < existing.length; i++) record("Element.replaceChildren", existing[i], this);\n } catch (error) {}\n return originalReplaceChildren.apply(this, arguments);\n };\n }\n } catch (error) {}\n globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__ = true;\n } catch (error) {}\n}\ntry {\n if (typeof globalThis === "object" && globalThis) {\n globalThis.__EXTENSIONJS_registerCleanup = __EXTENSIONJS_registerCleanup;\n globalThis.registerCleanup = __EXTENSIONJS_registerCleanup;\n }\n} catch (error) {}\ntry { __EXTENSIONJS_debugObserveOwnedRootRemoval(); } catch (error) {}\ntry { __EXTENSIONJS_patchDomRemovalApis(); } catch (error) {}\ntry { __EXTENSIONJS_recordExecutionSnapshot("bootstrap"); } catch (error) {}\nvar __EXTENSIONJS_previousEntry=__EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY];\nvar __EXTENSIONJS_REINJECT_GENERATION=__EXTENSIONJS_readReinjectGeneration(__EXTENSIONJS_previousEntry);\n// Sweep untagged orphans (prior-session roots that died before tagging)\n// before any further cleanup runs. Safe here because our mount has not\n// produced any roots yet — any untagged host is by definition not ours.\ntry { __EXTENSIONJS_cleanupOrphanRoots(); } catch (error) {}\ntry {\n var __EXTENSIONJS_previousCleanup=typeof __EXTENSIONJS_previousEntry === "function" ? __EXTENSIONJS_previousEntry : (__EXTENSIONJS_previousEntry && typeof __EXTENSIONJS_previousEntry.cleanup === "function" ? __EXTENSIONJS_previousEntry.cleanup : null);\n if (typeof __EXTENSIONJS_previousCleanup === "function") {\n try {\n var __extjsPageRoot = document.documentElement;\n if (__extjsPageRoot && typeof __extjsPageRoot.setAttribute === "function") {\n __extjsPageRoot.setAttribute("data-extjs-debug-stage", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-source", "previous-cleanup");\n }\n } catch (error) {}\n __EXTENSIONJS_previousCleanup();\n }\n} catch (error) {}\ntry { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\nfunction __EXTENSIONJS_syncAssetBase(){\n try {\n var base = "";\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") base = String(globalThis.browser.runtime.getURL("/"));\n else if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") base = String(globalThis.chrome.runtime.getURL("/"));\n } catch (error) {}\n if (!base) {\n try {\n if (typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n } catch (error) {}\n }\n if (!base) return false;\n if (base.charAt(base.length - 1) !== "/") base += "/";\n if (typeof __webpack_require__ === "function" || typeof __webpack_require__ === "object") {\n try { __webpack_require__.p = base; } catch (error) {}\n try { __webpack_require__.b = base; } catch (error) {}\n }\n return true;\n } catch (error) {}\n return false;\n}\ntry {\n if (!__EXTENSIONJS_syncAssetBase()) {\n var __EXTENSIONJS_assetBaseRetries = 0;\n var __EXTENSIONJS_retryAssetBase = function(){\n try {\n if (__EXTENSIONJS_syncAssetBase()) return;\n } catch (error) {}\n if (__EXTENSIONJS_assetBaseRetries++ < 50) setTimeout(__EXTENSIONJS_retryAssetBase, 100);\n };\n __EXTENSIONJS_retryAssetBase();\n }\n} catch (error) {}\n`;
186
+ const bootstrap = `var __EXTENSIONJS_BUNDLE_KEY=${JSON.stringify(bundleKey)};\nvar __EXTENSIONJS_REINJECT_KEY=${JSON.stringify(reinjectKey)};\nvar __EXTENSIONJS_REINJECT_BUILD_TOKEN=${JSON.stringify(buildToken)};\nvar __EXTENSIONJS_DEV_MARKERS_ENABLED=${JSON.stringify(!isProd)};\n${cssAssetUrlsInline}var __EXTENSIONJS_REINJECT_REGISTRY=(typeof globalThis==="object" && globalThis ? (globalThis.__EXTENSIONJS_DEV_REINJECT__ || (globalThis.__EXTENSIONJS_DEV_REINJECT__={})) : {});\nvar __EXTENSIONJS_REGISTERED_CLEANUPS=[];\nfunction __EXTENSIONJS_readReinjectGeneration(entry){\n try {\n if (!entry) return 0;\n if (typeof entry === "function" && typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry === "object") {\n if (typeof entry.__extjsGeneration === "number") return entry.__extjsGeneration;\n if (typeof entry.generation === "number") return entry.generation;\n if (typeof entry.cleanup === "function" && typeof entry.cleanup.__extjsGeneration === "number") return entry.cleanup.__extjsGeneration;\n }\n } catch (error) {}\n return 0;\n}\nfunction __EXTENSIONJS_runCleanups(list){\n try {\n if (!Array.isArray(list)) return;\n for (var i = list.length - 1; i >= 0; i--) {\n try { if (typeof list[i] === "function") list[i](); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_registerCleanup(fn){\n if (typeof fn === "function") __EXTENSIONJS_REGISTERED_CLEANUPS.push(fn);\n return fn;\n}\nfunction __EXTENSIONJS_setReinjectMarker(key, generation, status){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED || typeof document === "undefined") return;\n var root = document.body || document.documentElement;\n if (!root) return;\n var marker = null;\n try {\n var markers = Array.from(document.querySelectorAll("[data-extjs-reinject-marker=\\"true\\"]"));\n for (var i = 0; i < markers.length; i++) {\n var current = markers[i];\n if (current && typeof current.getAttribute === "function" && current.getAttribute("data-extjs-reinject-key") === key) { marker = current; break; }\n }\n } catch (error) {}\n if (!marker && typeof document.createElement === "function") {\n marker = document.createElement("div");\n marker.setAttribute("data-extjs-reinject-marker", "true");\n marker.setAttribute("hidden", "");\n marker.setAttribute("aria-hidden", "true");\n try { marker.style.display = "none"; } catch (error) {}\n root.appendChild(marker);\n }\n if (!marker) return;\n marker.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n marker.setAttribute("data-extjs-reinject-generation", String(generation));\n marker.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n marker.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try { marker.textContent = String(__EXTENSIONJS_BUNDLE_KEY || key || "") + ":" + String(generation) + ":" + String(status || "mounted"); } catch (error) {}\n try {\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n var ownedRootCount = 0;\n for (var j = 0; j < roots.length; j++) {\n var host = roots[j];\n if (!host || typeof host.setAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner && hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n ownedRootCount++;\n host.setAttribute("data-extjs-reinject-owner", String(__EXTENSIONJS_REINJECT_KEY || ""));\n host.setAttribute("data-extjs-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n host.setAttribute("data-extjs-reinject-generation", String(generation));\n host.setAttribute("data-extjs-reinject-status", String(status || "mounted"));\n host.setAttribute("data-extjs-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n try {\n if (!host.__extjsDebugRemovePatched) {\n host.__extjsDebugRemovePatched = true;\n var __extjsOriginalRemove = typeof host.remove === "function" ? host.remove.bind(host) : null;\n if (__extjsOriginalRemove) {\n host.remove = function(){\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "root-remove-called");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "remove()");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "patched-host-remove");\n }\n } catch (error) {}\n return __extjsOriginalRemove();\n };\n }\n }\n } catch (error) {}\n }\n try {\n marker.setAttribute("data-extjs-debug-stage", String(status || ""));\n marker.setAttribute("data-extjs-debug-root-count", String(roots.length));\n marker.setAttribute("data-extjs-debug-owned-root-count", String(ownedRootCount));\n marker.setAttribute("data-extjs-debug-marker-count", String(markers.length));\n } catch (error) {}\n } catch (error) {}\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-last-reinject-key", String(__EXTENSIONJS_BUNDLE_KEY || key || ""));\n pageRoot.setAttribute("data-extjs-last-reinject-generation", String(generation));\n pageRoot.setAttribute("data-extjs-last-reinject-status", String(status || "mounted"));\n pageRoot.setAttribute("data-extjs-last-reinject-build", String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", marker.getAttribute("data-extjs-debug-stage") || String(status || ""));\n pageRoot.setAttribute("data-extjs-debug-root-count", marker.getAttribute("data-extjs-debug-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-owned-root-count", marker.getAttribute("data-extjs-debug-owned-root-count") || "0");\n pageRoot.setAttribute("data-extjs-debug-marker-count", marker.getAttribute("data-extjs-debug-marker-count") || "0");\n }\n } catch (error) {}\n } catch (error) {}\n}\nfunction __EXTENSIONJS_debugObserveOwnedRootRemoval(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__) return;\n if (typeof MutationObserver !== "function" || typeof document === "undefined") return;\n var target = document.documentElement || document.body || document;\n if (!target) return;\n var observer = new MutationObserver(function(records){\n try {\n var ownedKey = String(__EXTENSIONJS_REINJECT_KEY || "");\n var findOwnedRoot = function(node){\n try {\n if (!node || node.nodeType !== 1) return null;\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === ownedKey) return node;\n if (typeof node.querySelector === "function") {\n return node.querySelector("[data-extjs-reinject-owner=\\"" + ownedKey.replace(/"/g, "\\\\\\"") + "\\"]");\n }\n } catch (error) {}\n return null;\n };\n for (var r = 0; r < records.length; r++) {\n var removedNodes = Array.from(records[r].removedNodes || []);\n for (var n = 0; n < removedNodes.length; n++) {\n var node = removedNodes[n];\n var ownedRoot = findOwnedRoot(node);\n if (!ownedRoot || typeof ownedRoot.getAttribute !== "function") continue;\n var owner = String(ownedRoot.getAttribute("data-extjs-reinject-owner") || "");\n if (!owner || owner !== ownedKey) continue;\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal")) pageRoot.setAttribute("data-extjs-debug-last-removal", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-key")) pageRoot.setAttribute("data-extjs-debug-last-removal-key", owner);\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-source")) pageRoot.setAttribute("data-extjs-debug-last-removal-source", "mutation-observer");\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-tag")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node.tagName || "").toLowerCase());\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-id")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node.id || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-class")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node.className || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removed-node-direct")) pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-ready-state")) pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n if (!pageRoot.getAttribute("data-extjs-debug-last-removal-url")) pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-stage", "root-removed-observed");\n }\n return;\n }\n }\n } catch (error) {}\n });\n observer.observe(target, { childList: true, subtree: true });\n globalThis.__EXTJS_DEBUG_REMOVAL_OBSERVER__ = observer;\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupKnownRoots(){\n try {\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (!hostOwner || hostOwner !== String(__EXTENSIONJS_REINJECT_KEY || "")) continue;\n // Build-aware: only remove hosts owned by us whose build token does NOT\n // match the current bundle. Fresh roots from the current mount carry\n // the active build token and must be preserved; orphans from a prior\n // build (e.g. the old isolated world after \`chrome.runtime.reload\`)\n // carry stale tokens and should be cleared so we never end up with two\n // hosts owned by the same key.\n var hostBuild = String(host.getAttribute("data-extjs-reinject-build") || "");\n var currentBuild = String(__EXTENSIONJS_REINJECT_BUILD_TOKEN || "");\n if (hostBuild && currentBuild && hostBuild === currentBuild) continue;\n try {\n var pageRoot = document.documentElement;\n if (pageRoot && typeof pageRoot.setAttribute === "function") {\n pageRoot.setAttribute("data-extjs-debug-stage", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", "cleanup-known-roots");\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(host.tagName || "").toLowerCase());\n }\n } catch (error) {}\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_cleanupOrphanRoots(){\n try {\n // At bundle execution start, before this run has mounted anything, any\n // \`data-extension-root\` host without \`data-extjs-reinject-owner\` is an\n // orphan from a prior session that died before \`setReinjectMarker\`\n // could tag it (typically: the previous isolated world was destroyed\n // by a \`chrome.runtime.reload\` mid-mount, or its \`whenReady\`-deferred\n // \`apply\` never fired). We have not created our own root yet, so any\n // untagged host we touch here is by definition NOT from this run.\n if (typeof document === "undefined" || typeof document.querySelectorAll !== "function") return;\n var roots = Array.from(document.querySelectorAll("[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])"));\n for (var i = 0; i < roots.length; i++) {\n var host = roots[i];\n if (!host || typeof host.getAttribute !== "function") continue;\n var hostOwner = String(host.getAttribute("data-extjs-reinject-owner") || "");\n if (hostOwner) continue;\n try { host.remove(); } catch (error) {}\n }\n } catch (error) {}\n}\nfunction __EXTENSIONJS_composeCleanup(primaryCleanup){\n return function(){\n try { if (typeof primaryCleanup === "function") primaryCleanup(); } catch (error) {}\n try { __EXTENSIONJS_runCleanups(__EXTENSIONJS_REGISTERED_CLEANUPS); } catch (error) {}\n try { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "cleaned"); } catch (error) {}\n };\n}\nfunction __EXTENSIONJS_recordExecutionSnapshot(stage){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof document === "undefined") return;\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.getAttribute !== "function" || typeof pageRoot.setAttribute !== "function") return;\n var currentCount = Number(pageRoot.getAttribute("data-extjs-debug-execution-count") || "0");\n var nextCount = Number.isFinite(currentCount) ? currentCount + 1 : 1;\n var roots = [];\n try { roots = Array.from(document.querySelectorAll("#extension-root,[data-extension-root]:not([data-extension-root=\\"extension-js-devtools\\"])")); } catch (error) {}\n pageRoot.setAttribute("data-extjs-debug-execution-count", String(nextCount));\n pageRoot.setAttribute("data-extjs-debug-last-execution-stage", String(stage || ""));\n pageRoot.setAttribute("data-extjs-debug-last-execution-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-existing-root-count-before-cleanup", String(roots.length));\n } catch (error) {}\n}\nfunction __EXTENSIONJS_patchDomRemovalApis(){\n try {\n if (!__EXTENSIONJS_DEV_MARKERS_ENABLED) return;\n if (typeof globalThis !== "object" || !globalThis || globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__) return;\n var record = function(source, node, parent){\n try {\n var pageRoot = document.documentElement;\n if (!pageRoot || typeof pageRoot.setAttribute !== "function") return;\n var ownedRoot = null;\n if (node && node.nodeType === 1) {\n if (typeof node.getAttribute === "function" && String(node.getAttribute("data-extjs-reinject-owner") || "") === String(__EXTENSIONJS_REINJECT_KEY || "")) ownedRoot = node;\n else if (typeof node.querySelector === "function") ownedRoot = node.querySelector("[data-extjs-reinject-owner=\\"" + String(__EXTENSIONJS_REINJECT_KEY || "").replace(/"/g, "\\\\\\"") + "\\"]");\n }\n if (!ownedRoot) return;\n pageRoot.setAttribute("data-extjs-debug-stage", "dom-api-removal");\n pageRoot.setAttribute("data-extjs-debug-last-removal", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-source", source);\n pageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-tag", String(node && node.tagName || "").toLowerCase());\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-id", String(node && node.id || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-class", String(node && node.className || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removed-node-direct", String(node === ownedRoot));\n pageRoot.setAttribute("data-extjs-debug-last-removal-ready-state", String(document.readyState || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-url", String(location.href || ""));\n pageRoot.setAttribute("data-extjs-debug-last-removal-parent-tag", String(parent && parent.tagName || "").toLowerCase());\n } catch (error) {}\n };\n try {\n var originalRemoveChild = Node.prototype.removeChild;\n if (typeof originalRemoveChild === "function") {\n Node.prototype.removeChild = function(child){\n record("Node.removeChild", child, this);\n return originalRemoveChild.call(this, child);\n };\n }\n } catch (error) {}\n try {\n var originalReplaceChildren = Element.prototype.replaceChildren;\n if (typeof originalReplaceChildren === "function") {\n Element.prototype.replaceChildren = function(){\n try {\n var existing = Array.from(this.childNodes || []);\n for (var i = 0; i < existing.length; i++) record("Element.replaceChildren", existing[i], this);\n } catch (error) {}\n return originalReplaceChildren.apply(this, arguments);\n };\n }\n } catch (error) {}\n globalThis.__EXTJS_DEBUG_DOM_APIS_PATCHED__ = true;\n } catch (error) {}\n}\ntry {\n if (typeof globalThis === "object" && globalThis) {\n globalThis.__EXTENSIONJS_registerCleanup = __EXTENSIONJS_registerCleanup;\n globalThis.registerCleanup = __EXTENSIONJS_registerCleanup;\n }\n} catch (error) {}\n// Dev-only DOM instrumentation. Gated so production content scripts never\n// install a whole-document MutationObserver, monkey-patch Node.prototype\n// removal APIs, or write data-extjs-debug-* attributes onto the host page.\nif (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try { __EXTENSIONJS_debugObserveOwnedRootRemoval(); } catch (error) {}\n try { __EXTENSIONJS_patchDomRemovalApis(); } catch (error) {}\n try { __EXTENSIONJS_recordExecutionSnapshot("bootstrap"); } catch (error) {}\n}\nvar __EXTENSIONJS_previousEntry=__EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY];\nvar __EXTENSIONJS_REINJECT_GENERATION=__EXTENSIONJS_readReinjectGeneration(__EXTENSIONJS_previousEntry);\n// Sweep untagged orphans (prior-session roots that died before tagging)\n// before any further cleanup runs. Safe here because our mount has not\n// produced any roots yet — any untagged host is by definition not ours.\ntry { __EXTENSIONJS_cleanupOrphanRoots(); } catch (error) {}\ntry {\n var __EXTENSIONJS_previousCleanup=typeof __EXTENSIONJS_previousEntry === "function" ? __EXTENSIONJS_previousEntry : (__EXTENSIONJS_previousEntry && typeof __EXTENSIONJS_previousEntry.cleanup === "function" ? __EXTENSIONJS_previousEntry.cleanup : null);\n if (typeof __EXTENSIONJS_previousCleanup === "function") {\n if (__EXTENSIONJS_DEV_MARKERS_ENABLED) {\n try {\n var __extjsPageRoot = document.documentElement;\n if (__extjsPageRoot && typeof __extjsPageRoot.setAttribute === "function") {\n __extjsPageRoot.setAttribute("data-extjs-debug-stage", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal", "previous-cleanup");\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-key", String(__EXTENSIONJS_REINJECT_KEY || ""));\n __extjsPageRoot.setAttribute("data-extjs-debug-last-removal-source", "previous-cleanup");\n }\n } catch (error) {}\n }\n __EXTENSIONJS_previousCleanup();\n }\n} catch (error) {}\ntry { __EXTENSIONJS_cleanupKnownRoots(); } catch (error) {}\nfunction __EXTENSIONJS_syncAssetBase(){\n try {\n var base = "";\n try {\n if (typeof globalThis === "object" && globalThis && globalThis.browser && globalThis.browser.runtime && typeof globalThis.browser.runtime.getURL === "function") base = String(globalThis.browser.runtime.getURL("/"));\n else if (typeof globalThis === "object" && globalThis && globalThis.chrome && globalThis.chrome.runtime && typeof globalThis.chrome.runtime.getURL === "function") base = String(globalThis.chrome.runtime.getURL("/"));\n } catch (error) {}\n if (!base) {\n try {\n if (typeof document === "object" && document && document.documentElement) base = String(document.documentElement.getAttribute("data-extjs-extension-base") || "");\n } catch (error) {}\n }\n if (!base) return false;\n if (base.charAt(base.length - 1) !== "/") base += "/";\n if (typeof __webpack_require__ === "function" || typeof __webpack_require__ === "object") {\n try { __webpack_require__.p = base; } catch (error) {}\n try { __webpack_require__.b = base; } catch (error) {}\n }\n return true;\n } catch (error) {}\n return false;\n}\ntry {\n if (!__EXTENSIONJS_syncAssetBase()) {\n var __EXTENSIONJS_assetBaseRetries = 0;\n var __EXTENSIONJS_retryAssetBase = function(){\n try {\n if (__EXTENSIONJS_syncAssetBase()) return;\n } catch (error) {}\n if (__EXTENSIONJS_assetBaseRetries++ < 50) setTimeout(__EXTENSIONJS_retryAssetBase, 100);\n };\n __EXTENSIONJS_retryAssetBase();\n }\n} catch (error) {}\n`;
170
187
  const runtimeInline = `function __EXTENSIONJS_whenReady(runAt, cb){\n try {\n if (typeof document === 'undefined') { cb(); return function(){} }\n if (runAt === 'document_start') { cb(); return function(){} }\n var isDone = false;\n function isReady(){\n if (runAt === 'document_end') return document.readyState === 'interactive' || document.readyState === 'complete';\n if (runAt === 'document_idle') return document.readyState === 'complete';\n return document.readyState === 'complete';\n }\n if (isReady()) { cb(); return function(){} }\n var onReady = function(){\n try {\n if (isDone) return;\n if (isReady()) { isDone = true; document.removeEventListener('readystatechange', onReady); cb(); }\n } catch (error) {}\n };\n document.addEventListener('readystatechange', onReady);\n return function(){ try { if (!isDone) document.removeEventListener('readystatechange', onReady); } catch (error) {} };\n } catch (error) { try { cb(); } catch (ignored) {} return function(){} }\n}\n${bundleCssHydrationInline}function __EXTENSIONJS_mount(mount, runAt){\n var cleanup = function(){};\n var cancelReady = function(){};\n if (typeof mount !== "function") {\n try { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n return __EXTENSIONJS_composeCleanup(null);\n }\n function apply(){\n try {\n var nextCleanup = mount();\n cleanup = __EXTENSIONJS_composeCleanup(nextCleanup);\n __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1;\n try { cleanup.__extjsGeneration = __EXTENSIONJS_REINJECT_GENERATION; cleanup.__extjsKey = __EXTENSIONJS_REINJECT_KEY; } catch (error) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, __EXTENSIONJS_REINJECT_GENERATION, "mounted"); } catch (error) {}\n try { __EXTENSIONJS_scheduleBundleCssHydration(); } catch (error) {}\n } catch (error) {\n try { console.warn("[extension.js] content script default export failed to run", error); } catch (ignored) {}\n try { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "mount-error"); } catch (ignored) {}\n }\n }\n function unmount(){ try { cancelReady && cancelReady(); } catch (error) {} try { if (typeof cleanup === 'function') cleanup(); } catch (error) {} }\n cancelReady = __EXTENSIONJS_whenReady(runAt, apply);\n return unmount;\n}\n`;
171
188
  if (!hasDefaultExport(rewrittenSource, this.resourcePath, compilation)) return `var __EXTJS_WRAPPER_KIND="FS3_INLINE";\n${bootstrap}${runtimeInline}${rewrittenSource}\ntry { __EXTENSIONJS_REINJECT_GENERATION = (Number(__EXTENSIONJS_REINJECT_GENERATION) || 0) + 1; } catch (error) {}\ntry { __EXTENSIONJS_setReinjectMarker(__EXTENSIONJS_REINJECT_KEY, Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, "executed"); } catch (error) {}\ntry { __EXTENSIONJS_scheduleBundleCssHydration() } catch (error) {}\ntry { __EXTENSIONJS_REINJECT_REGISTRY[__EXTENSIONJS_REINJECT_KEY] = { cleanup: __EXTENSIONJS_composeCleanup(null), generation: Number(__EXTENSIONJS_REINJECT_GENERATION) || 0, build: __EXTENSIONJS_REINJECT_BUILD_TOKEN }; } catch (error) {}\n`;
172
189
  const replaced = rewrittenSource.replace(/\bexport\s+default\b/, 'const __EXTENSIONJS_default__ =');
package/package.json CHANGED
@@ -20,15 +20,21 @@
20
20
  "types": "./dist/preview.d.ts",
21
21
  "import": "./dist/preview.mjs"
22
22
  },
23
+ "./bridge": {
24
+ "development": "./bridge-entry.ts",
25
+ "types": "./dist/bridge.d.ts",
26
+ "import": "./dist/bridge.mjs"
27
+ },
23
28
  "./package.json": "./package.json"
24
29
  },
25
30
  "main": "./dist/module.mjs",
26
31
  "types": "./dist/module.d.ts",
27
32
  "files": [
28
- "dist"
33
+ "dist",
34
+ "runtime"
29
35
  ],
30
36
  "name": "extension-develop",
31
- "version": "3.17.0",
37
+ "version": "3.18.0",
32
38
  "description": "Develop, build, preview, and package Extension.js projects.",
33
39
  "author": {
34
40
  "name": "Cezar Augusto",
@@ -79,7 +85,7 @@
79
85
  "@prefresh/core": "1.5.9",
80
86
  "@prefresh/utils": "1.2.1",
81
87
  "@rspack/core": "^2.0.1",
82
- "@rspack/dev-server": "^2.0.1",
88
+ "@rspack/dev-server": "2.0.1",
83
89
  "@rspack/plugin-preact-refresh": "1.1.5",
84
90
  "@rspack/plugin-react-refresh": "1.6.2",
85
91
  "@swc/core": "^1.15.8",
@@ -116,7 +122,8 @@
116
122
  "vue-loader": "17.4.2",
117
123
  "webextension-polyfill": "^0.12.0",
118
124
  "webpack-merge": "^6.0.1",
119
- "webpack-target-webextension": "^2.1.3"
125
+ "webpack-target-webextension": "^2.1.3",
126
+ "ws": "^8.20.1"
120
127
  },
121
128
  "devDependencies": {
122
129
  "@prefresh/webpack": "4.0.6",
@@ -129,10 +136,12 @@
129
136
  "@types/node": "^25.2.0",
130
137
  "@types/sass-loader": "8.0.10",
131
138
  "@types/webextension-polyfill": "0.12.4",
139
+ "@types/ws": "^8.18.1",
132
140
  "svelte": "5.55.9",
133
141
  "tsup": "^8.5.1",
134
142
  "typescript": "6.0.2",
135
143
  "vitest": "^4.1.3",
136
- "vue-style-loader": "4.1.3"
144
+ "vue-style-loader": "4.1.3",
145
+ "webpack": "^5.104.1"
137
146
  }
138
147
  }
@@ -0,0 +1,49 @@
1
+ 'use strict'
2
+
3
+ var noop = function () {}
4
+
5
+ function nextTick(callback) {
6
+ var args = Array.prototype.slice.call(arguments, 1)
7
+ var run = function () {
8
+ callback.apply(null, args)
9
+ }
10
+ if (typeof queueMicrotask === 'function') {
11
+ queueMicrotask(run)
12
+ } else {
13
+ Promise.resolve().then(run)
14
+ }
15
+ }
16
+
17
+ module.exports = {
18
+ // Unknown env keys resolve to `undefined` instead of throwing.
19
+ env: {},
20
+ argv: [],
21
+ version: '',
22
+ versions: {},
23
+ platform: 'browser',
24
+ arch: 'browser',
25
+ // Truthy hint used by some libraries to detect a browser-shimmed process.
26
+ browser: true,
27
+ title: 'browser',
28
+ pid: 0,
29
+ nextTick: nextTick,
30
+ cwd: function () {
31
+ return '/'
32
+ },
33
+ chdir: noop,
34
+ umask: function () {
35
+ return 0
36
+ },
37
+ on: noop,
38
+ once: noop,
39
+ off: noop,
40
+ addListener: noop,
41
+ removeListener: noop,
42
+ removeAllListeners: noop,
43
+ prependListener: noop,
44
+ prependOnceListener: noop,
45
+ emit: noop,
46
+ listeners: function () {
47
+ return []
48
+ }
49
+ }