extension-develop 2.0.0-beta.4 → 2.0.0-beta.5

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 (92) hide show
  1. package/dist/module.js +10 -10
  2. package/dist/run-chrome-profile/Default/BrowsingTopicsState +8 -1
  3. package/dist/run-chrome-profile/Default/Cache/Cache_Data/0aec0caf66c01b86_0 +0 -0
  4. package/dist/run-chrome-profile/Default/Cache/Cache_Data/74c341ad859e0a41_0 +0 -0
  5. package/dist/run-chrome-profile/Default/Cache/Cache_Data/index-dir/the-real-index +0 -0
  6. package/dist/run-chrome-profile/Default/Code Cache/js/7bef27e46289c1aa_0 +0 -0
  7. package/dist/run-chrome-profile/Default/Code Cache/js/a6ff79bb94132ba7_0 +0 -0
  8. package/dist/run-chrome-profile/Default/Code Cache/js/index-dir/the-real-index +0 -0
  9. package/dist/run-chrome-profile/Default/Cookies +0 -0
  10. package/dist/run-chrome-profile/Default/DIPS +0 -0
  11. package/dist/run-chrome-profile/Default/DawnGraphiteCache/data_1 +0 -0
  12. package/dist/run-chrome-profile/Default/DawnGraphiteCache/index +0 -0
  13. package/dist/run-chrome-profile/Default/DawnWebGPUCache/data_1 +0 -0
  14. package/dist/run-chrome-profile/Default/DawnWebGPUCache/index +0 -0
  15. package/dist/run-chrome-profile/Default/Extension Rules/000003.log +0 -0
  16. package/dist/run-chrome-profile/Default/Extension Rules/LOG +3 -3
  17. package/dist/run-chrome-profile/Default/Extension Rules/LOG.old +3 -3
  18. package/dist/run-chrome-profile/Default/Extension Scripts/000003.log +0 -0
  19. package/dist/run-chrome-profile/Default/Extension Scripts/LOG +3 -3
  20. package/dist/run-chrome-profile/Default/Extension Scripts/LOG.old +3 -3
  21. package/dist/run-chrome-profile/Default/Extension State/000003.log +0 -0
  22. package/dist/run-chrome-profile/Default/Extension State/LOG +3 -3
  23. package/dist/run-chrome-profile/Default/Extension State/LOG.old +3 -3
  24. package/dist/run-chrome-profile/Default/GPUCache/data_1 +0 -0
  25. package/dist/run-chrome-profile/Default/GPUCache/index +0 -0
  26. package/dist/run-chrome-profile/Default/History +0 -0
  27. package/dist/run-chrome-profile/Default/Local Extension Settings/ckalngflbgchjihhkfhlbkeoigafanol/LOG +3 -3
  28. package/dist/run-chrome-profile/Default/Local Extension Settings/ckalngflbgchjihhkfhlbkeoigafanol/LOG.old +3 -3
  29. package/dist/run-chrome-profile/Default/Local Storage/leveldb/000027.log +0 -0
  30. package/dist/run-chrome-profile/Default/Local Storage/leveldb/LOG +3 -3
  31. package/dist/run-chrome-profile/Default/Local Storage/leveldb/LOG.old +3 -3
  32. package/dist/run-chrome-profile/Default/Network Action Predictor +0 -0
  33. package/dist/run-chrome-profile/Default/Network Persistent State +1 -1
  34. package/dist/run-chrome-profile/Default/Platform Notifications/LOG +3 -3
  35. package/dist/run-chrome-profile/Default/Platform Notifications/LOG.old +3 -3
  36. package/dist/run-chrome-profile/Default/Preferences +1 -1
  37. package/dist/run-chrome-profile/Default/Secure Preferences +1 -1
  38. package/dist/run-chrome-profile/Default/Service Worker/Database/LOG +3 -3
  39. package/dist/run-chrome-profile/Default/Service Worker/Database/LOG.old +3 -3
  40. package/dist/run-chrome-profile/Default/Session Storage/000004.log +0 -0
  41. package/dist/run-chrome-profile/Default/Session Storage/LOG +3 -3
  42. package/dist/run-chrome-profile/Default/Session Storage/LOG.old +3 -3
  43. package/dist/run-chrome-profile/Default/Sessions/Session_13377058953741237 +0 -0
  44. package/dist/run-chrome-profile/Default/Sessions/Session_13377061656641166 +0 -0
  45. package/dist/run-chrome-profile/Default/Sessions/{Tabs_13376779029205180 → Tabs_13377058954674737} +0 -0
  46. package/dist/run-chrome-profile/Default/Sessions/{Tabs_13376774833612826 → Tabs_13377061657331745} +0 -0
  47. package/dist/run-chrome-profile/Default/Site Characteristics Database/000003.log +0 -0
  48. package/dist/run-chrome-profile/Default/Site Characteristics Database/LOG +3 -3
  49. package/dist/run-chrome-profile/Default/Site Characteristics Database/LOG.old +3 -3
  50. package/dist/run-chrome-profile/Default/Sync Data/LevelDB/LOG +3 -3
  51. package/dist/run-chrome-profile/Default/Sync Data/LevelDB/LOG.old +3 -3
  52. package/dist/run-chrome-profile/Default/TransportSecurity +1 -1
  53. package/dist/run-chrome-profile/Default/WebStorage/QuotaManager +0 -0
  54. package/dist/run-chrome-profile/Default/shared_proto_db/000007.log +0 -0
  55. package/dist/run-chrome-profile/Default/shared_proto_db/LOG +3 -3
  56. package/dist/run-chrome-profile/Default/shared_proto_db/LOG.old +3 -3
  57. package/dist/run-chrome-profile/Default/shared_proto_db/metadata/000003.log +0 -0
  58. package/dist/run-chrome-profile/Default/shared_proto_db/metadata/LOG +3 -3
  59. package/dist/run-chrome-profile/Default/shared_proto_db/metadata/LOG.old +3 -3
  60. package/dist/run-chrome-profile/GrShaderCache/data_0 +0 -0
  61. package/dist/run-chrome-profile/GrShaderCache/data_1 +0 -0
  62. package/dist/run-chrome-profile/GrShaderCache/f_000211 +0 -0
  63. package/dist/run-chrome-profile/GrShaderCache/f_000212 +0 -0
  64. package/dist/run-chrome-profile/GrShaderCache/f_000213 +0 -0
  65. package/dist/run-chrome-profile/GrShaderCache/f_000214 +0 -0
  66. package/dist/run-chrome-profile/GrShaderCache/f_000215 +0 -0
  67. package/dist/run-chrome-profile/GrShaderCache/f_000216 +0 -0
  68. package/dist/run-chrome-profile/GrShaderCache/f_000217 +0 -0
  69. package/dist/run-chrome-profile/GrShaderCache/f_000218 +0 -0
  70. package/dist/run-chrome-profile/GrShaderCache/f_000219 +0 -0
  71. package/dist/run-chrome-profile/GrShaderCache/f_00021a +0 -0
  72. package/dist/run-chrome-profile/GrShaderCache/f_00021b +0 -0
  73. package/dist/run-chrome-profile/GrShaderCache/f_00021c +0 -0
  74. package/dist/run-chrome-profile/GrShaderCache/f_00021d +0 -0
  75. package/dist/run-chrome-profile/GrShaderCache/f_00021e +0 -0
  76. package/dist/run-chrome-profile/GrShaderCache/f_00021f +0 -0
  77. package/dist/run-chrome-profile/GrShaderCache/f_000220 +0 -0
  78. package/dist/run-chrome-profile/GrShaderCache/f_000221 +0 -0
  79. package/dist/run-chrome-profile/GrShaderCache/f_000222 +0 -0
  80. package/dist/run-chrome-profile/GrShaderCache/f_000223 +0 -0
  81. package/dist/run-chrome-profile/GrShaderCache/index +0 -0
  82. package/dist/run-chrome-profile/GraphiteDawnCache/data_1 +0 -0
  83. package/dist/run-chrome-profile/GraphiteDawnCache/index +0 -0
  84. package/dist/run-chrome-profile/Local State +1 -1
  85. package/dist/run-chrome-profile/ShaderCache/data_1 +0 -0
  86. package/dist/run-chrome-profile/ShaderCache/index +0 -0
  87. package/dist/run-chrome-profile/first_party_sets.db +0 -0
  88. package/dist/run-chrome-profile/segmentation_platform/ukm_db +0 -0
  89. package/dist/run-chrome-profile/segmentation_platform/ukm_db-journal +0 -0
  90. package/package.json +1 -1
  91. package/dist/run-chrome-profile/Default/Sessions/Session_13376774833081071 +0 -0
  92. package/dist/run-chrome-profile/Default/Sessions/Session_13376779028632318 +0 -0
package/dist/module.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Wp=Object.create;var rt=Object.defineProperty;var Jp=Object.getOwnPropertyDescriptor;var zp=Object.getOwnPropertyNames;var Hp=Object.getPrototypeOf,Vp=Object.prototype.hasOwnProperty;var Gp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xp=(t,e)=>{for(var r in e)rt(t,r,{get:e[r],enumerable:!0})},zs=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of zp(e))!Vp.call(t,i)&&i!==r&&rt(t,i,{get:()=>e[i],enumerable:!(s=Jp(e,i))||s.enumerable});return t};var a=(t,e,r)=>(r=t!=null?Wp(Hp(t)):{},zs(e||!t||!t.__esModule?rt(r,"default",{value:t,enumerable:!0}):r,t)),Zp=t=>zs(rt({},"__esModule",{value:!0}),t);var Wr=Gp((Yl,Yp)=>{Yp.exports={license:"MIT",repository:{type:"git",url:"https://github.com/cezaraugusto/extension.git",directory:"programs/develop"},engines:{node:">=18"},name:"extension-develop",version:"2.0.0-beta.4",description:"The develop step of Extension.js",main:"./dist/module.js",types:"./dist/module.d.ts",files:["dist"],author:{name:"Cezar Augusto",email:"boss@cezaraugusto.net",url:"https://cezaraugusto.com"},scripts:{clean:"rm -rf dist",watch:"tsup-node ./module.ts --format cjs --dts --target=node18 --watch",compile:"tsup-node ./module.ts --format cjs --dts --target=node18 --minify && bash install_scripts.sh",test:"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.*'","test:coverage":"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.ts' --coverage","test:build":"jest ./build.spec.ts --no-cache"},dependencies:{"@colors/colors":"^1.6.0","@swc/core":"^1.7.3","@types/firefox-webext-browser":"^120.0.4",acorn:"^8.12.1","acorn-walk":"^8.3.3","adm-zip":"^0.5.12",ajv:"^8.17.1",astring:"^1.8.6",axios:"^1.6.8","case-sensitive-paths-webpack-plugin":"^2.4.0",chokidar:"^3.6.0","chrome-location":"^1.2.1","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.5","css-loader":"^6.10.0","csv-loader":"^3.0.5",dotenv:"^16.4.5","dotenv-webpack":"^8.0.1","edge-location":"^1.0.0","firefox-profile":"^4.6.0","fx-runner":"^1.4.0","go-git-it":"2.0.4",ignore:"^5.3.1","loader-utils":"^3.3.1",micromatch:"^4.0.7","mini-css-extract-plugin":"^2.8.1","package-manager-detector":"^0.2.0",parse5:"^7.1.2","parse5-utils":"^2.0.0",postcss:"^8.4.45",progress:"^2.0.3","schema-utils":"^4.2.0",slugify:"^1.6.6","style-loader":"^3.3.4","swc-loader":"^0.2.6","tiny-glob":"^0.2.9","tsconfig-paths-webpack-plugin":"^4.1.0","vue-template-compiler":"^2.7.16","webextension-polyfill":"^0.12.0",webpack:"~5.92.0","webpack-dev-server":"^5.0.2","webpack-merge":"^6.0.1","webpack-target-webextension":"^1.1.2",which:"^4.0.0",ws:"^8.18.0"},devDependencies:{"@types/adm-zip":"^0.5.5","@types/case-sensitive-paths-webpack-plugin":"^2.1.9","@types/chrome":"^0.0.270","@types/cross-spawn":"^6.0.6","@types/dotenv-webpack":"^7.0.7","@types/jest":"^29.5.12","@types/loader-utils":"^2.0.6","@types/node":"^22.5.3","@types/webextension-polyfill":"^0.10.7","@types/ws":"^8.5.12",jest:"^29.7.0","ts-jest":"^29.1.2",tsup:"^8.0.1",typescript:"5.3.3"},optionalDependencies:{"@pmmmwh/react-refresh-webpack-plugin":"^0.5.15","@prefresh/webpack":"^4.0.1","babel-loader":"^9.1.3","less-loader":"^12.2.0","postcss-flexbugs-fixes":"^5.0.2","postcss-loader":"^8.1.1","postcss-normalize":"^10.0.1","postcss-preset-env":"^9.6.0","postcss-scss":"^4.0.9","react-refresh":"^0.14.2","react-refresh-typescript":"^2.0.9","resolve-url-loader":"^5.0.0","sass-loader":"^16.0.0","svelte-loader":"^3.2.3","svelte-preprocess":"^2.6.4","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var zl={};Xp(zl,{extensionBuild:()=>Ar,extensionDev:()=>Tp,extensionPreview:()=>Nr,extensionStart:()=>Bp});module.exports=Zp(zl);var Pp=a(require("fs")),Rs=a(require("path")),kp=a(require("webpack")),Ep=require("webpack-merge");var et=a(require("path"));var Si=a(require("case-sensitive-paths-webpack-plugin"));var Ur=a(require("fs")),st=a(require("path")),re=require("webpack"),qr=a(require("dotenv")),it=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){let r=st.default.dirname(this.manifestPath),s=e.options.mode||"development",i=[`.env.${this.browser}.${s}`,`.env.${this.browser}`,`.env.${s}`,".env.local",".env",".env.example"],o="";for(let m of i){let g=st.default.join(r,m);if(Ur.default.existsSync(g)){o=g;break}}let n=o?qr.default.config({path:o}).parsed||{}:{},c=st.default.join(r,".env.defaults"),l={...Ur.default.existsSync(c)?qr.default.config({path:c}).parsed||{}:{},...n,...process.env},u=Object.keys(l).filter(m=>m.startsWith("EXTENSION_PUBLIC_")).reduce((m,g)=>(m[`process.env.${g}`]=JSON.stringify(l[g]),m[`import.meta.env.${g}`]=JSON.stringify(l[g]),m),{});u["process.env.EXTENSION_PUBLIC_BROWSER"]=JSON.stringify(this.browser),u["import.meta.env.EXTENSION_PUBLIC_BROWSER"]=JSON.stringify(this.browser),u["process.env.EXTENSION_PUBLIC_MODE"]=JSON.stringify(s),u["import.meta.env.EXTENSION_PUBLIC_MODE"]=JSON.stringify(s),u["process.env.EXTENSION_BROWSER"]=JSON.stringify(this.browser),u["import.meta.env.EXTENSION_BROWSER"]=JSON.stringify(this.browser),u["process.env.EXTENSION_MODE"]=JSON.stringify(s),u["import.meta.env.EXTENSION_MODE"]=JSON.stringify(s),new re.DefinePlugin(u).apply(e),e.hooks.thisCompilation.tap("manifest:update-manifest",m=>{m.hooks.processAssets.tap({name:"env:module",stage:re.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},g=>{Object.keys(g).forEach(j=>{if(j.endsWith(".json")||j.endsWith(".html")){let P=m.assets[j].source().toString();P=P.replace(/\$EXTENSION_PUBLIC_[A-Z_]+/g,k=>{let A=k.slice(1);return l[A]||k}),P=P.replace(/\$EXTENSION_[A-Z_]+/g,k=>{let A=k.slice(1);return l[A]||k}),m.updateAsset(j,new re.sources.RawSource(P))}})})})}};var Br=a(require("fs")),Hs=a(require("path")),ot=class{apply(e){let r=Hs.default.join(e.options.output.path||"");if(Br.default.existsSync(r))try{Br.default.rmSync(r,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanDistFolderPlugin] Removed old hot-update files before compilation.")}catch(s){console.error(`[CleanDistFolderPlugin] Failed to remove hot-update files: ${s.message}`)}}};var Jr=a(require("path")),f=require("@colors/colors/safe");var Vs=a(require("path")),nt=Vs.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),K=["chrome","edge"],Kp=["firefox"],Zl=[...K,...Kp];var Gs=require("console");function x(t,e){return e==="error"?`${(0,f.bold)((0,f.red)("ERROR"))} in ${t} ${(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:e==="warn"?`${t} ${(0,f.brightYellow)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:`${e==="info"?(0,f.cyan)("\u25BA\u25BA\u25BA"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)}`}function Xs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Zs(t,e,r){if(!!1)return`${r.hasErrors()?(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)} compiled ${r.hasErrors()?(0,f.red)("with errors"):(0,f.brightGreen)("successfully")} in ${e} ms.`}function Ks(t,e){return`${(0,Gs.info)("\u25BA\u25BA\u25BA")} Using ${(0,f.magenta)(t)}. Installing required dependencies via ${(0,f.brightYellow)(e)}...`}function _(t){return`${(0,f.cyan)("\u25BA\u25BA\u25BA")} Using ${(0,f.magenta)(t)}...`}function D(t){return`${x(t,"success")} installation completed. Run the program again and happy hacking.`}function Ys(t){return`${x(t,"info")} dependencies are being installed. This only happens for core contributors...`}function Qs(t){return`${x(t,"success")} dependencies installed ${(0,f.brightGreen)("successfully")}.`}function ei(t,e){return`${x("Integration","error")} ${t} Installation Error
1
+ "use strict";var Wp=Object.create;var rt=Object.defineProperty;var Jp=Object.getOwnPropertyDescriptor;var zp=Object.getOwnPropertyNames;var Hp=Object.getPrototypeOf,Vp=Object.prototype.hasOwnProperty;var Gp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xp=(t,e)=>{for(var r in e)rt(t,r,{get:e[r],enumerable:!0})},zs=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of zp(e))!Vp.call(t,i)&&i!==r&&rt(t,i,{get:()=>e[i],enumerable:!(s=Jp(e,i))||s.enumerable});return t};var a=(t,e,r)=>(r=t!=null?Wp(Hp(t)):{},zs(e||!t||!t.__esModule?rt(r,"default",{value:t,enumerable:!0}):r,t)),Zp=t=>zs(rt({},"__esModule",{value:!0}),t);var Wr=Gp((Kl,Yp)=>{Yp.exports={license:"MIT",repository:{type:"git",url:"https://github.com/cezaraugusto/extension.git",directory:"programs/develop"},engines:{node:">=18"},name:"extension-develop",version:"2.0.0-beta.5",description:"The develop step of Extension.js",main:"./dist/module.js",types:"./dist/module.d.ts",files:["dist"],author:{name:"Cezar Augusto",email:"boss@cezaraugusto.net",url:"https://cezaraugusto.com"},scripts:{clean:"rm -rf dist",watch:"tsup-node ./module.ts --format cjs --dts --target=node18 --watch",compile:"tsup-node ./module.ts --format cjs --dts --target=node18 --minify && bash install_scripts.sh",test:"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.*'","test:coverage":"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.ts' --coverage","test:build":"jest ./build.spec.ts --no-cache"},dependencies:{"@colors/colors":"^1.6.0","@swc/core":"^1.7.3","@types/firefox-webext-browser":"^120.0.4",acorn:"^8.12.1","acorn-walk":"^8.3.3","adm-zip":"^0.5.12",ajv:"^8.17.1",astring:"^1.8.6",axios:"^1.6.8","case-sensitive-paths-webpack-plugin":"^2.4.0",chokidar:"^3.6.0","chrome-location":"^1.2.1","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.5","css-loader":"^6.10.0","csv-loader":"^3.0.5",dotenv:"^16.4.5","dotenv-webpack":"^8.0.1","edge-location":"^1.0.0","firefox-profile":"^4.6.0","fx-runner":"^1.4.0","go-git-it":"2.0.4",ignore:"^5.3.1","loader-utils":"^3.3.1",micromatch:"^4.0.7","mini-css-extract-plugin":"^2.8.1","package-manager-detector":"^0.2.0",parse5:"^7.1.2","parse5-utils":"^2.0.0",postcss:"^8.4.45",progress:"^2.0.3","schema-utils":"^4.2.0",slugify:"^1.6.6","style-loader":"^3.3.4","swc-loader":"^0.2.6","tiny-glob":"^0.2.9","tsconfig-paths-webpack-plugin":"^4.1.0","vue-template-compiler":"^2.7.16","webextension-polyfill":"^0.12.0",webpack:"~5.92.0","webpack-dev-server":"^5.0.2","webpack-merge":"^6.0.1","webpack-target-webextension":"^1.1.2",which:"^4.0.0",ws:"^8.18.0"},devDependencies:{"@types/adm-zip":"^0.5.5","@types/case-sensitive-paths-webpack-plugin":"^2.1.9","@types/chrome":"^0.0.270","@types/cross-spawn":"^6.0.6","@types/dotenv-webpack":"^7.0.7","@types/jest":"^29.5.12","@types/loader-utils":"^2.0.6","@types/node":"^22.5.3","@types/webextension-polyfill":"^0.10.7","@types/ws":"^8.5.12",jest:"^29.7.0","ts-jest":"^29.1.2",tsup:"^8.0.1",typescript:"5.3.3"},optionalDependencies:{"@pmmmwh/react-refresh-webpack-plugin":"^0.5.15","@prefresh/webpack":"^4.0.1","babel-loader":"^9.1.3","less-loader":"^12.2.0","postcss-flexbugs-fixes":"^5.0.2","postcss-loader":"^8.1.1","postcss-normalize":"^10.0.1","postcss-preset-env":"^9.6.0","postcss-scss":"^4.0.9","react-refresh":"^0.14.2","react-refresh-typescript":"^2.0.9","resolve-url-loader":"^5.0.0","sass-loader":"^16.0.0","svelte-loader":"^3.2.3","svelte-preprocess":"^2.6.4","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var Jl={};Xp(Jl,{extensionBuild:()=>Ar,extensionDev:()=>Tp,extensionPreview:()=>Nr,extensionStart:()=>Bp});module.exports=Zp(Jl);var Pp=a(require("fs")),Rs=a(require("path")),kp=a(require("webpack")),Ep=require("webpack-merge");var et=a(require("path"));var Si=a(require("case-sensitive-paths-webpack-plugin"));var Ur=a(require("fs")),st=a(require("path")),re=require("webpack"),qr=a(require("dotenv")),it=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){let r=st.default.dirname(this.manifestPath),s=e.options.mode||"development",i=[`.env.${this.browser}.${s}`,`.env.${this.browser}`,`.env.${s}`,".env.local",".env",".env.example"],o="";for(let m of i){let g=st.default.join(r,m);if(Ur.default.existsSync(g)){o=g;break}}let n=o?qr.default.config({path:o}).parsed||{}:{},c=st.default.join(r,".env.defaults"),l={...Ur.default.existsSync(c)?qr.default.config({path:c}).parsed||{}:{},...n,...process.env},u=Object.keys(l).filter(m=>m.startsWith("EXTENSION_PUBLIC_")).reduce((m,g)=>(m[`process.env.${g}`]=JSON.stringify(l[g]),m[`import.meta.env.${g}`]=JSON.stringify(l[g]),m),{});u["process.env.EXTENSION_PUBLIC_BROWSER"]=JSON.stringify(this.browser),u["import.meta.env.EXTENSION_PUBLIC_BROWSER"]=JSON.stringify(this.browser),u["process.env.EXTENSION_PUBLIC_MODE"]=JSON.stringify(s),u["import.meta.env.EXTENSION_PUBLIC_MODE"]=JSON.stringify(s),u["process.env.EXTENSION_BROWSER"]=JSON.stringify(this.browser),u["import.meta.env.EXTENSION_BROWSER"]=JSON.stringify(this.browser),u["process.env.EXTENSION_MODE"]=JSON.stringify(s),u["import.meta.env.EXTENSION_MODE"]=JSON.stringify(s),new re.DefinePlugin(u).apply(e),e.hooks.thisCompilation.tap("manifest:update-manifest",m=>{m.hooks.processAssets.tap({name:"env:module",stage:re.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},g=>{Object.keys(g).forEach(j=>{if(j.endsWith(".json")||j.endsWith(".html")){let P=m.assets[j].source().toString();P=P.replace(/\$EXTENSION_PUBLIC_[A-Z_]+/g,k=>{let A=k.slice(1);return l[A]||k}),P=P.replace(/\$EXTENSION_[A-Z_]+/g,k=>{let A=k.slice(1);return l[A]||k}),m.updateAsset(j,new re.sources.RawSource(P))}})})})}};var Br=a(require("fs")),Hs=a(require("path")),ot=class{apply(e){let r=Hs.default.join(e.options.output.path||"");if(Br.default.existsSync(r))try{Br.default.rmSync(r,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanDistFolderPlugin] Removed old hot-update files before compilation.")}catch(s){console.error(`[CleanDistFolderPlugin] Failed to remove hot-update files: ${s.message}`)}}};var Jr=a(require("path")),f=require("@colors/colors/safe");var Vs=a(require("path")),nt=Vs.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),K=["chrome","edge"],Kp=["firefox"],Xl=[...K,...Kp];var Gs=require("console");function x(t,e){return e==="error"?`${(0,f.bold)((0,f.red)("ERROR"))} in ${t} ${(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:e==="warn"?`${t} ${(0,f.brightYellow)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:`${e==="info"?(0,f.cyan)("\u25BA\u25BA\u25BA"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)}`}function Xs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Zs(t,e,r){if(!!1)return`${r.hasErrors()?(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)} compiled ${r.hasErrors()?(0,f.red)("with errors"):(0,f.brightGreen)("successfully")} in ${e} ms.`}function Ks(t,e){return`${(0,Gs.info)("\u25BA\u25BA\u25BA")} Using ${(0,f.magenta)(t)}. Installing required dependencies via ${(0,f.brightYellow)(e)}...`}function _(t){return`${(0,f.cyan)("\u25BA\u25BA\u25BA")} Using ${(0,f.magenta)(t)}...`}function D(t){return`${x(t,"success")} installation completed. Run the program again and happy hacking.`}function Ys(t){return`${x(t,"info")} dependencies are being installed. This only happens for core contributors...`}function Qs(t){return`${x(t,"success")} dependencies installed ${(0,f.brightGreen)("successfully")}.`}function ei(t,e){return`${x("Integration","error")} ${t} Installation Error
2
2
 
3
3
  Failed to detect package manager or install ${t} dependencies:
4
4
  ${(0,f.red)(e?.toString()||"")}`}function ti(){return`${x("Firefox runner","error")} No Service Worker Support
@@ -109,7 +109,7 @@ Learn more about ${(0,f.bold)("mkcert")}: ${(0,f.underline)("https://github.com/
109
109
 
110
110
  For MAIN world content_scripts, the extension ID must be specified.
111
111
  Ensure your extension have a fixed ID and that the ${(0,f.brightYellow)("publicPath")}
112
- of your ${(0,f.brightYellow)("extension.config.js")} is defined as your extension URL.`}var pt=class{static name="plugin-compilation";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new Si.default().apply(e),new it({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ot().apply(e),e.hooks.done.tapAsync("develop:brand",(r,s)=>{r.compilation.name=void 0;let i=r.endTime-r.startTime,o=require(this.manifestPath).name;console.log(Zs(o,i,r)),s()})}};var Bi=a(require("path")),Wi=a(require("mini-css-extract-plugin"));var Ni=a(require("mini-css-extract-plugin"));var ke=a(require("path")),Ee=a(require("fs"));var ie=a(require("path")),lt=a(require("fs")),Hr=require("child_process"),ki=require("package-manager-detector");function Ei(t,e){return Object.values(e||{}).some(r=>r===t)}function h(t,e,r){let s=ie.default.extname(e),o=$(e,r)?ie.default.normalize(e):t;return[".js",".jsx",".tsx",".ts"].includes(s)&&(o=o.replace(s,".js")),[".html",".njk",".nunjucks"].includes(s)&&(o=o.replace(s,".html")),[".css",".scss",".sass",".less"].includes(s)&&(o=o.replace(s,".css")),Vr(o||"")}function Vr(t){return t.replace(/\\/g,"/")}function $(t,e={}){if(!e)return!1;let r=ie.default.normalize(Vr(t));return Object.values(e).some(i=>typeof i!="string"?!1:Vr(i).includes(r))}function J(t,e){if(t.getAsset("manifest.json")||t.assets["manifest.json"]){let r=t.assets["manifest.json"].source().toString();return JSON.parse(r||"{}")}return require(e)}function oe(){return process.env.npm_config_user_agent&&process.env.npm_config_user_agent.includes("pnpm")?"pnpm":!1}function Pi(){return process.env.npm_execpath?"npm":!1}async function F(t,e){try{let r=await(0,ki.detect)();console.log(Ks(t,r?.name||"unknown"));let s="";r?.name==="yarn"?s=`yarn --silent add ${e.join(" ")} --cwd ${__dirname} --optional`:r?.name==="npm"||Pi()?s=`npm --silent install ${e.join(" ")} --prefix ${__dirname} --save-optional`:oe()?s=`pnpm --silent add ${e.join(" ")} --prefix ${__dirname} --save-optional`:s=`${r} --silent install ${e.join(" ")} --cwd ${__dirname} --optional`,(0,Hr.execSync)(s,{stdio:"inherit"}),await new Promise(i=>setTimeout(i,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Ys(t)),r?.name==="yarn"?s="yarn install --silent > /dev/null 2>&1":r?.name==="npm"||Pi()?s="npm install --silent > /dev/null 2>&1":oe()?s="pnpm install --silent > /dev/null 2>&1":s=`${r} install --silent > /dev/null 2>&1`,(0,Hr.execSync)(s,{stdio:"inherit"})),console.log(Qs(t))}catch(r){console.error(ei(t,r))}}function ft(t){let e=ie.default.join(t,"package.json");if(!lt.default.existsSync(e))return!1;let r=JSON.parse(lt.default.readFileSync(e,"utf-8")),s=["react","vue","@angular/core","svelte","solid-js","preact"],i=r.dependencies||{},o=r.devDependencies||{};for(let n of s)if(i[n]||o[n])return!0;return!1}function $i(t){return!lt.default.existsSync(ie.default.resolve(__dirname,`run-${t}-profile`))}function Ci(t){let e=t.name?.replace(/ /g,"-").toLowerCase();return{data:{id:`${e}@extension-js`,manifest:t,management:{id:`${e}@extension-js`,mayDisable:!0,optionsUrl:"",installType:"development",type:"extension",enabled:!0,name:t.name||"",description:t.description||"",version:t.version||"",hostPermissions:t.host_permissions||[],permissions:t.permissions||[],offlineEnabled:t.offline_enabled||!1,shortName:t.short_name||"",isApp:t.app&&t.app.background&&t.app.background.scripts}}}}function S(t,e){return JSON.parse(JSON.stringify(t),function(i,o){let n=i.indexOf(":");if(n===-1)return o;let c=i.substring(0,n);(c===e||c==="chromium"&&K.includes(e)||c==="chromium"&&e.includes("chromium")||c==="gecko"&&e.includes("gecko"))&&(this[i.substring(n+1)]=o)})}var ji=!1;function ut(t){let e=ke.default.join(t,"package.json");if(!Ee.default.existsSync(e))return!1;let r=rl(t),s=require(e),i=s.devDependencies&&s.devDependencies.tailwindcss,o=s.dependencies&&s.dependencies.tailwindcss,n=!!r&&!!(i||o);return n&&(ji||(process.env.EXTENSION_ENV==="development"&&console.log(_("Tailwind")),ji=!0)),n}function rl(t){let e=ke.default.join(t,"tailwind.config.mjs"),r=ke.default.join(t,"tailwind.config.cjs"),s=ke.default.join(t,"tailwind.config.js");if(Ee.default.existsSync(e))return e;if(Ee.default.existsSync(r))return r;if(Ee.default.existsSync(s))return s}var Di=a(require("path")),Li=a(require("fs"));var Fi=!1;function $e(t){let e=Di.default.join(t,"package.json");if(!Li.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.sass,i=r.dependencies&&r.dependencies.sass;return s||i?(Fi||(process.env.EXTENSION_ENV==="development"&&console.log(_("SASS")),Fi=!0),!0):!1}async function Oi(t,e){if(!$e(t))return[];try{require.resolve("sass-loader")}catch{await F("PostCSS",["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),await F("SASS",["sass","sass-loader","resolve-url-loader"]),console.log(D("SASS")),process.exit(0)}return[{test:/\.(s(a|c)ss)$/,exclude:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/inline_style/,use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/inline_style/,use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var Mi=a(require("path")),Ai=a(require("fs"));var Ii=!1;function Ce(t){let e=Mi.default.join(t,"package.json");if(!Ai.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.less,i=r.dependencies&&r.dependencies.less;return s||i?(Ii||(process.env.EXTENSION_ENV==="development"&&console.log(_("LESS")),Ii=!0),!0):!1}async function Ti(t,e){if(!Ce(t))return[];try{require.resolve("less-loader")}catch{await F("LESS",["less","less-loader","resolve-url-loader"]),console.log(D("LESS")),process.exit(0)}return[{test:/\.less$/,oneOf:[{resourceQuery:/inline_style/,use:await T(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await T(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var dt=a(require("path")),mt=a(require("fs"));var ne=!1;function sl(t){let e=dt.default.join(t,"package.json");if(!mt.default.existsSync(e))return!1;let r=[".postcssrc",".postcssrc.json",".postcssrc.yaml",".postcssrc.yml",".postcssrc.js",".postcssrc.cjs","postcss.config.js","postcss.config.cjs"];if(mt.default.existsSync(e)){let s=require(e);if(s.dependencies&&s.dependencies.postcss||s.devDependencies&&s.devDependencies.postcss)return ne||(process.env.EXTENSION_ENV==="development"&&console.log(_("PostCSS")),ne=!0),!0}for(let s of r)if(mt.default.existsSync(dt.default.join(t,s)))return ne||(process.env.EXTENSION_ENV==="development"&&console.log(_("PostCSS")),ne=!0),!0;return ut(t)?(ne||(process.env.EXTENSION_ENV==="development"&&console.log(_("PostCSS")),ne=!0),!0):!1}async function Ri(t,e){if(!sl(t))return{};try{require.resolve("postcss-loader")}catch{!$e(t)&&!Ce(t)&&await F("PostCSS",["postcss","postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),console.log(D("PostCSS")),process.exit(0)}return{loader:require.resolve("postcss-loader"),options:{postcssOptions:{parser:require.resolve("postcss-scss"),ident:"postcss",config:dt.default.resolve(t,"postcss.config.js"),plugins:[require.resolve("postcss-flexbugs-fixes"),[require.resolve("postcss-preset-env"),{autoprefixer:{flexbox:"no-2009"},stage:3}].filter(Boolean),require.resolve("postcss-normalize")].filter(Boolean)},sourceMap:e.mode==="development"}}}function il(t){let e=()=>{let s=window.__EXTENSION_SHADOW_ROOT__;s?(s.appendChild(t),process.env.EXTENSION_ENV==="development"&&console.log("Element inserted into shadowRoot")):(document.head.appendChild(t),process.env.EXTENSION_ENV==="development"&&console.log("Element inserted into document.head"))};if(window.__EXTENSION_SHADOW_ROOT__){e();return}let r=new MutationObserver(()=>{window.__EXTENSION_SHADOW_ROOT__?(e(),r.disconnect()):setTimeout(()=>{r.disconnect()},5e3)});r.observe(document.body,{childList:!0,subtree:!0})}async function T(t,e){let r=Ni.default.loader,s=[e.useMiniCssExtractPlugin?r:{loader:require.resolve("style-loader"),options:{insert:il}},{loader:require.resolve("css-loader"),options:{sourceMap:e.mode==="development"}}].filter(Boolean);if(ut(t)||$e(t)||Ce(t)){let i=await Ri(t,e);i.loader&&s.push(i)}return e.loader&&s.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:e.mode==="development",root:t}},{loader:require.resolve(e.loader),options:{sourceMap:e.mode==="development"}}),s.filter(Boolean)}var R=a(require("path")),N=a(require("fs"));function ol(t){let e=R.default.join(t,"stylelint.config.json"),r=R.default.join(t,".stylelintrc.js file"),s=R.default.join(t,"stylelint.config.mjs"),i=R.default.join(t,".stylelintrc.mjs"),o=R.default.join(t,"stylelint.config.cjs"),n=R.default.join(t,".stylelintrc.cjs"),c=R.default.join(t,".stylelintrc.json"),p=R.default.join(t,".stylelintrc"),l=R.default.join(t,".stylelintrc.yml"),u=R.default.join(t,".stylelintrc.yaml");if(N.default.existsSync(e))return e;if(N.default.existsSync(r))return r;if(N.default.existsSync(s))return s;if(N.default.existsSync(i))return i;if(N.default.existsSync(o))return o;if(N.default.existsSync(n))return n;if(N.default.existsSync(c))return c;if(N.default.existsSync(p))return p;if(N.default.existsSync(l))return l;if(N.default.existsSync(u))return u}var Ui=!1;function nl(t){let e=R.default.join(t,"package.json");if(!N.default.existsSync(e))return!1;let s=!!ol(t);return s&&(Ui||(process.env.EXTENSION_ENV==="development"&&console.log(_("Stylelint")),Ui=!0)),s}async function qi(t){return nl(t),[]}var gt=class t{static name="plugin-css";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async configureOptions(e){let r=e.options.mode||"development",s=Bi.default.dirname(this.manifestPath),i=[new Wi.default];i.forEach(l=>l.apply(e));let o=await qi(s);i.push(...o);let n=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{resourceQuery:/inline_style/,use:await T(s,{mode:r,useMiniCssExtractPlugin:!1})},{use:await T(s,{mode:r,useMiniCssExtractPlugin:r==="production"})}]},{test:/\.module\.css$/,oneOf:[{resourceQuery:/inline_style/,use:await T(s,{mode:r,useMiniCssExtractPlugin:!1})},{use:await T(s,{mode:r,useMiniCssExtractPlugin:r==="production"})}]}];e.options.plugins=[...e.options.plugins,...i].filter(Boolean);let c=await Oi(s,r),p=await Ti(s,r);n.push(...c),n.push(...p),e.options.module.rules=[...e.options.module.rules,...n].filter(Boolean)}async apply(e){if((e.options.mode||"development")==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var ht=class{static name="plugin-css";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async apply(e){let r={test:/\.svg$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2048}}},i=[...e.options.module.rules.some(o=>o&&o.test instanceof RegExp&&o.test.test(".svg")&&o.use!==void 0)?[]:[r],{test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"}},{test:/\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(csv|tsv)$/i,use:[require.resolve("csv-loader")],generator:{filename:"assets/[name][ext]"}}];e.options.module.rules=[...e.options.module.rules,...i].filter(Boolean)}};var je=a(require("path")),po=a(require("tsconfig-paths-webpack-plugin"));var Gr=a(require("path")),Xr=a(require("fs"));var Ji=!1,al=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function cl(t){let e=Gr.default.join(t,"package.json");if(!Xr.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies["babel-core"],i=r.dependencies&&r.dependencies["babel-core"],o=al.some(n=>Xr.default.existsSync(Gr.default.join(t,n)))||!!s||!!i;return o&&(Ji||(process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(_("Babel")),Ji=!0)),o}async function zi(t,e){cl(e)}var Vi=a(require("path")),Gi=a(require("fs"));var Hi=!1;function ae(t){let e=Vi.default.join(t,"package.json");if(!Gi.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.preact,i=r.dependencies&&r.dependencies.preact;return(s||i)&&(Hi||(process.env.EXTENSION_ENV==="development"&&console.log(_("Preact")),Hi=!0)),!!s||!!i}async function Xi(t){if(!ae(t))return;try{require.resolve("@prefresh/webpack")}catch{await F("Preact",["@prefresh/webpack"]),console.log(D("Preact")),process.exit(0)}return{plugins:[new(require("@prefresh/webpack"))],loaders:void 0,alias:{react:"preact/compat","react-dom/test-utils":"preact/test-utils","react-dom":"preact/compat","react/jsx-runtime":"preact/jsx-runtime"}}}var Ki=a(require("path")),Yi=a(require("fs"));var Zi=!1;function ce(t){let e=Ki.default.join(t,"package.json");if(!Yi.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.react,i=r.dependencies&&r.dependencies.react;return(s||i)&&(Zi||(process.env.EXTENSION_ENV==="development"&&console.log(_("React")),Zi=!0)),!!s||!!i}async function Qi(t){if(!ce(t))return;try{require.resolve("@pmmmwh/react-refresh-webpack-plugin")}catch{await F("React",["react-refresh","@pmmmwh/react-refresh-webpack-plugin","react-refresh-typescript"]),console.log(D("React")),process.exit(0)}return{plugins:[new(require("@pmmmwh/react-refresh-webpack-plugin"))({overlay:!1})],loaders:void 0,alias:void 0}}var to=a(require("path")),ro=a(require("fs"));var eo=!1;function Zr(t){let e=to.default.join(t,"package.json");if(!ro.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.vue,i=r.dependencies&&r.dependencies.vue;return(s||i)&&(eo||(process.env.EXTENSION_ENV==="development"&&console.log(_("Vue")),eo=!0)),!!s||!!i}async function so(t){if(!Zr(t))return;try{require.resolve("vue-loader")}catch{await F("TypeScript",["typescript"]),await F("Vue",["vue-loader","vue-template-compiler","vue-style-loader"]),console.log(D("Vue")),process.exit(0)}let e=[{test:/\.vue$/,loader:require.resolve("vue-loader"),include:t,exclude:/node_modules/}];return{plugins:[new(require("vue-loader")).VueLoaderPlugin],loaders:e,alias:void 0}}var yt=a(require("path")),bt=a(require("fs"));var io=!1;function z(t){let e=yt.default.join(t,"package.json");if(!bt.default.existsSync(e))return!1;let r=ll(t),s=require(e),i=s.devDependencies&&s.devDependencies.typescript,o=s.dependencies&&s.dependencies.typescript;return io||((i||o)&&(r?process.env.EXTENSION_ENV==="development"&&console.log(_("TypeScript")):(console.log(gi()),fl(t))),io=!0),!!r&&!!(i||o)}function pl(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:ft(t)?"react-jsx":"preserve",lib:["dom","dom.iterable","esnext"],moduleResolution:"node",module:"esnext",resolveJsonModule:!0,strict:!0,target:"esnext",isolatedModules:!1,skipLibCheck:!0},exclude:["node_modules","dist"]}}function ll(t){let e=yt.default.join(t,"tsconfig.json");if(bt.default.existsSync(e))return e}function fl(t){bt.default.writeFileSync(yt.default.join(t,"tsconfig.json"),JSON.stringify(pl(t,{mode:"development"}),null,2))}var no=a(require("path")),ao=a(require("fs"));var oo=!1;function Kr(t){let e=no.default.join(t,"package.json");if(!ao.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies?.svelte,i=r.dependencies&&r.dependencies.svelte;return(s||i)&&(oo||(process.env.EXTENSION_ENV==="development"&&console.log(_("Svelte")),oo=!0)),!!s||!!i}async function co(t){if(!Kr(t))return;let e=process.env.NODE_ENV!=="production";try{require.resolve("svelte-loader")}catch{await F("TypeScript",["typescript"]),await F("Svelte",["svelte-loader","svelte-preprocess"]),console.log(D("Svelte")),process.exit(0)}return{plugins:void 0,loaders:[{test:/\.svelte$/,loader:require.resolve("svelte-loader"),include:t,exclude:/node_modules/,options:{compilerOptions:{dev:e},hotReload:e,preprocess:require("svelte-preprocess")()}}],alias:void 0}}var wt=class t{static name="plugin-js-frameworks";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async configureOptions(e){let r=e.options.mode||"development",s=je.default.dirname(this.manifestPath),i=await zi(e,s),o=await Qi(s),n=await Xi(s),c=await so(s),p=await co(s);e.options.resolve.alias={...i?.alias||{},...o?.alias||{},...n?.alias||{},...c?.alias||{},...p?.alias||{},...e.options.resolve.alias},e.options.module.rules=[{test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[je.default.dirname(this.manifestPath)],exclude:/node_modules/,use:{loader:require.resolve("swc-loader"),options:{sync:!0,module:{type:"es6"},minify:r==="production",isModule:!0,jsc:{target:"es2016",parser:{syntax:z(s)?"typescript":"ecmascript",tsx:z(s)&&(ce(s)||ae(s)),jsx:!z(s)&&(ce(s)||ae(s)),dynamicImport:!0},transform:{react:{development:r==="development",refresh:r==="development",runtime:"automatic",importSource:"react"}}}}}},...i?.loaders||[],...o?.loaders||[],...n?.loaders||[],...c?.loaders||[],...p?.loaders||[],...e.options.module.rules].filter(Boolean),o?.plugins?.forEach(l=>l.apply(e)),n?.plugins?.forEach(l=>l.apply(e)),c?.plugins?.forEach(l=>l.apply(e)),p?.plugins?.forEach(l=>l.apply(e)),z(s)&&(e.options.resolve.plugins=[new po.default({configFile:je.default.resolve(je.default.dirname(this.manifestPath),"tsconfig.json")})])}async apply(e){if((e.options.mode||"development")==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var ge=a(require("path"));var Zo=a(require("path"));var lo=a(require("path"));function fo(t,e){if(!e||!e.action||!e.action.default_popup)return;let r=e.action.default_popup;return lo.default.join(t,r)}var uo=a(require("path"));function mo(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let r=e.browser_action.default_popup;return uo.default.join(t,r)}var xt=a(require("path"));function go(t,e){let r={newtab:void 0};if(!e||!e.chrome_url_overrides)return{"chrome_url_overrides/newtab":void 0};if(e.chrome_url_overrides.history){let s=e.chrome_url_overrides.history;r={"chrome_url_overrides/history":xt.default.join(t,s)}}if(e.chrome_url_overrides.newtab){let s=e.chrome_url_overrides.newtab;r={"chrome_url_overrides/newtab":xt.default.join(t,s)}}if(e.chrome_url_overrides.bookmarks){let s=e.chrome_url_overrides.bookmarks;r={"chrome_url_overrides/bookmarks":xt.default.join(t,s)}}return r}var ho=a(require("path"));function yo(t,e){if(!e||!e.devtools_page)return;let r=e.devtools_page;return ho.default.join(t,r)}var Yr=a(require("path"));function bo(t,e){if(e.options_page){let s=e.options_page;return Yr.default.join(t,s)}if(!e||!e.options_ui||!e.options_ui.page)return;let r=e.options_ui.page;return Yr.default.join(t,r)}var wo=a(require("path"));function xo(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let r=e.page_action.default_popup;return wo.default.join(t,r)}var vo=a(require("path"));function _o(t,e){if(!e||!e.sandbox||!e.sandbox.pages)return{"sandbox/page-0":void 0};let r=e.sandbox.pages,s={};for(let[i,o]of r.entries())s[`sandbox/page-${i}`]=vo.default.join(t,o);return s}var So=a(require("path"));function Po(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let r=e.side_panel.default_path;return So.default.join(t,r)}var ko=a(require("path"));function Eo(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let r=e.sidebar_action.default_panel;return ko.default.join(t,r)}function Fe(t,e){return{"action/default_popup":fo(t,e),"browser_action/default_popup":mo(t,e),...go(t,e),devtools_page:yo(t,e),"options_ui/page":bo(t,e),"page_action/default_popup":xo(t,e),..._o(t,e),"side_panel/default_path":Po(t,e),"sidebar_action/default_panel":Eo(t,e)}}var Qr=a(require("path"));function $o(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Qr.default.join(t,e.action.default_icon);let r=[];for(let s in e.action.default_icon)r.push(Qr.default.join(t,e.action.default_icon[s]));return r}var es=a(require("path"));function Co(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let r=[];if(typeof e.browser_action.default_icon=="string")return es.default.join(t,e.browser_action.default_icon);for(let s in e.browser_action.default_icon){let i=e.browser_action.default_icon[s]=es.default.join(t,e.browser_action.default_icon[s]);r.push(i)}return r}var ts=a(require("path"));function jo(t,e){if(!(!e||!e.browser_action||!e.browser_action.theme_icons)){for(let r of e.browser_action.theme_icons)r.light&&(r.light=ts.default.join(t,r.light)),r.dark&&(r.dark=ts.default.join(t,r.dark)),r.size&&delete r.size;return e.browser_action.theme_icons}}var Fo=a(require("path"));function Do(t,e){if(!e||!e.icons)return;let r=[];for(let s in e.icons){let i=Fo.default.join(t,e.icons[s]);r.push(i)}return r}var rs=a(require("path"));function Lo(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return rs.default.join(t,e.page_action.default_icon);let r=[];for(let s in e.page_action.default_icon){let i=rs.default.join(t,e.page_action.default_icon[s]);r.push(i)}return r}var Oo=a(require("path"));function Io(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:Oo.default.join(t,e.sidebar_action.default_icon)}function Mo(t,e){return{action:$o(t,e),browser_action:Co(t,e),"browser_action/theme_icons":jo(t,e),icons:Do(t,e),page_action:Lo(t,e),sidebar_action:Io(t,e)}}var Ao=a(require("path"));function To(t,e){let r={};return!e||!e.declarative_net_request||!e.declarative_net_request.rule_resources?{"declarative_net_request/rule_resources-0":void 0}:(e.declarative_net_request.rule_resources.forEach(i=>{r[`declarative_net_request/${i.id}`]=Ao.default.join(t,i.path)}),r)}var Ro=a(require("path"));function No(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let r=e.storage.managed_schema;return Ro.default.join(t,r)}function Uo(t,e){return{...To(t,e),"storage/managed_schema":No(t,e)}}var De=a(require("path")),Le=a(require("fs"));function qo(t,e){let r=De.default.join(De.default.dirname(e),"_locales"),s=[];if(Le.default.existsSync(r))for(let i of Le.default.readdirSync(r)){let o=De.default.join(r,i);if(o&&Le.default.statSync(o).isDirectory())for(let n of Le.default.readdirSync(o))s.push(De.default.join(t,"_locales",i,n))}return s}var Bo=a(require("path"));function Wo(t,e){if(!e||!e.background)return;let r=e.background.scripts;if(r)return r.map(s=>Bo.default.join(t,s))}var Jo=a(require("path"));function zo(t,e){if(!e||!e.background)return;let r=e.background.service_worker;if(r)return Jo.default.join(t,r)}var ss=a(require("path"));function Ho(t,e){if(!e||!e.content_scripts)return{"content_scripts/content-0":void 0};let r=o=>{if(o.js?.length!==0)return o.js?.map(n=>ss.default.join(t,n))},s=o=>{if(o.css?.length!==0)return o.css?.map(n=>ss.default.join(t,n))},i={};for(let[o,n]of e.content_scripts.entries()){let c=r(n),p=s(n);i[`content_scripts/content-${o}`]=[...(c||[]).filter(l=>l!=null),...(p||[]).filter(l=>l!=null)]}return i}var Vo=a(require("path"));function Go(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let r=e.user_scripts.api_script;return Vo.default.join(t,r)}function Oe(t,e){return{"background/scripts":Wo(t,e),"background/service_worker":zo(t,e),...Ho(t,e),"user_scripts/api_script":Go(t,e)}}function Xo(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function pe({manifestPath:t,browser:e}){let r=Zo.default.dirname(t),s=require(t),i=S(s,e||"chrome");return{html:Fe(r,i),icons:Mo(r,i),json:Uo(r,i),locales:qo(r,t),scripts:Oe(r,i),web_accessible_resources:Xo(i)}}var le=a(require("path"));var vt=a(require("fs")),Ie=a(require("path"));function _t(t,e){if(!vt.default.existsSync(t)||!vt.default.statSync(t).isDirectory())return[];let r=[];function s(i){let o=vt.default.readdirSync(i,{withFileTypes:!0});for(let n of o){let c=Ie.default.join(i,n.name);n.isDirectory()?s(c):n.isFile()&&e(n.name)&&r.push(c)}}return s(t),r}function St(t,e,r=""){return!e||!e.length?{}:e.reduce((s,i)=>{let o=Ie.default.extname(i),n=Ie.default.basename(i,o),c=r?`${r}/${n}`:Ie.default.relative(t,i);return{...s,[c]:i}},{})}function Ko({manifestPath:t}){let e=le.default.dirname(t),r={public:le.default.join(e,"public"),pages:le.default.join(e,"pages"),scripts:le.default.join(e,"scripts")},s={public:_t(r.public,()=>!0),pages:_t(r.pages,o=>o.endsWith(".html")),scripts:_t(r.scripts,o=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(le.default.extname(o)))};return{public:St(e,s.public),pages:St(e,s.pages,"pages"),scripts:St(e,s.scripts,"scripts")}}var Pt=a(require("path")),Yo=a(require("webpack")),kt=class{manifestPath;browser;includeList;excludeList;loaderOptions;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList,this.loaderOptions=e.loaderOptions}apply(e){new Yo.default.ProvidePlugin({r:[Pt.default.resolve(__dirname,"./resolver-module.mjs"),"default"]}).apply(e),e.options.module?.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,loader:require.resolve(Pt.default.resolve(__dirname,"./resolver-loader.js")),include:[Pt.default.dirname(this.manifestPath)],exclude:/node_modules/,options:{manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList,jsx:this.loaderOptions?this.loaderOptions.jsx:!1,typescript:this.loaderOptions?this.loaderOptions.typescript:!1,minify:this.loaderOptions?this.loaderOptions.minify:!1}})}};var Qo=a(require("fs")),$t=a(require("webpack")),en=require("webpack");var Et=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){e.hooks.compilation.tap("manifest:emit-manifest",r=>{r.hooks.processAssets.tap({name:"manifest:emit-manifest",stage:$t.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let s=this.manifestPath,i;try{let c=Qo.default.readFileSync(s,"utf-8");i=JSON.parse(c),"$schema"in i&&delete i.$schema}catch(c){r.errors.push(new $t.default.WebpackError(ui(c)));return}let o=JSON.stringify(i,null,2);r.emitAsset("manifest.json",new en.sources.RawSource(o))})})}};var Ln=a(require("path")),Me=require("webpack");function tn(t,e){return t.background&&t.background.scripts&&{background:{...t.background,...t.background.scripts&&{scripts:[...t.background.scripts.map(r=>h("background/scripts.js",r,e))]}}}}var rn=a(require("path"));var Ct=t=>rn.default.basename(t);function sn(t,e){return t.browser_action&&{browser_action:{...t.browser_action,...t.browser_action.default_popup&&{default_popup:h("browser_action/default_popup.html",t.browser_action.default_popup,e)},...t.browser_action.default_icon&&{default_icon:typeof t.browser_action.default_icon=="string"?h(`icons/${Ct(t.browser_action.default_icon)}`,t.browser_action.default_icon,e):Object.fromEntries(Object.entries(t.browser_action.default_icon).map(([r,s])=>[r,h(`icons/${Ct(s)}`,s,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(r=>({...r,...r.light&&{light:h(`browser_action/${Ct(r.light)}`,r.light,e)},...r.dark&&{dark:h(`browser_action/${Ct(r.dark)}`,r.dark,e)}}))}}}}function on(t,e){return t.declarative_net_request&&{declarative_net_request:{...t.declarative_net_request,rule_resources:t.declarative_net_request.rule_resources.map(r=>({...r,path:r.path&&h(`declarative_net_request/${r.id}.json`,r.path,e)}))}}}function nn(t,e){return{...tn(t,e),...sn(t,e),...on(t,e)}}var cn=a(require("path"));var an=t=>cn.default.basename(t);function pn(t,e){return t.action&&{action:{...t.action,...t.action.default_popup&&{default_popup:h("action/default_popup.html",t.action.default_popup,e)},...t.action.default_icon&&{default_icon:typeof t.action.default_icon=="string"?h(`action/${an(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([r,s])=>[r,h(`action/${an(s)}`,s,e)]))}}}}function ln(t,e){return t.background&&t.background.service_worker&&{background:{...t.background,...t.background.service_worker&&{service_worker:h("background/service_worker.js",t.background.service_worker,e)}}}}function jt(t,e){return t.side_panel&&{side_panel:{...t.side_panel.default_path&&{default_path:h("side_panel/default_path.html",t.side_panel.default_path,e)}}}}function fn(t,e){return{...pn(t,e),...ln(t,e),...jt(t,e)}}function un(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function mn(t,e){return t.chrome_url_overrides&&{chrome_url_overrides:{...t.chrome_url_overrides.bookmarks&&{bookmarks:h("chrome_url_overrides/bookmarks.html",t.chrome_url_overrides.bookmarks,e)},...t.chrome_url_overrides.history&&{history:h("chrome_url_overrides/history.html",t.chrome_url_overrides.history,e)},...t.chrome_url_overrides.newtab&&{newtab:h("chrome_url_overrides/newtab.html",t.chrome_url_overrides.newtab,e)}}}}function dn(t,e){return t.content_scripts&&{content_scripts:t.content_scripts.map((r,s)=>{let i=[...new Set(r.js)],o=[...new Set(r.css)];return{...r,js:[...i.map(n=>h(`content_scripts/content-${s}.js`,n,e))],css:[...o.map(n=>h(`content_scripts/content-${s}.css`,n,e))]}})}}function gn(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var hn=a(require("path"));var ul=t=>hn.default.basename(t);function yn(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([r,s])=>[r,h(`icons/${ul(s)}`,s,e)]))}}function bn(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function wn(t,e){return t.options_ui&&{options_ui:{...t.options_ui,...t.options_ui.page&&{page:h("options_ui/page.html",t.options_ui.page,e)}}}}var vn=a(require("path"));var xn=t=>vn.default.basename(t);function _n(t,e){return t.page_action&&{page_action:{...t.page_action,...t.page_action.default_popup&&{default_popup:h("page_action/default_popup.html",t.page_action.default_popup,e)},...t.page_action.default_icon&&{default_icon:typeof t.page_action.default_icon=="string"?h(`icons/${xn(t.page_action.default_icon)}`,t.page_action.default_icon,e):Object.fromEntries(Object.entries(t.page_action.default_icon).map(([r,s])=>[r,h(`icons/${xn(s)}`,s,e)]))}}}}function Sn(t,e){return t.sandbox&&{sandbox:{...t.sandbox,...t.sandbox.pages&&{pages:t.sandbox.pages.map((r,s)=>h(`sandbox/page-${s}.html`,r,e))}}}}var Pn=a(require("path"));var ml=t=>Pn.default.basename(t);function kn(t,e){return t.sidebar_action&&{sidebar_action:{...t.sidebar_action,...t.sidebar_action.default_panel&&{default_panel:h("sidebar_action/default_panel.html",t.sidebar_action.default_panel,e)},...t.sidebar_action.default_icon&&{default_icon:h(`icons/${ml(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function En(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var $n=a(require("path"));var dl=t=>$n.default.basename(t);function Cn(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${dl(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function jn(t,e){return t.user_scripts&&{user_scripts:{...t.user_scripts,...t.user_scripts.api_script&&{api_script:h("user_scripts/api_script.js",t.user_scripts.api_script,e)}}}}function Fn(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function Dn(t,e){return{...un(t,e),...mn(t,e),...dn(t,e),...gn(t,e),...yn(t,e),...bn(t,e),...wn(t,e),..._n(t,e),...Sn(t,e),...jt(t,e),...kn(t,e),...En(t,e),...Cn(t,e),...jn(t,e),...Fn(t)}}function is(t,e,r){let s=e||require(t);return JSON.stringify({...s,...Dn(s,r),...nn(s,r),...fn(s,r)},null,2)}var Ft=class{manifestPath;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.excludeList=e.excludeList}applyDevOverrides(e){return e.content_scripts?e.content_scripts.map((r,s)=>(r.css.length&&!r.js.length&&(r.js=[h(`content_scripts-${s}`,"dev.js",{})]),r)):{}}applyProdOverrides(e,r){if(!r.content_scripts)return{};let s=e.options.output?.path||"",i=e.getAssets().filter(o=>o.name.includes("content_scripts")&&o.name.endsWith(".css")).map(o=>Ln.default.join(s,o.name));for(let o of r.content_scripts)o.css=i.map((n,c)=>h(`content_scripts/content-${c}.css`,n,{}));return r.content_scripts}apply(e){e.hooks.thisCompilation.tap("manifest:update-manifest",r=>{r.hooks.processAssets.tap({name:"manifest:update-manifest",stage:Me.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(r.errors.length>0)return;let s=J(r,this.manifestPath),i=is(this.manifestPath,s,this.excludeList||{}),o={...s,...JSON.parse(i)};e.options.mode==="development"&&o.content_scripts&&(o.content_scripts=this.applyDevOverrides(o));let n=JSON.stringify(o,null,2),c=new Me.sources.RawSource(n);r.updateAsset("manifest.json",c)}),e.options.mode==="production"&&r.hooks.afterOptimizeAssets.tap("manifest:update-manifest",()=>{if(r.errors.length>0)return;let s=J(r,this.manifestPath),i=is(this.manifestPath,s,this.excludeList||{}),o={...s,...JSON.parse(i)};o.content_scripts&&(o.content_scripts=this.applyProdOverrides(r,o));let n=JSON.stringify(o,null,2),c=new Me.sources.RawSource(n);r.updateAsset("manifest.json",c)})})}};var On=a(require("fs")),Dt=class{dependencyList;constructor(e){this.dependencyList=e}apply(e){e.hooks.afterCompile.tap("ManifestPlugin (AddDependenciesPlugin)",r=>{if(r.errors?.length)return;let s=new Set(r.fileDependencies);this.dependencyList&&this.dependencyList.forEach(i=>{On.default.existsSync(i)&&(s.has(i)||(s.add(i),r.fileDependencies.add(i)))})})}};var In=a(require("fs")),Mn=a(require("path")),Ot=a(require("webpack"));var Lt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}extractPaths(e){let r=Array.isArray(e)?e:[e];if(typeof r[0]=="string")return r;let s=[];if(typeof e=="object"&&!Array.isArray(e)){let i=e;i.light&&s.push(i.light),i.dark&&s.push(i.dark)}return s}handleErrors(e,r){let s=[".png",".jpg",".jpeg",".svg",".gif",".webp"],i=[".json"],o=[".js",".ts",".jsx",".tsx",".mjs",".cjs"],n=".html",c=Object.entries(this.includeList||{});for(let[p,l]of c)if(l){let u=this.extractPaths(l);for(let m of u){let g=Mn.default.extname(m),b=require(this.manifestPath),P=S(b,"chrome").name||"Extension.js";if(!In.default.existsSync(m)){if(m.startsWith("/"))return;let k=se(P,p,m);s.includes(g)?e.errors.push(new r(k)):i.includes(g)?e.errors.push(new r(k)):o.includes(g)?e.errors.push(new r(k)):g===n?e.errors.push(new r(k)):e.errors.push(new r(k))}}}}apply(e){e.hooks.compilation.tap("manifest:check-manifest-files",r=>{r.hooks.processAssets.tap({name:"compatibility:check-manifest-files",stage:Ot.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let s=Ot.default.WebpackError;this.handleErrors(r,s)})})}};var An=a(require("fs")),Mt=a(require("webpack"));var It=class{manifestPath;browser;includeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList}flattenAndSort(e){return e.flat(1/0).sort()}apply(e){e.hooks.watchRun.tapAsync("manifest:throw-if-recompile-is-needed",(r,s)=>{if((r.modifiedFiles||new Set).has(this.manifestPath)){let o=r.options.context||"",n=`${o}/package.json`;if(!An.default.existsSync(n)){s();return}let c=require(this.manifestPath),p=S(c,this.browser),l=this.flattenAndSort(Object.values(Fe(o,p))),u=this.flattenAndSort(Object.values(Oe(o,p)));r.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",m=>{m.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:Mt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let b=m.getAsset("manifest.json")?.source.source().toString(),j=JSON.parse(b||"{}"),P=this.flattenAndSort(Object.values(Fe(o,j))),k=this.flattenAndSort(Object.values(Oe(o,j)));if(u.toString()!==k.toString()||l.toString()!==P.toString()){let A=l.filter(W=>!P.includes(W))[0],U=P.filter(W=>!l.includes(W))[0],Se=mi(U,A);m.errors.push(new Mt.default.WebpackError(Se))}})})}s()})}};var At=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Et({manifestPath:this.manifestPath}).apply(e),new Lt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ft({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new Dt([this.manifestPath]).apply(e),new It({manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList}).apply(e)}};var ps=a(require("path"));var ns=a(require("fs")),Nt=a(require("webpack")),qn=require("webpack");var Tn=a(require("fs")),ue=a(require("path")),Rn=a(require("parse5-utils"));var fe=a(require("parse5-utils"));function Tt(t){try{return new URL(t),!0}catch{return!1}}function Ae(t,e){let{childNodes:r=[]}=t;for(let s of r)if(s.nodeName==="script"){let i=fe.default.getAttribute(s,"src");if(!i||Tt(i))continue;e({filePath:i,childNode:s,assetType:"script"})}else if(s.nodeName==="link"){let i=fe.default.getAttribute(s,"href"),o=fe.default.getAttribute(s,"rel");if(!i||Tt(i))continue;e(o==="dns-prefetch"||o==="icon"||o==="manifest"||o==="modulepreload"||o==="preconnect"||o==="prefetch"||o==="preload"||o==="prerender"?{filePath:i,childNode:s,assetType:"staticHref"}:{filePath:i,childNode:s,assetType:"css"})}else if(s.nodeName==="a"||s.nodeName==="area"){let i=fe.default.getAttribute(s,"href");if(!i||Tt(i))continue;e({filePath:i,childNode:s,assetType:"staticHref"})}else if(s.nodeName==="audio"||s.nodeName==="embed"||s.nodeName==="iframe"||s.nodeName==="img"||s.nodeName==="input"||s.nodeName==="source"||s.nodeName==="track"||s.nodeName==="video"){let i=fe.default.getAttribute(s,"src");if(!i||Tt(i))continue;e({filePath:i,childNode:s,assetType:"staticSrc"})}else Ae(s,e)}function L(t,e){let r={css:[],js:[],static:[]};if(!t)return r;let s=e||Tn.default.readFileSync(t,{encoding:"utf8"}),i=Rn.default.parse(s),o=(n,c)=>ue.default.join(ue.default.dirname(n),c.startsWith("/")?ue.default.relative(ue.default.dirname(n),c):c);for(let n of i.childNodes)if(n.nodeName==="html"){for(let c of n.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&Ae(c,({filePath:p,assetType:l})=>{let u=o(t,p);switch(l){case"script":r.js?.push(u);break;case"css":r.css?.push(u);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;r.static?.push(u);break;default:break}});return{css:r.css,js:r.js,static:r.static}}}function Nn(t,e,r){let s=Object.keys(t).find(o=>{let n=t[o];return t[o]===e||L(n)?.js?.includes(e)||L(n)?.css?.includes(e)})||"",i=os(e);return s?`/${s.replace(i,"")}${r}`:`${e.replace(i,"")}${r}`}function os(t){switch(ue.default.extname(t)){case".js":case".mjs":case".ts":case".tsx":return".js";case".css":case".scss":case".sass":case".less":return".css";case".html":return".html";default:return".js"}}function V(t,e,r){return r?`/${t}${e}`:`${t}${e}`}function Un(t,e){return Object.values(e||{}).some(r=>r===t)}var Rt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let r=require(this.manifestPath),i=S(r,"chrome").name||"Extension.js";e.hooks.thisCompilation.tap("html:emit-html-file",o=>{o.hooks.processAssets.tap({name:"AddAssetsToCompilationPlugin",stage:Nt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=Object.entries(this.includeList||{});for(let c of n){let[p,l]=c;if(l){if(!ns.default.existsSync(l)){let m=se(i,p,l);o.warnings.push(new Nt.default.WebpackError(m));return}let u=ns.default.readFileSync(l,"utf8");if(!$(l,this.excludeList)){let m=new qn.sources.RawSource(u),g=V(p,".html");o.emitAsset(g,m)}}}})})}};var Ut=a(require("fs")),me=a(require("path")),Bn=a(require("webpack")),Te=require("webpack");var qt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-assets-to-compilation",r=>{r.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Te.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{if(r.errors.length>0)return;let s=Object.entries(this.includeList||{});for(let i of s){let[o,n]=i,c=o+".html";if(n){let p=r.getAsset(c);if(p){let l=p.source.source().toString(),u=L(n,l)?.static,m=[...new Set(u)];for(let g of m)if(!g.startsWith("/")){if(!Ut.default.existsSync(g)&&!Un(g,this.includeList)&&!me.default.basename(g).startsWith("#")){let A=at(n,g);g.startsWith("/")||r.warnings.push(new Bn.default.WebpackError(A));return}let b=Ut.default.readFileSync(g),j=new Te.sources.RawSource(b),P=me.default.join("assets",me.default.basename(g));if(!r.getAsset(P))if(g.endsWith(".html")){let k=L(g),A=[...k?.js||[],...k?.css||[],...k?.static||[]];r.emitAsset(P,j),A.forEach(U=>{let Se=Ut.default.readFileSync(U),W=new Te.sources.RawSource(Se),Js=me.default.join("assets",me.default.basename(U));r.getAsset(Js)||r.emitAsset(Js,W)})}else r.emitAsset(P,j)}}}}})})}};var Wn=a(require("path")),as=a(require("fs"));var Bt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let r=this.includeList||{};for(let s of Object.entries(r)){let[i,o]=s;if(o){if(!as.default.existsSync(o))return;let n=L(o),c=n?.js||[],p=n?.css||[],l=[...c,...p].filter(u=>!$(u,this.excludeList));if(e.options.mode==="development"){let u=Wn.default.resolve(__dirname,"minimum-script-file.mjs");l.push(u)}as.default.existsSync(o)&&($(o,this.excludeList)||(e.options.entry={...e.options.entry,[i]:{import:l}}))}}}};var Jt=require("webpack");var cs=a(require("fs")),G=a(require("path")),O=a(require("parse5-utils"));function Jn(t,e,r,s,i){let o=cs.default.readFileSync(r,{encoding:"utf8"}),n=O.default.parse(o),c=!!t.getAsset(e+".css"),p=!1;for(let l of n.childNodes)if(l.nodeName==="html"){for(let u of l.childNodes){if((u.nodeName==="head"||u.nodeName==="body")&&Ae(u,({filePath:m,childNode:g,assetType:b})=>{let j=G.default.dirname(r),P=G.default.resolve(j,m),k=os(P),A=$(G.default.resolve(j,m),i),U=G.default.join("/",G.default.normalize(m)),Se=Ei(P,s);switch(b){case"script":{A?l=O.default.setAttribute(g,"src",U):(l=O.default.remove(g),p=!0);break}case"css":{A?l=O.default.setAttribute(g,"href",U):(l=O.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(A)l=O.default.setAttribute(g,b==="staticSrc"?"src":"href",U);else if(Se){let W=Nn(s,P,k);l=O.default.setAttribute(g,b==="staticSrc"?"src":"href",W)}else{let W=G.default.join("assets",G.default.basename(P,k));cs.default.existsSync(P)&&(l=O.default.setAttribute(g,b==="staticSrc"?"src":"href",V(W,"",!0)))}break}default:break}}),u.nodeName==="head"&&c&&t.options.mode==="production"){let m=O.default.createNode("link");m.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:V(e,".css",!0)}],O.default.append(u,m)}if(u.nodeName==="body"&&(p||t.options.mode!=="production")){let m=O.default.createNode("script");m.attrs=[{name:"src",value:V(e,".js",!0)}],O.default.append(u,m)}}return O.default.serialize(n)}}var Wt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("html:update-html-file",r=>{r.hooks.processAssets.tap({name:"html:update-html-file",stage:Jt.Compilation.PROCESS_ASSETS_STAGE_DERIVED},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i;if(n){let c=Jn(r,o,n,s,this.excludeList||{});if(!$(n,this.excludeList)&&c){let p=new Jt.sources.RawSource(c),l=V(o,".html");r.updateAsset(l,p)}}}})})}};var zn=a(require("fs")),Hn=require("webpack");var zt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-to-file-dependencies",r=>{r.hooks.processAssets.tap({name:"html:add-to-file-dependencies",stage:Hn.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i;if(o){let n=L(o),c=new Set(r.fileDependencies);if(zn.default.existsSync(o)){let p=[o,...n?.static||[]];for(let l of p)c.has(l)||(c.add(l),l===o&&r.fileDependencies.add(l))}}}})})}};var Vn=a(require("fs"));var Ht=class{manifestPath;includeList;initialHtmlAssets={};constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}hasEntriesChanged(e,r){if(!r||!e||e.length!==r.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==r[s])return!0;return!1}storeInitialHtmlAssets(e){Object.entries(e).forEach(([r,s])=>{let i=s;if(i){if(!Vn.default.existsSync(i)){let o=require(this.manifestPath),c=S(o,"chrome").name||"Extension.js";console.error(se(c,r,i)),process.exit(1)}this.initialHtmlAssets[i]={js:L(i)?.js||[],css:L(i)?.css||[]}}})}apply(e){let r=this.includeList||{};this.storeInitialHtmlAssets(r),e.hooks.make.tapAsync("html:throw-if-recompile-is-needed",(s,i)=>{let o=e.modifiedFiles||new Set,n=Array.from(o)[0];if(n&&this.initialHtmlAssets[n]){let c=L(n)?.js||[],p=L(n)?.css||[],{js:l,css:u}=this.initialHtmlAssets[n];(this.hasEntriesChanged(p,u)||this.hasEntriesChanged(c,l))&&console.log(wi(n))}i()})}};var Gn=a(require("fs")),Xn=require("webpack");function hl(t,e){let r="Module not found: Error: Can't resolve ",i=e.message.replace(r,"").split("'")[1];if(e.message.includes(r))for(let o of Object.entries(t)){let[,n]=o;if(n){if(!Gn.default.existsSync(n))return null;let c=L(n),p=c?.js?.filter(u=>!u.startsWith("/"))||[],l=c?.css?.filter(u=>!u.startsWith("/"))||[];if(p.includes(i)||l.includes(i)){let u=at(n,i);return new Xn.WebpackError(u)}}}return null}var Vt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.compilation.tap("html:handle-common-errors",r=>{r.hooks.afterSeal.tapPromise("html:handle-common-errors",async()=>{r.errors.forEach((s,i)=>{let o=hl(this.includeList||{},s);o&&(r.errors[i]=o)})})})}};var Gt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Rt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new qt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Bt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Wt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[ps.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(ps.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),new zt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ht({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Vt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var Re=a(require("path"));var ls=a(require("fs")),Zn=a(require("path"));function Kn(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>{let o=ls.default.existsSync(i)&&!$(i,e),n=Zn.default.extname(i);return o&&(n===".js"||n===".mjs"||n===".jsx"||n===".ts"||n===".tsx")})}function Yn(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>ls.default.existsSync(i)&&!$(i,e)&&(i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")||i.endsWith(".less")))}var Xt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let r=this.includeList||{},s={};for(let[i,o]of Object.entries(r)){let n=Kn(o,this.excludeList),c=Yn(o,this.excludeList),p=[...n];e.options.mode==="production"&&p.push(...c),(c.length||n.length)&&(s[i]={import:p})}e.options.entry={...e.options.entry,...s}}};var Y=require("webpack"),yl=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],bl=[...yl,`var runtime = isBrowser ? browser : isChrome ? chrome : (typeof self === 'object' && self.addEventListener) ? { get runtime() { throw new Error("No chrome or browser runtime found") } } : { runtime: { getURL: x => x } }`],Zt=class t{apply(e){let{RuntimeGlobals:r}=e.webpack;e.hooks.compilation.tap("PublicPathRuntimeModule",s=>{s.hooks.runtimeRequirementInTree.for(r.publicPath).tap(t.name,i=>{let o=wl();return s.addRuntimeModule(i,o),!0})})}};function wl(){class t extends Y.RuntimeModule{constructor(){super("publicPath",Y.RuntimeModule.STAGE_BASIC)}generate(){let r=this.compilation?.outputOptions.publicPath;return Y.Template.asString([...bl,`var path = ${JSON.stringify(this.compilation?.getPath(r||"",{hash:this.compilation.hash||"XXXX"}))}`,`${Y.RuntimeGlobals.publicPath} = typeof importScripts === 'function' || !(isBrowser || isChrome) ? path : runtime.runtime.getURL(path);`])}}return new t}var Kt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let r=require(this.manifestPath),s=S(r,this.browser);s.content_scripts?.some(i=>i.world&&i.world.toLowerCase()==="main")&&K.includes(this.browser)&&!s.key&&(console.error(_i()),process.exit(1))}};var Yt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Xt({manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Re.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Re.default.join(__dirname,"inject-content-css-during-dev.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Re.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Re.default.join(__dirname,"add-hmr-accept-code.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="production"&&new Zt().apply(e),new Kt({manifestPath:this.manifestPath,browser:this.browser||"chrome",includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e)}};var Ue=a(require("path")),qe=a(require("fs")),us=a(require("webpack")),Be=require("webpack");var de=a(require("path")),Ne=a(require("fs"));function fs(t){let e=de.default.join(de.default.dirname(t),"_locales"),r=[];if(Ne.default.existsSync(e))for(let s of Ne.default.readdirSync(e)){let i=de.default.join(e,s);if(i&&Ne.default.statSync(i).isDirectory())for(let o of Ne.default.readdirSync(i))r.push(de.default.join(de.default.dirname(t),"_locales",s,o))}return r}var Qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("locales:module",r=>{r.hooks.processAssets.tap({name:"locales:module",stage:Be.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(!qe.default.existsSync(this.manifestPath)){let i=require(this.manifestPath),n=S(i,"chrome").name||"Extension.js";r.errors.push(new us.default.WebpackError(fi(n,this.manifestPath)));return}if(r.errors.length>0)return;let s=fs(this.manifestPath);for(let i of Object.entries(s||[])){let[o,n]=i,c=n;if(c){if(Ue.default.extname(c)!==".json")continue;if(!qe.default.existsSync(c)){r.warnings.push(new us.default.WebpackError(ct(o,c)));return}let p=qe.default.readFileSync(c),l=new Be.sources.RawSource(p),u=e.options.context||Ue.default.dirname(this.manifestPath);if(!$(c,this.excludeList)){let m=Ue.default.relative(u,c);r.emitAsset(m,l)}}}})}),e.hooks.thisCompilation.tap("locales:module",r=>{r.hooks.processAssets.tap({name:"locales:module",stage:Be.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=fs(this.manifestPath);for(let i of Object.entries(s||[])){let[,o]=i;if(o){let n=new Set(r.fileDependencies),c=s||[];for(let p of c)qe.default.existsSync(p)&&Ue.default.extname(p)===".json"&&(n.has(p)||(n.add(p),r.fileDependencies.add(p)))}}})})}};var er=a(require("fs")),Qn=a(require("webpack")),We=require("webpack");var tr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("json:module",r=>{r.hooks.processAssets.tap({name:"json:module",stage:We.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i,c=Array.isArray(n)?n:[n];for(let p of c)if(p&&!$(p,this.excludeList)){if(!er.default.existsSync(p)){r.warnings.push(new Qn.default.WebpackError(ct(o,p)));return}let l=er.default.readFileSync(p),u=new We.sources.RawSource(l);r.emitAsset(o+".json",u)}}})}),e.hooks.thisCompilation.tap("json:module",r=>{r.hooks.processAssets.tap({name:"json:module",stage:We.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i,n=Array.isArray(o)?o:[o];for(let c of n)if(c){let p=new Set(r.fileDependencies);$(c,this.excludeList)||er.default.existsSync(c)&&(p.has(c)||(p.add(c),r.fileDependencies.add(c)))}}})})}};var ms=a(require("fs")),ea=a(require("path")),sr=require("webpack");var rr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:emit-file",r=>{r.hooks.processAssets.tap({name:"icons:emit-file",stage:sr.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i;if(n===void 0)continue;let c=Array.isArray(n)?typeof n[0]=="string"?n:n.map(Object.values).flat():[n];for(let p of c)if(p){if(!ms.default.existsSync(p))continue;if(!$(p,this.excludeList)){let l=ms.default.readFileSync(p),u=new sr.sources.RawSource(l),m=ea.default.basename(p),b=`${o.endsWith("theme_icons")?o.replace("theme_icons",""):o}/${m}`;r.emitAsset(b,u)}}}})})}};var ta=a(require("fs")),ra=require("webpack"),ir=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:add-to-file-dependencies",r=>{r.hooks.processAssets.tap({name:"icons:add-to-file-dependencies",stage:ra.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i,n=Array.isArray(o)?typeof o[0]=="string"?o:o.map(Object.values).flat():[o];for(let c of n)if(c){let p=new Set(r.fileDependencies);ta.default.existsSync(c)&&(p.has(c)||(p.add(c),r.fileDependencies.add(c)))}}})})}};var or=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new rr({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new ir({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ar=require("webpack");function sa(t){return t.map(e=>{try{let r=new URL(e.replace(/^\*:\/\//,"https://"));return e.endsWith(r.pathname)?`${e.substring(0,e.length-r.pathname.length)}/*`:r.pathname==="/"?`${e}/*`:e}catch{return e}})}var nr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}generateManifestPatches(e,r){let s=J(e,this.manifestPath),i=s.web_accessible_resources||[],o=s.web_accessible_resources||[];for(let[p,l]of Object.entries(r)){let u=s.content_scripts?.find(m=>m.js&&m.js.some(g=>g.includes(p)));if(u){let m=u.matches||[];if(s.manifest_version===3){let g=i.find(b=>b.matches.some(j=>m.includes(j)));g?l.forEach(b=>{!g.resources.includes(b)&&!b.endsWith(".map")&&g.resources.push(b)}):i.push({resources:l.filter(b=>!b.endsWith(".map")),matches:sa(m)})}else l.forEach(g=>{o.includes(g)||o.push(g)})}}s.manifest_version===3?i.length>0&&(s.web_accessible_resources=i):o.length>0&&(s.web_accessible_resources=Array.from(new Set(o)));let n=JSON.stringify(s,null,2),c=new ar.sources.RawSource(n);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",c)}apply(e){e.hooks.thisCompilation.tap("plugin-extension:feature-web-resources",r=>{r.hooks.processAssets.tap({name:"plugin-extension:feature-web-resources",stage:ar.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{let s=[],i=Object.keys(this.includeList||{});for(let c of i.filter(Boolean))c.startsWith("content_scripts")&&(Array.isArray(c)?s.push(...c):typeof c=="string"&&s.push(c));let o=r.chunkGraph,n={};r.entrypoints.forEach((c,p)=>{if(s.includes(p)){let l=[];c.chunks.forEach(u=>{Array.from(o.getChunkModulesIterable(u)).forEach(g=>{o.getModuleChunks(g).forEach(b=>{b.auxiliaryFiles.forEach(j=>{l.includes(j)||l.push(j)})})})}),n[p]=l}}),this.generateManifestPatches(r,n)})})}};var I=a(require("fs")),M=a(require("path")),ia=a(require("chokidar")),cr=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let r=M.default.dirname(e);if(I.default.existsSync(r))return!0;I.default.mkdirSync(r,{recursive:!0})}copyFile(e,r){this.ensureDirectoryExistence(r),I.default.copyFileSync(e,r)}copyFolder(e,r){I.default.existsSync(r)||I.default.mkdirSync(r,{recursive:!0}),I.default.readdirSync(e).forEach(i=>{let o=M.default.join(e,i),n=M.default.join(r,i);I.default.statSync(o).isDirectory()?this.copyFolder(o,n):this.copyFile(o,n)})}apply(e){let r=M.default.dirname(this.options.manifestPath),s=M.default.join(r,"public"),i=e.options.output?.path||"";I.default.existsSync(s)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let o=M.default.join(i,"/");I.default.existsSync(o)||I.default.mkdirSync(o,{recursive:!0}),I.default.existsSync(s)&&this.copyFolder(s,o)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let o=M.default.join(r,"public"),n=ia.default.watch(o,{ignoreInitial:!0});n.on("add",c=>{let p=M.default.join(i,M.default.relative(r,c));this.copyFile(c,p)}),n.on("change",c=>{let p=M.default.join(i,M.default.relative(r,c));this.copyFile(c,p)}),n.on("unlink",c=>{let p=M.default.join(i,M.default.relative(r,c));I.default.existsSync(p)&&I.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{n.close().catch(console.error)})}))}};var q=a(require("path")),ds=a(require("chokidar"));var pr=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,r,s){let i=q.relative(process.cwd(),r),c=di(s?"Adding":"Removing",e,e==="pages"?"HTML pages":"script files",i);if(s){console.warn(c);return}console.error(c),process.exit(1)}apply(e){e.hooks.afterPlugins.tap("special-folders:warn-upon-folder-changes",()=>{let r=q.dirname(this.manifestPath),s=q.join(r,"pages"),i=q.join(r,"scripts"),o=ds.watch(s,{ignoreInitial:!0}),n=ds.watch(i,{ignoreInitial:!0}),c=e.options.resolve?.extensions;o.on("add",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p,!0)}),o.on("unlink",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p)}),n.on("add",p=>{c?.includes(q.extname(p))&&this.throwCompilationError("scripts",p,!0)}),n.on("unlink",p=>{c?.includes(q.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{o.close().catch(console.error),n.close().catch(console.error)})})}};var lr=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:r}=this.options;new cr({manifestPath:r}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new pr(r).apply(e)}};var fr=class{static name="plugin-extension";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){let r=this.manifestPath,s=pe({manifestPath:r,browser:this.browser}),i=Ko({manifestPath:r,browser:this.browser});process.env.EXPERIMENTAL_EXTENSION_RESOLVER_PLUGIN==="true"&&new kt({manifestPath:r,browser:this.browser,includeList:{...i?.pages||{},...i?.scripts||{}},excludeList:i.public,loaderOptions:{jsx:ce(ge.default.dirname(this.manifestPath))||ae(ge.default.dirname(this.manifestPath))||Zr(ge.default.dirname(this.manifestPath))||Kr(ge.default.dirname(this.manifestPath)),typescript:z(ge.default.dirname(this.manifestPath)),minify:e.options.mode==="production"}}).apply(e),new At({browser:this.browser,manifestPath:r,includeList:{...s.html,...s.icons,...s.json,...s.scripts},excludeList:i.public}).apply(e),new Gt({manifestPath:r,includeList:{...s.html,...i.pages},excludeList:{...i.public,...i.scripts}}).apply(e),new Yt({manifestPath:r,browser:this.browser,includeList:{...s.scripts,...i.scripts},excludeList:{...i.public,...i.pages}}).apply(e),new Qt({manifestPath:r}).apply(e),new tr({manifestPath:r,includeList:s.json,excludeList:i.public}).apply(e),new or({manifestPath:r,includeList:s.icons,excludeList:i.public}).apply(e),new nr({manifestPath:r,includeList:{...s.scripts,...i.scripts},excludeList:i.public}).apply(e),new lr({manifestPath:r}).apply(e)}};var He=a(require("path"));var oa=a(require("path")),na=a(require("ws"));function ur(t,e){t.clients.forEach(r=>{r.readyState===na.default.OPEN&&r.send(JSON.stringify(e))})}function aa(t,e,r){if(!r||!e)return;let s=pe({manifestPath:e}).locales,i=pe({manifestPath:e}).scripts,o=pe({manifestPath:e}).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}oa.default.basename(r)==="manifest.json"&&ur(t,{changedFile:"manifest.json"}),s?.forEach(n=>{n.includes(r)&&ur(t,{changedFile:"_locales"})}),Object.entries(i).forEach(([n,c])=>{let p=Array.isArray(c)?c:[c];Object.values(p).flatMap(u=>u).includes(r)&&n==="background/service_worker"&&ur(t,{changedFile:"service_worker"})}),Object.entries(o).forEach(([n,c])=>{c?.includes(r)&&n==="declarative_net_request"&&ur(t,{changedFile:"declarative_net_request"})})}var hs=a(require("path")),fa=a(require("fs")),ze=a(require("ws"));var Je=a(require("path")),xl=a(require("http")),pa=a(require("https")),gs=a(require("fs"));var ca=t=>{if(!gs.default.existsSync(t))return;let e=Je.default.basename(t);return gs.default.readFileSync(Je.default.join(__dirname,"certs",e))};function la(t){let e={key:ca(Je.default.join(__dirname,"certs","localhost.key")),cert:ca(Je.default.join(__dirname,"certs","localhost.cert"))},r=pa.default.createServer(e,(s,i)=>{i.writeHead(200),i.end()});return r.on("error",s=>{throw console.error(vi(t)),new Error(s.message)}),{server:r,port:t}}function vl(t,e){switch(e){case"chrome":return new ze.default.Server({host:"localhost",port:t});case"edge":return new ze.default.Server({host:"localhost",port:t+1});case"firefox":return new ze.default.Server({server:la(t+2).server});default:return new ze.default.Server({host:"localhost",port:8888})}}async function ua(t,e){let r=t.options.context||"",s=require(hs.default.join(r,"manifest.json")),o=vl(8e3,e.browser);if(o.on("connection",n=>{n.send(JSON.stringify({status:"serverReady"})),n.on("error",c=>{console.log(yi(c))}),n.on("message",c=>{let p=JSON.parse(c.toString());if(p.status==="clientReady"){let l=require(hs.default.join(r,"manifest.json"));setTimeout(()=>{console.log(zr(l,e.browser,p)),console.log("")},2500),$i(e.browser)&&setTimeout(()=>{console.log(hi(e.browser))},5e3)}})}),e.browser==="firefox"||e.browser==="gecko-based"){let n=Ci(s);console.log(zr(s,e.browser,n)),console.log(""),fa.default.existsSync(nt)||(console.log(xi()),console.log(""))}return o}var ma=a(require("path")),ys=a(require("fs"));function da(t,e){let r=ma.default.resolve(__dirname,`./extensions/${t}-manager-extension/reload-service.js`);try{let s=ys.default.readFileSync(r,"utf8"),i=s.replace(/__RELOAD_PORT__/g,e.toString());i!==s&&ys.default.writeFileSync(r,i,"utf8")}catch(s){console.error(`Error processing file: ${s.message}`)}}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Ve=class{manifestPath;port;browser;stats;constructor(e){this.manifestPath=e.manifestPath,this.port=e.port||8e3,this.browser=e.browser||"chrome",this.stats=e.stats}async apply(e){if(!this.manifestPath)return;da(this.browser,this.port);let r=await ua(e,{...this,mode:e.options.mode,browser:this.browser,stats:this.stats,port:this.port});e.hooks.watchRun.tapAsync("reload:create-web-socket-server",(s,i)=>{let n=(s.modifiedFiles||new Set).values().next().value;if(!n){i();return}let c=He.default.relative(He.default.dirname(this.manifestPath),n),p=He.default.relative(process.cwd(),He.default.dirname(n));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&aa(r,this.manifestPath,n),i()})}};var bs=a(require("path"));function ga(t,e,r){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[bs.default.dirname(r)],exclude:/node_modules/,use:[{loader:bs.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:r,browser:e}}]})}var ws=a(require("path"));function ha(t,e,r){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[ws.default.dirname(r)],exclude:/node_modules/,use:[{loader:ws.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:r,browser:e}}]})}var dr=require("webpack");var xs=a(require("content-security-policy-parser"));function ya(t){let e="";for(let r in t)e+=`${r} ${t[r].join(" ")}; `;return e.trim()}function ba(t){let e=t.content_security_policy;if(!e)return"script-src 'self' 'unsafe-eval' blob: filesystem:; object-src 'self' blob: filesystem:; ";let r=(0,xs.default)(e);if(!r.get("script-src"))r.set("script-src",["'self'","'unsafe-eval'","blob:","filesystem:"]);else{let i=r.get("script-src")||[];i.includes("'unsafe-eval'")||i.push("'unsafe-eval'"),i.includes("blob:")||i.push("blob:"),i.includes("filesystem:")||i.push("filesystem:"),r.set("script-src",i)}r.get("object-src")||r.set("object-src",["'self'","blob:","filesystem:"]);let s=Object.fromEntries(r.entries());return ya(s)}function wa(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self';"};let r=(0,xs.default)(e.extension_pages||""),s={};for(let n in s)r.get(n)||r.set(n,s[n]);let i=Object.fromEntries(r.entries());return{extension_pages:ya(i)}}function xa(t){let e=["/*.json","/*.js","/*.css"],r=t.web_accessible_resources;if(!r||r.length===0)return e;let s=new Set(r);for(let i of e)s.has(i)||s.add(i);return Array.from(s)}function va(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function vs(t,e){return t.background?{background:{...t.background}}:e==="firefox"||e==="gecko-based"?{background:{...t.background||{},scripts:["background/script.js"]}}:t.manifest_version===2?{background:{...t.background||{},scripts:["background/script.js"]}}:{background:{...t.background||{},service_worker:"background/service_worker.js"}}}function _s(t){return t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:[...new Set(t.externally_connectable.ids||[]),"*"]}}:t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:["*"]}}:{}}var mr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}generateManifestPatches(e){let r=J(e,this.manifestPath),s={...r,content_security_policy:r.manifest_version===3?wa(r):ba(r),...r.manifest_version===3?r.permissions?{permissions:[...new Set(["scripting",...r.permissions])]}:{permissions:["scripting"]}:{},...vs(r,this.browser),..._s(r),web_accessible_resources:r.manifest_version===3?va(r):xa(r)},i=JSON.stringify(s,null,2),o=new dr.sources.RawSource(i);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",o)}apply(e){e.hooks.thisCompilation.tap("run-chromium:apply-manifest-dev-defaults",r=>{r.hooks.processAssets.tap({name:"run-chromium:apply-manifest-dev-defaults",stage:dr.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},s=>{if(!this.manifestPath){let i="No manifest.json found in your extension bundle. Unable to patch manifest.json.";r&&e.webpack.WebpackError&&r.errors.push(new e.webpack.WebpackError(`run-chromium: ${i}`));return}this.generateManifestPatches(r)})})}};var Ss=a(require("fs")),he=a(require("path")),_a=a(require("webpack-target-webextension"));var gr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,r,s){let i=he.default.resolve(__dirname,r==="firefox"||r==="gecko-based"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),o=he.default.dirname(this.manifestPath),n=S(s,r);if(r==="firefox"||r==="gecko-based"){n=s.background;let c=n?.scripts;if(c&&c.length>0){let p=he.default.join(o,c[0]);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/script",i)}else if(n=s.background,s.manifest_version===3){let c=n?.service_worker;if(c){let p=he.default.join(o,c);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/service_worker",i)}else if(s.manifest_version===2){let c=n?.scripts;if(c&&c.length>0){let p=he.default.join(o,c[0]);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/script",i)}}ensureFileExists(e){if(!Ss.default.existsSync(e)&&this.manifestPath){let r=require(this.manifestPath),i=S(r,"chrome").name||"Extension.js",o=bi(i,e);throw console.error(o),new Error(o)}}addDefaultEntry(e,r,s){e.options.entry={...e.options.entry,[r]:{import:[s]}}}getEntryName(e){if(e.background){if(this.browser==="firefox"||this.browser==="gecko-based")return{pageEntry:"background/script"};if(e.manifest_version===3)return{serviceWorkerEntry:"background/service_worker"};if(e.manifest_version===2)return{pageEntry:"background/script"}}return{pageEntry:"background"}}apply(e){if(!this.manifestPath||!Ss.default.lstatSync(this.manifestPath).isFile())return;let r=require(this.manifestPath),s=S(r,this.browser);this.handleBackground(e,this.browser,s),new _a.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}};var Ps=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){(K.includes(this.browser)||this.browser==="chromium-based")&&ga(e,this.browser,this.manifestPath),(this.browser==="firefox"||this.browser==="gecko-based")&&ha(e,this.browser,this.manifestPath),new mr({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new gr({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},Sa=Ps;var hr=class{static name="plugin-reload";manifestPath;browser;port;stats;autoReload;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.port=e.port,this.stats=e.stats,this.autoReload=e.autoReload}apply(e){e.options.mode==="development"&&new Ve({manifestPath:this.manifestPath,browser:this.browser,port:this.port,stats:this.stats}).apply(e),e.options.mode==="development"&&new Sa({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var Pa=a(require("webpack")),yr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new Pa.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var wr=require("webpack");var br=class{browser;manifestPath;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let r=S(e,this.browser);return JSON.stringify(r,null,2)}apply(e){e.hooks.compilation.tap("compatibility:browser-specific-fields",r=>{r.hooks.processAssets.tap({name:"compatibility:browser-specific-fields",stage:wr.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let s=J(r,this.manifestPath),i=this.patchManifest(s),o=new wr.sources.RawSource(i);r.updateAsset("manifest.json",o)})})}};var xr=class{static name="plugin-compatibility";manifestPath;browser;polyfill;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.polyfill=e.polyfill||!1}async apply(e){this.polyfill&&this.browser!=="firefox"&&new yr({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new br({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var Ma=a(require("fs"));var ka=a(require("webpack")),Ea=a(require("content-security-policy-parser"));function $a(t){let e=t.content_security_policy,r=t.content_security_policy?.extension_pages,s=i=>{if(!i)return;let o=(0,Ea.default)(i);if(o.get("script-src")&&o.get("script-src")?.includes("'unsafe-eval'"))return ri()};if(t.manifest_version===3){let i=e?s(r):void 0;if(i)return new ka.default.WebpackError(i)}return null}var ks=a(require("webpack"));function Ca(t,e){let r=t.web_accessible_resources;if(r){let s=r.some(o=>typeof o=="string"),i=r.some(o=>typeof o=="object"||o.resources||o.matches);if(t.manifest_version===2&&!s)return new ks.default.WebpackError(ii(e));if(t.manifest_version===3&&!i)return new ks.default.WebpackError(oi(e))}return null}var ja=a(require("webpack"));function Fa(t,e){return(e==="firefox"||e==="gecko-based")&&t.background?.service_worker?new ja.default.WebpackError(ti()):null}var Da=a(require("path")),La=a(require("fs")),Oa=a(require("webpack"));function Ia(t,e){let r=Da.default.join(e.options.context||"","_locales");return La.default.existsSync(r)&&!t.default_locale?new Oa.default.WebpackError(si()):null}var vr=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,r,s){let i=$a(r),o=Ca(r,s),n=Fa(r,s),c=Ia(r,e);i&&e.errors.push(i),o&&e.errors.push(o),n&&e.options.mode==="production"&&e.errors.push(n),c&&e.errors.push(c)}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(r,s)=>{let i=this.options.manifestPath,o=JSON.parse(Ma.default.readFileSync(i,"utf-8")),n=this.options.browser||"chrome";this.handleRuntimeErrors(r,o,n),s()})}};var Wa=a(require("fs")),Ja=a(require("ajv"));var Aa={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://json.schemastore.org/chrome-manifest.json",additionalProperties:!0,definitions:{action_v2:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{anyOf:[{type:"string",description:"FIXME: String form is deprecated."},{type:"object",description:"Icon for the main toolbar.",properties:{"19":{$ref:"#/definitions/icon"},"38":{$ref:"#/definitions/icon"}}}]}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},action_v3:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{type:"object",properties:{"16":{$ref:"#/definitions/icon"},"24":{$ref:"#/definitions/icon"},"32":{$ref:"#/definitions/icon"}}}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},command:{type:"object",if:{$comment:"Global shortcuts change the acceptable pattern for the suggested_key.",properties:{global:{const:!0}},required:["global"]},then:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl)\\+Shift\\+[0-9]"}}}}},else:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl|Alt|Option)\\+(Shift\\+)?[A-Z]"}}}}}},content_security_policy:{type:"string",description:"This introduces some fairly strict policies that will make extensions more secure by default, and provides you with the ability to create and enforce rules governing the types of content that can be loaded and executed by your extensions and applications.",format:"content-security-policy",default:"script-src 'self'; object-src 'self'"},glob_pattern:{type:"string",format:"glob-pattern"},icon:{$ref:"#/definitions/uri"},match_pattern:{type:"string",format:"match-pattern",pattern:"^((\\*|http|https|file|ftp|chrome-extension):\\/\\/(\\*|\\*\\.[^\\/\\*]+|[^\\/\\*]+)?(\\/.*))|urn:(\\*|.*)|<all_urls>$"},mime_type:{type:"string",format:"mime-type",pattern:"^(?:application|audio|image|message|model|multipart|text|video)\\/[-+.\\w]+$"},page:{$ref:"#/definitions/uri"},permissions:{type:"array",uniqueItems:!0,items:{type:"string",format:"permission"}},scripts:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}},uri:{type:"string"},version_string:{type:"string",pattern:"^(?:\\d{1,5}\\.){0,3}\\d{1,5}$"},web_resource:{type:"object",required:["resources"],properties:{resources:{type:"array",description:`An array of resources to be exposed. Resources are specified as strings and may contain * for wildcard matches. For example, "/images/*" exposes everything in the extension's /images directory recursively while "*.png" exposes all PNG files.`,items:{$ref:"#/definitions/glob_pattern"}},matches:{type:"array",description:"A list of URL match patterns specifying which pages can access the resources. Only the origin is used to match URLs; subdomains patterns (*.google.com) and paths are ignored.",items:{$ref:"#/definitions/match_pattern"}},extension_ids:{type:"array",description:"A list of extension IDs, specifying which extensions can access the resources.",items:{type:"string"}},use_dynamic_url:{type:"boolean",description:"If true, only allow resources to be accessible through dynamic ID. The dynamic ID is generated per session. It's regenerated on browser restart or extension reload."}}}},dependencies:{content_scripts:{not:{required:["script_badge"]}},script_badge:{not:{required:["content_scripts"]}}},else:{properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{persistent:{type:"boolean",description:"When false, makes the background page an event page (loaded only when needed).",default:!0},page:{$ref:"#/definitions/page",description:"Specify the HTML of the background page.",default:"background.html"},scripts:{$ref:"#/definitions/scripts",description:"A background page will be generated by the extension system that includes each of the files listed in the scripts property.",default:["background.js"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},browser_action:{$ref:"#/definitions/action_v2",description:"Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup."},page_action:{$ref:"#/definitions/action_v2",description:"Use the chrome.pageAction API to put icons inside the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages."},content_security_policy:{$ref:"#/definitions/content_security_policy"},web_accessible_resources:{type:"array",description:"An array of strings specifying the paths (relative to the package root) of packaged resources that are expected to be usable in the context of a web page.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}}},dependencies:{page_action:{not:{required:["browser_action"]}},browser_action:{not:{required:["page_action"]}}}},if:{properties:{manifest_version:{const:3}}},properties:{manifest_version:{type:"number",description:"One integer specifying the version of the manifest file format your package requires.",enum:[2,3]},name:{type:"string",description:"The name of the extension",maxLength:45},version:{$ref:"#/definitions/version_string",description:"One to four dot-separated integers identifying the version of this extension."},default_locale:{type:"string",description:"Specifies the subdirectory of _locales that contains the default strings for this extension.",default:"en"},description:{type:"string",description:"A plain text description of the extension",maxLength:132},icons:{type:"object",description:"One or more icons that represent the extension, app, or theme. Recommended format: PNG; also BMP, GIF, ICO, JPEG.",minProperties:1,properties:{"16":{$ref:"#/definitions/icon",description:"Used as the favicon for an extension's pages and infobar."},"48":{$ref:"#/definitions/icon",description:"Used on the extension management page (chrome://extensions)."},"128":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."},"256":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."}}},chrome_url_overrides:{type:"object",description:"Override pages are a way to substitute an HTML file from your extension for a page that Google Chrome normally provides.",additionalProperties:!1,maxProperties:1,properties:{bookmarks:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the Bookmark Manager menu item from the Chrome menu or, on Mac, the Bookmark Manager item from the Bookmarks menu. You can also get to this page by entering the URL chrome://bookmarks.",default:"bookmarks.html"},history:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the History menu item from the Chrome menu or, on Mac, the Show Full History item from the History menu. You can also get to this page by entering the URL chrome://history.",default:"history.html"},newtab:{$ref:"#/definitions/page",description:"The page that appears when the user creates a new tab or window. You can also get to this page by entering the URL chrome://newtab.",default:"newtab.html"}}},commands:{type:"object",description:"Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.",patternProperties:{".*":{$ref:"#/definitions/command"},"^_execute_browser_action$":{$ref:"#/definitions/command"},"^_execute_page_action$":{$ref:"#/definitions/command"}}},content_scripts:{type:"array",description:"Content scripts are JavaScript files that run in the context of web pages.",minItems:1,uniqueItems:!0,items:{type:"object",required:["matches"],additionalProperties:!1,properties:{matches:{type:"array",description:"Specifies which pages this content script will be injected into.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},exclude_matches:{type:"array",description:"Excludes pages that this content script would otherwise be injected into.",uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},css:{type:"array",description:"The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page.",uniqueItems:!0,items:{$ref:"#/definitions/uri"}},js:{$ref:"#/definitions/scripts",description:"The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array."},world:{type:"string",description:"The JavaScript world for a script to execute within.",enum:["ISOLATED","MAIN"],default:"ISOLATED"},run_at:{type:"string",description:"Controls when the files in js are injected.",enum:["document_start","document_end","document_idle"],default:"document_idle"},all_frames:{type:"boolean",description:"Controls whether the content script runs in all frames of the matching page, or only the top frame.",default:!1},include_globs:{type:"array",description:"Applied after matches to include only those URLs that also match this glob. Intended to emulate the @include Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},exclude_globs:{type:"array",description:"Applied after matches to exclude URLs that match this glob. Intended to emulate the @exclude Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},match_about_blank:{type:"boolean",description:"Whether to insert the content script on about:blank and about:srcdoc.",default:!1}}}},devtools_page:{$ref:"#/definitions/page",description:"A DevTools extension adds functionality to the Chrome DevTools. It can add new UI panels and sidebars, interact with the inspected page, get information about network requests, and more."},externally_connectable:{description:"Declares which extensions, apps, and web pages can connect to your extension via runtime.connect and runtime.sendMessage.",type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string",description:"The IDs of extensions or apps that are allowed to connect. If left empty or unspecified, no extensions or apps can connect."}},matches:{type:"array",items:{type:"string",description:"The URL patterns for web pages that are allowed to connect. This does not affect content scripts. If left empty or unspecified, no web pages can connect."}},accepts_tls_channel_id:{type:"boolean",default:!1,description:"Indicates that the extension would like to make use of the TLS channel ID of the web page connecting to it. The web page must also opt to send the TLS channel ID to the extension via setting includeTlsChannelId to true in runtime.connect's connectInfo or runtime.sendMessage's options."}}},file_browser_handlers:{type:"array",description:"You can use this API to enable users to upload files to your website.",minItems:1,items:{type:"object",required:["id","default_title","file_filters"],additionalProperties:!1,properties:{id:{type:"string",description:"Used by event handling code to differentiate between multiple file handlers"},default_title:{type:"string",description:"What the button will display."},file_filters:{type:"array",description:"Filetypes to match.",minItems:1,items:{type:"string"}}}}},homepage_url:{$ref:"#/definitions/uri",description:"The URL of the homepage for this extension."},incognito:{type:"string",description:"Specify how this extension will behave if allowed to run in incognito mode.",enum:["spanning","split","not_allowed"],default:"spanning"},input_components:{type:"array",description:"Allows your extension to handle keystrokes, set the composition, and manage the candidate window.",items:{type:"object",required:["name","type","id","description","language","layouts"],additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"},id:{type:"string"},description:{type:"string"},language:{type:"string"},layouts:{type:"array"}}}},key:{type:"string",description:"This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development."},minimum_chrome_version:{$ref:"#/definitions/version_string",description:"The version of Chrome that your extension, app, or theme requires, if any."},nacl_modules:{type:"array",description:"One or more mappings from MIME types to the Native Client module that handles each type.",minItems:1,uniqueItems:!0,items:{type:"object",required:["path","mime_type"],additionalProperties:!1,properties:{path:{$ref:"#/definitions/uri",description:"The location of a Native Client manifest (a .nmf file) within the extension directory."},mime_type:{$ref:"#/definitions/mime_type",description:"The MIME type for which the Native Client module will be registered as content handler."}}}},oauth2:{type:"object",description:"Use the Chrome Identity API to authenticate users: the getAuthToken for users logged into their Google Account and the launchWebAuthFlow for users logged into a non-Google account.",required:["client_id","scopes"],additionalProperties:!1,properties:{client_id:{type:"string",description:"You need to register your app in the Google APIs Console to get the client ID."},scopes:{type:"array",minItems:1,items:{type:"string"}}}},offline_enabled:{type:"boolean",description:"Whether the app or extension is expected to work offline. When Chrome detects that it is offline, apps with this field set to true will be highlighted on the New Tab page."},omnibox:{type:"object",description:"The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.",required:["keyword"],additionalProperties:!1,properties:{keyword:{type:"string",description:"The keyword that will trigger your extension."}}},optional_permissions:{$ref:"#/definitions/permissions",description:"Use the chrome.permissions API to request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary."},options_page:{$ref:"#/definitions/page",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, a link to it will be provided from the extensions management page at chrome://extensions. Clicking the Options link opens a new tab pointing at your options page.",default:"options.html"},options_ui:{type:"object",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, an Options link will be shown on the extensions management page at chrome://extensions which opens a dialogue containing your options page.",required:["page"],properties:{page:{type:"string",description:"The path to your options page, relative to your extension's root."},chrome_style:{type:"boolean",default:!0,description:"If true, a Chrome user agent stylesheet will be applied to your options page. The default value is false, but we recommend you enable it for a consistent UI with Chrome."},open_in_tab:{type:"boolean",default:!1,description:"If true, your extension's options page will be opened in a new tab rather than embedded in chrome://extensions. The default is false, and we recommend that you don't change it. This is only useful to delay the inevitable deprecation of the old options UI! It will be removed soon, so try not to use it. It will break."}}},permissions:{$ref:"#/definitions/permissions",description:"Permissions help to limit damage if your extension or app is compromised by malware. Some permissions are also displayed to users before installation, as detailed in Permission Warnings."},requirements:{type:"object",description:"Technologies required by the app or extension. Hosting sites such as the Chrome Web Store may use this list to dissuade users from installing apps or extensions that will not work on their computer.",additionalProperties:!1,properties:{plugins:{type:"object",description:"Indicates if an app or extension requires NPAPI to run. This requirement is enabled by default when the manifest includes the 'plugins' field.",required:["npapi"],additionalProperties:!1,properties:{npapi:{type:"boolean",default:!0}}},"3D":{type:"object",description:"The '3D' requirement denotes GPU hardware acceleration.",required:["features"],additionalProperties:!1,properties:{features:{type:"array",description:"List of the 3D-related features your app requires.",minItems:1,uniqueItems:!0,items:{type:"string",enum:["webgl"]}}}}}},sandbox:{type:"object",description:"Defines an collection of app or extension pages that are to be served in a sandboxed unique origin, and optionally a Content Security Policy to use with them.",required:["pages"],additionalProperties:!1,properties:{pages:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/page"}},content_security_policy:{$ref:"#/definitions/content_security_policy",default:"sandbox allow-scripts allow-forms"}}},short_name:{type:"string",description:"The short name is typically used where there is insufficient space to display the full name.",maxLength:12},update_url:{$ref:"#/definitions/uri",description:"If you publish using the Chrome Developer Dashboard, ignore this field. If you host your own extension or app: URL to an update manifest XML file."},tts_engine:{type:"object",description:"Register itself as a speech engine.",required:["voices"],additionalProperties:!1,properties:{voices:{type:"array",description:"Voices the extension can synthesize.",minItems:1,uniqueItems:!0,items:{type:"object",required:["voice_name","event_types"],additionalProperties:!1,properties:{voice_name:{type:"string",description:"Identifies the name of the voice and the engine used."},lang:{type:"string",description:"Almost always, a voice can synthesize speech in just a single language. When an engine supports more than one language, it can easily register a separate voice for each language."},gender:{type:"string",description:"If your voice corresponds to a male or female voice, you can use this parameter to help clients choose the most appropriate voice for their application."},event_types:{type:"array",description:"Events sent to update the client on the progress of speech synthesis.",minItems:1,uniqueItems:!0,items:{type:"string",description:"",enum:["start","word","sentence","marker","end","error"]}}}}}}},version_name:{type:"string",description:"In addition to the version field, which is used for update purposes, version_name can be set to a descriptive version string and will be used for display purposes if present."},chrome_settings_overrides:{},content_pack:{},current_locale:{},import:{},platforms:{},signature:{},spellcheck:{},storage:{},system_indicator:{}},required:["manifest_version","name","version"],then:{$comment:"browser_action and page_action are no longer present in v3",properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{service_worker:{type:"string",description:"The service worker js file."},type:{type:"string",enum:["module"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},host_permissions:{$ref:"#/definitions/permissions"},action:{$ref:"#/definitions/action_v3",description:"Used to control the toolbar button for your extension in Chrome's UI."},content_security_policy:{type:"object",properties:{extension_pages:{$ref:"#/definitions/content_security_policy",description:"This policy covers pages in your extension, including html files and service workers."},sandbox:{$ref:"#/definitions/content_security_policy",description:"This policy covers any sandboxed extension pages that your extension uses."}}},web_accessible_resources:{type:"array",description:"An array of objects that declare resource access rules. Each object maps an array of extension resources to an array of URLs and/or extension IDs that can access those resources.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/web_resource"}}},dependencies:{browser_action:{not:{required:["browser_action"]}},page_action:{not:{required:["page_action"]}}}},title:"JSON schema for Google Chrome extension manifest files",type:"object"};function Ta(t){t.addFormat("permission",{type:"string",validate:e=>typeof e=="string"&&e.trim()!==""}),t.addFormat("content-security-policy",{type:"string",validate:e=>typeof e=="string"}),t.addFormat("glob-pattern",{type:"string",validate:e=>typeof e=="string"&&/[\*\?\[\]]/.test(e)}),t.addFormat("match-pattern",{type:"string",validate:e=>e==="<all_urls>"||e==="file:///"||e.startsWith("http://localhost")||e.startsWith("http:// ")||e.startsWith("http://*:*/*")?!0:typeof e=="string"&&/^(\*|http|https|file|ftp):\/\//.test(e)}),t.addFormat("uri",{type:"string",validate:e=>typeof e=="string"&&/^(\w+:)?\/\//.test(e)}),t.addFormat("mime-type",{type:"string",validate:e=>typeof e=="string"&&/^[a-z]+\/[a-z0-9\-\+]+$/.test(e)})}var Ra=require("webpack");function Na(t,e,r){let s=e?.params.missingProperty;t.errors.push(new Ra.WebpackError(ci(r,s)))}var Ua=require("webpack");function qa(t,e,r){t.warnings.push(new Ua.WebpackError(ai(e,r)))}var Ba=require("webpack");function Es(t,e,r){t.warnings.push(new Ba.WebpackError(ni(r,e)))}var _r=class{options;constructor(e){this.options=e}handleSchemaErrors(e,r,s){let i=new Ja.default;Ta(i);let o={allOf:[Aa]},n=i.compile(o),c=S(r,s),p=n(c),l=c.manifest_version===3;if(!p&&n.errors){let u=n.errors[0];if(u?.keyword==="required"){Na(e,u,s);return}l&&(u?.keyword==="type"&&qa(e,u,s),u?.keyword==="not"&&Es(e,u,s))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(r,s)=>{let i=this.options.manifestPath,o=JSON.parse(Wa.default.readFileSync(i,"utf-8")),n=this.options.browser||"chrome";this.handleSchemaErrors(r,o,n),s()})}};var Va=a(require("fs")),Cs=a(require("path"));var $s=a(require("webpack"));function za(t,e){let r="Conflict: Multiple assets emit different content to the same filename ";if(e.message.includes(r)){let s=e.message.replace(r,"");if(s.startsWith("content_scripts"))return new $s.default.WebpackError(pi(t,s))}return null}function Ha(t,e){let r=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new $s.default.WebpackError(li(r.name)):null}var Sr=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let r=Cs.default.join(Cs.default.dirname(this.manifestPath),"package.json");if(!Va.default.existsSync(r))return;let s=require(r).name;e.hooks.compilation.tap("develop:common-errors",i=>{i.hooks.afterSeal.tapAsync("develop:common-errors",o=>{i.errors.forEach((n,c)=>{let p=za(s,n),l=Ha(s,n);p&&(i.errors[c]=p),l&&(i.errors[c]=l)}),o()})})}};var Pr=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new vr({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new _r({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new Sr({manifestPath:this.manifestPath}).apply(e)}};var mp=a(require("os")),Ms=a(require("path"));var vc=a(require("fs")),_c=a(require("path")),Sc=require("child_process");var be=a(require("path")),Xe=a(require("fs"));var Ga={alternate_error_pages:{enabled:!1},autofill:{enabled:!1},browser:{check_default_browser:!1,default_browser_setting_enabled:!1},default_apps:"install",distribution:{alternate_shortcut_text:!1,auto_launch_chrome:!1,import_bookmarks:!1,import_history:!1,import_home_page:!1,import_search_engine:!1,suppress_first_run_bubble:!0,do_not_register_for_update_launch:!0,make_chrome_default:!1,make_chrome_default_for_user:!1,require_eula:!1,suppress_first_run_default_browser_prompt:!0},dns_prefetching:{enabled:!1},download:{default_directory:"/tmp/",directory_upgrade:!0,open_pdf_in_adobe_reader:!1,prompt_for_download:!0},enable_do_not_track:!0,extensions:{theme:{use_system:!1},toolbarsize:-1,ui:{developer_mode:!0}},plugins:{plugins_list:[{enabled:!1,name:"Java(TM)"}],show_details:!0},profile:{password_manager_enabled:!1},safebrowsing:{enabled:!1,safebrowsingextended_reporting_enabled:!1},savefile:{default_directory:"/tmp",type:0},search:{suggest_enabled:!1},session:{restore_on_startup:1},sync:{suppress_start:!0},sync_promo:{show_on_first_run_allowed:!1,show_ntp_bubble:!1},translate:{enabled:!1}},Xa={...Ga},Za={...Ga};var y=require("@colors/colors/safe");function v(t,e){let r=e==="warn"?(0,y.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,y.cyan)("\u25BA\u25BA\u25BA"):e==="error"?`${(0,y.bold)((0,y.red)("ERROR"))} in ${ye(t)} ${(0,y.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,y.brightGreen)("\u25BA\u25BA\u25BA");return`${(0,y.gray)("")}${r}`}function ye(t){return t.charAt(0).toUpperCase()+t.slice(1)}function kr(t){let e=ye(t);return`${v(t,"info")} Creating new ${e} user profile...`}function Ka(t){return`${v(t,"success")} Instance already running.`}function Ya(t){return`${v(t,"info")} Instance exited.`}function Er(t,e){let r=t==="firefox"||t==="gecko-based"?"Add-on":"Extension";return`${v(t,"success")} ${ye(t)} ${r} running in ${(0,y.brightBlue)(e||"unknown")} mode.`}function Ge(t,e){let r=e=="null"?`Browser is not installed
112
+ of your ${(0,f.brightYellow)("extension.config.js")} is defined as your extension URL.`}var pt=class{static name="plugin-compilation";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new Si.default().apply(e),new it({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ot().apply(e),e.hooks.done.tapAsync("develop:brand",(r,s)=>{r.compilation.name=void 0;let i=r.endTime-r.startTime,o=require(this.manifestPath).name;console.log(Zs(o,i,r)),s()})}};var Bi=a(require("path")),Wi=a(require("mini-css-extract-plugin"));var Ni=a(require("mini-css-extract-plugin"));var ke=a(require("path")),Ee=a(require("fs"));var ie=a(require("path")),lt=a(require("fs")),Hr=require("child_process"),ki=require("package-manager-detector");function Ei(t,e){return Object.values(e||{}).some(r=>r===t)}function h(t,e,r){let s=ie.default.extname(e),o=$(e,r)?ie.default.normalize(e):t;return[".js",".jsx",".tsx",".ts"].includes(s)&&(o=o.replace(s,".js")),[".html",".njk",".nunjucks"].includes(s)&&(o=o.replace(s,".html")),[".css",".scss",".sass",".less"].includes(s)&&(o=o.replace(s,".css")),Vr(o||"")}function Vr(t){return t.replace(/\\/g,"/")}function $(t,e={}){if(!e)return!1;let r=ie.default.normalize(Vr(t));return Object.values(e).some(i=>typeof i!="string"?!1:Vr(i).includes(r))}function J(t,e){if(t.getAsset("manifest.json")||t.assets["manifest.json"]){let r=t.assets["manifest.json"].source().toString();return JSON.parse(r||"{}")}return require(e)}function oe(){return process.env.npm_config_user_agent&&process.env.npm_config_user_agent.includes("pnpm")?"pnpm":!1}function Pi(){return process.env.npm_execpath?"npm":!1}async function F(t,e){try{let r=await(0,ki.detect)();console.log(Ks(t,r?.name||"unknown"));let s="";r?.name==="yarn"?s=`yarn --silent add ${e.join(" ")} --cwd ${__dirname} --optional`:r?.name==="npm"||Pi()?s=`npm --silent install ${e.join(" ")} --prefix ${__dirname} --save-optional`:oe()?s=`pnpm --silent add ${e.join(" ")} --prefix ${__dirname} --save-optional`:s=`${r} --silent install ${e.join(" ")} --cwd ${__dirname} --optional`,(0,Hr.execSync)(s,{stdio:"inherit"}),await new Promise(i=>setTimeout(i,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Ys(t)),r?.name==="yarn"?s="yarn install --silent > /dev/null 2>&1":r?.name==="npm"||Pi()?s="npm install --silent > /dev/null 2>&1":oe()?s="pnpm install --silent > /dev/null 2>&1":s=`${r} install --silent > /dev/null 2>&1`,(0,Hr.execSync)(s,{stdio:"inherit"})),console.log(Qs(t))}catch(r){console.error(ei(t,r))}}function ft(t){let e=ie.default.join(t,"package.json");if(!lt.default.existsSync(e))return!1;let r=JSON.parse(lt.default.readFileSync(e,"utf-8")),s=["react","vue","@angular/core","svelte","solid-js","preact"],i=r.dependencies||{},o=r.devDependencies||{};for(let n of s)if(i[n]||o[n])return!0;return!1}function $i(t){return!lt.default.existsSync(ie.default.resolve(__dirname,`run-${t}-profile`))}function Ci(t){let e=t.name?.replace(/ /g,"-").toLowerCase();return{data:{id:`${e}@extension-js`,manifest:t,management:{id:`${e}@extension-js`,mayDisable:!0,optionsUrl:"",installType:"development",type:"extension",enabled:!0,name:t.name||"",description:t.description||"",version:t.version||"",hostPermissions:t.host_permissions||[],permissions:t.permissions||[],offlineEnabled:t.offline_enabled||!1,shortName:t.short_name||"",isApp:t.app&&t.app.background&&t.app.background.scripts}}}}function S(t,e){return JSON.parse(JSON.stringify(t),function(i,o){let n=i.indexOf(":");if(n===-1)return o;let c=i.substring(0,n);(c===e||c==="chromium"&&K.includes(e)||c==="chromium"&&e.includes("chromium")||c==="gecko"&&e.includes("gecko"))&&(this[i.substring(n+1)]=o)})}var ji=!1;function ut(t){let e=ke.default.join(t,"package.json");if(!Ee.default.existsSync(e))return!1;let r=rl(t),s=require(e),i=s.devDependencies&&s.devDependencies.tailwindcss,o=s.dependencies&&s.dependencies.tailwindcss,n=!!r&&!!(i||o);return n&&(ji||(process.env.EXTENSION_ENV==="development"&&console.log(_("Tailwind")),ji=!0)),n}function rl(t){let e=ke.default.join(t,"tailwind.config.mjs"),r=ke.default.join(t,"tailwind.config.cjs"),s=ke.default.join(t,"tailwind.config.js");if(Ee.default.existsSync(e))return e;if(Ee.default.existsSync(r))return r;if(Ee.default.existsSync(s))return s}var Di=a(require("path")),Li=a(require("fs"));var Fi=!1;function $e(t){let e=Di.default.join(t,"package.json");if(!Li.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.sass,i=r.dependencies&&r.dependencies.sass;return s||i?(Fi||(process.env.EXTENSION_ENV==="development"&&console.log(_("SASS")),Fi=!0),!0):!1}async function Ii(t,e){if(!$e(t))return[];try{require.resolve("sass-loader")}catch{await F("PostCSS",["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),await F("SASS",["sass","sass-loader","resolve-url-loader"]),console.log(D("SASS")),process.exit(0)}return[{test:/\.(s(a|c)ss)$/,exclude:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/inline_style/,use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/inline_style/,use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await T(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var Mi=a(require("path")),Ai=a(require("fs"));var Oi=!1;function Ce(t){let e=Mi.default.join(t,"package.json");if(!Ai.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.less,i=r.dependencies&&r.dependencies.less;return s||i?(Oi||(process.env.EXTENSION_ENV==="development"&&console.log(_("LESS")),Oi=!0),!0):!1}async function Ti(t,e){if(!Ce(t))return[];try{require.resolve("less-loader")}catch{await F("LESS",["less","less-loader","resolve-url-loader"]),console.log(D("LESS")),process.exit(0)}return[{test:/\.less$/,oneOf:[{resourceQuery:/inline_style/,use:await T(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await T(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var dt=a(require("path")),mt=a(require("fs"));var ne=!1;function sl(t){let e=dt.default.join(t,"package.json");if(!mt.default.existsSync(e))return!1;let r=[".postcssrc",".postcssrc.json",".postcssrc.yaml",".postcssrc.yml",".postcssrc.js",".postcssrc.cjs","postcss.config.js","postcss.config.cjs"];if(mt.default.existsSync(e)){let s=require(e);if(s.dependencies&&s.dependencies.postcss||s.devDependencies&&s.devDependencies.postcss)return ne||(process.env.EXTENSION_ENV==="development"&&console.log(_("PostCSS")),ne=!0),!0}for(let s of r)if(mt.default.existsSync(dt.default.join(t,s)))return ne||(process.env.EXTENSION_ENV==="development"&&console.log(_("PostCSS")),ne=!0),!0;return ut(t)?(ne||(process.env.EXTENSION_ENV==="development"&&console.log(_("PostCSS")),ne=!0),!0):!1}async function Ri(t,e){if(!sl(t))return{};try{require.resolve("postcss-loader")}catch{!$e(t)&&!Ce(t)&&await F("PostCSS",["postcss","postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),console.log(D("PostCSS")),process.exit(0)}return{loader:require.resolve("postcss-loader"),options:{postcssOptions:{parser:require.resolve("postcss-scss"),ident:"postcss",config:dt.default.resolve(t,"postcss.config.js"),plugins:[require.resolve("postcss-flexbugs-fixes"),[require.resolve("postcss-preset-env"),{autoprefixer:{flexbox:"no-2009"},stage:3}].filter(Boolean),require.resolve("postcss-normalize")].filter(Boolean)},sourceMap:e.mode==="development"}}}async function T(t,e){let r=Ni.default.loader,s=[e.useMiniCssExtractPlugin?r:{loader:require.resolve("style-loader")},{loader:require.resolve("css-loader"),options:{sourceMap:e.mode==="development"}}].filter(Boolean);if(ut(t)||$e(t)||Ce(t)){let i=await Ri(t,e);i.loader&&s.push(i)}return e.loader&&s.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:e.mode==="development",root:t}},{loader:require.resolve(e.loader),options:{sourceMap:e.mode==="development"}}),s.filter(Boolean)}var R=a(require("path")),N=a(require("fs"));function il(t){let e=R.default.join(t,"stylelint.config.json"),r=R.default.join(t,".stylelintrc.js file"),s=R.default.join(t,"stylelint.config.mjs"),i=R.default.join(t,".stylelintrc.mjs"),o=R.default.join(t,"stylelint.config.cjs"),n=R.default.join(t,".stylelintrc.cjs"),c=R.default.join(t,".stylelintrc.json"),p=R.default.join(t,".stylelintrc"),l=R.default.join(t,".stylelintrc.yml"),u=R.default.join(t,".stylelintrc.yaml");if(N.default.existsSync(e))return e;if(N.default.existsSync(r))return r;if(N.default.existsSync(s))return s;if(N.default.existsSync(i))return i;if(N.default.existsSync(o))return o;if(N.default.existsSync(n))return n;if(N.default.existsSync(c))return c;if(N.default.existsSync(p))return p;if(N.default.existsSync(l))return l;if(N.default.existsSync(u))return u}var Ui=!1;function ol(t){let e=R.default.join(t,"package.json");if(!N.default.existsSync(e))return!1;let s=!!il(t);return s&&(Ui||(process.env.EXTENSION_ENV==="development"&&console.log(_("Stylelint")),Ui=!0)),s}async function qi(t){return ol(t),[]}var gt=class t{static name="plugin-css";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async configureOptions(e){let r=e.options.mode||"development",s=Bi.default.dirname(this.manifestPath),i=[new Wi.default];i.forEach(l=>l.apply(e));let o=await qi(s);i.push(...o);let n=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{resourceQuery:/inline_style/,use:await T(s,{mode:r,useMiniCssExtractPlugin:!1})},{use:await T(s,{mode:r,useMiniCssExtractPlugin:r==="production"})}]},{test:/\.module\.css$/,oneOf:[{resourceQuery:/inline_style/,use:await T(s,{mode:r,useMiniCssExtractPlugin:!1})},{use:await T(s,{mode:r,useMiniCssExtractPlugin:r==="production"})}]}];e.options.plugins=[...e.options.plugins,...i].filter(Boolean);let c=await Ii(s,r),p=await Ti(s,r);n.push(...c),n.push(...p),e.options.module.rules=[...e.options.module.rules,...n].filter(Boolean)}async apply(e){if((e.options.mode||"development")==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var ht=class{static name="plugin-css";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async apply(e){let r={test:/\.svg$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2048}}},i=[...e.options.module.rules.some(o=>o&&o.test instanceof RegExp&&o.test.test(".svg")&&o.use!==void 0)?[]:[r],{test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"}},{test:/\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(csv|tsv)$/i,use:[require.resolve("csv-loader")],generator:{filename:"assets/[name][ext]"}}];e.options.module.rules=[...e.options.module.rules,...i].filter(Boolean)}};var je=a(require("path")),po=a(require("tsconfig-paths-webpack-plugin"));var Gr=a(require("path")),Xr=a(require("fs"));var Ji=!1,nl=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function al(t){let e=Gr.default.join(t,"package.json");if(!Xr.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies["babel-core"],i=r.dependencies&&r.dependencies["babel-core"],o=nl.some(n=>Xr.default.existsSync(Gr.default.join(t,n)))||!!s||!!i;return o&&(Ji||(process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(_("Babel")),Ji=!0)),o}async function zi(t,e){al(e)}var Vi=a(require("path")),Gi=a(require("fs"));var Hi=!1;function ae(t){let e=Vi.default.join(t,"package.json");if(!Gi.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.preact,i=r.dependencies&&r.dependencies.preact;return(s||i)&&(Hi||(process.env.EXTENSION_ENV==="development"&&console.log(_("Preact")),Hi=!0)),!!s||!!i}async function Xi(t){if(!ae(t))return;try{require.resolve("@prefresh/webpack")}catch{await F("Preact",["@prefresh/webpack"]),console.log(D("Preact")),process.exit(0)}return{plugins:[new(require("@prefresh/webpack"))],loaders:void 0,alias:{react:"preact/compat","react-dom/test-utils":"preact/test-utils","react-dom":"preact/compat","react/jsx-runtime":"preact/jsx-runtime"}}}var Ki=a(require("path")),Yi=a(require("fs"));var Zi=!1;function ce(t){let e=Ki.default.join(t,"package.json");if(!Yi.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.react,i=r.dependencies&&r.dependencies.react;return(s||i)&&(Zi||(process.env.EXTENSION_ENV==="development"&&console.log(_("React")),Zi=!0)),!!s||!!i}async function Qi(t){if(!ce(t))return;try{require.resolve("@pmmmwh/react-refresh-webpack-plugin")}catch{await F("React",["react-refresh","@pmmmwh/react-refresh-webpack-plugin","react-refresh-typescript"]),console.log(D("React")),process.exit(0)}return{plugins:[new(require("@pmmmwh/react-refresh-webpack-plugin"))({overlay:!1})],loaders:void 0,alias:void 0}}var to=a(require("path")),ro=a(require("fs"));var eo=!1;function Zr(t){let e=to.default.join(t,"package.json");if(!ro.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies.vue,i=r.dependencies&&r.dependencies.vue;return(s||i)&&(eo||(process.env.EXTENSION_ENV==="development"&&console.log(_("Vue")),eo=!0)),!!s||!!i}async function so(t){if(!Zr(t))return;try{require.resolve("vue-loader")}catch{await F("TypeScript",["typescript"]),await F("Vue",["vue-loader","vue-template-compiler","vue-style-loader"]),console.log(D("Vue")),process.exit(0)}let e=[{test:/\.vue$/,loader:require.resolve("vue-loader"),include:t,exclude:/node_modules/}];return{plugins:[new(require("vue-loader")).VueLoaderPlugin],loaders:e,alias:void 0}}var yt=a(require("path")),bt=a(require("fs"));var io=!1;function z(t){let e=yt.default.join(t,"package.json");if(!bt.default.existsSync(e))return!1;let r=pl(t),s=require(e),i=s.devDependencies&&s.devDependencies.typescript,o=s.dependencies&&s.dependencies.typescript;return io||((i||o)&&(r?process.env.EXTENSION_ENV==="development"&&console.log(_("TypeScript")):(console.log(gi()),ll(t))),io=!0),!!r&&!!(i||o)}function cl(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:ft(t)?"react-jsx":"preserve",lib:["dom","dom.iterable","esnext"],moduleResolution:"node",module:"esnext",resolveJsonModule:!0,strict:!0,target:"esnext",isolatedModules:!1,skipLibCheck:!0},exclude:["node_modules","dist"]}}function pl(t){let e=yt.default.join(t,"tsconfig.json");if(bt.default.existsSync(e))return e}function ll(t){bt.default.writeFileSync(yt.default.join(t,"tsconfig.json"),JSON.stringify(cl(t,{mode:"development"}),null,2))}var no=a(require("path")),ao=a(require("fs"));var oo=!1;function Kr(t){let e=no.default.join(t,"package.json");if(!ao.default.existsSync(e))return!1;let r=require(e),s=r.devDependencies&&r.devDependencies?.svelte,i=r.dependencies&&r.dependencies.svelte;return(s||i)&&(oo||(process.env.EXTENSION_ENV==="development"&&console.log(_("Svelte")),oo=!0)),!!s||!!i}async function co(t){if(!Kr(t))return;let e=process.env.NODE_ENV!=="production";try{require.resolve("svelte-loader")}catch{await F("TypeScript",["typescript"]),await F("Svelte",["svelte-loader","svelte-preprocess"]),console.log(D("Svelte")),process.exit(0)}return{plugins:void 0,loaders:[{test:/\.svelte$/,loader:require.resolve("svelte-loader"),include:t,exclude:/node_modules/,options:{compilerOptions:{dev:e},hotReload:e,preprocess:require("svelte-preprocess")()}}],alias:void 0}}var wt=class t{static name="plugin-js-frameworks";manifestPath;constructor(e){this.manifestPath=e.manifestPath}async configureOptions(e){let r=e.options.mode||"development",s=je.default.dirname(this.manifestPath),i=await zi(e,s),o=await Qi(s),n=await Xi(s),c=await so(s),p=await co(s);e.options.resolve.alias={...i?.alias||{},...o?.alias||{},...n?.alias||{},...c?.alias||{},...p?.alias||{},...e.options.resolve.alias},e.options.module.rules=[{test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[je.default.dirname(this.manifestPath)],exclude:/node_modules/,use:{loader:require.resolve("swc-loader"),options:{sync:!0,module:{type:"es6"},minify:r==="production",isModule:!0,jsc:{target:"es2016",parser:{syntax:z(s)?"typescript":"ecmascript",tsx:z(s)&&(ce(s)||ae(s)),jsx:!z(s)&&(ce(s)||ae(s)),dynamicImport:!0},transform:{react:{development:r==="development",refresh:r==="development",runtime:"automatic",importSource:"react"}}}}}},...i?.loaders||[],...o?.loaders||[],...n?.loaders||[],...c?.loaders||[],...p?.loaders||[],...e.options.module.rules].filter(Boolean),o?.plugins?.forEach(l=>l.apply(e)),n?.plugins?.forEach(l=>l.apply(e)),c?.plugins?.forEach(l=>l.apply(e)),p?.plugins?.forEach(l=>l.apply(e)),z(s)&&(e.options.resolve.plugins=[new po.default({configFile:je.default.resolve(je.default.dirname(this.manifestPath),"tsconfig.json")})])}async apply(e){if((e.options.mode||"development")==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var ge=a(require("path"));var Zo=a(require("path"));var lo=a(require("path"));function fo(t,e){if(!e||!e.action||!e.action.default_popup)return;let r=e.action.default_popup;return lo.default.join(t,r)}var uo=a(require("path"));function mo(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let r=e.browser_action.default_popup;return uo.default.join(t,r)}var xt=a(require("path"));function go(t,e){let r={newtab:void 0};if(!e||!e.chrome_url_overrides)return{"chrome_url_overrides/newtab":void 0};if(e.chrome_url_overrides.history){let s=e.chrome_url_overrides.history;r={"chrome_url_overrides/history":xt.default.join(t,s)}}if(e.chrome_url_overrides.newtab){let s=e.chrome_url_overrides.newtab;r={"chrome_url_overrides/newtab":xt.default.join(t,s)}}if(e.chrome_url_overrides.bookmarks){let s=e.chrome_url_overrides.bookmarks;r={"chrome_url_overrides/bookmarks":xt.default.join(t,s)}}return r}var ho=a(require("path"));function yo(t,e){if(!e||!e.devtools_page)return;let r=e.devtools_page;return ho.default.join(t,r)}var Yr=a(require("path"));function bo(t,e){if(e.options_page){let s=e.options_page;return Yr.default.join(t,s)}if(!e||!e.options_ui||!e.options_ui.page)return;let r=e.options_ui.page;return Yr.default.join(t,r)}var wo=a(require("path"));function xo(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let r=e.page_action.default_popup;return wo.default.join(t,r)}var vo=a(require("path"));function _o(t,e){if(!e||!e.sandbox||!e.sandbox.pages)return{"sandbox/page-0":void 0};let r=e.sandbox.pages,s={};for(let[i,o]of r.entries())s[`sandbox/page-${i}`]=vo.default.join(t,o);return s}var So=a(require("path"));function Po(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let r=e.side_panel.default_path;return So.default.join(t,r)}var ko=a(require("path"));function Eo(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let r=e.sidebar_action.default_panel;return ko.default.join(t,r)}function Fe(t,e){return{"action/default_popup":fo(t,e),"browser_action/default_popup":mo(t,e),...go(t,e),devtools_page:yo(t,e),"options_ui/page":bo(t,e),"page_action/default_popup":xo(t,e),..._o(t,e),"side_panel/default_path":Po(t,e),"sidebar_action/default_panel":Eo(t,e)}}var Qr=a(require("path"));function $o(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Qr.default.join(t,e.action.default_icon);let r=[];for(let s in e.action.default_icon)r.push(Qr.default.join(t,e.action.default_icon[s]));return r}var es=a(require("path"));function Co(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let r=[];if(typeof e.browser_action.default_icon=="string")return es.default.join(t,e.browser_action.default_icon);for(let s in e.browser_action.default_icon){let i=e.browser_action.default_icon[s]=es.default.join(t,e.browser_action.default_icon[s]);r.push(i)}return r}var ts=a(require("path"));function jo(t,e){if(!(!e||!e.browser_action||!e.browser_action.theme_icons)){for(let r of e.browser_action.theme_icons)r.light&&(r.light=ts.default.join(t,r.light)),r.dark&&(r.dark=ts.default.join(t,r.dark)),r.size&&delete r.size;return e.browser_action.theme_icons}}var Fo=a(require("path"));function Do(t,e){if(!e||!e.icons)return;let r=[];for(let s in e.icons){let i=Fo.default.join(t,e.icons[s]);r.push(i)}return r}var rs=a(require("path"));function Lo(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return rs.default.join(t,e.page_action.default_icon);let r=[];for(let s in e.page_action.default_icon){let i=rs.default.join(t,e.page_action.default_icon[s]);r.push(i)}return r}var Io=a(require("path"));function Oo(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:Io.default.join(t,e.sidebar_action.default_icon)}function Mo(t,e){return{action:$o(t,e),browser_action:Co(t,e),"browser_action/theme_icons":jo(t,e),icons:Do(t,e),page_action:Lo(t,e),sidebar_action:Oo(t,e)}}var Ao=a(require("path"));function To(t,e){let r={};return!e||!e.declarative_net_request||!e.declarative_net_request.rule_resources?{"declarative_net_request/rule_resources-0":void 0}:(e.declarative_net_request.rule_resources.forEach(i=>{r[`declarative_net_request/${i.id}`]=Ao.default.join(t,i.path)}),r)}var Ro=a(require("path"));function No(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let r=e.storage.managed_schema;return Ro.default.join(t,r)}function Uo(t,e){return{...To(t,e),"storage/managed_schema":No(t,e)}}var De=a(require("path")),Le=a(require("fs"));function qo(t,e){let r=De.default.join(De.default.dirname(e),"_locales"),s=[];if(Le.default.existsSync(r))for(let i of Le.default.readdirSync(r)){let o=De.default.join(r,i);if(o&&Le.default.statSync(o).isDirectory())for(let n of Le.default.readdirSync(o))s.push(De.default.join(t,"_locales",i,n))}return s}var Bo=a(require("path"));function Wo(t,e){if(!e||!e.background)return;let r=e.background.scripts;if(r)return r.map(s=>Bo.default.join(t,s))}var Jo=a(require("path"));function zo(t,e){if(!e||!e.background)return;let r=e.background.service_worker;if(r)return Jo.default.join(t,r)}var ss=a(require("path"));function Ho(t,e){if(!e||!e.content_scripts)return{"content_scripts/content-0":void 0};let r=o=>{if(o.js?.length!==0)return o.js?.map(n=>ss.default.join(t,n))},s=o=>{if(o.css?.length!==0)return o.css?.map(n=>ss.default.join(t,n))},i={};for(let[o,n]of e.content_scripts.entries()){let c=r(n),p=s(n);i[`content_scripts/content-${o}`]=[...(c||[]).filter(l=>l!=null),...(p||[]).filter(l=>l!=null)]}return i}var Vo=a(require("path"));function Go(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let r=e.user_scripts.api_script;return Vo.default.join(t,r)}function Ie(t,e){return{"background/scripts":Wo(t,e),"background/service_worker":zo(t,e),...Ho(t,e),"user_scripts/api_script":Go(t,e)}}function Xo(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function pe({manifestPath:t,browser:e}){let r=Zo.default.dirname(t),s=require(t),i=S(s,e||"chrome");return{html:Fe(r,i),icons:Mo(r,i),json:Uo(r,i),locales:qo(r,t),scripts:Ie(r,i),web_accessible_resources:Xo(i)}}var le=a(require("path"));var vt=a(require("fs")),Oe=a(require("path"));function _t(t,e){if(!vt.default.existsSync(t)||!vt.default.statSync(t).isDirectory())return[];let r=[];function s(i){let o=vt.default.readdirSync(i,{withFileTypes:!0});for(let n of o){let c=Oe.default.join(i,n.name);n.isDirectory()?s(c):n.isFile()&&e(n.name)&&r.push(c)}}return s(t),r}function St(t,e,r=""){return!e||!e.length?{}:e.reduce((s,i)=>{let o=Oe.default.extname(i),n=Oe.default.basename(i,o),c=r?`${r}/${n}`:Oe.default.relative(t,i);return{...s,[c]:i}},{})}function Ko({manifestPath:t}){let e=le.default.dirname(t),r={public:le.default.join(e,"public"),pages:le.default.join(e,"pages"),scripts:le.default.join(e,"scripts")},s={public:_t(r.public,()=>!0),pages:_t(r.pages,o=>o.endsWith(".html")),scripts:_t(r.scripts,o=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(le.default.extname(o)))};return{public:St(e,s.public),pages:St(e,s.pages,"pages"),scripts:St(e,s.scripts,"scripts")}}var Pt=a(require("path")),Yo=a(require("webpack")),kt=class{manifestPath;browser;includeList;excludeList;loaderOptions;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList,this.loaderOptions=e.loaderOptions}apply(e){new Yo.default.ProvidePlugin({r:[Pt.default.resolve(__dirname,"./resolver-module.mjs"),"default"]}).apply(e),e.options.module?.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,loader:require.resolve(Pt.default.resolve(__dirname,"./resolver-loader.js")),include:[Pt.default.dirname(this.manifestPath)],exclude:/node_modules/,options:{manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList,jsx:this.loaderOptions?this.loaderOptions.jsx:!1,typescript:this.loaderOptions?this.loaderOptions.typescript:!1,minify:this.loaderOptions?this.loaderOptions.minify:!1}})}};var Qo=a(require("fs")),$t=a(require("webpack")),en=require("webpack");var Et=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){e.hooks.compilation.tap("manifest:emit-manifest",r=>{r.hooks.processAssets.tap({name:"manifest:emit-manifest",stage:$t.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let s=this.manifestPath,i;try{let c=Qo.default.readFileSync(s,"utf-8");i=JSON.parse(c),"$schema"in i&&delete i.$schema}catch(c){r.errors.push(new $t.default.WebpackError(ui(c)));return}let o=JSON.stringify(i,null,2);r.emitAsset("manifest.json",new en.sources.RawSource(o))})})}};var Ln=a(require("path")),Me=require("webpack");function tn(t,e){return t.background&&t.background.scripts&&{background:{...t.background,...t.background.scripts&&{scripts:[...t.background.scripts.map(r=>h("background/scripts.js",r,e))]}}}}var rn=a(require("path"));var Ct=t=>rn.default.basename(t);function sn(t,e){return t.browser_action&&{browser_action:{...t.browser_action,...t.browser_action.default_popup&&{default_popup:h("browser_action/default_popup.html",t.browser_action.default_popup,e)},...t.browser_action.default_icon&&{default_icon:typeof t.browser_action.default_icon=="string"?h(`icons/${Ct(t.browser_action.default_icon)}`,t.browser_action.default_icon,e):Object.fromEntries(Object.entries(t.browser_action.default_icon).map(([r,s])=>[r,h(`icons/${Ct(s)}`,s,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(r=>({...r,...r.light&&{light:h(`browser_action/${Ct(r.light)}`,r.light,e)},...r.dark&&{dark:h(`browser_action/${Ct(r.dark)}`,r.dark,e)}}))}}}}function on(t,e){return t.declarative_net_request&&{declarative_net_request:{...t.declarative_net_request,rule_resources:t.declarative_net_request.rule_resources.map(r=>({...r,path:r.path&&h(`declarative_net_request/${r.id}.json`,r.path,e)}))}}}function nn(t,e){return{...tn(t,e),...sn(t,e),...on(t,e)}}var cn=a(require("path"));var an=t=>cn.default.basename(t);function pn(t,e){return t.action&&{action:{...t.action,...t.action.default_popup&&{default_popup:h("action/default_popup.html",t.action.default_popup,e)},...t.action.default_icon&&{default_icon:typeof t.action.default_icon=="string"?h(`action/${an(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([r,s])=>[r,h(`action/${an(s)}`,s,e)]))}}}}function ln(t,e){return t.background&&t.background.service_worker&&{background:{...t.background,...t.background.service_worker&&{service_worker:h("background/service_worker.js",t.background.service_worker,e)}}}}function jt(t,e){return t.side_panel&&{side_panel:{...t.side_panel.default_path&&{default_path:h("side_panel/default_path.html",t.side_panel.default_path,e)}}}}function fn(t,e){return{...pn(t,e),...ln(t,e),...jt(t,e)}}function un(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function mn(t,e){return t.chrome_url_overrides&&{chrome_url_overrides:{...t.chrome_url_overrides.bookmarks&&{bookmarks:h("chrome_url_overrides/bookmarks.html",t.chrome_url_overrides.bookmarks,e)},...t.chrome_url_overrides.history&&{history:h("chrome_url_overrides/history.html",t.chrome_url_overrides.history,e)},...t.chrome_url_overrides.newtab&&{newtab:h("chrome_url_overrides/newtab.html",t.chrome_url_overrides.newtab,e)}}}}function dn(t,e){return t.content_scripts&&{content_scripts:t.content_scripts.map((r,s)=>{let i=[...new Set(r.js)],o=[...new Set(r.css)];return{...r,js:[...i.map(n=>h(`content_scripts/content-${s}.js`,n,e))],css:[...o.map(n=>h(`content_scripts/content-${s}.css`,n,e))]}})}}function gn(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var hn=a(require("path"));var fl=t=>hn.default.basename(t);function yn(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([r,s])=>[r,h(`icons/${fl(s)}`,s,e)]))}}function bn(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function wn(t,e){return t.options_ui&&{options_ui:{...t.options_ui,...t.options_ui.page&&{page:h("options_ui/page.html",t.options_ui.page,e)}}}}var vn=a(require("path"));var xn=t=>vn.default.basename(t);function _n(t,e){return t.page_action&&{page_action:{...t.page_action,...t.page_action.default_popup&&{default_popup:h("page_action/default_popup.html",t.page_action.default_popup,e)},...t.page_action.default_icon&&{default_icon:typeof t.page_action.default_icon=="string"?h(`icons/${xn(t.page_action.default_icon)}`,t.page_action.default_icon,e):Object.fromEntries(Object.entries(t.page_action.default_icon).map(([r,s])=>[r,h(`icons/${xn(s)}`,s,e)]))}}}}function Sn(t,e){return t.sandbox&&{sandbox:{...t.sandbox,...t.sandbox.pages&&{pages:t.sandbox.pages.map((r,s)=>h(`sandbox/page-${s}.html`,r,e))}}}}var Pn=a(require("path"));var ul=t=>Pn.default.basename(t);function kn(t,e){return t.sidebar_action&&{sidebar_action:{...t.sidebar_action,...t.sidebar_action.default_panel&&{default_panel:h("sidebar_action/default_panel.html",t.sidebar_action.default_panel,e)},...t.sidebar_action.default_icon&&{default_icon:h(`icons/${ul(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function En(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var $n=a(require("path"));var ml=t=>$n.default.basename(t);function Cn(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${ml(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function jn(t,e){return t.user_scripts&&{user_scripts:{...t.user_scripts,...t.user_scripts.api_script&&{api_script:h("user_scripts/api_script.js",t.user_scripts.api_script,e)}}}}function Fn(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function Dn(t,e){return{...un(t,e),...mn(t,e),...dn(t,e),...gn(t,e),...yn(t,e),...bn(t,e),...wn(t,e),..._n(t,e),...Sn(t,e),...jt(t,e),...kn(t,e),...En(t,e),...Cn(t,e),...jn(t,e),...Fn(t)}}function is(t,e,r){let s=e||require(t);return JSON.stringify({...s,...Dn(s,r),...nn(s,r),...fn(s,r)},null,2)}var Ft=class{manifestPath;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.excludeList=e.excludeList}applyDevOverrides(e){return e.content_scripts?e.content_scripts.map((r,s)=>(r.css.length&&!r.js.length&&(r.js=[h(`content_scripts-${s}`,"dev.js",{})]),r)):{}}applyProdOverrides(e,r){if(!r.content_scripts)return{};let s=e.options.output?.path||"",i=e.getAssets().filter(o=>o.name.includes("content_scripts")&&o.name.endsWith(".css")).map(o=>Ln.default.join(s,o.name));for(let o of r.content_scripts)o.css=i.map((n,c)=>h(`content_scripts/content-${c}.css`,n,{}));return r.content_scripts}apply(e){e.hooks.thisCompilation.tap("manifest:update-manifest",r=>{r.hooks.processAssets.tap({name:"manifest:update-manifest",stage:Me.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(r.errors.length>0)return;let s=J(r,this.manifestPath),i=is(this.manifestPath,s,this.excludeList||{}),o={...s,...JSON.parse(i)};e.options.mode==="development"&&o.content_scripts&&(o.content_scripts=this.applyDevOverrides(o));let n=JSON.stringify(o,null,2),c=new Me.sources.RawSource(n);r.updateAsset("manifest.json",c)}),e.options.mode==="production"&&r.hooks.afterOptimizeAssets.tap("manifest:update-manifest",()=>{if(r.errors.length>0)return;let s=J(r,this.manifestPath),i=is(this.manifestPath,s,this.excludeList||{}),o={...s,...JSON.parse(i)};o.content_scripts&&(o.content_scripts=this.applyProdOverrides(r,o));let n=JSON.stringify(o,null,2),c=new Me.sources.RawSource(n);r.updateAsset("manifest.json",c)})})}};var In=a(require("fs")),Dt=class{dependencyList;constructor(e){this.dependencyList=e}apply(e){e.hooks.afterCompile.tap("ManifestPlugin (AddDependenciesPlugin)",r=>{if(r.errors?.length)return;let s=new Set(r.fileDependencies);this.dependencyList&&this.dependencyList.forEach(i=>{In.default.existsSync(i)&&(s.has(i)||(s.add(i),r.fileDependencies.add(i)))})})}};var On=a(require("fs")),Mn=a(require("path")),It=a(require("webpack"));var Lt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}extractPaths(e){let r=Array.isArray(e)?e:[e];if(typeof r[0]=="string")return r;let s=[];if(typeof e=="object"&&!Array.isArray(e)){let i=e;i.light&&s.push(i.light),i.dark&&s.push(i.dark)}return s}handleErrors(e,r){let s=[".png",".jpg",".jpeg",".svg",".gif",".webp"],i=[".json"],o=[".js",".ts",".jsx",".tsx",".mjs",".cjs"],n=".html",c=Object.entries(this.includeList||{});for(let[p,l]of c)if(l){let u=this.extractPaths(l);for(let m of u){let g=Mn.default.extname(m),b=require(this.manifestPath),P=S(b,"chrome").name||"Extension.js";if(!On.default.existsSync(m)){if(m.startsWith("/"))return;let k=se(P,p,m);s.includes(g)?e.errors.push(new r(k)):i.includes(g)?e.errors.push(new r(k)):o.includes(g)?e.errors.push(new r(k)):g===n?e.errors.push(new r(k)):e.errors.push(new r(k))}}}}apply(e){e.hooks.compilation.tap("manifest:check-manifest-files",r=>{r.hooks.processAssets.tap({name:"compatibility:check-manifest-files",stage:It.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let s=It.default.WebpackError;this.handleErrors(r,s)})})}};var An=a(require("fs")),Mt=a(require("webpack"));var Ot=class{manifestPath;browser;includeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList}flattenAndSort(e){return e.flat(1/0).sort()}apply(e){e.hooks.watchRun.tapAsync("manifest:throw-if-recompile-is-needed",(r,s)=>{if((r.modifiedFiles||new Set).has(this.manifestPath)){let o=r.options.context||"",n=`${o}/package.json`;if(!An.default.existsSync(n)){s();return}let c=require(this.manifestPath),p=S(c,this.browser),l=this.flattenAndSort(Object.values(Fe(o,p))),u=this.flattenAndSort(Object.values(Ie(o,p)));r.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",m=>{m.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:Mt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let b=m.getAsset("manifest.json")?.source.source().toString(),j=JSON.parse(b||"{}"),P=this.flattenAndSort(Object.values(Fe(o,j))),k=this.flattenAndSort(Object.values(Ie(o,j)));if(u.toString()!==k.toString()||l.toString()!==P.toString()){let A=l.filter(W=>!P.includes(W))[0],U=P.filter(W=>!l.includes(W))[0],Se=mi(U,A);m.errors.push(new Mt.default.WebpackError(Se))}})})}s()})}};var At=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Et({manifestPath:this.manifestPath}).apply(e),new Lt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ft({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new Dt([this.manifestPath]).apply(e),new Ot({manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList}).apply(e)}};var ps=a(require("path"));var ns=a(require("fs")),Nt=a(require("webpack")),qn=require("webpack");var Tn=a(require("fs")),ue=a(require("path")),Rn=a(require("parse5-utils"));var fe=a(require("parse5-utils"));function Tt(t){try{return new URL(t),!0}catch{return!1}}function Ae(t,e){let{childNodes:r=[]}=t;for(let s of r)if(s.nodeName==="script"){let i=fe.default.getAttribute(s,"src");if(!i||Tt(i))continue;e({filePath:i,childNode:s,assetType:"script"})}else if(s.nodeName==="link"){let i=fe.default.getAttribute(s,"href"),o=fe.default.getAttribute(s,"rel");if(!i||Tt(i))continue;e(o==="dns-prefetch"||o==="icon"||o==="manifest"||o==="modulepreload"||o==="preconnect"||o==="prefetch"||o==="preload"||o==="prerender"?{filePath:i,childNode:s,assetType:"staticHref"}:{filePath:i,childNode:s,assetType:"css"})}else if(s.nodeName==="a"||s.nodeName==="area"){let i=fe.default.getAttribute(s,"href");if(!i||Tt(i))continue;e({filePath:i,childNode:s,assetType:"staticHref"})}else if(s.nodeName==="audio"||s.nodeName==="embed"||s.nodeName==="iframe"||s.nodeName==="img"||s.nodeName==="input"||s.nodeName==="source"||s.nodeName==="track"||s.nodeName==="video"){let i=fe.default.getAttribute(s,"src");if(!i||Tt(i))continue;e({filePath:i,childNode:s,assetType:"staticSrc"})}else Ae(s,e)}function L(t,e){let r={css:[],js:[],static:[]};if(!t)return r;let s=e||Tn.default.readFileSync(t,{encoding:"utf8"}),i=Rn.default.parse(s),o=(n,c)=>ue.default.join(ue.default.dirname(n),c.startsWith("/")?ue.default.relative(ue.default.dirname(n),c):c);for(let n of i.childNodes)if(n.nodeName==="html"){for(let c of n.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&Ae(c,({filePath:p,assetType:l})=>{let u=o(t,p);switch(l){case"script":r.js?.push(u);break;case"css":r.css?.push(u);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;r.static?.push(u);break;default:break}});return{css:r.css,js:r.js,static:r.static}}}function Nn(t,e,r){let s=Object.keys(t).find(o=>{let n=t[o];return t[o]===e||L(n)?.js?.includes(e)||L(n)?.css?.includes(e)})||"",i=os(e);return s?`/${s.replace(i,"")}${r}`:`${e.replace(i,"")}${r}`}function os(t){switch(ue.default.extname(t)){case".js":case".mjs":case".ts":case".tsx":return".js";case".css":case".scss":case".sass":case".less":return".css";case".html":return".html";default:return".js"}}function V(t,e,r){return r?`/${t}${e}`:`${t}${e}`}function Un(t,e){return Object.values(e||{}).some(r=>r===t)}var Rt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let r=require(this.manifestPath),i=S(r,"chrome").name||"Extension.js";e.hooks.thisCompilation.tap("html:emit-html-file",o=>{o.hooks.processAssets.tap({name:"AddAssetsToCompilationPlugin",stage:Nt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=Object.entries(this.includeList||{});for(let c of n){let[p,l]=c;if(l){if(!ns.default.existsSync(l)){let m=se(i,p,l);o.warnings.push(new Nt.default.WebpackError(m));return}let u=ns.default.readFileSync(l,"utf8");if(!$(l,this.excludeList)){let m=new qn.sources.RawSource(u),g=V(p,".html");o.emitAsset(g,m)}}}})})}};var Ut=a(require("fs")),me=a(require("path")),Bn=a(require("webpack")),Te=require("webpack");var qt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-assets-to-compilation",r=>{r.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Te.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{if(r.errors.length>0)return;let s=Object.entries(this.includeList||{});for(let i of s){let[o,n]=i,c=o+".html";if(n){let p=r.getAsset(c);if(p){let l=p.source.source().toString(),u=L(n,l)?.static,m=[...new Set(u)];for(let g of m)if(!g.startsWith("/")){if(!Ut.default.existsSync(g)&&!Un(g,this.includeList)&&!me.default.basename(g).startsWith("#")){let A=at(n,g);g.startsWith("/")||r.warnings.push(new Bn.default.WebpackError(A));return}let b=Ut.default.readFileSync(g),j=new Te.sources.RawSource(b),P=me.default.join("assets",me.default.basename(g));if(!r.getAsset(P))if(g.endsWith(".html")){let k=L(g),A=[...k?.js||[],...k?.css||[],...k?.static||[]];r.emitAsset(P,j),A.forEach(U=>{let Se=Ut.default.readFileSync(U),W=new Te.sources.RawSource(Se),Js=me.default.join("assets",me.default.basename(U));r.getAsset(Js)||r.emitAsset(Js,W)})}else r.emitAsset(P,j)}}}}})})}};var Wn=a(require("path")),as=a(require("fs"));var Bt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let r=this.includeList||{};for(let s of Object.entries(r)){let[i,o]=s;if(o){if(!as.default.existsSync(o))return;let n=L(o),c=n?.js||[],p=n?.css||[],l=[...c,...p].filter(u=>!$(u,this.excludeList));if(e.options.mode==="development"){let u=Wn.default.resolve(__dirname,"minimum-script-file.mjs");l.push(u)}as.default.existsSync(o)&&($(o,this.excludeList)||(e.options.entry={...e.options.entry,[i]:{import:l}}))}}}};var Jt=require("webpack");var cs=a(require("fs")),G=a(require("path")),I=a(require("parse5-utils"));function Jn(t,e,r,s,i){let o=cs.default.readFileSync(r,{encoding:"utf8"}),n=I.default.parse(o),c=!!t.getAsset(e+".css"),p=!1;for(let l of n.childNodes)if(l.nodeName==="html"){for(let u of l.childNodes){if((u.nodeName==="head"||u.nodeName==="body")&&Ae(u,({filePath:m,childNode:g,assetType:b})=>{let j=G.default.dirname(r),P=G.default.resolve(j,m),k=os(P),A=$(G.default.resolve(j,m),i),U=G.default.join("/",G.default.normalize(m)),Se=Ei(P,s);switch(b){case"script":{A?l=I.default.setAttribute(g,"src",U):(l=I.default.remove(g),p=!0);break}case"css":{A?l=I.default.setAttribute(g,"href",U):(l=I.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(A)l=I.default.setAttribute(g,b==="staticSrc"?"src":"href",U);else if(Se){let W=Nn(s,P,k);l=I.default.setAttribute(g,b==="staticSrc"?"src":"href",W)}else{let W=G.default.join("assets",G.default.basename(P,k));cs.default.existsSync(P)&&(l=I.default.setAttribute(g,b==="staticSrc"?"src":"href",V(W,"",!0)))}break}default:break}}),u.nodeName==="head"&&c&&t.options.mode==="production"){let m=I.default.createNode("link");m.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:V(e,".css",!0)}],I.default.append(u,m)}if(u.nodeName==="body"&&(p||t.options.mode!=="production")){let m=I.default.createNode("script");m.attrs=[{name:"src",value:V(e,".js",!0)}],I.default.append(u,m)}}return I.default.serialize(n)}}var Wt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("html:update-html-file",r=>{r.hooks.processAssets.tap({name:"html:update-html-file",stage:Jt.Compilation.PROCESS_ASSETS_STAGE_DERIVED},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i;if(n){let c=Jn(r,o,n,s,this.excludeList||{});if(!$(n,this.excludeList)&&c){let p=new Jt.sources.RawSource(c),l=V(o,".html");r.updateAsset(l,p)}}}})})}};var zn=a(require("fs")),Hn=require("webpack");var zt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-to-file-dependencies",r=>{r.hooks.processAssets.tap({name:"html:add-to-file-dependencies",stage:Hn.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i;if(o){let n=L(o),c=new Set(r.fileDependencies);if(zn.default.existsSync(o)){let p=[o,...n?.static||[]];for(let l of p)c.has(l)||(c.add(l),l===o&&r.fileDependencies.add(l))}}}})})}};var Vn=a(require("fs"));var Ht=class{manifestPath;includeList;initialHtmlAssets={};constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}hasEntriesChanged(e,r){if(!r||!e||e.length!==r.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==r[s])return!0;return!1}storeInitialHtmlAssets(e){Object.entries(e).forEach(([r,s])=>{let i=s;if(i){if(!Vn.default.existsSync(i)){let o=require(this.manifestPath),c=S(o,"chrome").name||"Extension.js";console.error(se(c,r,i)),process.exit(1)}this.initialHtmlAssets[i]={js:L(i)?.js||[],css:L(i)?.css||[]}}})}apply(e){let r=this.includeList||{};this.storeInitialHtmlAssets(r),e.hooks.make.tapAsync("html:throw-if-recompile-is-needed",(s,i)=>{let o=e.modifiedFiles||new Set,n=Array.from(o)[0];if(n&&this.initialHtmlAssets[n]){let c=L(n)?.js||[],p=L(n)?.css||[],{js:l,css:u}=this.initialHtmlAssets[n];(this.hasEntriesChanged(p,u)||this.hasEntriesChanged(c,l))&&console.log(wi(n))}i()})}};var Gn=a(require("fs")),Xn=require("webpack");function gl(t,e){let r="Module not found: Error: Can't resolve ",i=e.message.replace(r,"").split("'")[1];if(e.message.includes(r))for(let o of Object.entries(t)){let[,n]=o;if(n){if(!Gn.default.existsSync(n))return null;let c=L(n),p=c?.js?.filter(u=>!u.startsWith("/"))||[],l=c?.css?.filter(u=>!u.startsWith("/"))||[];if(p.includes(i)||l.includes(i)){let u=at(n,i);return new Xn.WebpackError(u)}}}return null}var Vt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.compilation.tap("html:handle-common-errors",r=>{r.hooks.afterSeal.tapPromise("html:handle-common-errors",async()=>{r.errors.forEach((s,i)=>{let o=gl(this.includeList||{},s);o&&(r.errors[i]=o)})})})}};var Gt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Rt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new qt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Bt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Wt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[ps.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(ps.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),new zt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ht({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Vt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var Re=a(require("path"));var ls=a(require("fs")),Zn=a(require("path"));function Kn(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>{let o=ls.default.existsSync(i)&&!$(i,e),n=Zn.default.extname(i);return o&&(n===".js"||n===".mjs"||n===".jsx"||n===".ts"||n===".tsx")})}function Yn(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>ls.default.existsSync(i)&&!$(i,e)&&(i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")||i.endsWith(".less")))}var Xt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let r=this.includeList||{},s={};for(let[i,o]of Object.entries(r)){let n=Kn(o,this.excludeList),c=Yn(o,this.excludeList),p=[...n];e.options.mode==="production"&&p.push(...c),(c.length||n.length)&&(s[i]={import:p})}e.options.entry={...e.options.entry,...s}}};var Y=require("webpack"),hl=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],yl=[...hl,`var runtime = isBrowser ? browser : isChrome ? chrome : (typeof self === 'object' && self.addEventListener) ? { get runtime() { throw new Error("No chrome or browser runtime found") } } : { runtime: { getURL: x => x } }`],Zt=class t{apply(e){let{RuntimeGlobals:r}=e.webpack;e.hooks.compilation.tap("PublicPathRuntimeModule",s=>{s.hooks.runtimeRequirementInTree.for(r.publicPath).tap(t.name,i=>{let o=bl();return s.addRuntimeModule(i,o),!0})})}};function bl(){class t extends Y.RuntimeModule{constructor(){super("publicPath",Y.RuntimeModule.STAGE_BASIC)}generate(){let r=this.compilation?.outputOptions.publicPath;return Y.Template.asString([...yl,`var path = ${JSON.stringify(this.compilation?.getPath(r||"",{hash:this.compilation.hash||"XXXX"}))}`,`${Y.RuntimeGlobals.publicPath} = typeof importScripts === 'function' || !(isBrowser || isChrome) ? path : runtime.runtime.getURL(path);`])}}return new t}var Kt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let r=require(this.manifestPath),s=S(r,this.browser);s.content_scripts?.some(i=>i.world&&i.world.toLowerCase()==="main")&&K.includes(this.browser)&&!s.key&&(console.error(_i()),process.exit(1))}};var Yt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Xt({manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Re.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Re.default.join(__dirname,"inject-content-css-during-dev.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="development"&&e.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Re.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Re.default.join(__dirname,"add-hmr-accept-code.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="production"&&new Zt().apply(e),new Kt({manifestPath:this.manifestPath,browser:this.browser||"chrome",includeList:this.includeList||{},excludeList:this.excludeList||{}}).apply(e)}};var Ue=a(require("path")),qe=a(require("fs")),us=a(require("webpack")),Be=require("webpack");var de=a(require("path")),Ne=a(require("fs"));function fs(t){let e=de.default.join(de.default.dirname(t),"_locales"),r=[];if(Ne.default.existsSync(e))for(let s of Ne.default.readdirSync(e)){let i=de.default.join(e,s);if(i&&Ne.default.statSync(i).isDirectory())for(let o of Ne.default.readdirSync(i))r.push(de.default.join(de.default.dirname(t),"_locales",s,o))}return r}var Qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("locales:module",r=>{r.hooks.processAssets.tap({name:"locales:module",stage:Be.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(!qe.default.existsSync(this.manifestPath)){let i=require(this.manifestPath),n=S(i,"chrome").name||"Extension.js";r.errors.push(new us.default.WebpackError(fi(n,this.manifestPath)));return}if(r.errors.length>0)return;let s=fs(this.manifestPath);for(let i of Object.entries(s||[])){let[o,n]=i,c=n;if(c){if(Ue.default.extname(c)!==".json")continue;if(!qe.default.existsSync(c)){r.warnings.push(new us.default.WebpackError(ct(o,c)));return}let p=qe.default.readFileSync(c),l=new Be.sources.RawSource(p),u=e.options.context||Ue.default.dirname(this.manifestPath);if(!$(c,this.excludeList)){let m=Ue.default.relative(u,c);r.emitAsset(m,l)}}}})}),e.hooks.thisCompilation.tap("locales:module",r=>{r.hooks.processAssets.tap({name:"locales:module",stage:Be.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=fs(this.manifestPath);for(let i of Object.entries(s||[])){let[,o]=i;if(o){let n=new Set(r.fileDependencies),c=s||[];for(let p of c)qe.default.existsSync(p)&&Ue.default.extname(p)===".json"&&(n.has(p)||(n.add(p),r.fileDependencies.add(p)))}}})})}};var er=a(require("fs")),Qn=a(require("webpack")),We=require("webpack");var tr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("json:module",r=>{r.hooks.processAssets.tap({name:"json:module",stage:We.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i,c=Array.isArray(n)?n:[n];for(let p of c)if(p&&!$(p,this.excludeList)){if(!er.default.existsSync(p)){r.warnings.push(new Qn.default.WebpackError(ct(o,p)));return}let l=er.default.readFileSync(p),u=new We.sources.RawSource(l);r.emitAsset(o+".json",u)}}})}),e.hooks.thisCompilation.tap("json:module",r=>{r.hooks.processAssets.tap({name:"json:module",stage:We.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i,n=Array.isArray(o)?o:[o];for(let c of n)if(c){let p=new Set(r.fileDependencies);$(c,this.excludeList)||er.default.existsSync(c)&&(p.has(c)||(p.add(c),r.fileDependencies.add(c)))}}})})}};var ms=a(require("fs")),ea=a(require("path")),sr=require("webpack");var rr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:emit-file",r=>{r.hooks.processAssets.tap({name:"icons:emit-file",stage:sr.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER},()=>{if(r.errors.length>0)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[o,n]=i;if(n===void 0)continue;let c=Array.isArray(n)?typeof n[0]=="string"?n:n.map(Object.values).flat():[n];for(let p of c)if(p){if(!ms.default.existsSync(p))continue;if(!$(p,this.excludeList)){let l=ms.default.readFileSync(p),u=new sr.sources.RawSource(l),m=ea.default.basename(p),b=`${o.endsWith("theme_icons")?o.replace("theme_icons",""):o}/${m}`;r.emitAsset(b,u)}}}})})}};var ta=a(require("fs")),ra=require("webpack"),ir=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:add-to-file-dependencies",r=>{r.hooks.processAssets.tap({name:"icons:add-to-file-dependencies",stage:ra.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(r.errors?.length)return;let s=this.includeList||{};for(let i of Object.entries(s)){let[,o]=i,n=Array.isArray(o)?typeof o[0]=="string"?o:o.map(Object.values).flat():[o];for(let c of n)if(c){let p=new Set(r.fileDependencies);ta.default.existsSync(c)&&(p.has(c)||(p.add(c),r.fileDependencies.add(c)))}}})})}};var or=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new rr({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new ir({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ar=require("webpack");function sa(t){return t.map(e=>{try{let r=new URL(e.replace(/^\*:\/\//,"https://"));return e.endsWith(r.pathname)?`${e.substring(0,e.length-r.pathname.length)}/*`:r.pathname==="/"?`${e}/*`:e}catch{return e}})}var nr=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}generateManifestPatches(e,r){let s=J(e,this.manifestPath),i=s.web_accessible_resources||[],o=s.web_accessible_resources||[];for(let[p,l]of Object.entries(r)){let u=s.content_scripts?.find(m=>m.js&&m.js.some(g=>g.includes(p)));if(u){let m=u.matches||[];if(s.manifest_version===3){let g=i.find(b=>b.matches.some(j=>m.includes(j)));g?l.forEach(b=>{!g.resources.includes(b)&&!b.endsWith(".map")&&g.resources.push(b)}):i.push({resources:l.filter(b=>!b.endsWith(".map")),matches:sa(m)})}else l.forEach(g=>{o.includes(g)||o.push(g)})}}s.manifest_version===3?i.length>0&&(s.web_accessible_resources=i):o.length>0&&(s.web_accessible_resources=Array.from(new Set(o)));let n=JSON.stringify(s,null,2),c=new ar.sources.RawSource(n);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",c)}apply(e){e.hooks.thisCompilation.tap("plugin-extension:feature-web-resources",r=>{r.hooks.processAssets.tap({name:"plugin-extension:feature-web-resources",stage:ar.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{let s=[],i=Object.keys(this.includeList||{});for(let c of i.filter(Boolean))c.startsWith("content_scripts")&&(Array.isArray(c)?s.push(...c):typeof c=="string"&&s.push(c));let o=r.chunkGraph,n={};r.entrypoints.forEach((c,p)=>{if(s.includes(p)){let l=[];c.chunks.forEach(u=>{Array.from(o.getChunkModulesIterable(u)).forEach(g=>{o.getModuleChunks(g).forEach(b=>{b.auxiliaryFiles.forEach(j=>{l.includes(j)||l.push(j)})})})}),n[p]=l}}),this.generateManifestPatches(r,n)})})}};var O=a(require("fs")),M=a(require("path")),ia=a(require("chokidar")),cr=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let r=M.default.dirname(e);if(O.default.existsSync(r))return!0;O.default.mkdirSync(r,{recursive:!0})}copyFile(e,r){this.ensureDirectoryExistence(r),O.default.copyFileSync(e,r)}copyFolder(e,r){O.default.existsSync(r)||O.default.mkdirSync(r,{recursive:!0}),O.default.readdirSync(e).forEach(i=>{let o=M.default.join(e,i),n=M.default.join(r,i);O.default.statSync(o).isDirectory()?this.copyFolder(o,n):this.copyFile(o,n)})}apply(e){let r=M.default.dirname(this.options.manifestPath),s=M.default.join(r,"public"),i=e.options.output?.path||"";O.default.existsSync(s)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let o=M.default.join(i,"/");O.default.existsSync(o)||O.default.mkdirSync(o,{recursive:!0}),O.default.existsSync(s)&&this.copyFolder(s,o)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let o=M.default.join(r,"public"),n=ia.default.watch(o,{ignoreInitial:!0});n.on("add",c=>{let p=M.default.join(i,M.default.relative(r,c));this.copyFile(c,p)}),n.on("change",c=>{let p=M.default.join(i,M.default.relative(r,c));this.copyFile(c,p)}),n.on("unlink",c=>{let p=M.default.join(i,M.default.relative(r,c));O.default.existsSync(p)&&O.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{n.close().catch(console.error)})}))}};var q=a(require("path")),ds=a(require("chokidar"));var pr=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,r,s){let i=q.relative(process.cwd(),r),c=di(s?"Adding":"Removing",e,e==="pages"?"HTML pages":"script files",i);if(s){console.warn(c);return}console.error(c),process.exit(1)}apply(e){e.hooks.afterPlugins.tap("special-folders:warn-upon-folder-changes",()=>{let r=q.dirname(this.manifestPath),s=q.join(r,"pages"),i=q.join(r,"scripts"),o=ds.watch(s,{ignoreInitial:!0}),n=ds.watch(i,{ignoreInitial:!0}),c=e.options.resolve?.extensions;o.on("add",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p,!0)}),o.on("unlink",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p)}),n.on("add",p=>{c?.includes(q.extname(p))&&this.throwCompilationError("scripts",p,!0)}),n.on("unlink",p=>{c?.includes(q.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{o.close().catch(console.error),n.close().catch(console.error)})})}};var lr=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:r}=this.options;new cr({manifestPath:r}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new pr(r).apply(e)}};var fr=class{static name="plugin-extension";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){let r=this.manifestPath,s=pe({manifestPath:r,browser:this.browser}),i=Ko({manifestPath:r,browser:this.browser});process.env.EXPERIMENTAL_EXTENSION_RESOLVER_PLUGIN==="true"&&new kt({manifestPath:r,browser:this.browser,includeList:{...i?.pages||{},...i?.scripts||{}},excludeList:i.public,loaderOptions:{jsx:ce(ge.default.dirname(this.manifestPath))||ae(ge.default.dirname(this.manifestPath))||Zr(ge.default.dirname(this.manifestPath))||Kr(ge.default.dirname(this.manifestPath)),typescript:z(ge.default.dirname(this.manifestPath)),minify:e.options.mode==="production"}}).apply(e),new At({browser:this.browser,manifestPath:r,includeList:{...s.html,...s.icons,...s.json,...s.scripts},excludeList:i.public}).apply(e),new Gt({manifestPath:r,includeList:{...s.html,...i.pages},excludeList:{...i.public,...i.scripts}}).apply(e),new Yt({manifestPath:r,browser:this.browser,includeList:{...s.scripts,...i.scripts},excludeList:{...i.public,...i.pages}}).apply(e),new Qt({manifestPath:r}).apply(e),new tr({manifestPath:r,includeList:s.json,excludeList:i.public}).apply(e),new or({manifestPath:r,includeList:s.icons,excludeList:i.public}).apply(e),new nr({manifestPath:r,includeList:{...s.scripts,...i.scripts},excludeList:i.public}).apply(e),new lr({manifestPath:r}).apply(e)}};var He=a(require("path"));var oa=a(require("path")),na=a(require("ws"));function ur(t,e){t.clients.forEach(r=>{r.readyState===na.default.OPEN&&r.send(JSON.stringify(e))})}function aa(t,e,r){if(!r||!e)return;let s=pe({manifestPath:e}).locales,i=pe({manifestPath:e}).scripts,o=pe({manifestPath:e}).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}oa.default.basename(r)==="manifest.json"&&ur(t,{changedFile:"manifest.json"}),s?.forEach(n=>{n.includes(r)&&ur(t,{changedFile:"_locales"})}),Object.entries(i).forEach(([n,c])=>{let p=Array.isArray(c)?c:[c];Object.values(p).flatMap(u=>u).includes(r)&&n==="background/service_worker"&&ur(t,{changedFile:"service_worker"})}),Object.entries(o).forEach(([n,c])=>{c?.includes(r)&&n==="declarative_net_request"&&ur(t,{changedFile:"declarative_net_request"})})}var hs=a(require("path")),fa=a(require("fs")),ze=a(require("ws"));var Je=a(require("path")),wl=a(require("http")),pa=a(require("https")),gs=a(require("fs"));var ca=t=>{if(!gs.default.existsSync(t))return;let e=Je.default.basename(t);return gs.default.readFileSync(Je.default.join(__dirname,"certs",e))};function la(t){let e={key:ca(Je.default.join(__dirname,"certs","localhost.key")),cert:ca(Je.default.join(__dirname,"certs","localhost.cert"))},r=pa.default.createServer(e,(s,i)=>{i.writeHead(200),i.end()});return r.on("error",s=>{throw console.error(vi(t)),new Error(s.message)}),{server:r,port:t}}function xl(t,e){switch(e){case"chrome":return new ze.default.Server({host:"localhost",port:t});case"edge":return new ze.default.Server({host:"localhost",port:t+1});case"firefox":return new ze.default.Server({server:la(t+2).server});default:return new ze.default.Server({host:"localhost",port:8888})}}async function ua(t,e){let r=t.options.context||"",s=require(hs.default.join(r,"manifest.json")),o=xl(8e3,e.browser);if(o.on("connection",n=>{n.send(JSON.stringify({status:"serverReady"})),n.on("error",c=>{console.log(yi(c))}),n.on("message",c=>{let p=JSON.parse(c.toString());if(p.status==="clientReady"){let l=require(hs.default.join(r,"manifest.json"));setTimeout(()=>{console.log(zr(l,e.browser,p)),console.log("")},2500),$i(e.browser)&&setTimeout(()=>{console.log(hi(e.browser))},5e3)}})}),e.browser==="firefox"||e.browser==="gecko-based"){let n=Ci(s);console.log(zr(s,e.browser,n)),console.log(""),fa.default.existsSync(nt)||(console.log(xi()),console.log(""))}return o}var ma=a(require("path")),ys=a(require("fs"));function da(t,e){let r=ma.default.resolve(__dirname,`./extensions/${t}-manager-extension/reload-service.js`);try{let s=ys.default.readFileSync(r,"utf8"),i=s.replace(/__RELOAD_PORT__/g,e.toString());i!==s&&ys.default.writeFileSync(r,i,"utf8")}catch(s){console.error(`Error processing file: ${s.message}`)}}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Ve=class{manifestPath;port;browser;stats;constructor(e){this.manifestPath=e.manifestPath,this.port=e.port||8e3,this.browser=e.browser||"chrome",this.stats=e.stats}async apply(e){if(!this.manifestPath)return;da(this.browser,this.port);let r=await ua(e,{...this,mode:e.options.mode,browser:this.browser,stats:this.stats,port:this.port});e.hooks.watchRun.tapAsync("reload:create-web-socket-server",(s,i)=>{let n=(s.modifiedFiles||new Set).values().next().value;if(!n){i();return}let c=He.default.relative(He.default.dirname(this.manifestPath),n),p=He.default.relative(process.cwd(),He.default.dirname(n));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&aa(r,this.manifestPath,n),i()})}};var bs=a(require("path"));function ga(t,e,r){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[bs.default.dirname(r)],exclude:/node_modules/,use:[{loader:bs.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:r,browser:e}}]})}var ws=a(require("path"));function ha(t,e,r){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[ws.default.dirname(r)],exclude:/node_modules/,use:[{loader:ws.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:r,browser:e}}]})}var dr=require("webpack");var xs=a(require("content-security-policy-parser"));function ya(t){let e="";for(let r in t)e+=`${r} ${t[r].join(" ")}; `;return e.trim()}function ba(t){let e=t.content_security_policy;if(!e)return"script-src 'self' 'unsafe-eval' blob: filesystem:; object-src 'self' blob: filesystem:; ";let r=(0,xs.default)(e);if(!r.get("script-src"))r.set("script-src",["'self'","'unsafe-eval'","blob:","filesystem:"]);else{let i=r.get("script-src")||[];i.includes("'unsafe-eval'")||i.push("'unsafe-eval'"),i.includes("blob:")||i.push("blob:"),i.includes("filesystem:")||i.push("filesystem:"),r.set("script-src",i)}r.get("object-src")||r.set("object-src",["'self'","blob:","filesystem:"]);let s=Object.fromEntries(r.entries());return ya(s)}function wa(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self';"};let r=(0,xs.default)(e.extension_pages||""),s={};for(let n in s)r.get(n)||r.set(n,s[n]);let i=Object.fromEntries(r.entries());return{extension_pages:ya(i)}}function xa(t){let e=["/*.json","/*.js","/*.css"],r=t.web_accessible_resources;if(!r||r.length===0)return e;let s=new Set(r);for(let i of e)s.has(i)||s.add(i);return Array.from(s)}function va(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function vs(t,e){return t.background?{background:{...t.background}}:e==="firefox"||e==="gecko-based"?{background:{...t.background||{},scripts:["background/script.js"]}}:t.manifest_version===2?{background:{...t.background||{},scripts:["background/script.js"]}}:{background:{...t.background||{},service_worker:"background/service_worker.js"}}}function _s(t){return t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:[...new Set(t.externally_connectable.ids||[]),"*"]}}:t.externally_connectable&&!t.externally_connectable.ids?{externally_connectable:{...t.externally_connectable,ids:["*"]}}:{}}var mr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}generateManifestPatches(e){let r=J(e,this.manifestPath),s={...r,content_security_policy:r.manifest_version===3?wa(r):ba(r),...r.manifest_version===3?r.permissions?{permissions:[...new Set(["scripting",...r.permissions])]}:{permissions:["scripting"]}:{},...vs(r,this.browser),..._s(r),web_accessible_resources:r.manifest_version===3?va(r):xa(r)},i=JSON.stringify(s,null,2),o=new dr.sources.RawSource(i);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",o)}apply(e){e.hooks.thisCompilation.tap("run-chromium:apply-manifest-dev-defaults",r=>{r.hooks.processAssets.tap({name:"run-chromium:apply-manifest-dev-defaults",stage:dr.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},s=>{if(!this.manifestPath){let i="No manifest.json found in your extension bundle. Unable to patch manifest.json.";r&&e.webpack.WebpackError&&r.errors.push(new e.webpack.WebpackError(`run-chromium: ${i}`));return}this.generateManifestPatches(r)})})}};var Ss=a(require("fs")),he=a(require("path")),_a=a(require("webpack-target-webextension"));var gr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,r,s){let i=he.default.resolve(__dirname,r==="firefox"||r==="gecko-based"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),o=he.default.dirname(this.manifestPath),n=S(s,r);if(r==="firefox"||r==="gecko-based"){n=s.background;let c=n?.scripts;if(c&&c.length>0){let p=he.default.join(o,c[0]);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/script",i)}else if(n=s.background,s.manifest_version===3){let c=n?.service_worker;if(c){let p=he.default.join(o,c);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/service_worker",i)}else if(s.manifest_version===2){let c=n?.scripts;if(c&&c.length>0){let p=he.default.join(o,c[0]);this.ensureFileExists(p)}else this.addDefaultEntry(e,"background/script",i)}}ensureFileExists(e){if(!Ss.default.existsSync(e)&&this.manifestPath){let r=require(this.manifestPath),i=S(r,"chrome").name||"Extension.js",o=bi(i,e);throw console.error(o),new Error(o)}}addDefaultEntry(e,r,s){e.options.entry={...e.options.entry,[r]:{import:[s]}}}getEntryName(e){if(e.background){if(this.browser==="firefox"||this.browser==="gecko-based")return{pageEntry:"background/script"};if(e.manifest_version===3)return{serviceWorkerEntry:"background/service_worker"};if(e.manifest_version===2)return{pageEntry:"background/script"}}return{pageEntry:"background"}}apply(e){if(!this.manifestPath||!Ss.default.lstatSync(this.manifestPath).isFile())return;let r=require(this.manifestPath),s=S(r,this.browser);this.handleBackground(e,this.browser,s),new _a.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}};var Ps=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){(K.includes(this.browser)||this.browser==="chromium-based")&&ga(e,this.browser,this.manifestPath),(this.browser==="firefox"||this.browser==="gecko-based")&&ha(e,this.browser,this.manifestPath),new mr({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new gr({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},Sa=Ps;var hr=class{static name="plugin-reload";manifestPath;browser;port;stats;autoReload;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.port=e.port,this.stats=e.stats,this.autoReload=e.autoReload}apply(e){e.options.mode==="development"&&new Ve({manifestPath:this.manifestPath,browser:this.browser,port:this.port,stats:this.stats}).apply(e),e.options.mode==="development"&&new Sa({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var Pa=a(require("webpack")),yr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new Pa.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var wr=require("webpack");var br=class{browser;manifestPath;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let r=S(e,this.browser);return JSON.stringify(r,null,2)}apply(e){e.hooks.compilation.tap("compatibility:browser-specific-fields",r=>{r.hooks.processAssets.tap({name:"compatibility:browser-specific-fields",stage:wr.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let s=J(r,this.manifestPath),i=this.patchManifest(s),o=new wr.sources.RawSource(i);r.updateAsset("manifest.json",o)})})}};var xr=class{static name="plugin-compatibility";manifestPath;browser;polyfill;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.polyfill=e.polyfill||!1}async apply(e){this.polyfill&&this.browser!=="firefox"&&new yr({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new br({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var Ma=a(require("fs"));var ka=a(require("webpack")),Ea=a(require("content-security-policy-parser"));function $a(t){let e=t.content_security_policy,r=t.content_security_policy?.extension_pages,s=i=>{if(!i)return;let o=(0,Ea.default)(i);if(o.get("script-src")&&o.get("script-src")?.includes("'unsafe-eval'"))return ri()};if(t.manifest_version===3){let i=e?s(r):void 0;if(i)return new ka.default.WebpackError(i)}return null}var ks=a(require("webpack"));function Ca(t,e){let r=t.web_accessible_resources;if(r){let s=r.some(o=>typeof o=="string"),i=r.some(o=>typeof o=="object"||o.resources||o.matches);if(t.manifest_version===2&&!s)return new ks.default.WebpackError(ii(e));if(t.manifest_version===3&&!i)return new ks.default.WebpackError(oi(e))}return null}var ja=a(require("webpack"));function Fa(t,e){return(e==="firefox"||e==="gecko-based")&&t.background?.service_worker?new ja.default.WebpackError(ti()):null}var Da=a(require("path")),La=a(require("fs")),Ia=a(require("webpack"));function Oa(t,e){let r=Da.default.join(e.options.context||"","_locales");return La.default.existsSync(r)&&!t.default_locale?new Ia.default.WebpackError(si()):null}var vr=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,r,s){let i=$a(r),o=Ca(r,s),n=Fa(r,s),c=Oa(r,e);i&&e.errors.push(i),o&&e.errors.push(o),n&&e.options.mode==="production"&&e.errors.push(n),c&&e.errors.push(c)}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(r,s)=>{let i=this.options.manifestPath,o=JSON.parse(Ma.default.readFileSync(i,"utf-8")),n=this.options.browser||"chrome";this.handleRuntimeErrors(r,o,n),s()})}};var Wa=a(require("fs")),Ja=a(require("ajv"));var Aa={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://json.schemastore.org/chrome-manifest.json",additionalProperties:!0,definitions:{action_v2:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{anyOf:[{type:"string",description:"FIXME: String form is deprecated."},{type:"object",description:"Icon for the main toolbar.",properties:{"19":{$ref:"#/definitions/icon"},"38":{$ref:"#/definitions/icon"}}}]}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},action_v3:{type:"object",properties:{default_title:{type:"string",description:"Tooltip for the main toolbar icon."},default_popup:{$ref:"#/definitions/uri",description:"The popup appears when the user clicks the icon."},default_icon:{type:"object",properties:{"16":{$ref:"#/definitions/icon"},"24":{$ref:"#/definitions/icon"},"32":{$ref:"#/definitions/icon"}}}},dependencies:{name:{not:{required:["name"]}},icons:{not:{required:["icons"]}},popup:{not:{required:["popup"]}}}},command:{type:"object",if:{$comment:"Global shortcuts change the acceptable pattern for the suggested_key.",properties:{global:{const:!0}},required:["global"]},then:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl)\\+Shift\\+[0-9]"}}}}},else:{additionalProperties:!1,properties:{description:{type:"string"},global:{type:"boolean",description:"Whether this command should work while Chrome does not have focus. Keyboard shortcut suggestions for global commands are limited to Ctrl+Shift+[0..9]"},suggested_key:{type:"object",additionalProperties:!1,patternProperties:{"^(default|mac|windows|linux|chromeos)$":{type:"string",pattern:"^(Ctrl|Command|MacCtrl|Alt|Option)\\+(Shift\\+)?[A-Z]"}}}}}},content_security_policy:{type:"string",description:"This introduces some fairly strict policies that will make extensions more secure by default, and provides you with the ability to create and enforce rules governing the types of content that can be loaded and executed by your extensions and applications.",format:"content-security-policy",default:"script-src 'self'; object-src 'self'"},glob_pattern:{type:"string",format:"glob-pattern"},icon:{$ref:"#/definitions/uri"},match_pattern:{type:"string",format:"match-pattern",pattern:"^((\\*|http|https|file|ftp|chrome-extension):\\/\\/(\\*|\\*\\.[^\\/\\*]+|[^\\/\\*]+)?(\\/.*))|urn:(\\*|.*)|<all_urls>$"},mime_type:{type:"string",format:"mime-type",pattern:"^(?:application|audio|image|message|model|multipart|text|video)\\/[-+.\\w]+$"},page:{$ref:"#/definitions/uri"},permissions:{type:"array",uniqueItems:!0,items:{type:"string",format:"permission"}},scripts:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}},uri:{type:"string"},version_string:{type:"string",pattern:"^(?:\\d{1,5}\\.){0,3}\\d{1,5}$"},web_resource:{type:"object",required:["resources"],properties:{resources:{type:"array",description:`An array of resources to be exposed. Resources are specified as strings and may contain * for wildcard matches. For example, "/images/*" exposes everything in the extension's /images directory recursively while "*.png" exposes all PNG files.`,items:{$ref:"#/definitions/glob_pattern"}},matches:{type:"array",description:"A list of URL match patterns specifying which pages can access the resources. Only the origin is used to match URLs; subdomains patterns (*.google.com) and paths are ignored.",items:{$ref:"#/definitions/match_pattern"}},extension_ids:{type:"array",description:"A list of extension IDs, specifying which extensions can access the resources.",items:{type:"string"}},use_dynamic_url:{type:"boolean",description:"If true, only allow resources to be accessible through dynamic ID. The dynamic ID is generated per session. It's regenerated on browser restart or extension reload."}}}},dependencies:{content_scripts:{not:{required:["script_badge"]}},script_badge:{not:{required:["content_scripts"]}}},else:{properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{persistent:{type:"boolean",description:"When false, makes the background page an event page (loaded only when needed).",default:!0},page:{$ref:"#/definitions/page",description:"Specify the HTML of the background page.",default:"background.html"},scripts:{$ref:"#/definitions/scripts",description:"A background page will be generated by the extension system that includes each of the files listed in the scripts property.",default:["background.js"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},browser_action:{$ref:"#/definitions/action_v2",description:"Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup."},page_action:{$ref:"#/definitions/action_v2",description:"Use the chrome.pageAction API to put icons inside the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages."},content_security_policy:{$ref:"#/definitions/content_security_policy"},web_accessible_resources:{type:"array",description:"An array of strings specifying the paths (relative to the package root) of packaged resources that are expected to be usable in the context of a web page.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/uri"}}},dependencies:{page_action:{not:{required:["browser_action"]}},browser_action:{not:{required:["page_action"]}}}},if:{properties:{manifest_version:{const:3}}},properties:{manifest_version:{type:"number",description:"One integer specifying the version of the manifest file format your package requires.",enum:[2,3]},name:{type:"string",description:"The name of the extension",maxLength:45},version:{$ref:"#/definitions/version_string",description:"One to four dot-separated integers identifying the version of this extension."},default_locale:{type:"string",description:"Specifies the subdirectory of _locales that contains the default strings for this extension.",default:"en"},description:{type:"string",description:"A plain text description of the extension",maxLength:132},icons:{type:"object",description:"One or more icons that represent the extension, app, or theme. Recommended format: PNG; also BMP, GIF, ICO, JPEG.",minProperties:1,properties:{"16":{$ref:"#/definitions/icon",description:"Used as the favicon for an extension's pages and infobar."},"48":{$ref:"#/definitions/icon",description:"Used on the extension management page (chrome://extensions)."},"128":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."},"256":{$ref:"#/definitions/icon",description:"Used during installation and in the Chrome Web Store."}}},chrome_url_overrides:{type:"object",description:"Override pages are a way to substitute an HTML file from your extension for a page that Google Chrome normally provides.",additionalProperties:!1,maxProperties:1,properties:{bookmarks:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the Bookmark Manager menu item from the Chrome menu or, on Mac, the Bookmark Manager item from the Bookmarks menu. You can also get to this page by entering the URL chrome://bookmarks.",default:"bookmarks.html"},history:{$ref:"#/definitions/page",description:"The page that appears when the user chooses the History menu item from the Chrome menu or, on Mac, the Show Full History item from the History menu. You can also get to this page by entering the URL chrome://history.",default:"history.html"},newtab:{$ref:"#/definitions/page",description:"The page that appears when the user creates a new tab or window. You can also get to this page by entering the URL chrome://newtab.",default:"newtab.html"}}},commands:{type:"object",description:"Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.",patternProperties:{".*":{$ref:"#/definitions/command"},"^_execute_browser_action$":{$ref:"#/definitions/command"},"^_execute_page_action$":{$ref:"#/definitions/command"}}},content_scripts:{type:"array",description:"Content scripts are JavaScript files that run in the context of web pages.",minItems:1,uniqueItems:!0,items:{type:"object",required:["matches"],additionalProperties:!1,properties:{matches:{type:"array",description:"Specifies which pages this content script will be injected into.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},exclude_matches:{type:"array",description:"Excludes pages that this content script would otherwise be injected into.",uniqueItems:!0,items:{$ref:"#/definitions/match_pattern"}},css:{type:"array",description:"The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array, before any DOM is constructed or displayed for the page.",uniqueItems:!0,items:{$ref:"#/definitions/uri"}},js:{$ref:"#/definitions/scripts",description:"The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array."},world:{type:"string",description:"The JavaScript world for a script to execute within.",enum:["ISOLATED","MAIN"],default:"ISOLATED"},run_at:{type:"string",description:"Controls when the files in js are injected.",enum:["document_start","document_end","document_idle"],default:"document_idle"},all_frames:{type:"boolean",description:"Controls whether the content script runs in all frames of the matching page, or only the top frame.",default:!1},include_globs:{type:"array",description:"Applied after matches to include only those URLs that also match this glob. Intended to emulate the @include Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},exclude_globs:{type:"array",description:"Applied after matches to exclude URLs that match this glob. Intended to emulate the @exclude Greasemonkey keyword.",uniqueItems:!0,items:{$ref:"#/definitions/glob_pattern"}},match_about_blank:{type:"boolean",description:"Whether to insert the content script on about:blank and about:srcdoc.",default:!1}}}},devtools_page:{$ref:"#/definitions/page",description:"A DevTools extension adds functionality to the Chrome DevTools. It can add new UI panels and sidebars, interact with the inspected page, get information about network requests, and more."},externally_connectable:{description:"Declares which extensions, apps, and web pages can connect to your extension via runtime.connect and runtime.sendMessage.",type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string",description:"The IDs of extensions or apps that are allowed to connect. If left empty or unspecified, no extensions or apps can connect."}},matches:{type:"array",items:{type:"string",description:"The URL patterns for web pages that are allowed to connect. This does not affect content scripts. If left empty or unspecified, no web pages can connect."}},accepts_tls_channel_id:{type:"boolean",default:!1,description:"Indicates that the extension would like to make use of the TLS channel ID of the web page connecting to it. The web page must also opt to send the TLS channel ID to the extension via setting includeTlsChannelId to true in runtime.connect's connectInfo or runtime.sendMessage's options."}}},file_browser_handlers:{type:"array",description:"You can use this API to enable users to upload files to your website.",minItems:1,items:{type:"object",required:["id","default_title","file_filters"],additionalProperties:!1,properties:{id:{type:"string",description:"Used by event handling code to differentiate between multiple file handlers"},default_title:{type:"string",description:"What the button will display."},file_filters:{type:"array",description:"Filetypes to match.",minItems:1,items:{type:"string"}}}}},homepage_url:{$ref:"#/definitions/uri",description:"The URL of the homepage for this extension."},incognito:{type:"string",description:"Specify how this extension will behave if allowed to run in incognito mode.",enum:["spanning","split","not_allowed"],default:"spanning"},input_components:{type:"array",description:"Allows your extension to handle keystrokes, set the composition, and manage the candidate window.",items:{type:"object",required:["name","type","id","description","language","layouts"],additionalProperties:!1,properties:{name:{type:"string"},type:{type:"string"},id:{type:"string"},description:{type:"string"},language:{type:"string"},layouts:{type:"array"}}}},key:{type:"string",description:"This value can be used to control the unique ID of an extension, app, or theme when it is loaded during development."},minimum_chrome_version:{$ref:"#/definitions/version_string",description:"The version of Chrome that your extension, app, or theme requires, if any."},nacl_modules:{type:"array",description:"One or more mappings from MIME types to the Native Client module that handles each type.",minItems:1,uniqueItems:!0,items:{type:"object",required:["path","mime_type"],additionalProperties:!1,properties:{path:{$ref:"#/definitions/uri",description:"The location of a Native Client manifest (a .nmf file) within the extension directory."},mime_type:{$ref:"#/definitions/mime_type",description:"The MIME type for which the Native Client module will be registered as content handler."}}}},oauth2:{type:"object",description:"Use the Chrome Identity API to authenticate users: the getAuthToken for users logged into their Google Account and the launchWebAuthFlow for users logged into a non-Google account.",required:["client_id","scopes"],additionalProperties:!1,properties:{client_id:{type:"string",description:"You need to register your app in the Google APIs Console to get the client ID."},scopes:{type:"array",minItems:1,items:{type:"string"}}}},offline_enabled:{type:"boolean",description:"Whether the app or extension is expected to work offline. When Chrome detects that it is offline, apps with this field set to true will be highlighted on the New Tab page."},omnibox:{type:"object",description:"The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.",required:["keyword"],additionalProperties:!1,properties:{keyword:{type:"string",description:"The keyword that will trigger your extension."}}},optional_permissions:{$ref:"#/definitions/permissions",description:"Use the chrome.permissions API to request declared optional permissions at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary."},options_page:{$ref:"#/definitions/page",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, a link to it will be provided from the extensions management page at chrome://extensions. Clicking the Options link opens a new tab pointing at your options page.",default:"options.html"},options_ui:{type:"object",description:"To allow users to customize the behavior of your extension, you may wish to provide an options page. If you do, an Options link will be shown on the extensions management page at chrome://extensions which opens a dialogue containing your options page.",required:["page"],properties:{page:{type:"string",description:"The path to your options page, relative to your extension's root."},chrome_style:{type:"boolean",default:!0,description:"If true, a Chrome user agent stylesheet will be applied to your options page. The default value is false, but we recommend you enable it for a consistent UI with Chrome."},open_in_tab:{type:"boolean",default:!1,description:"If true, your extension's options page will be opened in a new tab rather than embedded in chrome://extensions. The default is false, and we recommend that you don't change it. This is only useful to delay the inevitable deprecation of the old options UI! It will be removed soon, so try not to use it. It will break."}}},permissions:{$ref:"#/definitions/permissions",description:"Permissions help to limit damage if your extension or app is compromised by malware. Some permissions are also displayed to users before installation, as detailed in Permission Warnings."},requirements:{type:"object",description:"Technologies required by the app or extension. Hosting sites such as the Chrome Web Store may use this list to dissuade users from installing apps or extensions that will not work on their computer.",additionalProperties:!1,properties:{plugins:{type:"object",description:"Indicates if an app or extension requires NPAPI to run. This requirement is enabled by default when the manifest includes the 'plugins' field.",required:["npapi"],additionalProperties:!1,properties:{npapi:{type:"boolean",default:!0}}},"3D":{type:"object",description:"The '3D' requirement denotes GPU hardware acceleration.",required:["features"],additionalProperties:!1,properties:{features:{type:"array",description:"List of the 3D-related features your app requires.",minItems:1,uniqueItems:!0,items:{type:"string",enum:["webgl"]}}}}}},sandbox:{type:"object",description:"Defines an collection of app or extension pages that are to be served in a sandboxed unique origin, and optionally a Content Security Policy to use with them.",required:["pages"],additionalProperties:!1,properties:{pages:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/page"}},content_security_policy:{$ref:"#/definitions/content_security_policy",default:"sandbox allow-scripts allow-forms"}}},short_name:{type:"string",description:"The short name is typically used where there is insufficient space to display the full name.",maxLength:12},update_url:{$ref:"#/definitions/uri",description:"If you publish using the Chrome Developer Dashboard, ignore this field. If you host your own extension or app: URL to an update manifest XML file."},tts_engine:{type:"object",description:"Register itself as a speech engine.",required:["voices"],additionalProperties:!1,properties:{voices:{type:"array",description:"Voices the extension can synthesize.",minItems:1,uniqueItems:!0,items:{type:"object",required:["voice_name","event_types"],additionalProperties:!1,properties:{voice_name:{type:"string",description:"Identifies the name of the voice and the engine used."},lang:{type:"string",description:"Almost always, a voice can synthesize speech in just a single language. When an engine supports more than one language, it can easily register a separate voice for each language."},gender:{type:"string",description:"If your voice corresponds to a male or female voice, you can use this parameter to help clients choose the most appropriate voice for their application."},event_types:{type:"array",description:"Events sent to update the client on the progress of speech synthesis.",minItems:1,uniqueItems:!0,items:{type:"string",description:"",enum:["start","word","sentence","marker","end","error"]}}}}}}},version_name:{type:"string",description:"In addition to the version field, which is used for update purposes, version_name can be set to a descriptive version string and will be used for display purposes if present."},chrome_settings_overrides:{},content_pack:{},current_locale:{},import:{},platforms:{},signature:{},spellcheck:{},storage:{},system_indicator:{}},required:["manifest_version","name","version"],then:{$comment:"browser_action and page_action are no longer present in v3",properties:{background:{type:"object",description:"The background page is an HTML page that runs in the extension process. It exists for the lifetime of your extension, and only one instance of it at a time is active.",properties:{service_worker:{type:"string",description:"The service worker js file."},type:{type:"string",enum:["module"]}},dependencies:{page:{not:{required:["scripts"]}},scripts:{not:{required:["page"]}}}},host_permissions:{$ref:"#/definitions/permissions"},action:{$ref:"#/definitions/action_v3",description:"Used to control the toolbar button for your extension in Chrome's UI."},content_security_policy:{type:"object",properties:{extension_pages:{$ref:"#/definitions/content_security_policy",description:"This policy covers pages in your extension, including html files and service workers."},sandbox:{$ref:"#/definitions/content_security_policy",description:"This policy covers any sandboxed extension pages that your extension uses."}}},web_accessible_resources:{type:"array",description:"An array of objects that declare resource access rules. Each object maps an array of extension resources to an array of URLs and/or extension IDs that can access those resources.",minItems:1,uniqueItems:!0,items:{$ref:"#/definitions/web_resource"}}},dependencies:{browser_action:{not:{required:["browser_action"]}},page_action:{not:{required:["page_action"]}}}},title:"JSON schema for Google Chrome extension manifest files",type:"object"};function Ta(t){t.addFormat("permission",{type:"string",validate:e=>typeof e=="string"&&e.trim()!==""}),t.addFormat("content-security-policy",{type:"string",validate:e=>typeof e=="string"}),t.addFormat("glob-pattern",{type:"string",validate:e=>typeof e=="string"&&/[\*\?\[\]]/.test(e)}),t.addFormat("match-pattern",{type:"string",validate:e=>e==="<all_urls>"||e==="file:///"||e.startsWith("http://localhost")||e.startsWith("http:// ")||e.startsWith("http://*:*/*")?!0:typeof e=="string"&&/^(\*|http|https|file|ftp):\/\//.test(e)}),t.addFormat("uri",{type:"string",validate:e=>typeof e=="string"&&/^(\w+:)?\/\//.test(e)}),t.addFormat("mime-type",{type:"string",validate:e=>typeof e=="string"&&/^[a-z]+\/[a-z0-9\-\+]+$/.test(e)})}var Ra=require("webpack");function Na(t,e,r){let s=e?.params.missingProperty;t.errors.push(new Ra.WebpackError(ci(r,s)))}var Ua=require("webpack");function qa(t,e,r){t.warnings.push(new Ua.WebpackError(ai(e,r)))}var Ba=require("webpack");function Es(t,e,r){t.warnings.push(new Ba.WebpackError(ni(r,e)))}var _r=class{options;constructor(e){this.options=e}handleSchemaErrors(e,r,s){let i=new Ja.default;Ta(i);let o={allOf:[Aa]},n=i.compile(o),c=S(r,s),p=n(c),l=c.manifest_version===3;if(!p&&n.errors){let u=n.errors[0];if(u?.keyword==="required"){Na(e,u,s);return}l&&(u?.keyword==="type"&&qa(e,u,s),u?.keyword==="not"&&Es(e,u,s))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(r,s)=>{let i=this.options.manifestPath,o=JSON.parse(Wa.default.readFileSync(i,"utf-8")),n=this.options.browser||"chrome";this.handleSchemaErrors(r,o,n),s()})}};var Va=a(require("fs")),Cs=a(require("path"));var $s=a(require("webpack"));function za(t,e){let r="Conflict: Multiple assets emit different content to the same filename ";if(e.message.includes(r)){let s=e.message.replace(r,"");if(s.startsWith("content_scripts"))return new $s.default.WebpackError(pi(t,s))}return null}function Ha(t,e){let r=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new $s.default.WebpackError(li(r.name)):null}var Sr=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let r=Cs.default.join(Cs.default.dirname(this.manifestPath),"package.json");if(!Va.default.existsSync(r))return;let s=require(r).name;e.hooks.compilation.tap("develop:common-errors",i=>{i.hooks.afterSeal.tapAsync("develop:common-errors",o=>{i.errors.forEach((n,c)=>{let p=za(s,n),l=Ha(s,n);p&&(i.errors[c]=p),l&&(i.errors[c]=l)}),o()})})}};var Pr=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new vr({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new _r({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new Sr({manifestPath:this.manifestPath}).apply(e)}};var mp=a(require("os")),Ms=a(require("path"));var vc=a(require("fs")),_c=a(require("path")),Sc=require("child_process");var be=a(require("path")),Xe=a(require("fs"));var Ga={alternate_error_pages:{enabled:!1},autofill:{enabled:!1},browser:{check_default_browser:!1,default_browser_setting_enabled:!1},default_apps:"install",distribution:{alternate_shortcut_text:!1,auto_launch_chrome:!1,import_bookmarks:!1,import_history:!1,import_home_page:!1,import_search_engine:!1,suppress_first_run_bubble:!0,do_not_register_for_update_launch:!0,make_chrome_default:!1,make_chrome_default_for_user:!1,require_eula:!1,suppress_first_run_default_browser_prompt:!0},dns_prefetching:{enabled:!1},download:{default_directory:"/tmp/",directory_upgrade:!0,open_pdf_in_adobe_reader:!1,prompt_for_download:!0},enable_do_not_track:!0,extensions:{theme:{use_system:!1},toolbarsize:-1,ui:{developer_mode:!0}},plugins:{plugins_list:[{enabled:!1,name:"Java(TM)"}],show_details:!0},profile:{password_manager_enabled:!1},safebrowsing:{enabled:!1,safebrowsingextended_reporting_enabled:!1},savefile:{default_directory:"/tmp",type:0},search:{suggest_enabled:!1},session:{restore_on_startup:1},sync:{suppress_start:!0},sync_promo:{show_on_first_run_allowed:!1,show_ntp_bubble:!1},translate:{enabled:!1}},Xa={...Ga},Za={...Ga};var y=require("@colors/colors/safe");function v(t,e){let r=e==="warn"?(0,y.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,y.cyan)("\u25BA\u25BA\u25BA"):e==="error"?`${(0,y.bold)((0,y.red)("ERROR"))} in ${ye(t)} ${(0,y.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,y.brightGreen)("\u25BA\u25BA\u25BA");return`${(0,y.gray)("")}${r}`}function ye(t){return t.charAt(0).toUpperCase()+t.slice(1)}function kr(t){let e=ye(t);return`${v(t,"info")} Creating new ${e} user profile...`}function Ka(t){return`${v(t,"success")} Instance already running.`}function Ya(t){return`${v(t,"info")} Instance exited.`}function Er(t,e){let r=t==="firefox"||t==="gecko-based"?"Add-on":"Extension";return`${v(t,"success")} ${ye(t)} ${r} running in ${(0,y.brightBlue)(e||"unknown")} mode.`}function Ge(t,e){let r=e=="null"?`Browser is not installed
113
113
 
114
114
  `:`Can't find the browser path
115
115
 
@@ -126,7 +126,7 @@ ${(0,y.red)(e)}`}function ic(t,e){return`${v(t,"error")} Path is not directory
126
126
  Please provide a valid directory path and try again.
127
127
  ${(0,y.red)("NOT DIRECTORY")} ${(0,y.underline)(e)}`}function oc(t){return`${v(t,"error")} Error parsing message length.`}function nc(t){return`${v(t,"error")} ${(0,y.magenta)("MessagingClient")} connection closed.`}function ac(t,e){return`${v(t,"error")} Unexpected ${(0,y.magenta)("MessagingClient")} request without target actor: ${(0,y.brightYellow)(e)}`}function cc(t){return`${v(t,"error")} ${(0,y.magenta)("MessagingClient")} connection closed.`}function pc(t,e){return`${v(t,"error")} Target actor ${(0,y.brightYellow)(e)} already has an active request.`}function lc(t,e){return`${v(t,"error")} Error parsing packet: ${(0,y.red)(e)}`}function fc(t,e){return`${v(t,"error")} Message received without a sender actor:
128
128
  ${(0,y.brightYellow)(JSON.stringify(e))}`}function uc(t,e){return`${v(t,"error")} Received unexpected message:
129
- ${(0,y.red)(e)}`}function mc(t,e){return`${v(t,"info")} Using own ${(0,y.magenta)("starting URL")} ${(0,y.underline)(e)}. `}function js(t,e){return`${v(t,"info")} Using own ${(0,y.magenta)(`${ye(t)} browser binary`)} ${(0,y.underline)(e)}. `}function dc(t,e){return`${v(t,"info")} Using own ${(0,y.magenta)("browser profile")} ${(0,y.underline)(e)}. `}function gc(t){return`${v(t,"info")} Using own ${(0,y.magenta)("browser preferences")}. `}function hc(t){return`${v(t,"info")} Using own ${(0,y.magenta)("browser flags")}. `}function yc(t,e){return`${v(t,"info")} Browser launcher is ${(0,y.brightYellow)(e?"enabled":"disabled")}. `}var bc=a(require("progress"));function $r(t,e){let s=new bc.default(`${t} [:bar] :percent :etas`,{complete:"=",incomplete:" ",width:50,total:131072}),i=setInterval(()=>{let o=Math.random()*10*1024;s.tick(o),s.complete&&(clearInterval(i),e())},50)}function wc(t,e,r={}){if(e&&Xe.default.existsSync(e))return e;let s=be.default.resolve(__dirname,`run-${t}-profile`);if(!e&&Xe.default.existsSync(s))return be.default.resolve(__dirname,`run-${t}-profile`);let o=JSON.stringify({...t==="chrome"?Xa:Za,...r});return $r(kr(t),()=>{let n=e||s,c=be.default.join(n,"Default");Xe.default.mkdirSync(c,{recursive:!0});let p=be.default.join(c,"Preferences");Xe.default.writeFileSync(p,o,"utf8")}),be.default.resolve(__dirname,`run-${t}-profile`)}function xc(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],r=wc(t.browser,t.profile,t.preferences);return[`--load-extension=${e.join()}`,`--user-data-dir=${r}`,"--no-first-run","--disable-client-side-phishing-detection","--disable-component-extensions-with-background-pages","--disable-default-apps","--disable-features=InterestFeedContentSuggestions","--disable-features=Translate","--hide-scrollbars","--mute-audio","--no-default-browser-check","--ash-no-nudges","--disable-search-engine-choice-screen","--disable-features=MediaRoute","--use-mock-keychain","--disable-background-networking","--disable-breakpad","--disable-component-update","--disable-domain-reliability","--disable-features=AutofillServerCommunicatio","--disable-features=CertificateTransparencyComponentUpdate","--disable-sync","--disable-features=OptimizationHints","--disable-features=DialMediaRouteProvider","--no-pings","--enable-features=SidePanelUpdates",...t.browserFlags||[]]}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Ze=class{extension;browser;browserFlags;profile;preferences;startingUrl;autoReload;stats;chromiumBinary;constructor(e){this.extension=e.extension,this.browser=e.browser,this.browserFlags=e.browserFlags||[],this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl,this.chromiumBinary=e.chromiumBinary}launchChromium(e){let r;switch(e){case"chrome":r=require(`${e}-location`);break;case"edge":r=require(`${e}-location`)();break;case"chromium-based":r=_c.default.normalize(this.chromiumBinary);break;default:r=require(`${e}`);break}vc.default.existsSync(r)||(console.error(Ge(e,r)),process.exit());let s=xc(this),i=this.startingUrl?[this.startingUrl,...s]:[...s],o=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",n=(0,Sc.spawn)(`${r}`,i,{stdio:o});process.env.EXTENSION_ENV==="development"&&(n.stdout?.pipe(process.stdout),n.stderr?.pipe(process.stderr))}apply(e){let r=!1;e.hooks.done.tapAsync("run-browsers:module",(s,i)=>{if(s.compilation.errors.length>0){i();return}if(r){i();return}this.launchChromium(this.browser),setTimeout(()=>{console.log(Er(this.browser,s.compilation.options.mode))},2e3),r=!0,i()})}};var fp=a(require("fs")),up=a(require("path")),Is=require("child_process");var Ke=a(require("fs")),Cr=a(require("path")),Pc=a(require("os")),kc=a(require("which")),Ec=process.platform==="darwin",Sl=process.platform==="win32",Pl=!Ec&&!Sl;function kl(){if(Pl)try{return kc.default.sync("firefox")}catch{return null}else if(Ec){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=Cr.default.join(Pc.default.homedir(),t.slice(1));return Ke.default.existsSync(t)?t:Ke.default.existsSync(e)?e:null}else{let t=Cr.default.join("Mozilla Firefox","firefox.exe"),e=[process.env.LOCALAPPDATA,process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"]];for(let s of e)if(s){let i=Cr.default.join(s,t);if(Ke.default.existsSync(i))return i}let r=["C:\\Program Files\\Mozilla Firefox\\firefox.exe","C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"];for(let s of r)if(Ke.default.existsSync(s))return s;return null}}var $c=kl();var Ls=a(require("path")),Fr=a(require("fs")),Os=a(require("firefox-profile"));var El={"app.update.enabled":!1,"browser.dom.window.dump.enabled":!0,"browser.formfill.enable":!1,"browser.link.open_newwindow":3,"browser.sessionstore.enabled":!1,"browser.shell.checkDefaultBrowser":!1,"browser.sync.enabled":!1,"browser.startup.page":0,"browser.startup.homepage_welcome_url":"about:blank","browser.startup.homepage_welcome_url_additional":"about:blank","browser.urlbar.suggest.bookmark":!1,"browser.urlbar.suggest.clipboard":!1,"browser.urlbar.suggest.history":!1,"browser.urlbar.suggest.openpage":!1,"browser.urlbar.suggest.remotetab":!1,"browser.urlbar.suggest.searches":!1,"browser.urlbar.suggest.topsites":!1,"browser.urlbar.suggest.engines":!1,"browser.urlbar.suggest.calculator":!1,"browser.urlbar.suggest.recentsearches":!1,"datareporting.policy.dataSubmissionEnabled":!1,"datareporting.policy.firstRunURL":"","devtools.browserconsole.contentMessages":!0,"devtools.chrome.enabled":!0,"devtools.debugger.prompt-connection":!1,"devtools.debugger.remote-enabled":!0,"devtools.errorconsole.enabled":!0,"extensions.installDistroAddons":!1,"extensions.autoDisableScopes":10,"extensions.chrome.enabled":!0,"extensions.logging.enabled":!1,"extensions.checkCompatibility.nightly":!1,"extensions.update.enabled":!1,"extensions.update.notifyUser":!1,"extensions.enabledScopes":5,"extensions.getAddons.cache.enabled":!1,"network.prefetch.next":!1,"network.speculative.preconnect.enabled":!1,"toolkit.telemetry.enabled":!1,"toolkit.telemetry.archive.enabled":!1,"toolkit.telemetry.newProfilePing.enabled":!1,"toolkit.recovery.enabled":!1,"urlclassifier.updateinterval":172800,"security.enterprise_roots.enabled":!0,"xpinstall.signatures.required":!1};function Fs(t){return{...El,...t}}var Ye=a(require("fs")),Qe=a(require("path"));var jr=a(require("path")),Cc=a(require("fs")),d=require("@colors/colors/safe");function E(t){return`${t==="warn"?(0,d.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,d.cyan)("\u25BA\u25BA\u25BA"):t==="error"?`${(0,d.bold)((0,d.red)("ERROR"))} in Extension.js ${(0,d.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,d.brightGreen)("\u25BA\u25BA\u25BA")}`}function X(t){return`${E("error")} Manifest file not found.
129
+ ${(0,y.red)(e)}`}function mc(t,e){return`${v(t,"info")} Using own ${(0,y.magenta)("starting URL")} ${(0,y.underline)(e)}. `}function js(t,e){return`${v(t,"info")} Using own ${(0,y.magenta)(`${ye(t)} browser binary`)} ${(0,y.underline)(e)}. `}function dc(t,e){return`${v(t,"info")} Using own ${(0,y.magenta)("browser profile")} ${(0,y.underline)(e)}. `}function gc(t){return`${v(t,"info")} Using own ${(0,y.magenta)("browser preferences")}. `}function hc(t){return`${v(t,"info")} Using own ${(0,y.magenta)("browser flags")}. `}function yc(t,e){return`${v(t,"info")} Browser launcher is ${(0,y.brightYellow)(e?"enabled":"disabled")}. `}var bc=a(require("progress"));function $r(t,e){let s=new bc.default(`${t} [:bar] :percent :etas`,{complete:"=",incomplete:" ",width:50,total:131072}),i=setInterval(()=>{let o=Math.random()*10*1024;s.tick(o),s.complete&&(clearInterval(i),e())},50)}function wc(t,e,r={}){if(e&&Xe.default.existsSync(e))return e;let s=be.default.resolve(__dirname,`run-${t}-profile`);if(!e&&Xe.default.existsSync(s))return be.default.resolve(__dirname,`run-${t}-profile`);let o=JSON.stringify({...t==="chrome"?Xa:Za,...r});return $r(kr(t),()=>{let n=e||s,c=be.default.join(n,"Default");Xe.default.mkdirSync(c,{recursive:!0});let p=be.default.join(c,"Preferences");Xe.default.writeFileSync(p,o,"utf8")}),be.default.resolve(__dirname,`run-${t}-profile`)}function xc(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],r=wc(t.browser,t.profile,t.preferences);return[`--load-extension=${e.join()}`,`--user-data-dir=${r}`,"--no-first-run","--disable-client-side-phishing-detection","--disable-component-extensions-with-background-pages","--disable-default-apps","--disable-features=InterestFeedContentSuggestions","--disable-features=Translate","--hide-scrollbars","--mute-audio","--no-default-browser-check","--ash-no-nudges","--disable-search-engine-choice-screen","--disable-features=MediaRoute","--use-mock-keychain","--disable-background-networking","--disable-breakpad","--disable-component-update","--disable-domain-reliability","--disable-features=AutofillServerCommunicatio","--disable-features=CertificateTransparencyComponentUpdate","--disable-sync","--disable-features=OptimizationHints","--disable-features=DialMediaRouteProvider","--no-pings","--enable-features=SidePanelUpdates",...t.browserFlags||[]]}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Ze=class{extension;browser;browserFlags;profile;preferences;startingUrl;autoReload;stats;chromiumBinary;constructor(e){this.extension=e.extension,this.browser=e.browser,this.browserFlags=e.browserFlags||[],this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl,this.chromiumBinary=e.chromiumBinary}launchChromium(e){let r;switch(e){case"chrome":r=require(`${e}-location`);break;case"edge":r=require(`${e}-location`)();break;case"chromium-based":r=_c.default.normalize(this.chromiumBinary);break;default:r=require(`${e}`);break}vc.default.existsSync(r)||(console.error(Ge(e,r)),process.exit());let s=xc(this),i=this.startingUrl?[this.startingUrl,...s]:[...s],o=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",n=(0,Sc.spawn)(`${r}`,i,{stdio:o});process.env.EXTENSION_ENV==="development"&&(n.stdout?.pipe(process.stdout),n.stderr?.pipe(process.stderr))}apply(e){let r=!1;e.hooks.done.tapAsync("run-browsers:module",(s,i)=>{if(s.compilation.errors.length>0){i();return}if(r){i();return}this.launchChromium(this.browser),setTimeout(()=>{console.log(Er(this.browser,s.compilation.options.mode))},2e3),r=!0,i()})}};var fp=a(require("fs")),up=a(require("path")),Os=require("child_process");var Ke=a(require("fs")),Cr=a(require("path")),Pc=a(require("os")),kc=a(require("which")),Ec=process.platform==="darwin",_l=process.platform==="win32",Sl=!Ec&&!_l;function Pl(){if(Sl)try{return kc.default.sync("firefox")}catch{return null}else if(Ec){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=Cr.default.join(Pc.default.homedir(),t.slice(1));return Ke.default.existsSync(t)?t:Ke.default.existsSync(e)?e:null}else{let t=Cr.default.join("Mozilla Firefox","firefox.exe"),e=[process.env.LOCALAPPDATA,process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"]];for(let s of e)if(s){let i=Cr.default.join(s,t);if(Ke.default.existsSync(i))return i}let r=["C:\\Program Files\\Mozilla Firefox\\firefox.exe","C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"];for(let s of r)if(Ke.default.existsSync(s))return s;return null}}var $c=Pl();var Ls=a(require("path")),Fr=a(require("fs")),Is=a(require("firefox-profile"));var kl={"app.update.enabled":!1,"browser.dom.window.dump.enabled":!0,"browser.formfill.enable":!1,"browser.link.open_newwindow":3,"browser.sessionstore.enabled":!1,"browser.shell.checkDefaultBrowser":!1,"browser.sync.enabled":!1,"browser.startup.page":0,"browser.startup.homepage_welcome_url":"about:blank","browser.startup.homepage_welcome_url_additional":"about:blank","browser.urlbar.suggest.bookmark":!1,"browser.urlbar.suggest.clipboard":!1,"browser.urlbar.suggest.history":!1,"browser.urlbar.suggest.openpage":!1,"browser.urlbar.suggest.remotetab":!1,"browser.urlbar.suggest.searches":!1,"browser.urlbar.suggest.topsites":!1,"browser.urlbar.suggest.engines":!1,"browser.urlbar.suggest.calculator":!1,"browser.urlbar.suggest.recentsearches":!1,"datareporting.policy.dataSubmissionEnabled":!1,"datareporting.policy.firstRunURL":"","devtools.browserconsole.contentMessages":!0,"devtools.chrome.enabled":!0,"devtools.debugger.prompt-connection":!1,"devtools.debugger.remote-enabled":!0,"devtools.errorconsole.enabled":!0,"extensions.installDistroAddons":!1,"extensions.autoDisableScopes":10,"extensions.chrome.enabled":!0,"extensions.logging.enabled":!1,"extensions.checkCompatibility.nightly":!1,"extensions.update.enabled":!1,"extensions.update.notifyUser":!1,"extensions.enabledScopes":5,"extensions.getAddons.cache.enabled":!1,"network.prefetch.next":!1,"network.speculative.preconnect.enabled":!1,"toolkit.telemetry.enabled":!1,"toolkit.telemetry.archive.enabled":!1,"toolkit.telemetry.newProfilePing.enabled":!1,"toolkit.recovery.enabled":!1,"urlclassifier.updateinterval":172800,"security.enterprise_roots.enabled":!0,"xpinstall.signatures.required":!1};function Fs(t){return{...kl,...t}}var Ye=a(require("fs")),Qe=a(require("path"));var jr=a(require("path")),Cc=a(require("fs")),d=require("@colors/colors/safe");function E(t){return`${t==="warn"?(0,d.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,d.cyan)("\u25BA\u25BA\u25BA"):t==="error"?`${(0,d.bold)((0,d.red)("ERROR"))} in Extension.js ${(0,d.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:(0,d.brightGreen)("\u25BA\u25BA\u25BA")}`}function X(t){return`${E("error")} Manifest file not found.
130
130
 
131
131
  Ensure the path to your extension exists and try again.
132
132
  ${(0,d.red)("NOT FOUND")} ${(0,d.underline)(t)}`}function jc(t){let e=t==="firefox"||t==="gecko-based"?"Add-on":"Extension";return`${E("info")} Building ${we(t)} ${e} package...`}function Fc(t,e){let r=jr.default.join(t,"dist",e.browser||"chrome"),s=jr.default.join(r,"manifest.json"),i=require(s),{name:o,version:n,hostPermissions:c,permissions:p}=i,l=c&&c.length,u=p&&p.length,m=Wr().version;return`
@@ -142,9 +142,9 @@ Build completed in ${((s?.time||0)/1e3).toFixed(2)} seconds.`,l=`Build Target: $
142
142
  `,u=`Build Status: ${e?.hasErrors()?(0,d.red)("Failed"):(0,d.brightGreen)("Success")}
143
143
  `,m=`
144
144
  Version: ${(0,d.gray)(o.version)}
145
- `,g=`Size: ${(0,d.gray)($l(n))}
146
- `,b="";return b+=c,b+=Cl(n),b+=m,b+=g,b+=l,b+=u,b+=p,b}function Lc(){return`${E("success")} No errors or warnings found. Your extension is ${(0,d.brightGreen)("ready for deployment")}.`}function Oc(t,e){return`${E("info")} Fetching data...
147
- ${(0,d.gray)("URL")} ${(0,d.underline)(`https://github.com/${t}/${e}`)}`}function Ic(t){return`${E("info")} Downloading ${(0,d.cyan)(t)}...`}function Mc(t){return`
145
+ `,g=`Size: ${(0,d.gray)(El(n))}
146
+ `,b="";return b+=c,b+=$l(n),b+=m,b+=g,b+=l,b+=u,b+=p,b}function Lc(){return`${E("success")} No errors or warnings found. Your extension is ${(0,d.brightGreen)("ready for deployment")}.`}function Ic(t,e){return`${E("info")} Fetching data...
147
+ ${(0,d.gray)("URL")} ${(0,d.underline)(`https://github.com/${t}/${e}`)}`}function Oc(t){return`${E("info")} Downloading ${(0,d.cyan)(t)}...`}function Mc(t){return`
148
148
  ${E("info")} Creating a new browser extension...
149
149
  ${(0,d.gray)("PATH")} ${(0,d.underline)(`${t}`)}`}function Ac(t){return`${E("info")} No ${(0,d.brightYellow)(".gitignore")} found, zipping all the content inside path:
150
150
  ${(0,d.gray)("PATH")} ${(0,d.underline)(t)}`}function Tc(t){return`${E("info")} Packaging source files. Files in ${(0,d.brightYellow)(".gitignore")} will be excluded...
@@ -157,9 +157,9 @@ ${(0,d.gray)("PATH")} ${(0,d.underline)(t)}`}function Nc(t,e,r,s){return`\u{1F4E
157
157
  ${(0,d.red)(t)}`}function Wc(t){return`${E("info")} Writing type definitions for ${(0,d.cyan)(t.name||"")}...`}function Jc(t){return`${E("error")} Failed to write the extension type definition.
158
158
  ${(0,d.red)(t)}`}function zc(t){return`${E("info")} Downloading extension...
159
159
  ${(0,d.gray)("URL")} ${(0,d.underline)(t)}`}function Hc(t){return`${E("info")} Unpackaging browser extension...
160
- ${(0,d.gray)("PATH")} ${(0,d.underline)(t)}`}function Vc(){return`${E("info")} Browser extension unpackaged ${(0,d.brightGreen)("successfully")}. Compiling...`}function Gc(t){return`${E("error")} Failed to download or extract ZIP file. ${(0,d.red)(t)}`}function we(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Xc(t){return`${(t/1024).toFixed(2)}KB`}function $l(t){let e=0;return t?.forEach(r=>{e+=r.size}),Xc(e)}function Zc(t,e=""){let r="";return Object.keys(t).forEach((s,i,o)=>{let n=i===o.length-1,c=n?"\u2514\u2500":"\u251C\u2500",p=t[s].size?` (${Xc(t[s].size)})`:"";r+=`${(0,d.gray)(e)}${(0,d.gray)(c)} ${s}${(0,d.gray)(p)}
161
- `,typeof t[s]=="object"&&!t[s].size&&(r+=Zc(t[s],`${e}${n?" ":(0,d.gray)("\u2502 ")}`))}),r}function Cl(t){let e={};return t?.forEach(r=>{let s=r.name.split("/"),i=e;s.forEach((o,n)=>{i[o]||(i[o]={}),n===s.length-1?i[o]={size:r.size}:i=i[o]})}),`.
162
- ${Zc(e)}`}function Kc(t){return`${E("info")} Using ${(0,d.magenta)(t)}. ${(0,d.brightYellow)("This is very experimental")}.`}function Yc(){return`${E("info")} Installing project dependencies...`}function Qc(t,e,r){return`${E("error")} Command ${t} ${e.join(" ")} failed with exit code ${r}`}function ep(t){return`${E("error")} Can't install project dependencies. ${(0,d.red)(t.message||t.toString())}`}async function xe(t){let e=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(e)&&await Ds(t)){let r=require(e);if(r&&typeof r.config=="function")return r.config}return r=>r}async function rp(t,e){let r=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(r)&&await Ds(t)){let s=require(r);if(s)return s[e]}return{}}async function ve(t,e="chrome"){let r=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(r)&&await Ds(t)){let s=require(r);if(s&&s.browser&&s.browser[e])return s.browser[e]||{browser:"chrome"}}return{browser:"chrome"}}var tp=!1;async function Ds(t){let e=Qe.default.join(t,"extension.config.js");return Ye.default.existsSync(e)?(tp||(console.log(Kc("extension.config.js")),tp=!0),!0):!1}function sp(t,e){let r={...ve(Ls.default.resolve(__dirname,"run-firefox"),"firefox"),...Fs(e)};Object.keys(r).forEach(o=>{t.setPreference(o,r[o])});let i=Object.keys(e);return i.length>0&&i.forEach(o=>{t.setPreference(o,e[o])}),t.updatePreferences(),t}function jl(t,e){let r=new Os.default({destinationDirectory:t});return sp(r,e)}function Fl(t,e,r){let s;if(Fr.default.statSync(e).isDirectory())s=e;else throw new Error(ic(t,e));let o=new Os.default({destinationDirectory:s});return sp(o,r)}function ip(t,e,r={}){let s,i=e||Ls.default.resolve(__dirname,`run-${t}-profile`),c={...Fs(r||{}),...r};return!e&&Fr.default.existsSync(i)?s=Fl(t,i,c):($r(kr(t),()=>{}),Fr.default.mkdirSync(i,{recursive:!0}),s=jl(i,c)),s}async function op(t,e){let{browser:r,startingUrl:s,preferences:i,profile:o,browserFlags:n=[]}=e,c=ip(r,o,i),p=[];s&&p.push(`--url=${s}`),n&&p.push(...n);let l=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args="${p.join(" ")}"`,`--profile="${c.path()}"`,`--listen=${l}`,"--verbose"].join(" ")}var lp=a(require("path"));var np=a(require("net")),ap=a(require("events"));function Dl(t,e){let r=e.toString(),s=r.indexOf(":");if(s<1)return{remainingData:e};let i=parseInt(r.substring(0,s),10);if(isNaN(i))return{remainingData:e,error:new Error(oc(t)),fatal:!0};if(e.length-(s+1)<i)return{remainingData:e};let o=e.slice(s+1,s+1+i),n=e.slice(s+1+i);try{let c=JSON.parse(o.toString());return{remainingData:n,parsedMessage:c}}catch(c){return{remainingData:n,error:c,fatal:!1}}}var Dr=class extends ap.default{incomingData=Buffer.alloc(0);pendingRequests=[];activeRequests=new Map;connection;async connect(e){await new Promise((r,s)=>{try{let i={port:e,host:"127.0.0.1"},o=np.default.createConnection(i,()=>{r()});this.connection=o,o.on("data",this.onData.bind(this)),o.on("error",s),o.on("end",this.onEnd.bind(this)),o.on("timeout",this.onTimeout.bind(this)),this.expectReply("root",{resolve:r,reject:s})}catch(i){s(i)}})}disconnect(){this.connection&&(this.connection.removeAllListeners(),this.connection.end(),this.rejectAllRequests(new Error(nc("firefox"))))}rejectAllRequests(e){this.activeRequests.forEach(r=>{r.reject(e)}),this.activeRequests.clear(),this.pendingRequests.forEach(({deferred:r})=>{r.reject(e)}),this.pendingRequests=[]}async request(e){let r=typeof e=="string"?{to:"root",type:e}:e;if(!r.to)throw new Error(ac("firefox",r.type));return await new Promise((s,i)=>{let o={resolve:s,reject:i};this.pendingRequests.push({request:r,deferred:o}),this.flushPendingRequests()})}flushPendingRequests(){this.pendingRequests=this.pendingRequests.filter(({request:e,deferred:r})=>{if(this.activeRequests.has(e.to))return!0;if(!this.connection)throw new Error(cc("firefox"));try{let s=`${Buffer.from(JSON.stringify(e)).length}:${JSON.stringify(e)}`;this.connection.write(s),this.expectReply(e.to,r)}catch(s){r.reject(s)}return!1})}expectReply(e,r){if(this.activeRequests.has(e))throw new Error(pc("firefox",e));this.activeRequests.set(e,r)}onData(e){for(this.incomingData=Buffer.concat([this.incomingData,e]);this.readMessage(););}readMessage(){let{remainingData:e,parsedMessage:r,error:s,fatal:i}=Dl("firefox",this.incomingData);return this.incomingData=e,s?(this.emit("error",new Error(lc("firefox",s))),i&&this.disconnect(),!i):r?(this.handleMessage(r),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(fc("firefox",e)));return}let r=this.activeRequests.get(e.from);r?(this.activeRequests.delete(e.from),e.error?r.reject(e):r.resolve(e),this.flushPendingRequests()):this.emit("error",new Error(uc("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function cp(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function pp(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var Ll=150,Ol=1e3,Lr=class{options;constructor(e){this.options=e}async connectClient(e){let r;for(let s of Array.from({length:Ll}))try{let i=new Dr;return await i.connect(e),i}catch(i){if(pp("ECONNREFUSED",i))await new Promise(o=>setTimeout(o,Ol)),r=i;else throw console.error(tc(this.options.browser,i.stack)),i}throw console.error(rc(this.options.browser)),r}async installAddons(e){let{devtools:r}=this.options,s=Array.isArray(this.options.extension)?this.options.extension:[this.options.extension],i=e.options.devServer?.port,o=i?i+100:9222,n=await this.connectClient(o);for(let[c,p]of s.entries()){let l=lp.default.join(p.replace(/"/g,"")),u=c===0&&r;try{let m=await n.request({to:"root",type:"getRoot"});await n.request({to:m.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:u})}catch(m){let g=cp(m);throw new Error(sc(this.options.browser,g))}}}};var ee=null;process.on("SIGINT",()=>{ee&&ee.kill("SIGINT"),process.exit()});process.on("SIGTERM",()=>{ee&&ee.kill("SIGTERM"),process.exit()});var Or=class{extension;browser;browserFlags;profile;preferences;startingUrl;autoReload;stats;geckoBinary;constructor(e){this.extension=e.extension,this.browser=e.browser||"firefox",this.browserFlags=e.browserFlags||[],this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl,this.geckoBinary=e.geckoBinary}async getFxRunnerCommand(){let e=oe()?"pnpm dlx fx-runner":"npm exec fx-runner";try{return await new Promise((r,s)=>{(0,Is.exec)(`${e} --version`,i=>{i?s(i):r(null)})}),e}catch{console.error(Ge("firefox",e)),process.exit(1)}}async launchFirefox(e,r){let s=await this.getFxRunnerCommand(),i;switch(r.browser){case"gecko-based":i=up.default.normalize(this.geckoBinary);break;default:i=$c;break}let o=`${s} start --binary "${i}" --foreground --no-remote`;fp.default.existsSync(i||"")||(console.error(Ge(this.browser,i||"")),process.exit(1));let n=await op(e,r),c=`${o} ${n}`;ee=(0,Is.exec)(c,(l,u,m)=>{if(l!=null)throw l;m.includes("Unable to move the cache")?console.log(Ka(this.browser)):(console.log(Ya(this.browser)),process.exit())}),process.env.EXTENSION_ENV==="development"&&(ee.stdout?.pipe(process.stdout),ee.stderr?.pipe(process.stderr));let p=new Lr(this);try{await p.installAddons(e)}catch(l){l?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Qa(this.browser)),process.exit(1)),console.error(ec(this.browser,l)),process.exit(1)}}apply(e){let r=!1;e.hooks.done.tapAsync("run-firefox:module",async(s,i)=>{if(s.compilation.errors.length>0){i();return}if(r){i();return}setTimeout(()=>{console.log(Er(this.browser,s.compilation.options.mode))},2e3),await this.launchFirefox(e,{browser:this.browser,browserFlags:this.browserFlags,profile:this.profile,preferences:this.preferences,startingUrl:this.startingUrl,mode:s.compilation.options.mode}),r=!0,i()})}};var Ir=class{static name="plugin-browsers";extension;browser;open;browserFlags;profile;preferences;startingUrl;chromiumBinary;geckoBinary;constructor(e){this.extension=[...e.extension,...e.browserFlags?.filter(r=>!r.startsWith("--load-extension="))||[]],this.browser=e.browser||"chrome",this.open=e.open,this.browserFlags=e.browserFlags?.filter(r=>!r.startsWith("--load-extension="))||[],this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl||"",this.chromiumBinary=e.chromiumBinary,this.geckoBinary=e.geckoBinary}getProfilePath(e,r,s){return s||(e.options.mode==="production"?Ms.default.join(mp.default.tmpdir(),"extension-js",r,"profile"):Ms.default.resolve(__dirname,`run-${r}-profile`))}async apply(e){let r={stats:!0,open:this.open!=="false",extension:this.extension,browser:this.browser,browserFlags:this.browserFlags||[],profile:this.profile,preferences:this.preferences,startingUrl:this.startingUrl,chromiumBinary:this.chromiumBinary,geckoBinary:this.geckoBinary},s=await ve(e.context,this.browser),i={...r,...s};if(i?.open===!1&&console.log(yc(this.browser,!1)),i?.startingUrl&&console.log(mc(i?.browser,i?.startingUrl)),i?.chromiumBinary&&console.log(js("chromium",i?.chromiumBinary)),i?.geckoBinary&&console.log(js("gecko",i?.geckoBinary)),i?.profile&&console.log(dc(i?.browser,i?.profile)),i?.preferences&&console.log(gc(i?.browser)),i?.browserFlags&&i?.browserFlags.length>0&&console.log(hc(i?.browser)),i.open===!1)return;let o=this.getProfilePath(e,this.browser,this.profile||this.profile);switch(this.browser){case"chrome":case"edge":case"chromium-based":{new Ze({...i,browser:this.browser,profile:o}).apply(e);break}case"firefox":case"gecko-based":new Or({...i,browser:this.browser,profile:o}).apply(e);break;default:{new Ze({...i,browser:"chrome",profile:o}).apply(e);break}}}};function te(t,e){let r=et.default.join(t,"manifest.json"),s=S(require(r),e.browser),i=et.default.join(t,`dist/${e.browser}`),o=e.chromiumBinary?"chromium-based":e.geckoBinary?"gecko-based":e.browser;return{mode:e.mode||"development",entry:{},target:"web",context:t,devtool:s.manifest_version===3?"cheap-source-map":"eval-cheap-source-map",output:{clean:{keep(n){return!n.startsWith("hot/background")}},path:i,publicPath:"/",hotUpdateChunkFilename:"hot/[id].[fullhash].hot-update.js",hotUpdateMainFilename:"hot/[runtime].[fullhash].hot-update.json",environment:{bigIntLiteral:!0,dynamicImport:!0}},resolve:{modules:["node_modules",et.default.join(t,"node_modules")],extensions:[".js",".mjs",".jsx",".ts",".mts",".tsx",".json",".wasm",".less",".css",".sass",".scss"]},watchOptions:{ignored:/node_modules|dist/},module:{rules:[]},plugins:[new pt({manifestPath:r,browser:o}),new ht({manifestPath:r}),new gt({manifestPath:r}),new wt({manifestPath:r}),process.env.EXPERIMENTAL_ERRORS_PLUGIN==="true"&&new Pr({manifestPath:r,browser:o}),new xr({manifestPath:r,browser:o,polyfill:e.polyfill}),new fr({manifestPath:r,browser:o}),new hr({manifestPath:r,browser:o,stats:!0,port:8e3}),new Ir({extension:[i,et.default.join(__dirname,"extensions",`${o}-manager-extension`)],browser:o,open:e.open,startingUrl:e.startingUrl,profile:e.profile,preferences:e.preferences,browserFlags:e.browserFlags,chromiumBinary:e.chromiumBinary,geckoBinary:e.geckoBinary})].filter(Boolean),stats:{all:!1,errors:!0,warnings:!0},infrastructureLogging:{level:"none"},performance:{hints:!1,maxAssetSize:999e3,maxEntrypointSize:999e3},optimization:{minimize:e.mode==="production"},experiments:{asyncWebAssembly:!0}}}var tt=a(require("path")),bp=a(require("go-git-it"));var Mr=a(require("path")),dp=a(require("axios")),gp=a(require("adm-zip"));var As=a(require("stream")),hp=require("util"),Il=(0,hp.promisify)(As.default.pipeline);async function yp(t,e){let r=t.split("?")[0];try{console.log(zc(r));let s=await(0,dp.default)({url:t,method:"GET",responseType:"stream"}),i=Mr.default.extname(r),o=Mr.default.basename(r,i),n=Mr.default.join(e,o);console.log(Hc(n));let c=[];await Il(s.data,new As.default.Writable({write(u,m,g){c.push(u),g()}}));let p=Buffer.concat(c);return new gp.default(p).extractAllTo(n,!0),console.log(Vc()),n}catch(s){throw console.error(Gc(s)),s}}var Ml=t=>{try{return new URL(t),!0}catch{return!1}};async function Al(t,e){return await(0,bp.default)(t,process.cwd(),e),tt.default.resolve(process.cwd(),tt.default.basename(t))}async function Tl(t){return await yp(t,process.cwd())}async function Z(t){if(!t)return process.cwd();if(Ml(t)){let e=new URL(t);if(e.protocol.startsWith("http")){if(e.origin!=="https://github.com")return await Tl(t);let r=e.pathname.split("/"),s=r.slice(1,3)[0],i=r.slice(1,3)[1];console.log(Oc(s,i));let o=tt.default.basename(e.pathname),n=await Al(t,Ic(o));return console.log(Mc(o)),n}}return tt.default.resolve(process.cwd(),t)}var H=a(require("path")),wp=a(require("fs")),xp=a(require("ignore")),vp=a(require("tiny-glob")),Ts=a(require("adm-zip")),_p=a(require("slugify"));function Rl(t){try{return wp.default.readFileSync(t,"utf8")}catch{return""}}function Nl(t){return(0,_p.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function Ul(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function ql(t,e){let r=Nl(e.zipFilename||t.name);return e.zipFilename?r:`${r}-${t.version}`}async function Bl(t){let e=H.default.join(t,".gitignore"),r=Rl(e),s=(0,xp.default)();return r?s.add(r):console.log(Ac(t)),(await(0,vp.default)("**/*",{cwd:t,dot:!0})).filter(o=>!s.ignores(o))}async function Sp(t,{browser:e="chrome",...r}){try{let s=H.default.join(t,"dist"),i=H.default.join(s,e),o=r.zipSource?t:i,n=require(H.default.join(o,"manifest.json")),c=ql(n,{browser:e,...r}),p=Ul(e),l=H.default.join(i,`${c}.${p}`),u=H.default.join(s,`${c}-source.${p}`);if(r.zipSource){console.log(""),console.log(Tc(u));let m=new Ts.default;(await Bl(t)).forEach(b=>{m.addLocalFile(H.default.join(t,b),H.default.dirname(b))}),m.writeZip(u)}if(r.zip){console.log(""),console.log(Rc(l));let m=new Ts.default;m.addLocalFolder(i),m.writeZip(l)}r.zip&&r.zipSource?(console.log(""),console.log(Nc(e,c,u,l))):r.zip?(console.log(""),console.log(Uc(c,p,e,l))):r.zipSource&&(console.log(""),console.log(qc(c,p,e,u)))}catch(s){throw console.error(Bc(s)),s}}async function Ar(t,e){let r=await Z(t);!t?.startsWith("http")&&!Pp.default.existsSync(Rs.default.join(r,"manifest.json"))&&(console.log(X(Rs.default.join(r,"manifest.json"))),process.exit(1));try{let s=e?.browser||"chrome",i=te(r,{...e,browser:s,mode:"production"}),o=i.plugins?.filter(u=>u?.constructor.name!=="plugin-browsers"&&u?.constructor.name!=="plugin-reload"),c=(await xe(r))({...i,plugins:o}),p=(0,Ep.merge)(c),l=(0,kp.default)(p);await new Promise((u,m)=>{l.run(async(g,b)=>{if(g)return console.error(g.stack||g),m(g);e?.silent||console.log(Dc(r,b,s)),(e?.zip||e?.zipSource)&&await Sp(r,{...e,browser:s}),b?.hasErrors()?(console.log(b.toString({colors:!0})),process.exit(1)):(console.log(Lc()),u())})})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}var qs=a(require("fs")),Rr=a(require("path"));var Us=a(require("path")),$p=a(require("webpack")),Cp=a(require("webpack-dev-server")),jp=require("webpack-merge");function Ns(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function Fp(t,e){let r=rp(t,"dev"),s=ve(t,e.browser),i=te(t,{...e,...r,...s,mode:"development"}),n=(await xe(t))(i),c=(0,jp.merge)(n),p=(0,$p.default)(c),l={host:"127.0.0.1",allowedHosts:"all",static:Us.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:ft(t)?void 0:{paths:[Us.default.join(t,"**/*.html")],options:{usePolling:!0,interval:1e3}},client:{logging:process.env.EXTENSION_ENV==="development"?"error":"none",progress:!1,overlay:!1},headers:{"Access-Control-Allow-Origin":"*"},port:"auto",hot:"only"},u=new Cp.default(l,p);u.startCallback(m=>{m!=null&&console.log(`Error in the Extension.js runner: ${m.stack||""}`)}),process.on("ERROR",()=>{Ns(u)}),process.on("SIGINT",()=>{Ns(u)}),process.on("SIGTERM",()=>{Ns(u)})}var Tr=a(require("path")),_e=a(require("fs/promises"));async function Dp(t){let e=Tr.default.join(t,"extension-env.d.ts"),r=process.env.EXTENSION_ENV==="development"?Tr.default.resolve(process.cwd(),"programs/cli/types"):"extension/dist/types",s=`// Required Extension.js types for TypeScript projects.
160
+ ${(0,d.gray)("PATH")} ${(0,d.underline)(t)}`}function Vc(){return`${E("info")} Browser extension unpackaged ${(0,d.brightGreen)("successfully")}. Compiling...`}function Gc(t){return`${E("error")} Failed to download or extract ZIP file. ${(0,d.red)(t)}`}function we(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Xc(t){return`${(t/1024).toFixed(2)}KB`}function El(t){let e=0;return t?.forEach(r=>{e+=r.size}),Xc(e)}function Zc(t,e=""){let r="";return Object.keys(t).forEach((s,i,o)=>{let n=i===o.length-1,c=n?"\u2514\u2500":"\u251C\u2500",p=t[s].size?` (${Xc(t[s].size)})`:"";r+=`${(0,d.gray)(e)}${(0,d.gray)(c)} ${s}${(0,d.gray)(p)}
161
+ `,typeof t[s]=="object"&&!t[s].size&&(r+=Zc(t[s],`${e}${n?" ":(0,d.gray)("\u2502 ")}`))}),r}function $l(t){let e={};return t?.forEach(r=>{let s=r.name.split("/"),i=e;s.forEach((o,n)=>{i[o]||(i[o]={}),n===s.length-1?i[o]={size:r.size}:i=i[o]})}),`.
162
+ ${Zc(e)}`}function Kc(t){return`${E("info")} Using ${(0,d.magenta)(t)}. ${(0,d.brightYellow)("This is very experimental")}.`}function Yc(){return`${E("info")} Installing project dependencies...`}function Qc(t,e,r){return`${E("error")} Command ${t} ${e.join(" ")} failed with exit code ${r}`}function ep(t){return`${E("error")} Can't install project dependencies. ${(0,d.red)(t.message||t.toString())}`}async function xe(t){let e=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(e)&&await Ds(t)){let r=require(e);if(r&&typeof r.config=="function")return r.config}return r=>r}async function rp(t,e){let r=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(r)&&await Ds(t)){let s=require(r);if(s)return s[e]}return{}}async function ve(t,e="chrome"){let r=Qe.default.join(t,"extension.config.js");if(Ye.default.existsSync(r)&&await Ds(t)){let s=require(r);if(s&&s.browser&&s.browser[e])return s.browser[e]||{browser:"chrome"}}return{browser:"chrome"}}var tp=!1;async function Ds(t){let e=Qe.default.join(t,"extension.config.js");return Ye.default.existsSync(e)?(tp||(console.log(Kc("extension.config.js")),tp=!0),!0):!1}function sp(t,e){let r={...ve(Ls.default.resolve(__dirname,"run-firefox"),"firefox"),...Fs(e)};Object.keys(r).forEach(o=>{t.setPreference(o,r[o])});let i=Object.keys(e);return i.length>0&&i.forEach(o=>{t.setPreference(o,e[o])}),t.updatePreferences(),t}function Cl(t,e){let r=new Is.default({destinationDirectory:t});return sp(r,e)}function jl(t,e,r){let s;if(Fr.default.statSync(e).isDirectory())s=e;else throw new Error(ic(t,e));let o=new Is.default({destinationDirectory:s});return sp(o,r)}function ip(t,e,r={}){let s,i=e||Ls.default.resolve(__dirname,`run-${t}-profile`),c={...Fs(r||{}),...r};return!e&&Fr.default.existsSync(i)?s=jl(t,i,c):($r(kr(t),()=>{}),Fr.default.mkdirSync(i,{recursive:!0}),s=Cl(i,c)),s}async function op(t,e){let{browser:r,startingUrl:s,preferences:i,profile:o,browserFlags:n=[]}=e,c=ip(r,o,i),p=[];s&&p.push(`--url=${s}`),n&&p.push(...n);let l=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args="${p.join(" ")}"`,`--profile="${c.path()}"`,`--listen=${l}`,"--verbose"].join(" ")}var lp=a(require("path"));var np=a(require("net")),ap=a(require("events"));function Fl(t,e){let r=e.toString(),s=r.indexOf(":");if(s<1)return{remainingData:e};let i=parseInt(r.substring(0,s),10);if(isNaN(i))return{remainingData:e,error:new Error(oc(t)),fatal:!0};if(e.length-(s+1)<i)return{remainingData:e};let o=e.slice(s+1,s+1+i),n=e.slice(s+1+i);try{let c=JSON.parse(o.toString());return{remainingData:n,parsedMessage:c}}catch(c){return{remainingData:n,error:c,fatal:!1}}}var Dr=class extends ap.default{incomingData=Buffer.alloc(0);pendingRequests=[];activeRequests=new Map;connection;async connect(e){await new Promise((r,s)=>{try{let i={port:e,host:"127.0.0.1"},o=np.default.createConnection(i,()=>{r()});this.connection=o,o.on("data",this.onData.bind(this)),o.on("error",s),o.on("end",this.onEnd.bind(this)),o.on("timeout",this.onTimeout.bind(this)),this.expectReply("root",{resolve:r,reject:s})}catch(i){s(i)}})}disconnect(){this.connection&&(this.connection.removeAllListeners(),this.connection.end(),this.rejectAllRequests(new Error(nc("firefox"))))}rejectAllRequests(e){this.activeRequests.forEach(r=>{r.reject(e)}),this.activeRequests.clear(),this.pendingRequests.forEach(({deferred:r})=>{r.reject(e)}),this.pendingRequests=[]}async request(e){let r=typeof e=="string"?{to:"root",type:e}:e;if(!r.to)throw new Error(ac("firefox",r.type));return await new Promise((s,i)=>{let o={resolve:s,reject:i};this.pendingRequests.push({request:r,deferred:o}),this.flushPendingRequests()})}flushPendingRequests(){this.pendingRequests=this.pendingRequests.filter(({request:e,deferred:r})=>{if(this.activeRequests.has(e.to))return!0;if(!this.connection)throw new Error(cc("firefox"));try{let s=`${Buffer.from(JSON.stringify(e)).length}:${JSON.stringify(e)}`;this.connection.write(s),this.expectReply(e.to,r)}catch(s){r.reject(s)}return!1})}expectReply(e,r){if(this.activeRequests.has(e))throw new Error(pc("firefox",e));this.activeRequests.set(e,r)}onData(e){for(this.incomingData=Buffer.concat([this.incomingData,e]);this.readMessage(););}readMessage(){let{remainingData:e,parsedMessage:r,error:s,fatal:i}=Fl("firefox",this.incomingData);return this.incomingData=e,s?(this.emit("error",new Error(lc("firefox",s))),i&&this.disconnect(),!i):r?(this.handleMessage(r),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(fc("firefox",e)));return}let r=this.activeRequests.get(e.from);r?(this.activeRequests.delete(e.from),e.error?r.reject(e):r.resolve(e),this.flushPendingRequests()):this.emit("error",new Error(uc("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function cp(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function pp(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var Dl=150,Ll=1e3,Lr=class{options;constructor(e){this.options=e}async connectClient(e){let r;for(let s of Array.from({length:Dl}))try{let i=new Dr;return await i.connect(e),i}catch(i){if(pp("ECONNREFUSED",i))await new Promise(o=>setTimeout(o,Ll)),r=i;else throw console.error(tc(this.options.browser,i.stack)),i}throw console.error(rc(this.options.browser)),r}async installAddons(e){let{devtools:r}=this.options,s=Array.isArray(this.options.extension)?this.options.extension:[this.options.extension],i=e.options.devServer?.port,o=i?i+100:9222,n=await this.connectClient(o);for(let[c,p]of s.entries()){let l=lp.default.join(p.replace(/"/g,"")),u=c===0&&r;try{let m=await n.request({to:"root",type:"getRoot"});await n.request({to:m.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:u})}catch(m){let g=cp(m);throw new Error(sc(this.options.browser,g))}}}};var ee=null;process.on("SIGINT",()=>{ee&&ee.kill("SIGINT"),process.exit()});process.on("SIGTERM",()=>{ee&&ee.kill("SIGTERM"),process.exit()});var Ir=class{extension;browser;browserFlags;profile;preferences;startingUrl;autoReload;stats;geckoBinary;constructor(e){this.extension=e.extension,this.browser=e.browser||"firefox",this.browserFlags=e.browserFlags||[],this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl,this.geckoBinary=e.geckoBinary}async getFxRunnerCommand(){let e=oe()?"pnpm dlx fx-runner":"npm exec fx-runner";try{return await new Promise((r,s)=>{(0,Os.exec)(`${e} --version`,i=>{i?s(i):r(null)})}),e}catch{console.error(Ge("firefox",e)),process.exit(1)}}async launchFirefox(e,r){let s=await this.getFxRunnerCommand(),i;switch(r.browser){case"gecko-based":i=up.default.normalize(this.geckoBinary);break;default:i=$c;break}let o=`${s} start --binary "${i}" --foreground --no-remote`;fp.default.existsSync(i||"")||(console.error(Ge(this.browser,i||"")),process.exit(1));let n=await op(e,r),c=`${o} ${n}`;ee=(0,Os.exec)(c,(l,u,m)=>{if(l!=null)throw l;m.includes("Unable to move the cache")?console.log(Ka(this.browser)):(console.log(Ya(this.browser)),process.exit())}),process.env.EXTENSION_ENV==="development"&&(ee.stdout?.pipe(process.stdout),ee.stderr?.pipe(process.stderr));let p=new Lr(this);try{await p.installAddons(e)}catch(l){l?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Qa(this.browser)),process.exit(1)),console.error(ec(this.browser,l)),process.exit(1)}}apply(e){let r=!1;e.hooks.done.tapAsync("run-firefox:module",async(s,i)=>{if(s.compilation.errors.length>0){i();return}if(r){i();return}setTimeout(()=>{console.log(Er(this.browser,s.compilation.options.mode))},2e3),await this.launchFirefox(e,{browser:this.browser,browserFlags:this.browserFlags,profile:this.profile,preferences:this.preferences,startingUrl:this.startingUrl,mode:s.compilation.options.mode}),r=!0,i()})}};var Or=class{static name="plugin-browsers";extension;browser;open;browserFlags;profile;preferences;startingUrl;chromiumBinary;geckoBinary;constructor(e){this.extension=[...e.extension,...e.browserFlags?.filter(r=>!r.startsWith("--load-extension="))||[]],this.browser=e.browser||"chrome",this.open=e.open,this.browserFlags=e.browserFlags?.filter(r=>!r.startsWith("--load-extension="))||[],this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl||"",this.chromiumBinary=e.chromiumBinary,this.geckoBinary=e.geckoBinary}getProfilePath(e,r,s){return s||(e.options.mode==="production"?Ms.default.join(mp.default.tmpdir(),"extension-js",r,"profile"):Ms.default.resolve(__dirname,`run-${r}-profile`))}async apply(e){let r={stats:!0,open:this.open!=="false",extension:this.extension,browser:this.browser,browserFlags:this.browserFlags||[],profile:this.profile,preferences:this.preferences,startingUrl:this.startingUrl,chromiumBinary:this.chromiumBinary,geckoBinary:this.geckoBinary},s=await ve(e.context,this.browser),i={...r,...s};if(i?.open===!1&&console.log(yc(this.browser,!1)),i?.startingUrl&&console.log(mc(i?.browser,i?.startingUrl)),i?.chromiumBinary&&console.log(js("chromium",i?.chromiumBinary)),i?.geckoBinary&&console.log(js("gecko",i?.geckoBinary)),i?.profile&&console.log(dc(i?.browser,i?.profile)),i?.preferences&&console.log(gc(i?.browser)),i?.browserFlags&&i?.browserFlags.length>0&&console.log(hc(i?.browser)),i.open===!1)return;let o=this.getProfilePath(e,this.browser,this.profile||this.profile);switch(this.browser){case"chrome":case"edge":case"chromium-based":{new Ze({...i,browser:this.browser,profile:o}).apply(e);break}case"firefox":case"gecko-based":new Ir({...i,browser:this.browser,profile:o}).apply(e);break;default:{new Ze({...i,browser:"chrome",profile:o}).apply(e);break}}}};function te(t,e){let r=et.default.join(t,"manifest.json"),s=S(require(r),e.browser),i=et.default.join(t,`dist/${e.browser}`),o=e.chromiumBinary?"chromium-based":e.geckoBinary?"gecko-based":e.browser;return{mode:e.mode||"development",entry:{},target:"web",context:t,devtool:s.manifest_version===3?"cheap-source-map":"eval-cheap-source-map",output:{clean:{keep(n){return!n.startsWith("hot/background")}},path:i,publicPath:"/",hotUpdateChunkFilename:"hot/[id].[fullhash].hot-update.js",hotUpdateMainFilename:"hot/[runtime].[fullhash].hot-update.json",environment:{bigIntLiteral:!0,dynamicImport:!0}},resolve:{modules:["node_modules",et.default.join(t,"node_modules")],extensions:[".js",".mjs",".jsx",".ts",".mts",".tsx",".json",".wasm",".less",".css",".sass",".scss"]},watchOptions:{ignored:/node_modules|dist/},module:{rules:[]},plugins:[new pt({manifestPath:r,browser:o}),new ht({manifestPath:r}),new gt({manifestPath:r}),new wt({manifestPath:r}),process.env.EXPERIMENTAL_ERRORS_PLUGIN==="true"&&new Pr({manifestPath:r,browser:o}),new xr({manifestPath:r,browser:o,polyfill:e.polyfill}),new fr({manifestPath:r,browser:o}),new hr({manifestPath:r,browser:o,stats:!0,port:8e3}),new Or({extension:[i,et.default.join(__dirname,"extensions",`${o}-manager-extension`)],browser:o,open:e.open,startingUrl:e.startingUrl,profile:e.profile,preferences:e.preferences,browserFlags:e.browserFlags,chromiumBinary:e.chromiumBinary,geckoBinary:e.geckoBinary})].filter(Boolean),stats:{all:!1,errors:!0,warnings:!0},infrastructureLogging:{level:"none"},performance:{hints:!1,maxAssetSize:999e3,maxEntrypointSize:999e3},optimization:{minimize:e.mode==="production"},experiments:{asyncWebAssembly:!0}}}var tt=a(require("path")),bp=a(require("go-git-it"));var Mr=a(require("path")),dp=a(require("axios")),gp=a(require("adm-zip"));var As=a(require("stream")),hp=require("util"),Il=(0,hp.promisify)(As.default.pipeline);async function yp(t,e){let r=t.split("?")[0];try{console.log(zc(r));let s=await(0,dp.default)({url:t,method:"GET",responseType:"stream"}),i=Mr.default.extname(r),o=Mr.default.basename(r,i),n=Mr.default.join(e,o);console.log(Hc(n));let c=[];await Il(s.data,new As.default.Writable({write(u,m,g){c.push(u),g()}}));let p=Buffer.concat(c);return new gp.default(p).extractAllTo(n,!0),console.log(Vc()),n}catch(s){throw console.error(Gc(s)),s}}var Ol=t=>{try{return new URL(t),!0}catch{return!1}};async function Ml(t,e){return await(0,bp.default)(t,process.cwd(),e),tt.default.resolve(process.cwd(),tt.default.basename(t))}async function Al(t){return await yp(t,process.cwd())}async function Z(t){if(!t)return process.cwd();if(Ol(t)){let e=new URL(t);if(e.protocol.startsWith("http")){if(e.origin!=="https://github.com")return await Al(t);let r=e.pathname.split("/"),s=r.slice(1,3)[0],i=r.slice(1,3)[1];console.log(Ic(s,i));let o=tt.default.basename(e.pathname),n=await Ml(t,Oc(o));return console.log(Mc(o)),n}}return tt.default.resolve(process.cwd(),t)}var H=a(require("path")),wp=a(require("fs")),xp=a(require("ignore")),vp=a(require("tiny-glob")),Ts=a(require("adm-zip")),_p=a(require("slugify"));function Tl(t){try{return wp.default.readFileSync(t,"utf8")}catch{return""}}function Rl(t){return(0,_p.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function Nl(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function Ul(t,e){let r=Rl(e.zipFilename||t.name);return e.zipFilename?r:`${r}-${t.version}`}async function ql(t){let e=H.default.join(t,".gitignore"),r=Tl(e),s=(0,xp.default)();return r?s.add(r):console.log(Ac(t)),(await(0,vp.default)("**/*",{cwd:t,dot:!0})).filter(o=>!s.ignores(o))}async function Sp(t,{browser:e="chrome",...r}){try{let s=H.default.join(t,"dist"),i=H.default.join(s,e),o=r.zipSource?t:i,n=require(H.default.join(o,"manifest.json")),c=Ul(n,{browser:e,...r}),p=Nl(e),l=H.default.join(i,`${c}.${p}`),u=H.default.join(s,`${c}-source.${p}`);if(r.zipSource){console.log(""),console.log(Tc(u));let m=new Ts.default;(await ql(t)).forEach(b=>{m.addLocalFile(H.default.join(t,b),H.default.dirname(b))}),m.writeZip(u)}if(r.zip){console.log(""),console.log(Rc(l));let m=new Ts.default;m.addLocalFolder(i),m.writeZip(l)}r.zip&&r.zipSource?(console.log(""),console.log(Nc(e,c,u,l))):r.zip?(console.log(""),console.log(Uc(c,p,e,l))):r.zipSource&&(console.log(""),console.log(qc(c,p,e,u)))}catch(s){throw console.error(Bc(s)),s}}async function Ar(t,e){let r=await Z(t);!t?.startsWith("http")&&!Pp.default.existsSync(Rs.default.join(r,"manifest.json"))&&(console.log(X(Rs.default.join(r,"manifest.json"))),process.exit(1));try{let s=e?.browser||"chrome",i=te(r,{...e,browser:s,mode:"production"}),o=i.plugins?.filter(u=>u?.constructor.name!=="plugin-browsers"&&u?.constructor.name!=="plugin-reload"),c=(await xe(r))({...i,plugins:o}),p=(0,Ep.merge)(c),l=(0,kp.default)(p);await new Promise((u,m)=>{l.run(async(g,b)=>{if(g)return console.error(g.stack||g),m(g);e?.silent||console.log(Dc(r,b,s)),(e?.zip||e?.zipSource)&&await Sp(r,{...e,browser:s}),b?.hasErrors()?(console.log(b.toString({colors:!0})),process.exit(1)):(console.log(Lc()),u())})})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}var qs=a(require("fs")),Rr=a(require("path"));var Us=a(require("path")),$p=a(require("webpack")),Cp=a(require("webpack-dev-server")),jp=require("webpack-merge");function Ns(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function Fp(t,e){let r=rp(t,"dev"),s=ve(t,e.browser),i=te(t,{...e,...r,...s,mode:"development"}),n=(await xe(t))(i),c=(0,jp.merge)(n),p=(0,$p.default)(c),l={host:"127.0.0.1",allowedHosts:"all",static:Us.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:ft(t)?void 0:{paths:[Us.default.join(t,"**/*.html")],options:{usePolling:!0,interval:1e3}},client:{logging:process.env.EXTENSION_ENV==="development"?"error":"none",progress:!1,overlay:!1},headers:{"Access-Control-Allow-Origin":"*"},port:"auto",hot:"only"},u=new Cp.default(l,p);u.startCallback(m=>{m!=null&&console.log(`Error in the Extension.js runner: ${m.stack||""}`)}),process.on("ERROR",()=>{Ns(u)}),process.on("SIGINT",()=>{Ns(u)}),process.on("SIGTERM",()=>{Ns(u)})}var Tr=a(require("path")),_e=a(require("fs/promises"));async function Dp(t){let e=Tr.default.join(t,"extension-env.d.ts"),r=process.env.EXTENSION_ENV==="development"?Tr.default.resolve(process.cwd(),"programs/cli/types"):"extension/dist/types",s=`// Required Extension.js types for TypeScript projects.
163
163
  // This file is auto-generated and should not be excluded.
164
164
  // If you need additional types, consider creating a new *.d.ts file and
165
165
  // referencing it in the "include" array of your tsconfig.json file.
@@ -168,4 +168,4 @@ ${Zc(e)}`}function Kc(t){return`${E("info")} Using ${(0,d.magenta)(t)}. ${(0,d.b
168
168
 
169
169
  // Polyfill types for browser.* APIs.
170
170
  /// <reference types="${r}/polyfill.d.ts" />
171
- `;try{await _e.default.access(e),(await _e.default.readFile(e,"utf8")).includes("develop/dist/types")&&await _e.default.writeFile(e,s),process.env.EXTENSION_ENV==="development"&&await _e.default.writeFile(e,s)}catch{let o=require(Tr.default.join(t,"manifest.json"));console.log(Wc(o));try{await _e.default.writeFile(e,s)}catch(n){console.log(Jc(n))}}}var Lp=a(require("path")),Op=require("cross-spawn"),Ip=a(require("fs")),Mp=require("package-manager-detector");async function Wl(){let t=await(0,Mp.detect)(),e="npm";if(oe())return"pnpm";switch(t?.name){case"yarn":e="yarn";break;case"pnpm":e="pnpm";break;default:e="npm"}return e}function Jl(){return["install"]}async function Ap(t){let e=Lp.default.join(t,"node_modules"),r=await Wl(),s=Jl(),i=process.cwd();try{process.chdir(t),await Ip.default.promises.mkdir(e,{recursive:!0});let o=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",n=(0,Op.spawn)(r,s,{stdio:o});await new Promise((c,p)=>{n.on("close",l=>{l!==0?p(new Error(Qc(r,s,l))):c()}),n.on("error",l=>{p(l)})})}catch(o){console.error(ep(o)),process.exit(1)}finally{process.chdir(i)}}async function Tp(t,e){let r=await Z(t),s=Rr.default.join(r,"manifest.json");!t?.startsWith("http")&&!qs.default.existsSync(s)&&(console.log(X(Rr.default.join(r,"manifest.json"))),process.exit(1));try{z(r)&&await Dp(r);let i=Rr.default.join(r,"node_modules");qs.default.existsSync(i)||(console.log(Yc()),await Ap(r)),setTimeout(async()=>{await Fp(r,{...e,mode:"development",browser:e.browser||"chrome"})},50)}catch(i){process.env.EXTENSION_ENV==="development"&&console.error(i),process.exit(1)}}var Rp=a(require("fs")),Bs=a(require("path")),Np=a(require("webpack")),Up=require("webpack-merge");async function Nr(t,e){let r=await Z(t);!t?.startsWith("http")&&!Rp.default.existsSync(Bs.default.join(r,"manifest.json"))&&(console.log(X(Bs.default.join(r,"manifest.json"))),process.exit(1));try{let s=e.browser||"chrome",i=te(r,{mode:"production",profile:e.profile,browser:s,chromiumBinary:e.chromiumBinary,geckoBinary:e.geckoBinary,startingUrl:e.startingUrl}),o=i.plugins?.filter(u=>u?.constructor.name==="plugin-browsers");console.log(jc(s));let c=(await xe(r))({...i,plugins:o}),p=(0,Up.merge)(c);(0,Np.default)(p).run(async(u,m)=>{u&&(console.error(u.stack||u),process.exit(1)),m?.hasErrors()?(console.log(m.toString({colors:!0})),process.exit(1)):console.log(Fc(r,{browser:s,mode:"production"}))})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}var qp=a(require("fs")),Ws=a(require("path"));async function Bp(t,e){let r=await Z(t);!t?.startsWith("http")&&!qp.default.existsSync(Ws.default.join(r,"manifest.json"))&&(console.log(X(Ws.default.join(r,"manifest.json"))),process.exit(1));try{let s=e.browser||"chrome";await Ar(t,{...e,browser:s,silent:!0}),await Nr(t,{...e,browser:s})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});
171
+ `;try{await _e.default.access(e),(await _e.default.readFile(e,"utf8")).includes("develop/dist/types")&&await _e.default.writeFile(e,s),process.env.EXTENSION_ENV==="development"&&await _e.default.writeFile(e,s)}catch{let o=require(Tr.default.join(t,"manifest.json"));console.log(Wc(o));try{await _e.default.writeFile(e,s)}catch(n){console.log(Jc(n))}}}var Lp=a(require("path")),Ip=require("cross-spawn"),Op=a(require("fs")),Mp=require("package-manager-detector");async function Bl(){let t=await(0,Mp.detect)(),e="npm";if(oe())return"pnpm";switch(t?.name){case"yarn":e="yarn";break;case"pnpm":e="pnpm";break;default:e="npm"}return e}function Wl(){return["install"]}async function Ap(t){let e=Lp.default.join(t,"node_modules"),r=await Bl(),s=Wl(),i=process.cwd();try{process.chdir(t),await Op.default.promises.mkdir(e,{recursive:!0});let o=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",n=(0,Ip.spawn)(r,s,{stdio:o});await new Promise((c,p)=>{n.on("close",l=>{l!==0?p(new Error(Qc(r,s,l))):c()}),n.on("error",l=>{p(l)})})}catch(o){console.error(ep(o)),process.exit(1)}finally{process.chdir(i)}}async function Tp(t,e){let r=await Z(t),s=Rr.default.join(r,"manifest.json");!t?.startsWith("http")&&!qs.default.existsSync(s)&&(console.log(X(Rr.default.join(r,"manifest.json"))),process.exit(1));try{z(r)&&await Dp(r);let i=Rr.default.join(r,"node_modules");qs.default.existsSync(i)||(console.log(Yc()),await Ap(r)),setTimeout(async()=>{await Fp(r,{...e,mode:"development",browser:e.browser||"chrome"})},50)}catch(i){process.env.EXTENSION_ENV==="development"&&console.error(i),process.exit(1)}}var Rp=a(require("fs")),Bs=a(require("path")),Np=a(require("webpack")),Up=require("webpack-merge");async function Nr(t,e){let r=await Z(t);!t?.startsWith("http")&&!Rp.default.existsSync(Bs.default.join(r,"manifest.json"))&&(console.log(X(Bs.default.join(r,"manifest.json"))),process.exit(1));try{let s=e.browser||"chrome",i=te(r,{mode:"production",profile:e.profile,browser:s,chromiumBinary:e.chromiumBinary,geckoBinary:e.geckoBinary,startingUrl:e.startingUrl}),o=i.plugins?.filter(u=>u?.constructor.name==="plugin-browsers");console.log(jc(s));let c=(await xe(r))({...i,plugins:o}),p=(0,Up.merge)(c);(0,Np.default)(p).run(async(u,m)=>{u&&(console.error(u.stack||u),process.exit(1)),m?.hasErrors()?(console.log(m.toString({colors:!0})),process.exit(1)):console.log(Fc(r,{browser:s,mode:"production"}))})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}var qp=a(require("fs")),Ws=a(require("path"));async function Bp(t,e){let r=await Z(t);!t?.startsWith("http")&&!qp.default.existsSync(Ws.default.join(r,"manifest.json"))&&(console.log(X(Ws.default.join(r,"manifest.json"))),process.exit(1));try{let s=e.browser||"chrome";await Ar(t,{...e,browser:s,silent:!0}),await Nr(t,{...e,browser:s})}catch(s){process.env.EXTENSION_ENV==="development"&&console.error(s),process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});