extension-develop 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/dist/add-dynamic-public-path.js +3 -0
  3. package/dist/add-hmr-accept-code.js +3 -0
  4. package/dist/add-query-param-to-imported-css.js +1 -0
  5. package/dist/ensure-hmr-for-scripts.js +3 -0
  6. package/dist/extensions/manager-extension/background.js +57 -0
  7. package/dist/extensions/manager-extension/define-initial-tab.js +67 -0
  8. package/dist/extensions/manager-extension/manifest.json +17 -0
  9. package/dist/extensions/manager-extension/pages/sakura-dark.css +268 -0
  10. package/dist/extensions/manager-extension/pages/sakura.css +267 -0
  11. package/dist/extensions/manager-extension/pages/welcome.html +49 -0
  12. package/dist/extensions/manager-extension/pages/welcome.js +34 -0
  13. package/dist/extensions/manager-extension/public/logo.png +0 -0
  14. package/dist/extensions/manager-extension/reload-service.js +145 -0
  15. package/dist/extensions/manager-extension-firefox/background.js +68 -0
  16. package/dist/extensions/manager-extension-firefox/define-initial-tab.js +57 -0
  17. package/dist/extensions/manager-extension-firefox/manifest.json +16 -0
  18. package/dist/extensions/manager-extension-firefox/pages/sakura-dark.css +268 -0
  19. package/dist/extensions/manager-extension-firefox/pages/sakura.css +267 -0
  20. package/dist/extensions/manager-extension-firefox/pages/welcome.html +49 -0
  21. package/dist/extensions/manager-extension-firefox/pages/welcome.js +34 -0
  22. package/dist/extensions/manager-extension-firefox/public/logo.png +0 -0
  23. package/dist/extensions/manager-extension-firefox/reload-service.js +130 -0
  24. package/dist/inject-chromium-client-loader.js +52 -0
  25. package/dist/inject-content-css-during-dev.js +10 -0
  26. package/dist/inject-firefox-client-loader.js +48 -0
  27. package/dist/minimum-chromium-file.mjs +1 -0
  28. package/dist/minimum-content-file.mjs +1 -0
  29. package/dist/minimum-firefox-file.mjs +1 -0
  30. package/dist/minimum-script-file.mjs +0 -0
  31. package/dist/module.d.ts +44 -0
  32. package/dist/module.js +178 -0
  33. package/dist/resolver-loader.js +1 -0
  34. package/dist/resolver-module.js +1 -0
  35. package/dist/stylelint.config.js +7 -0
  36. package/dist/tailwind.config.js +25 -0
  37. package/dist/types/css-content.d.ts +7 -0
  38. package/dist/types/css-modules.d.ts +19 -0
  39. package/dist/types/images.d.ts +58 -0
  40. package/dist/types/index.d.ts +13 -0
  41. package/dist/types/index.ts +7 -0
  42. package/dist/types/polyfill.d.ts +1 -0
  43. package/package.json +113 -0
package/dist/module.js ADDED
@@ -0,0 +1,178 @@
1
+ "use strict";var dp=Object.create;var Je=Object.defineProperty;var gp=Object.getOwnPropertyDescriptor;var hp=Object.getOwnPropertyNames;var yp=Object.getPrototypeOf,bp=Object.prototype.hasOwnProperty;var wp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xp=(t,e)=>{for(var s in e)Je(t,s,{get:e[s],enumerable:!0})},Cr=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of hp(e))!bp.call(t,n)&&n!==s&&Je(t,n,{get:()=>e[n],enumerable:!(r=gp(e,n))||r.enumerable});return t};var c=(t,e,s)=>(s=t!=null?dp(yp(t)):{},Cr(e||!t||!t.__esModule?Je(s,"default",{value:t,enumerable:!0}):s,t)),vp=t=>Cr(Je({},"__esModule",{value:!0}),t);var Cs=wp((fl,_p)=>{_p.exports={license:"MIT",repository:{type:"git",url:"https://github.com/cezaraugusto/extension.git",directory:"programs/develop"},engines:{node:">=18"},name:"extension-develop",version:"0.1.0",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"},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","browser-extension-manifest-fields":"^1.0.6","case-sensitive-paths-webpack-plugin":"^2.4.0",chokidar:"^3.6.0","chrome-location":"^1.2.1","content-security-policy-parser":"^0.6.0","css-loader":"^6.10.0","csv-loader":"^3.0.5","detect-package-manager":"^3.0.2","dotenv-webpack":"^8.0.1","edge-location":"^1.0.0","firefox-profile":"^4.6.0","fx-runner":"^1.4.0","go-git-it":"^1.2.6",ignore:"^5.3.1","loader-utils":"^3.3.1","mini-css-extract-plugin":"^2.8.1",parse5:"^7.1.2","parse5-utils":"^2.0.0",postcss:"^8.4.40",progress:"^2.0.3","resolve-url-loader":"^5.0.0","schema-utils":"^4.2.0",slugify:"^1.6.6","style-loader":"^3.3.4","swc-loader":"^0.2.6","tiny-glob":"^0.2.9",webpack:"~5.92.0","webpack-browser-extension-resolve":"*","webpack-dev-server":"^5.0.2","webpack-target-webextension":"^1.1.2"},devDependencies:{"@types/adm-zip":"^0.5.5","@types/case-sensitive-paths-webpack-plugin":"^2.1.9","@types/chrome":"^0.0.268","@types/dotenv-webpack":"^7.0.7","@types/jest":"^29.5.12","@types/loader-utils":"^2.0.6","@types/node":"^20.14.12","@types/webextension-polyfill":"^0.10.7",jest:"^29.7.0","ts-jest":"^29.1.2",tsup:"^8.0.1",typescript:"5.3.3"},optionalDependencies:{"@babel/core":"^7.24.9","@pmmmwh/react-refresh-webpack-plugin":"^0.5.15","@svgr/webpack":"^8.1.0","@vue/compiler-sfc":"^3.4.34","babel-loader":"^9.1.3","babel-preset-modern-browser-extension":"^0.7.0",less:"^4.2.0","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:"^1.77.8","sass-loader":"^16.0.0",stylelint:"^16.7.0","stylelint-config-standard-scss":"^13.1.0","stylelint-webpack-plugin":"^5.0.1",tailwindcss:"^3.4.7",typescript:"5.3.3","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var pl={};xp(pl,{extensionBuild:()=>Qc,extensionDev:()=>ip,extensionPreview:()=>pp,extensionStart:()=>mp});module.exports=vp(pl);var Xc=c(require("fs")),Yc=c(require("path")),Kc=c(require("webpack"));var we=c(require("path"));var un=c(require("case-sensitive-paths-webpack-plugin"));var J=c(require("fs")),M=c(require("path")),pn=c(require("dotenv-webpack"));var Ls=c(require("path")),u=require("@colors/colors/safe");var Lr=c(require("path")),ze=Lr.default.join(process.cwd(),"node_modules/extension-develop/dist/certs");function b(t,e){let s=e==="warn"?(0,u.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,u.brightBlue)("\u25BA\u25BA\u25BA"):e==="error"?(0,u.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,u.brightGreen)("\u25BA\u25BA\u25BA");return`${(0,u.gray)(t)} ${s}`}function Fr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ar(t,e){if(!!1)return`${b(t,"info")} compiled ${(0,u.brightGreen)("successfully")} in ${e} ms`}function Ir(t,e,s){return`${b(t,"info")} ${(0,u.cyan)(e)} Integration Found
2
+
3
+ Installing required setup dependencies via ${(0,u.brightYellow)(s)}. This is a one time operation...`}function Mr(t){return`${b(t,"info")} loaded ${(0,u.brightYellow)("env")} file successfully.`}function v(t,e){return`${b(t,"info")} is using ${(0,u.cyan)(e)}.`}function P(t,e){return`${b(t,"success")} You Are All Set
4
+
5
+ Run the program again to start hacking with ${(0,u.cyan)(e)} support.`}function Or(t,e){return`${b(t,"info")} Installing Root Dependencies
6
+
7
+ Installing ${(0,u.cyan)(e)} Dependencies in Extension.js root. This only happens for authors and contributors.`}function Rr(t,e){return`${b(t,"success")} ${e} Dependencies Installed ${(0,u.brightGreen)("Successfully")}.`}function Tr(t,e,s){return`${b(t,"error")} ${(0,u.cyan)(e)} Installation Error
8
+
9
+ Failed to detect package manager or install ${(0,u.cyan)(e)} dependencies: ${(0,u.red)(s?.toString()||"")}`}function Nr(t){return`${b(t,"error")} No Service Worker Support
10
+
11
+ Firefox does not support the ${(0,u.brightYellow)("background.service_worker")} field yet.
12
+ Update your manifest.json file to use ${(0,u.brightYellow)("background.scripts")} instead.
13
+
14
+ Read more: ${(0,u.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function qr(t){return`${b(t,"error")} Insecure Content-Security-Policy
15
+
16
+ Manifest includes insecure content-security-policy value ${(0,u.brightYellow)("'unsafe-eval'")} in directive ${(0,u.brightBlue)("'script-src'")}.`}function Ur(t){return`${b(t,"error")} No Default Locale Specified
17
+
18
+ Localization used, but ${(0,u.brightYellow)("default_locale")} wasn't specified in the manifest.`}function ve(t){return t==="chrome"?(0,u.underline)("https://developer.chrome.com/docs/extensions/reference/manifest"):(0,u.underline)("https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json")}function Wr(t,e){return`${b(t,"error")} Wrong Manifest Field Type
19
+
20
+ Field ${(0,u.brightYellow)("web_accessible_resources")} must be a string array in Manifest version 2.
21
+
22
+ Read more: ${ve(e)}`}function Br(t,e){return`${b(t,"error")} Wrong Manifest Field Type
23
+
24
+ Field ${(0,u.brightYellow)("web_accessible_resources")} must be an array of objects in Manifest version 3.
25
+
26
+ Read more: ${ve(e)}`}function Jr(t,e,s){let n=s?.schemaPath?.split("/"),i=n?.slice(n.length-2).shift();return`${b(t,"error")} Deprecated Field
27
+
28
+ Field ${(0,u.brightYellow)(i||"")} is deprecated in Manifest V3. Update your manifest.json file to run your extension.
29
+
30
+ Read more: ${ve(e)}`}function zr(t,e,s){let r=e?.instancePath.replaceAll("/",".").slice(1)||"",n=e?.params.type;return`${b(t,"error")} Invalid Manifest Field
31
+
32
+ Field ${(0,u.brightYellow)(r)} must be of type ${(0,u.cyan)(n)}.
33
+
34
+ Read more: ${ve(s)}`}function Hr(t,e,s){return`${b(t,"error")} Missing Required Manifest Field
35
+
36
+ Field ${(0,u.brightYellow)(s||"")} is required. Update your manifest.json file to run your extension.
37
+
38
+ Read more: ${ve(e)}`}function Gr(t,e){let s=e.split(".").pop(),r=`${b(t,"error")} Content Script Import
39
+
40
+ One of your ${s?.toUpperCase()} imports is also a content_script CSS in manifest.json.
41
+ Remove the duplicate entry and try again.`;if(e.startsWith("content_scripts"))return r}function Vr(t,e){let s="https://extension.js.org/n/development/special-folders",r=e.startsWith(".");return`${b(t,"error")} ${t} ${(0,u.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Module ${(0,u.brightYellow)(e)} Not Found
42
+
43
+ `+r?"Make sure the file exists in the extension directory. ":`Make sure module is installed via package manager. If you need to handle entries not declared in manifest.json, add them to a special folder.
44
+
45
+ Read more: ${(0,u.underline)(s)}.`}function Zr(t){return`${b(t,"error")} Top Level Await In Non-ECMAScript Module
46
+
47
+ Top-level await is only supported in ECMAScript modules.
48
+ To use it in your extension, make sure to set ${(0,u.brightYellow)('"type": "module"')}
49
+ in your package.json or use the ${(0,u.brightYellow)(".mjs")} extension for your script files.`}function He(t,e,s){if(!e)throw new Error("This operation is impossible. Please report a bug.");switch(Ls.default.extname(s)){case".js":case".ts":case".jsx":case".tsx":return Pp(t,e,s);case".css":case".scss":case".sass":case".less":return Sp(t,e,s);default:return kp(t,e,s)}}function oe(t,e,s){let r=e.startsWith("content_scripts")?"content_scripts":e.replace("/","."),n=e.split("-")[1],i=e.startsWith("pages");return`${b(t,"error")} File Not Found
50
+
51
+ ${i?`Check the ${(0,u.brightYellow)("pages")} folder in your project root directory.
52
+
53
+ `:`Check the ${(0,u.brightYellow)(r)} `+e.includes("content_scripts")&&`(index ${n}) field in your manifest.json file.
54
+
55
+ `}${(0,u.red)("NOT FOUND")} ${(0,u.underline)(s)}`}function Ge(t,e,s){return`${b(t,"error")} File Not Found
56
+
57
+ Check the ${(0,u.brightYellow)(e)} field in your manifest.json file.
58
+
59
+ ${(0,u.red)("NOT FOUND")} ${(0,u.underline)(s)}`}function Xr(t){return`${b(t,"error")} Manifest Not Found
60
+
61
+ Ensure you have a manifest.json file at the root directory of your project.`}function Yr(t,e){return`${b(t,"error")} Invalid Manifest
62
+
63
+ Update your manifest.json file and try again. `+e}function Kr(t,e,s){return`${b(t,"error")} Manifest Entry Point Modification
64
+
65
+ Changing the path of ${(0,u.brightYellow)("<script>")} or ${(0,u.brightYellow)('<link rel="stylesheet">')} files after compilation requires a server restart.
66
+
67
+ ${(0,u.gray)("PATH")} ${(0,u.red)("REMOVED")} ${(0,u.underline)(s)}
68
+ ${(0,u.gray)("PATH")} ${(0,u.brightGreen)("ADDED")} ${(0,u.underline)(e)}`}function Qr(t,e,s,r,n){let i=t.charAt(0).toUpperCase()+t.slice(1);return`${b("manifest.json","info")} Manifest Entry Point Modification
69
+
70
+ ${i} ${(0,u.brightYellow)(r)} in the ${(0,u.underline)(s+"/")} folder after compilation requires a server restart.
71
+
72
+ ${(0,u.gray)("PATH")} ${(0,u.underline)(n)}`}function en(t){return`${b(t,"warn")}`+v(t,"TypeScript").replace(".",`but no config file was found. Creating ${(0,u.brightYellow)("tsconfig.json")}...`)}function Fs(t,e){let s=t.name||"Extension.js";if(!e.data)return`${b(s,"error")} No Data From Client
73
+
74
+ Ensure your extension is enabled and that no hanging browser instance is open and try again.`;let{id:r,management:n}=e.data;if(!n&&process.env.EXTENSION_ENV==="development")return`${b(s,"error")} No management API info received from client. Investigate.`;let{name:i,version:o}=n,a=Cs().version;return`
75
+ \u{1F9E9} ${(0,u.brightGreen)("Extension.js")} ${(0,u.gray)(`${a}`)}
76
+ Extension Name ${(0,u.gray)(i)}
77
+ Extension Version ${(0,u.gray)(o)}
78
+ Extension ID ${(0,u.gray)(r)}`}function tn(t,e,s){let r=e==="firefox"?"Add-on":"Extension";return`${(0,u.gray)("\u25BA\u25BA\u25BA")} ${Fr(e)} ${r} ${s?(0,u.brightGreen)("enabled"):(0,u.gray)("disabled")}. Running in ${(0,u.brightYellow)(t||"unknown")} mode.`}function sn(t){return`This is your first run using Extension.js via ${Fr(t)}. Welcome! \u{1F389}
79
+
80
+ \u{1F9E9} Learn more at ${(0,u.underline)("https://extension.js.org")}`}function rn(t,e){return`${b(t,"error")} WebSocket: ${e}`}function nn(t,e,s){return`
81
+
82
+ ${(0,u.bold)((0,u.red)("ERROR"))} in ${b(t,"error")} File Not Found
83
+
84
+ Check the ${(0,u.brightYellow)(e.replace("/","."))} field in your manifest.json file.
85
+
86
+ ${(0,u.red)("NOT FOUND")} ${(0,u.underline)(s)}}`}function on(t,e){return`${b(t,"error")} HTML Entry Point Modification
87
+
88
+ Changing the path of ${(0,u.brightYellow)("<script>")} or ${(0,u.brightYellow)('<link rel="stylesheet">')} files after compilation requires a server restart.
89
+
90
+ ${(0,u.gray)("PATH")} ${e}`}function Pp(t,e,s){return`${b(t,"error")} File Not Found
91
+
92
+ Check your ${(0,u.brightYellow)("<script>")} tags in ${(0,u.underline)(e)}.
93
+
94
+ ${(0,u.red)("NOT FOUND")} ${(0,u.underline)(s)}`}function Sp(t,e,s){return`${b(t,"error")} File Not Found
95
+
96
+ Check your ${(0,u.brightYellow)("<link>")} tags in ${(0,u.underline)(e)}.
97
+
98
+ ${(0,u.red)("NOT FOUND")} ${(0,u.underline)(s)}`}function kp(t,e,s){let r=Ls.default.extname(s);return`${b(t,"error")} File Not Found
99
+
100
+ Check your ${(0,u.brightYellow)("*"+r)} assets in ${(0,u.underline)(e)}.
101
+
102
+ ${(0,u.red)("NOT FOUND")} ${(0,u.underline)(s)}`}function an(){return`This is your first run using Extension.js. Welcome! \u{1F389}
103
+
104
+ ${(0,u.brightYellow)("Note")}: Firefox requires a secure certificate for localhost connections,
105
+ needed for the reloader to work. By default, your manifest.json file
106
+ is not being watched. To enable this feature, run:
107
+
108
+ npx -y mkcert-cli \\
109
+ ${(0,u.brightGreen)("--outDir")} ${(0,u.gray)(ze)} \\
110
+ ${(0,u.brightGreen)("--cert")} ${(0,u.gray)("localhost.cert")} \\
111
+ ${(0,u.brightGreen)("--key")} ${(0,u.gray)("localhost.key")}
112
+
113
+ This will create a secure certificate via ${(0,u.bold)("mkcert")}
114
+ enabling the secure connection needed for Firefox.
115
+
116
+ Learn more: ${(0,u.underline)("https://extension.js.org")}`}function cn(t,e){return`${b(t,"error")} Default port ${e} in use, choose a new port. `}var Ve=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=M.default.dirname(this.manifestPath),n=require(this.manifestPath).name||"Extension.js";(J.default.existsSync(M.default.join(s,".env"))||J.default.existsSync(M.default.join(s,".env.example"))||J.default.existsSync(M.default.join(s,".env.local"))||J.default.existsSync(M.default.join(s,".env.defaults")))&&(console.log(Mr(n)),new pn.default({path:J.default.existsSync(M.default.join(s,".env"))?M.default.join(s,".env"):J.default.existsSync(M.default.join(s,".env.local"))?M.default.join(s,".env.local"):M.default.join(s,".env.example"),allowEmptyValues:!0,defaults:J.default.existsSync(M.default.join(s,".env.defaults")),systemvars:!0}).apply(e))}};var As=c(require("fs")),ln=c(require("path")),Ze=class{apply(e){let s=ln.default.join(e.options.output.path||"","hot");As.default.existsSync(s)&&(As.default.rmSync(s,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanHotUpdatesPlugin] Removed old hot-update files before compilation."))}};var Xe=class{static name="plugin-compilation";manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){new un.default().apply(e),new Ve({manifestPath:this.manifestPath}).apply(e),new Ze().apply(e),e.hooks.done.tap("develop:brand",s=>{s.compilation.name=void 0;let n=require(this.manifestPath).name||"Extension.js",i=s.endTime-s.startTime;console.log(Ar(`${n}`,i))})}};var An=c(require("path")),In=c(require("mini-css-extract-plugin"));var En=c(require("mini-css-extract-plugin"));var te=c(require("path")),Pe=c(require("fs"));var _e=c(require("path")),Ye=c(require("fs")),Is=require("child_process"),fn=require("detect-package-manager");function mn(t,e){return Object.values(e||{}).some(s=>s===t)}function d(t,e,s){let r=_e.default.extname(e),i=S(e,{exclude:s})?_e.default.normalize(e):t;return[".js",".jsx",".tsx",".ts"].includes(r)&&(i=i.replace(r,".js")),[".html",".njk",".nunjucks"].includes(r)&&(i=i.replace(r,".html")),[".css",".scss",".sass",".less"].includes(r)&&(i=i.replace(r,".css")),dn(i||"")}function dn(t){return t.replace(/\\/g,"/")}function S(t,e){return e?(Array.isArray(e)?e:[e]).some(r=>{if(typeof r!="string")return!1;let n=dn(r);return t.includes(n.startsWith("/")?n.slice(1):n)}):!1}function z(t,e){if(t.getAsset("manifest.json")||t.assets["manifest.json"]){let s=t.assets["manifest.json"].source().toString();return JSON.parse(s||"{}")}return require(e)}async function _(t,e,s){try{let r=await(0,fn.detect)();console.log(Ir(t,e,r));let n="";r==="yarn"?n=`yarn --silent add ${s.join(" ")} --cwd ${__dirname} --optional`:r==="npm"?n=`npm --silent install ${s.join(" ")} --prefix ${__dirname} --save-optional`:r==="pnpm"?n=`pnpm --silent add ${s.join(" ")} --prefix ${__dirname} --save-optional`:n=`${r} --silent install ${s.join(" ")} --cwd ${__dirname} --optional`,(0,Is.execSync)(n,{stdio:"inherit"}),await new Promise(i=>setTimeout(i,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Or(t,e)),r==="yarn"?n="yarn install --silent > /dev/null 2>&1":r==="npm"?n="npm install --silent > /dev/null 2>&1":r==="pnpm"?n="pnpm install --silent > /dev/null 2>&1":n=`${r} install --silent > /dev/null 2>&1`,(0,Is.execSync)(n,{stdio:"inherit"})),console.log(Rr(t,e))}catch(r){console.error(Tr(t,e,r))}}function Ke(t){let e=_e.default.join(t,"package.json");if(!Ye.default.existsSync(e))return!1;let s=JSON.parse(Ye.default.readFileSync(e,"utf-8")),r=["react","vue","@angular/core","svelte","solid-js","preact"],n=s.dependencies||{},i=s.devDependencies||{};for(let o of r)if(n[o]||i[o])return!0;return!1}function Ms(t){return!Ye.default.existsSync(_e.default.resolve(__dirname,`run-${t}-profile`))}function gn(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}}}}var hn=!1;function ae(t){let e=te.default.join(t,"package.json"),s=te.default.join(t,"manifest.json");if(!Pe.default.existsSync(e))return!1;let r=jp(t),n=require(e),i=n.devDependencies&&n.devDependencies.tailwindcss,o=n.dependencies&&n.dependencies.tailwindcss,a=!!r&&!!(i||o);if(a&&!hn){let l=require(s).name||"Extension.js";console.log(v(l,"Tailwind")),hn=!0}return a}function jp(t){let e=te.default.join(t,"tailwind.config.mjs"),s=te.default.join(t,"tailwind.config.cjs"),r=te.default.join(t,"tailwind.config.js");if(Pe.default.existsSync(e))return e;if(Pe.default.existsSync(s))return s;if(Pe.default.existsSync(r))return r}async function yn(t){let e=require(te.default.join(t,"package.json")).name;if(ae(t)){try{require.resolve("tailwindcss")}catch{await _(e,"PostCSS",["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),await _(e,"Tailwind",["tailwindcss"]),console.log(P(e,"Tailwind")),process.exit(0)}return[...ae(t)?[require.resolve("tailwindcss",{paths:[t]})]:[]]}return[]}var Qe=c(require("path")),wn=c(require("fs"));var bn=!1;function Se(t){let e=Qe.default.join(t,"package.json"),s=Qe.default.join(t,"manifest.json");if(!wn.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies.sass,i=r.dependencies&&r.dependencies.sass;if(n||i){if(!bn){let a=require(s).name||"Extension.js";console.log(v(a,"SASS")),bn=!0}return!0}return!1}async function xn(t,e){if(!Se(t))return[];try{require.resolve("sass-loader")}catch{let r=["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"],n=require(Qe.default.join(t,"package.json")).name;await _(n,"PostCSS",r),await _(n,"SASS",["sass","sass-loader","resolve-url-loader"]),console.log(P(n,"SASS")),process.exit(0)}return[{test:/\.(s(a|c)ss)$/,exclude:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await I(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await I(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await I(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await I(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!0})}]}]}var et=c(require("path")),_n=c(require("fs"));var vn=!1;function ke(t){let e=et.default.join(t,"package.json"),s=et.default.join(t,"manifest.json"),n=require(s).name||"Extension.js";if(!_n.default.existsSync(e))return!1;let i=require(e),o=i.devDependencies&&i.devDependencies.less,a=i.dependencies&&i.dependencies.less;return o||a?(vn||(console.log(v(n,"LESS")),vn=!0),!0):!1}async function Pn(t,e){if(!ke(t))return[];try{require.resolve("less-loader")}catch{let r=require(et.default.join(t,"package.json")).name;await _(r,"LESS",["less","less-loader","resolve-url-loader"]),console.log(P(r,"LESS")),process.exit(0)}return[{test:/\.less$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await I(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await I(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var je=c(require("path")),Rs=c(require("fs"));var ce=!1;function $p(t){let e=je.default.join(t,"package.json"),s=je.default.join(t,"manifest.json"),r=[".postcssrc",".postcssrc.json",".postcssrc.yaml",".postcssrc.yml",".postcssrc.js",".postcssrc.cjs","postcss.config.js","postcss.config.cjs"],i=require(s).name||"Extension.js";if(Rs.default.existsSync(e)&&require(e).postcss)return ce||(console.log(v(i,"PostCSS")),ce=!0),!0;for(let o of r)if(Rs.default.existsSync(je.default.join(t,o)))return ce||(console.log(v(i,"PostCSS")),ce=!0),!0;return ae(t)?(ce||(console.log(v(i,"PostCSS")),ce=!0),!0):!1}async function Sn(t,e){if(!$p(t))return{};try{require.resolve("postcss-loader")}catch{let n=require(je.default.join(t,"package.json")).name;!Se(t)&&!ke(t)&&await _(n,"PostCSS",["postcss","postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),console.log(P(n,"PostCSS")),process.exit(0)}let s=await yn(t);return{loader:require.resolve("postcss-loader"),options:{postcssOptions:{parser:require.resolve("postcss-scss"),ident:"postcss",config:!1,plugins:[...s,require.resolve("postcss-flexbugs-fixes"),[require.resolve("postcss-preset-env"),{autoprefixer:{flexbox:"no-2009"},stage:3}],require.resolve("postcss-normalize")]},sourceMap:e.mode==="development"}}}var tt=c(require("path")),jn=c(require("fs"));var kn=!1;function $e(t){let e=tt.default.join(t,"package.json"),s=tt.default.join(t,"manifest.json");if(!jn.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies.vue,i=r.dependencies&&r.dependencies.vue;if((n||i)&&!kn){let a=require(s).name||"Extension.js";console.log(v(a,"Vue")),kn=!0}return!!n||!!i}async function $n(t){if(!$e(t))return;try{require.resolve("vue-loader")}catch{let n=["typescript"],o=require(tt.default.join(t,"manifest.json")).name||"Extension.js";await _(o,"TypeScript",n),await _(o,"Vue",["vue-loader","@vue/compiler-sfc","vue-template-compiler","vue-style-loader"]),console.log(P(o,"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}}async function I(t,e){let s=En.default.loader,r=[e.useMiniCssExtractPlugin?s:$e(t)?"vue-style-loader":"style-loader","css-loader"].filter(Boolean);if(ae(t)||Se(t)||ke(t)){let n=await Sn(t,e);n.loader&&r.push(n)}return e.loader&&r.push({loader:require.resolve("resolve-url-loader"),options:{sourceMap:e.mode==="development",root:t}},{loader:require.resolve(e.loader),options:{sourceMap:e.mode==="development"}}),r.filter(Boolean)}var D=c(require("path")),O=c(require("fs"));function Ln(t){let e=D.default.join(t,"stylelint.config.js"),s=D.default.join(t,".stylelintrc.js file"),r=D.default.join(t,"stylelint.config.mjs"),n=D.default.join(t,".stylelintrc.mjs"),i=D.default.join(t,"stylelint.config.cjs"),o=D.default.join(t,".stylelintrc.cjs"),a=D.default.join(t,".stylelintrc.json"),p=D.default.join(t,".stylelintrc"),l=D.default.join(t,".stylelintrc.yml"),f=D.default.join(t,".stylelintrc.yaml");if(O.default.existsSync(e))return e;if(O.default.existsSync(s))return s;if(O.default.existsSync(r))return r;if(O.default.existsSync(n))return n;if(O.default.existsSync(i))return i;if(O.default.existsSync(o))return o;if(O.default.existsSync(a))return a;if(O.default.existsSync(p))return p;if(O.default.existsSync(l))return l;if(O.default.existsSync(f))return f}var Dn=!1;function Cn(t){let e=D.default.join(t,"package.json"),s=D.default.join(t,"manifest.json");if(!O.default.existsSync(e))return!1;let n=!!Ln(t);if(n&&!Dn){let o=require(s).name||"Extension.js";console.log(v(o,"Stylelint")),Dn=!0}return n}async function Fn(t){if(!Cn(t))return[];try{require.resolve("stylelint")}catch{let r=["stylelint","stylelint-webpack-plugin","stylelint-config-standard-scss"],n=require(D.default.join(t,"package.json")).name;await _(n,"Stylelint",r),console.log(P(n,"Stylelint")),process.exit(0)}let e=require("stylelint-webpack-plugin");return[new e({context:t,configFile:Cn(t)?Ln(t):D.default.join(__dirname,"stylelint.config.js"),files:"**/*.{css,scss,sass,less}",exclude:["node_modules",D.default.join(t,"node_modules")]})]}var st=class t{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=An.default.dirname(this.manifestPath),r=[new In.default({chunkFilename:p=>{let l=p.chunk?.runtime;return Ts(l)}})];r.forEach(p=>p.apply(e));let n=await Fn(s);r.push(...n);let i=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await I(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await I(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]},{test:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await I(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await I(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]}];e.options.plugins=[...e.options.plugins,...r].filter(Boolean);let o=await xn(s,this.mode),a=await Pn(s,this.mode);i.push(...o),i.push(...a),e.options.module.rules=[...e.options.module.rules,...i].filter(Boolean)}async apply(e){if(this.mode==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var rt=class{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async apply(e){let s=n=>`${n}/[name][ext]`,r=[{test:/\.svg$/i,type:"asset",resourceQuery:/url/,generator:{filename:()=>s("assets")}},{test:/\.svg$/i,issuer:/\.[jt]sx?$/,resourceQuery:{not:[/url/]},use:["@svgr/webpack"],generator:{filename:()=>s("assets")}},{test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i,type:"asset/resource",generator:{filename:()=>s("assets")},parser:{dataUrlCondition:{maxSize:2048}}},{test:/\.(woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:()=>s("assets")}},{test:/\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i,type:"asset/resource",generator:{filename:()=>s("assets")},parser:{dataUrlCondition:{maxSize:2048}}},{test:/\.(csv|tsv)$/i,use:[require.resolve("csv-loader")],generator:{filename:()=>s("assets")}}];e.options.module.rules=[...e.options.module.rules,...r].filter(Boolean)}};var Ns=c(require("path"));var le=c(require("path")),at=c(require("fs"));var nt=c(require("path")),On=c(require("fs"));var Mn=!1;function H(t){let e=nt.default.join(t,"package.json"),s=nt.default.join(t,"manifest.json");if(!On.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies.react,i=r.dependencies&&r.dependencies.react;if((n||i)&&!Mn){let a=require(s).name||"Extension.js";console.log(v(a,"React")),Mn=!0}return!!n||!!i}async function Rn(t){if(!H(t))return;try{require.resolve("@pmmmwh/react-refresh-webpack-plugin")}catch{let r=["react-refresh","@pmmmwh/react-refresh-webpack-plugin","@svgr/webpack","react-refresh-typescript"],i=require(nt.default.join(t,"manifest.json")).name||"Extension.js";await _(i,"React",r),console.log(P(i,"React")),process.exit(0)}return{plugins:[new(require("@pmmmwh/react-refresh-webpack-plugin"))],loaders:void 0,alias:void 0}}var it=c(require("path")),Nn=c(require("fs"));var Tn=!1;function G(t){let e=it.default.join(t,"package.json"),s=it.default.join(t,"manifest.json");if(!Nn.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies.preact,i=r.dependencies&&r.dependencies.preact;if((n||i)&&!Tn){let a=require(s).name||"Extension.js";console.log(v(a,"Preact")),Tn=!0}return!!n||!!i}async function qn(t){if(!G(t))return;try{require.resolve("react-refresh")}catch{let r=["react-refresh","@pmmmwh/react-refresh-webpack-plugin","@svgr/webpack","react-refresh-typescript"],i=require(it.default.join(t,"manifest.json")).name||"Extension.js";await _(i,"Preact",r),console.log(P(i,"Preact")),process.exit(0)}return{plugins:[new(require("@pmmmwh/react-refresh-webpack-plugin"))],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 pe=c(require("path")),ot=c(require("fs"));var Un=!1;function R(t){let e=pe.default.join(t,"package.json");if(!ot.default.existsSync(e))return!1;let s=Dp(t),r=require(e),n=require(pe.default.join(t,"manifest.json")),i=n.name||"Extension.js",o=r.devDependencies&&r.devDependencies.typescript,a=r.dependencies&&r.dependencies.typescript;return Un||((o||a)&&(s?console.log(v(i,"TypeScript")):(console.log(en(n)),Cp(t))),Un=!0),!!s&&!!(o||a)}function Ep(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:Ke(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 Dp(t){let e=pe.default.join(t,"tsconfig.json");if(ot.default.existsSync(e))return e}function Cp(t){ot.default.writeFileSync(pe.default.join(t,"tsconfig.json"),JSON.stringify(Ep(t,{mode:"development"}),null,2))}async function Wn(t){if(!R(t))return!1;try{require.resolve("typescript")}catch{let s=["typescript"],n=require(pe.default.join(t,"manifest.json")).name||"Extension.js";await _(n,"TypeScript",s),console.log(P(n,"TypeScript")),process.exit(0)}return!0}var Bn=!1,Jn=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function Lp(t){let e=le.default.join(t,"package.json"),s=le.default.join(t,"manifest.json");if(!at.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies["babel-core"],i=r.dependencies&&r.dependencies["babel-core"],o=Jn.some(a=>at.default.existsSync(le.default.join(t,a)))||!!n||!!i;if(o&&!Bn){let p=require(s).name||"Extension.js";console.log(v(p,"Babel")),Bn=!0}return o}function Fp(t){for(let e of Jn){let s=le.default.join(t,e);if(at.default.existsSync(s))return s}}function Ap(t,e){let s=require("babel-preset-modern-browser-extension").default;return{cacheDirectory:!1,cacheCompression:!1,babelrc:!1,configFile:Fp(t),compact:e.mode==="production",overrides:[s(e).overrides],presets:[...s(e).presets],plugins:[...s(e).plugins,process.env.NODE_ENV!=="test"&&e.mode==="development"&&(H(t)||G(t))&&require.resolve("react-refresh/babel")].filter(Boolean)}}async function zn(t,e){if(!Lp(e))return;try{require.resolve("babel-loader")}catch{let o=["@babel/core","babel-loader","babel-preset-modern-browser-extension"],p=require(le.default.join(e,"manifest.json")).name||"Extension.js";await _(p,"Babel",o),console.log(P(p,"Babel")),process.exit(0)}let s=R(e)?/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/:/\.(js|mjs|jsx|mjsx)$/,r=t.options.mode,n=await Wn(e);return{plugins:void 0,loaders:[{test:s,include:e,exclude:/node_modules/,loader:require.resolve("babel-loader"),options:Ap(e,{mode:r,typescript:n})}],alias:void 0}}var ct=class t{static name="plugin-js-frameworks";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Ns.default.dirname(this.manifestPath),r=await zn(e,s),n=await Rn(s),i=await qn(s),o=await $n(s);e.options.resolve.alias={...r?.alias||{},...n?.alias||{},...i?.alias||{},...o?.alias||{},...e.options.resolve.alias},e.options.module.rules=[{test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Ns.default.dirname(this.manifestPath)],exclude:/node_modules/,use:{loader:require.resolve("swc-loader"),options:{sync:!0,module:{type:"es6"},minify:this.mode==="production",isModule:!0,jsc:{target:"es2016",parser:{syntax:R(s)?"typescript":"ecmascript",tsx:R(s)&&(H(s)||G(s)),jsx:!R(s)&&(H(s)||G(s)),dynamicImport:!0},transform:{react:{runtime:"automatic",importSource:"react"}}}}}},...r?.loaders||[],...n?.loaders||[],...i?.loaders||[],...o?.loaders||[],...e.options.module.rules].filter(Boolean),n?.plugins?.forEach(a=>a.apply(e)),i?.plugins?.forEach(a=>a.apply(e)),o?.plugins?.forEach(a=>a.apply(e))}async apply(e){if(this.mode==="production"){e.hooks.beforeRun.tapPromise(t.name,async()=>await this.configureOptions(e));return}await this.configureOptions(e)}};var Oe=c(require("path"));var Ci=c(require("path"));var Hn=c(require("path"));function Gn(t,e){if(!e||!e.action||!e.action.default_popup)return;let s=e.action.default_popup;return Hn.default.join(t,s)}var Vn=c(require("path"));function Zn(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let s=e.browser_action.default_popup;return Vn.default.join(t,s)}var pt=c(require("path"));function Xn(t,e){let s={newtab:void 0};if(!e||!e.chrome_url_overrides)return{"chrome_url_overrides/newtab":void 0};if(e.chrome_url_overrides.history){let r=e.chrome_url_overrides.history;s={"chrome_url_overrides/history":pt.default.join(t,r)}}if(e.chrome_url_overrides.newtab){let r=e.chrome_url_overrides.newtab;s={"chrome_url_overrides/newtab":pt.default.join(t,r)}}if(e.chrome_url_overrides.bookmarks){let r=e.chrome_url_overrides.bookmarks;s={"chrome_url_overrides/bookmarks":pt.default.join(t,r)}}return s}var Yn=c(require("path"));function Kn(t,e){if(!e||!e.devtools_page)return;let s=e.devtools_page;return Yn.default.join(t,s)}var qs=c(require("path"));function Qn(t,e){if(e.options_page){let r=e.options_page;return qs.default.join(t,r)}if(!e||!e.options_ui||!e.options_ui.page)return;let s=e.options_ui.page;return qs.default.join(t,s)}var ei=c(require("path"));function ti(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let s=e.page_action.default_popup;return ei.default.join(t,s)}var si=c(require("path"));function ri(t,e){if(!e||!e.sandbox||!e.sandbox.pages)return{"sandbox/page-0":void 0};let s=e.sandbox.pages,r={};for(let[n,i]of s.entries())r[`sandbox/page-${n}`]=si.default.join(t,i);return r}var ni=c(require("path"));function ii(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let s=e.side_panel.default_path;return ni.default.join(t,s)}var oi=c(require("path"));function ai(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let s=e.sidebar_action.default_panel;return oi.default.join(t,s)}function Ee(t,e){return{"action/default_popup":Gn(t,e),"browser_action/default_popup":Zn(t,e),...Xn(t,e),devtools_page:Kn(t,e),"options_ui/page":Qn(t,e),"page_action/default_popup":ti(t,e),...ri(t,e),"side_panel/default_path":ii(t,e),"sidebar_action/default_panel":ai(t,e)}}var Us=c(require("path"));function ci(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Us.default.join(t,e.action.default_icon);let s=[];for(let r in e.action.default_icon)s.push(Us.default.join(t,e.action.default_icon[r]));return s}var Ws=c(require("path"));function pi(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let s=[];if(typeof e.browser_action.default_icon=="string")return Ws.default.join(t,e.browser_action.default_icon);for(let r in e.browser_action.default_icon){let n=e.browser_action.default_icon[r]=Ws.default.join(t,e.browser_action.default_icon[r]);s.push(n)}return s}var Bs=c(require("path"));function li(t,e){if(!(!e||!e.browser_action||!e.browser_action.theme_icons)){for(let s of e.browser_action.theme_icons)s.light&&(s.light=Bs.default.join(t,s.light)),s.dark&&(s.dark=Bs.default.join(t,s.dark)),s.size&&delete s.size;return e.browser_action.theme_icons}}var ui=c(require("path"));function fi(t,e){if(!e||!e.icons)return;let s=[];for(let r in e.icons){let n=ui.default.join(t,e.icons[r]);s.push(n)}return s}var Js=c(require("path"));function mi(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return Js.default.join(t,e.page_action.default_icon);let s=[];for(let r in e.page_action.default_icon){let n=Js.default.join(t,e.page_action.default_icon[r]);s.push(n)}return s}var di=c(require("path"));function gi(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:di.default.join(t,e.sidebar_action.default_icon)}function hi(t,e){return{action:ci(t,e),browser_action:pi(t,e),"browser_action/theme_icons":li(t,e),icons:fi(t,e),page_action:mi(t,e),sidebar_action:gi(t,e)}}var yi=c(require("path"));function bi(t,e){let s={};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(n=>{s[`declarative_net_request/${n.id}`]=yi.default.join(t,n.path)}),s)}var wi=c(require("path"));function xi(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let s=e.storage.managed_schema;return wi.default.join(t,s)}function vi(t,e){return{...bi(t,e),"storage/managed_schema":xi(t,e)}}var _i=c(require("path"));function Pi(t,e){if(!e||!e.background)return;let s=e.background.scripts;if(s)return s.map(r=>_i.default.join(t,r))}var Si=c(require("path"));function ki(t,e){if(!e||!e.background)return;let s=e.background.service_worker;if(s)return Si.default.join(t,s)}var zs=c(require("path"));function ji(t,e){if(!e||!e.content_scripts)return{"content_scripts/content-0":void 0};let s=i=>{if(i.js?.length!==0)return i.js?.map(o=>zs.default.join(t,o))},r=i=>{if(i.css?.length!==0)return i.css?.map(o=>zs.default.join(t,o))},n={};for(let[i,o]of e.content_scripts.entries()){let a=s(o),p=r(o);n[`content_scripts/content-${i}`]=[...(a||[]).filter(l=>l!=null),...(p||[]).filter(l=>l!=null)]}return n}var $i=c(require("path"));function Ei(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let s=e.user_scripts.api_script;return $i.default.join(t,s)}function De(t,e){return{"background/scripts":Pi(t,e),"background/service_worker":ki(t,e),...ji(t,e),"user_scripts/api_script":Ei(t,e)}}function Di(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function Ip(t){function e(s){let r={};for(let n in s)if(s.hasOwnProperty(n)){let i=n.includes(":")?n.split(":")[1]:n;typeof s[n]=="object"&&!Array.isArray(s[n])?r[i]=e(s[n]):r[i]=s[n]}return r}return e(t)}function Li({manifestPath:t}){let e=Ci.default.dirname(t),s=require(t),r=Ip(s);return{html:Ee(e,r),icons:hi(e,r),json:vi(e,r),scripts:De(e,r),web_accessible_resources:Di(r)}}var ue=c(require("path"));var lt=c(require("fs")),Ce=c(require("path"));function ut(t,e){if(!lt.default.existsSync(t)||!lt.default.statSync(t).isDirectory())return[];let s=[];function r(n){let i=lt.default.readdirSync(n,{withFileTypes:!0});for(let o of i){let a=Ce.default.join(n,o.name);o.isDirectory()?r(a):o.isFile()&&e(o.name)&&s.push(a)}}return r(t),s}function ft(t,e,s=""){return!e||!e.length?{}:e.reduce((r,n)=>{let i=Ce.default.extname(n),o=Ce.default.basename(n,i),a=s?`${s}/${o}`:Ce.default.relative(t,n);return{...r,[a]:n}},{})}function Fi({manifestPath:t}){let e=ue.default.dirname(t),s={public:ue.default.join(e,"public"),pages:ue.default.join(e,"pages"),scripts:ue.default.join(e,"scripts")},r={public:ut(s.public,()=>!0),pages:ut(s.pages,i=>i.endsWith(".html")),scripts:ut(s.scripts,i=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(ue.default.extname(i)))};return{public:ft(e,r.public),pages:ft(e,r.pages,"pages"),scripts:ft(e,r.scripts,"scripts")}}var mt=c(require("path")),Ai=c(require("webpack")),dt=class{manifestPath;includeList;excludeList;loaderOptions;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList,this.loaderOptions=e.loaderOptions}apply(e){new Ai.default.ProvidePlugin({r:[mt.default.resolve(__dirname,"./resolver-module.js"),"default"]}).apply(e),e.options.module?.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,loader:require.resolve(mt.default.resolve(__dirname,"./resolver-loader.js")),include:[mt.default.dirname(this.manifestPath)],exclude:/node_modules/,options:{manifestPath:this.manifestPath,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 Ii=c(require("fs")),ht=c(require("webpack")),Mi=require("webpack");var gt=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){e.hooks.compilation.tap("manifest:emit-manifest",s=>{s.hooks.processAssets.tap({name:"manifest:emit-manifest",stage:ht.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let r=this.manifestPath,n;try{let a=Ii.default.readFileSync(r,"utf-8");n=JSON.parse(a)}catch(a){let l=require(this.manifestPath).name||"Extension.js";s.errors.push(new ht.default.WebpackError(Yr(l,a)));return}let i=JSON.stringify(n,null,2);s.emitAsset("manifest.json",new Mi.sources.RawSource(i))})})}};var xt=require("webpack");var fo=c(require("path"));function Oi(t,e){return t.background&&t.background.scripts&&{background:{...t.background,...t.background.scripts&&{scripts:["background/scripts.js",...t.background.scripts.filter(s=>e.includes(s))]}}}}var Ri=c(require("path"));var yt=t=>Ri.default.basename(t);function Ti(t,e){return t.browser_action&&{browser_action:{...t.browser_action,...t.browser_action.default_popup&&{default_popup:d("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"?d(`icons/${yt(t.browser_action.default_icon)}`,t.browser_action.default_icon,e):Object.fromEntries(Object.entries(t.browser_action.default_icon).map(([s,r])=>[s,d(`icons/${yt(r)}`,r,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(s=>({...s,...s.light&&{light:d(`browser_action/${yt(s.light)}`,s.light,e)},...s.dark&&{dark:d(`browser_action/${yt(s.dark)}`,s.dark,e)}}))}}}}function Ni(t,e){return t.declarative_net_request&&{declarative_net_request:{...t.declarative_net_request,rule_resources:t.declarative_net_request.rule_resources.map(s=>({...s,path:s.path&&d(`declarative_net_request/${s.id}.json`,s.path,e)}))}}}function qi(t,e){return{...Oi(t,e),...Ti(t,e),...Ni(t,e)}}var Wi=c(require("path"));var Ui=t=>Wi.default.basename(t);function Bi(t,e){return t.action&&{action:{...t.action,...t.action.default_popup&&{default_popup:d("action/default_popup.html",t.action.default_popup,e)},...t.action.default_icon&&{default_icon:typeof t.action.default_icon=="string"?d(`action/${Ui(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([s,r])=>[s,d(`action/${Ui(r)}`,r,e)]))}}}}function Ji(t,e){return t.background&&t.background.service_worker&&{background:{...t.background,...t.background.service_worker&&{service_worker:d("background/service_worker.js",t.background.service_worker,e)}}}}function bt(t,e){return t.side_panel&&{side_panel:{...t.side_panel.default_path&&{default_path:d("side_panel/default_path.html",t.side_panel.default_path,e)}}}}function zi(t,e){return{...Bi(t,e),...Ji(t,e),...bt(t,e)}}function Hi(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:d("background/page.html",t.background.page,e)}}}}function Gi(t,e){return t.chrome_url_overrides&&{chrome_url_overrides:{...t.chrome_url_overrides.bookmarks&&{bookmarks:d("chrome_url_overrides/bookmarks.html",t.chrome_url_overrides.bookmarks,e)},...t.chrome_url_overrides.history&&{history:d("chrome_url_overrides/history.html",t.chrome_url_overrides.history,e)},...t.chrome_url_overrides.newtab&&{newtab:d("chrome_url_overrides/newtab.html",t.chrome_url_overrides.newtab,e)}}}}function Vi(t,e){return t.content_scripts&&{content_scripts:t.content_scripts.map((s,r)=>{let n=[...new Set(s.js)],i=[...new Set(s.css)];return{...s,js:[...n.map(o=>d(`content_scripts/content-${r}.js`,o,e))],css:[...i.map(o=>d(`content_scripts/content-${r}.css`,o,e))]}})}}function Zi(t,e){return t.devtools_page&&{devtools_page:d("devtools_page.html",t.devtools_page,e)}}var Xi=c(require("path"));var Mp=t=>Xi.default.basename(t);function Yi(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([s,r])=>[s,d(`icons/${Mp(r)}`,r,e)]))}}function Ki(t,e){return t.options_page&&{options_page:d("options_ui/page.html",t.options_page,e)}}function Qi(t,e){return t.options_ui&&{options_ui:{...t.options_ui,...t.options_ui.page&&{page:d("options_ui/page.html",t.options_ui.page,e)}}}}var to=c(require("path"));var eo=t=>to.default.basename(t);function so(t,e){return t.page_action&&{page_action:{...t.page_action,...t.page_action.default_popup&&{default_popup:d("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"?d(`icons/${eo(t.page_action.default_icon)}`,t.page_action.default_icon,e):Object.fromEntries(Object.entries(t.page_action.default_icon).map(([s,r])=>[s,d(`icons/${eo(r)}`,r,e)]))}}}}function ro(t,e){return t.sandbox&&{sandbox:{...t.sandbox,...t.sandbox.pages&&{pages:t.sandbox.pages.map((s,r)=>d(`sandbox/page-${r}.html`,s,e))}}}}var no=c(require("path"));var Op=t=>no.default.basename(t);function io(t,e){return t.sidebar_action&&{sidebar_action:{...t.sidebar_action,...t.sidebar_action.default_panel&&{default_panel:d("sidebar_action/default_panel.html",t.sidebar_action.default_panel,e)},...t.sidebar_action.default_icon&&{default_icon:d(`icons/${Op(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function oo(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:d("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var ao=c(require("path"));var Rp=t=>ao.default.basename(t);function co(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:d(`theme/images/${Rp(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function po(t,e){return t.user_scripts&&{user_scripts:{...t.user_scripts,...t.user_scripts.api_script&&{api_script:d("user_scripts/api_script.js",t.user_scripts.api_script,e)}}}}function lo(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function uo(t,e){return{...Hi(t,e),...Gi(t,e),...Vi(t,e),...Zi(t,e),...Yi(t,e),...Ki(t,e),...Qi(t,e),...so(t,e),...ro(t,e),...bt(t,e),...io(t,e),...oo(t,e),...co(t,e),...po(t,e),...lo(t)}}function mo(t,e,s){let r=e||require(t),n=a=>Array.isArray(a)?a.map(p=>i(p)):typeof a=="string"?[i(a)]:[],i=a=>{let p=fo.default.dirname(t),l=a.replace(p,"");return l.startsWith("/")?l.slice(1):l},o=Object.entries(s).flatMap(([,a])=>n(a));return JSON.stringify({...r,...uo(r,o),...qi(r,o),...zi(r,o)},null,2)}var wt=class{manifestPath;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.excludeList=e.excludeList}applyDevOverrides(e){return e.content_scripts?e.content_scripts.map((s,r)=>(s.css.length&&!s.js.length&&(s.js=[d(`content_scripts-${r}`,"dev.js",[])]),s)):{}}apply(e){e.hooks.thisCompilation.tap("manifest:update-manifest",s=>{s.hooks.processAssets.tap({name:"manifest:update-manifest",stage:xt.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(s.errors.length>0)return;let r=z(s,this.manifestPath),n=mo(this.manifestPath,r,this.excludeList||{}),i={...r,...JSON.parse(n)};e.options.mode!=="production"&&i.content_scripts&&(i.content_scripts=this.applyDevOverrides(i));let o=JSON.stringify(i,null,2),a=new xt.sources.RawSource(o);s.updateAsset("manifest.json",a)})})}};var go=c(require("fs")),vt=class{dependencyList;constructor(e){this.dependencyList=e}apply(e){e.hooks.afterCompile.tap("ManifestPlugin (AddDependenciesPlugin)",s=>{if(s.errors?.length)return;let r=new Set(s.fileDependencies);this.dependencyList&&this.dependencyList.forEach(n=>{go.default.existsSync(n)&&(r.has(n)||(r.add(n),s.fileDependencies.add(n)))})})}};var ho=c(require("fs")),yo=c(require("path")),Pt=c(require("webpack"));var _t=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}extractPaths(e){let s=Array.isArray(e)?e:[e];if(typeof s[0]=="string")return s;let r=[];if(typeof e=="object"&&!Array.isArray(e)){let n=e;n.light&&r.push(n.light),n.dark&&r.push(n.dark)}return r}handleErrors(e,s){let r=[".png",".jpg",".jpeg",".svg",".gif",".webp"],n=[".json"],i=[".js",".ts",".jsx",".tsx",".mjs",".cjs"],o=".html",a=Object.entries(this.includeList||{});for(let[p,l]of a)if(l){let f=this.extractPaths(l);for(let g of f){let h=yo.default.extname(g),j=require(this.manifestPath).name||"Extension.js",E=oe(j,p,g);ho.default.existsSync(g)||(r.includes(h)?e.errors.push(new s(E)):n.includes(h)?e.errors.push(new s(E)):i.includes(h)?e.errors.push(new s(E)):h===o?e.errors.push(new s(E)):e.errors.push(new s(E)))}}}apply(e){e.hooks.compilation.tap("manifest:check-manifest-files",s=>{s.hooks.processAssets.tap({name:"compatibility:check-manifest-files",stage:Pt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let r=Pt.default.WebpackError;this.handleErrors(s,r)})})}};var kt=c(require("webpack"));var St=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}flattenAndSort(e){return e.flat(1/0).sort()}apply(e){e.hooks.watchRun.tapAsync("manifest:throw-if-recompile-is-needed",(s,r)=>{if((s.modifiedFiles||new Set).has(this.manifestPath)){let i=s.options.context||"",o=require(`${i}/package.json`).name,a=require(this.manifestPath),p=this.flattenAndSort(Object.values(Ee(i,a))),l=this.flattenAndSort(Object.values(De(i,a)));s.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",f=>{f.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:kt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let h=f.getAsset("manifest.json")?.source.source().toString(),y=JSON.parse(h||"{}"),j=this.flattenAndSort(Object.values(Ee(i,y))),E=this.flattenAndSort(Object.values(De(i,y)));if(l.toString()!==E.toString()||p.toString()!==j.toString()){let N=p.filter(ee=>!j.includes(ee))[0],q=j.filter(ee=>!p.includes(ee))[0],B=Kr(o,q,N);f.errors.push(new kt.default.WebpackError(B))}})})}r()})}};var jt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new gt({manifestPath:this.manifestPath}).apply(e),new _t({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new wt({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new vt([this.manifestPath]).apply(e),new St({manifestPath:this.manifestPath,includeList:this.includeList}).apply(e)}};var Xs=c(require("path"));var Gs=c(require("fs")),Dt=c(require("webpack")),_o=require("webpack");var bo=c(require("fs")),me=c(require("path")),wo=c(require("parse5-utils"));var fe=c(require("parse5-utils"));function $t(t){try{return new URL(t),!0}catch{return!1}}function Le(t,e){let{childNodes:s=[]}=t;for(let r of s)if(r.nodeName==="script"){let n=fe.default.getAttribute(r,"src");if(!n||$t(n))continue;e({filePath:n,childNode:r,assetType:"script"})}else if(r.nodeName==="link"){let n=fe.default.getAttribute(r,"href"),i=fe.default.getAttribute(r,"rel");if(!n||$t(n))continue;e(i==="dns-prefetch"||i==="icon"||i==="manifest"||i==="modulepreload"||i==="preconnect"||i==="prefetch"||i==="preload"||i==="prerender"?{filePath:n,childNode:r,assetType:"staticHref"}:{filePath:n,childNode:r,assetType:"css"})}else if(r.nodeName==="a"||r.nodeName==="area"){let n=fe.default.getAttribute(r,"href");if(!n||$t(n))continue;e({filePath:n,childNode:r,assetType:"staticHref"})}else if(r.nodeName==="audio"||r.nodeName==="embed"||r.nodeName==="iframe"||r.nodeName==="img"||r.nodeName==="input"||r.nodeName==="source"||r.nodeName==="track"||r.nodeName==="video"){let n=fe.default.getAttribute(r,"src");if(!n||$t(n))continue;e({filePath:n,childNode:r,assetType:"staticSrc"})}else Le(r,e)}function C(t,e){let s={css:[],js:[],static:[]};if(!t)return s;let r=e||bo.default.readFileSync(t,{encoding:"utf8"}),n=wo.default.parse(r),i=(o,a)=>me.default.join(me.default.dirname(o),a.startsWith("/")?me.default.relative(me.default.dirname(o),a):a);for(let o of n.childNodes)if(o.nodeName==="html"){for(let a of o.childNodes)(a.nodeName==="head"||a.nodeName==="body")&&Le(a,({filePath:p,assetType:l})=>{let f=i(t,p);switch(l){case"script":s.js?.push(f);break;case"css":s.css?.push(f);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;s.static?.push(f);break;default:break}});return{css:s.css,js:s.js,static:s.static}}}function xo(t,e,s){let r=Object.keys(t).find(i=>{let o=t[i];return t[i]===e||C(o)?.js?.includes(e)||C(o)?.css?.includes(e)})||"",n=Hs(e);return r?`/${r.replace(n,"")}${s}`:`${e.replace(n,"")}${s}`}function Hs(t){switch(me.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,s){return s?`/${t}${e}`:`${t}${e}`}function vo(t,e){return Object.values(e||{}).some(s=>s===t)}var Et=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).name||"Extension.js";e.hooks.thisCompilation.tap("html:emit-html-file",n=>{n.hooks.processAssets.tap({name:"AddAssetsToCompilationPlugin",stage:Dt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let i=Object.entries(this.includeList||{});for(let o of i){let[a,p]=o;if(p){if(!Gs.default.existsSync(p)){let f=oe(r,a,p);n.warnings.push(new Dt.default.WebpackError(f));return}let l=Gs.default.readFileSync(p,"utf8");if(!S(p,this.excludeList)){let f=new _o.sources.RawSource(l),g=V(a,".html");n.emitAsset(g,f)}}}})})}};var Ct=c(require("fs")),de=c(require("path")),Po=c(require("webpack")),Fe=require("webpack");var Lt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-assets-to-compilation",s=>{s.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Fe.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{if(s.errors.length>0)return;let r=Object.entries(this.includeList||{});for(let n of r){let[i,o]=n,a=i+".html";if(o){let p=s.getAsset(a);if(p){let l=p.source.source().toString(),f=C(o,l)?.static,g=[...new Set(f)];for(let h of g)if(!h.includes("public/")){if(!Ct.default.existsSync(h)&&!vo(h,this.includeList)&&!de.default.basename(h).startsWith("#")){let q=He(this.manifestPath,o,h);s.warnings.push(new Po.default.WebpackError(q));return}let y=Ct.default.readFileSync(h),j=new Fe.sources.RawSource(y),E=de.default.join("assets",de.default.basename(h));if(!s.getAsset(E))if(h.endsWith(".html")){let N=C(h),q=[...N?.js||[],...N?.css||[],...N?.static||[]];s.emitAsset(E,j),q.forEach(B=>{let ee=Ct.default.readFileSync(B),xe=new Fe.sources.RawSource(ee),Dr=de.default.join("assets",de.default.basename(B));s.getAsset(Dr)||s.emitAsset(Dr,xe)})}else s.emitAsset(E,j)}}}}})})}};var So=c(require("path")),Vs=c(require("fs"));var Ft=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){let s=this.includeList||{};for(let r of Object.entries(s)){let[n,i]=r;if(i){if(!Vs.default.existsSync(i))return;let o=C(i),a=o?.js||[],p=o?.css||[],l=[...a,...p].filter(f=>!S(f,this.excludeList));if(e.options.mode==="development"){let f=So.default.resolve(__dirname,"minimum-script-file.mjs");l.push(f)}Vs.default.existsSync(i)&&(S(i,this.excludeList)||(e.options.entry={...e.options.entry,[n]:{import:l}}))}}}};var It=require("webpack");var Zs=c(require("fs")),Z=c(require("path")),L=c(require("parse5-utils"));function ko(t,e,s,r,n){let i=Zs.default.readFileSync(s,{encoding:"utf8"}),o=L.default.parse(i),a=!!t.getAsset(e+".css"),p=!1;for(let l of o.childNodes)if(l.nodeName==="html"){for(let f of l.childNodes){if((f.nodeName==="head"||f.nodeName==="body")&&Le(f,({filePath:g,childNode:h,assetType:y})=>{let j=Z.default.dirname(s),E=Z.default.resolve(j,g),N=Hs(E),q=S(Z.default.resolve(j,g),n),B=Z.default.join("/",Z.default.normalize(g)),ee=mn(E,r);switch(y){case"script":{q?l=L.default.setAttribute(h,"src",B):(l=L.default.remove(h),p=!0);break}case"css":{q?l=L.default.setAttribute(h,"href",B):(l=L.default.remove(h),a=!0);break}case"staticHref":case"staticSrc":{if(q)l=L.default.setAttribute(h,y==="staticSrc"?"src":"href",B);else if(ee){let xe=xo(r,E,N);l=L.default.setAttribute(h,y==="staticSrc"?"src":"href",xe)}else{let xe=Z.default.join("assets",Z.default.basename(E,N));Zs.default.existsSync(E)&&(l=L.default.setAttribute(h,y==="staticSrc"?"src":"href",V(xe,"",!0)))}break}default:break}}),f.nodeName==="head"&&a&&t.options.mode==="production"){let g=L.default.createNode("link");g.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:V(e,".css",!0)}],L.default.append(f,g)}if(f.nodeName==="body"&&(p||t.options.mode!=="production")){let g=L.default.createNode("script");g.attrs=[{name:"src",value:V(e,".js",!0)}],L.default.append(f,g)}}return L.default.serialize(o)}}var At=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",s=>{s.hooks.processAssets.tap({name:"html:update-html-file",stage:It.Compilation.PROCESS_ASSETS_STAGE_DERIVED},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let n of Object.entries(r)){let[i,o]=n;if(o){let a=ko(s,i,o,r,this.excludeList||{});if(!S(o,this.includeList)&&a){let p=new It.sources.RawSource(a),l=V(i,".html");s.updateAsset(l,p)}}}})})}};var jo=c(require("fs")),$o=require("webpack");var Mt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.thisCompilation.tap("html:add-to-file-dependencies",s=>{s.hooks.processAssets.tap({name:"html:add-to-file-dependencies",stage:$o.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let n of Object.entries(r)){let[,i]=n;if(i){let o=C(i),a=new Set(s.fileDependencies);if(jo.default.existsSync(i)){let p=[i,...o?.static||[]];for(let l of p)a.has(l)||(a.add(l),l===i&&s.fileDependencies.add(l))}}}})})}};var Eo=c(require("fs")),Do=c(require("path"));var Ot=class{manifestPath;includeList;initialHtmlAssets={};constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}hasEntriesChanged(e,s){if(!s||!e||e.length!==s.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==s[r])return!0;return!1}storeInitialHtmlAssets(e){Object.entries(e).forEach(([s,r])=>{let n=r;if(n){if(!Eo.default.existsSync(n)){let o=require(this.manifestPath).name||"Extension.js";console.error(oe(o,s,n)),process.exit(1)}this.initialHtmlAssets[n]={js:C(n)?.js||[],css:C(n)?.css||[]}}})}apply(e){let s=this.includeList||{};this.storeInitialHtmlAssets(s),e.hooks.make.tapAsync("html:throw-if-recompile-is-needed",(r,n)=>{let i=e.modifiedFiles||new Set,o=Array.from(i)[0];if(o&&this.initialHtmlAssets[o]){let a=C(o)?.js||[],p=C(o)?.css||[],{js:l,css:f}=this.initialHtmlAssets[o];if(this.hasEntriesChanged(p,f)||this.hasEntriesChanged(a,l)){let g=Do.default.dirname(this.manifestPath);console.log(on(g,o))}}n()})}};var Co=c(require("fs")),Lo=require("webpack");function Tp(t,e,s){let r="Module not found: Error: Can't resolve ",i=s.message.replace(r,"").split("'")[1];if(s.message.includes(r))for(let o of Object.entries(e)){let[,a]=o;if(a){if(!Co.default.existsSync(a))return null;let p=C(a),l=p?.js||[],f=p?.css||[];if(l.includes(i)||f.includes(i)){let g=He(t,a,i);return new Lo.WebpackError(g)}}}return null}var Rt=class{manifestPath;includeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList}apply(e){e.hooks.compilation.tap("html:handle-common-errors",s=>{s.hooks.afterSeal.tapPromise("html:handle-common-errors",async()=>{s.errors.forEach((r,n)=>{let i=Tp(this.manifestPath,this.includeList||{},r);i&&(s.errors[n]=i)})})})}};var Tt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Et({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Lt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ft({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new At({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:[Xs.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Xs.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),new Mt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ot({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Rt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var re=c(require("path"));var Ys=c(require("fs")),Fo=c(require("path"));function Ao(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(n=>{let i=Ys.default.existsSync(n)&&!S(n,e),o=Fo.default.extname(n);return i&&n?.includes(o)})}function Io(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(n=>Ys.default.existsSync(n)&&!S(n,e)&&n.endsWith(".css")||n.endsWith(".scss")||n.endsWith(".sass")||n.endsWith(".less"))}var Nt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let s=this.includeList||{};for(let r of Object.entries(s)){let[n,i]=r,o=Ao(i,this.excludeList),a=Io(i,this.excludeList),p=[...o];e.options.mode==="production"&&p.push(...a),(a.length||o.length)&&(e.options.entry={...e.options.entry,[n]:{import:p}})}}};var se=require("webpack"),Np=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],qp=[...Np,`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 } }`],qt=class t{apply(e){let{RuntimeGlobals:s}=e.webpack;e.hooks.compilation.tap("PublicPathRuntimeModule",r=>{r.hooks.runtimeRequirementInTree.for(s.publicPath).tap(t.name,n=>{let i=Up();return r.addRuntimeModule(n,i),!0})})}};function Up(){class t extends se.RuntimeModule{constructor(){super("publicPath",se.RuntimeModule.STAGE_BASIC)}generate(){let s=this.compilation?.outputOptions.publicPath;return se.Template.asString([...qp,`var path = ${JSON.stringify(this.compilation?.getPath(s||"",{hash:this.compilation.hash||"XXXX"}))}`,`${se.RuntimeGlobals.publicPath} = typeof importScripts === 'function' || !(isBrowser || isChrome) ? path : runtime.runtime.getURL(path);`])}}return new t}var Ut=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Nt({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 qt().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:re.default.resolve(__dirname,"./add-query-param-to-imported-css.js"),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]})}};var Qs=c(require("path")),Ae=c(require("fs")),er=c(require("webpack")),Ie=require("webpack");var ge=c(require("path")),Wt=c(require("fs"));function Ks(t){let e=ge.default.join(ge.default.dirname(t),"_locales"),s=[];if(Wt.default.existsSync(e))for(let r of Wt.default.readdirSync(e)){let n=ge.default.join(e,r);for(let i of Wt.default.readdirSync(n))s.push(ge.default.join(ge.default.dirname(t),"_locales",r,i))}return s}var Bt=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",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Ie.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let n=require(this.manifestPath).name||"Extension.js";if(!Ae.default.existsSync(this.manifestPath)){s.errors.push(new er.default.WebpackError(Xr(n)));return}if(s.errors.length>0)return;let i=Ks(this.manifestPath);for(let o of Object.entries(i||[])){let[a,p]=o,l=p;if(l){if(!Ae.default.existsSync(l)){s.warnings.push(new er.default.WebpackError(Ge(n,a,l)));return}let f=Ae.default.readFileSync(l),g=new Ie.sources.RawSource(f),h=e.options.context||Qs.default.dirname(this.manifestPath);if(!S(l,this.excludeList)){let y=Qs.default.relative(h,l);s.emitAsset(y,g)}}}})}),e.hooks.thisCompilation.tap("locales:module",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Ie.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=Ks(this.manifestPath);for(let n of Object.entries(r||[])){let[,i]=n;if(i){let o=new Set(s.fileDependencies),a=r||[];for(let p of a)Ae.default.existsSync(p)&&(o.has(p)||(o.add(p),s.fileDependencies.add(p)))}}})})}};var Jt=c(require("fs")),Mo=c(require("webpack")),Me=require("webpack");var zt=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",s=>{s.hooks.processAssets.tap({name:"json:module",stage:Me.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let n of Object.entries(r)){let[i,o]=n,a=Array.isArray(o)?o:[o];for(let p of a)if(p&&!S(p,this.excludeList)){if(!Jt.default.existsSync(p)){let h=require(this.manifestPath).name||"Extension.js";s.warnings.push(new Mo.default.WebpackError(Ge(h,i,p)));return}let l=Jt.default.readFileSync(p),f=new Me.sources.RawSource(l);s.emitAsset(i+".json",f)}}})}),e.hooks.thisCompilation.tap("json:module",s=>{s.hooks.processAssets.tap({name:"json:module",stage:Me.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let n of Object.entries(r)){let[,i]=n,o=Array.isArray(i)?i:[i];for(let a of o)if(a){let p=new Set(s.fileDependencies);S(a,this.excludeList)||Jt.default.existsSync(a)&&(p.has(a)||(p.add(a),s.fileDependencies.add(a)))}}})})}};var tr=c(require("fs")),Oo=c(require("path")),Gt=require("webpack");var Ht=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",s=>{s.hooks.processAssets.tap({name:"icons:emit-file",stage:Gt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let n of Object.entries(r)){let[i,o]=n;if(o===void 0)continue;let a=Array.isArray(o)?typeof o[0]=="string"?o:o.map(Object.values).flat():[o];for(let p of a)if(p){if(!tr.default.existsSync(p))continue;if(!S(p,this.excludeList)){let l=tr.default.readFileSync(p),f=new Gt.sources.RawSource(l),g=Oo.default.basename(p),y=`${i.endsWith("theme_icons")?i.replace("theme_icons",""):i}/${g}`;s.emitAsset(y,f)}}}})})}};var Ro=c(require("fs")),To=require("webpack"),Vt=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",s=>{s.hooks.processAssets.tap({name:"icons:add-to-file-dependencies",stage:To.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let n of Object.entries(r)){let[,i]=n,o=Array.isArray(i)?typeof i[0]=="string"?i:i.map(Object.values).flat():[i];for(let a of o)if(a){let p=new Set(s.fileDependencies);Ro.default.existsSync(a)&&(p.has(a)||(p.add(a),s.fileDependencies.add(a)))}}})})}};var Zt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.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 Yt=require("webpack");var Xt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}generateManifestPatches(e,s){let r=z(e,this.manifestPath),n=r.web_accessible_resources||[],i=r.web_accessible_resources||[];for(let[p,l]of Object.entries(s)){let f=r.content_scripts?.find(g=>g.js&&g.js.some(h=>h.includes(p)));if(f){let g=f.matches||[];if(r.manifest_version===3){let h=n.find(y=>y.matches.some(j=>g.includes(j)));h?l.forEach(y=>{h.resources.includes(y)||h.resources.push(y)}):n.push({resources:l.filter(y=>!y.endsWith(".map")),matches:g})}else l.forEach(h=>{i.includes(h)||i.push(h)})}}r.manifest_version===3?r.web_accessible_resources=n:r.web_accessible_resources=Array.from(new Set(i));let o=JSON.stringify(r,null,2),a=new Yt.sources.RawSource(o);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",a)}apply(e){e.hooks.thisCompilation.tap("plugin-extension:feature-web-resources",s=>{s.hooks.processAssets.tap({name:"plugin-extension:feature-web-resources",stage:Yt.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{let r=[],n=Object.keys(this.includeList||{});for(let a of n.filter(Boolean))a.startsWith("content_scripts")&&(Array.isArray(a)?r.push(...a):typeof a=="string"&&r.push(a));let i=s.chunkGraph,o={};s.entrypoints.forEach((a,p)=>{if(r.includes(p)){let l=[];a.chunks.forEach(f=>{Array.from(i.getChunkModulesIterable(f)).forEach(h=>{i.getModuleChunks(h).forEach(y=>{y.auxiliaryFiles.forEach(j=>{l.includes(j)||l.push(j)})})})}),o[p]=l}}),this.generateManifestPatches(s,o)})})}};var F=c(require("fs")),A=c(require("path")),No=c(require("chokidar")),Kt=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let s=A.default.dirname(e);if(F.default.existsSync(s))return!0;F.default.mkdirSync(s,{recursive:!0})}copyFile(e,s){this.ensureDirectoryExistence(s),F.default.copyFileSync(e,s)}copyFolder(e,s){F.default.existsSync(s)||F.default.mkdirSync(s,{recursive:!0}),F.default.readdirSync(e).forEach(n=>{let i=A.default.join(e,n),o=A.default.join(s,n);F.default.statSync(i).isDirectory()?this.copyFolder(i,o):this.copyFile(i,o)})}apply(e){let s=A.default.dirname(this.options.manifestPath),r=A.default.join(s,"public"),n=e.options.output?.path||"";F.default.existsSync(r)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let i=A.default.join(n,"public");F.default.existsSync(i)||F.default.mkdirSync(i,{recursive:!0}),F.default.existsSync(r)&&this.copyFolder(r,i)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let i=A.default.join(s,"public"),o=No.default.watch(i,{ignoreInitial:!0});o.on("add",a=>{let p=A.default.join(n,A.default.relative(s,a));this.copyFile(a,p)}),o.on("change",a=>{let p=A.default.join(n,A.default.relative(s,a));this.copyFile(a,p)}),o.on("unlink",a=>{let p=A.default.join(n,A.default.relative(s,a));F.default.existsSync(p)&&F.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{o.close().catch(console.error)})}))}};var T=c(require("path")),sr=c(require("chokidar"));var Qt=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,s,r){let n=T.relative(process.cwd(),s),p=Qr(r?"Adding":"Removing",r?"added":"removed",e,e==="pages"?"HTML pages":"script files",n);if(r){console.warn(p);return}console.error(p),process.exit(1)}apply(e){e.hooks.afterPlugins.tap("special-folders:warn-upon-folder-changes",()=>{let s=T.dirname(this.manifestPath),r=T.join(s,"pages"),n=T.join(s,"scripts"),i=sr.watch(r,{ignoreInitial:!0}),o=sr.watch(n,{ignoreInitial:!0}),a=e.options.resolve?.extensions;i.on("add",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p,!0)}),i.on("unlink",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p)}),o.on("add",p=>{a?.includes(T.extname(p))&&this.throwCompilationError("scripts",p,!0)}),o.on("unlink",p=>{a?.includes(T.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{i.close().catch(console.error),o.close().catch(console.error)})})}};var es=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:s}=this.options;new Kt({manifestPath:s}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new Qt(s).apply(e)}};var ts=class{static name="plugin-extension";manifestPath;browser;mode;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.mode=e.mode}apply(e){let s=this.manifestPath,r=Li({manifestPath:s}),n=Fi({manifestPath:s});new dt({manifestPath:s,includeList:{...n?.pages||{},...n?.scripts||{}},excludeList:n.public,loaderOptions:{jsx:H(Oe.default.dirname(this.manifestPath))||G(Oe.default.dirname(this.manifestPath))||$e(Oe.default.dirname(this.manifestPath)),typescript:R(Oe.default.dirname(this.manifestPath)),minify:this.mode==="production"}}).apply(e),new jt({browser:this.browser,manifestPath:s,includeList:{...r.html,...r.icons,...r.json,...r.scripts},excludeList:n.public}).apply(e),new Tt({manifestPath:s,includeList:{...r.html,...n.pages},excludeList:{...n.public,...n.scripts}}).apply(e),new Ut({manifestPath:s,includeList:{...r.scripts,...n.scripts},excludeList:{...n.public,...n.pages}}).apply(e),new Bt({manifestPath:s}).apply(e),new zt({manifestPath:s,includeList:r.json,excludeList:n.public}).apply(e),new Zt({manifestPath:s,includeList:r.icons,excludeList:n.public}).apply(e),new Xt({manifestPath:s,includeList:{...r.scripts,...n.scripts},excludeList:n.public}).apply(e),new es({manifestPath:s}).apply(e)}};var Ne=c(require("path"));var qo=c(require("path")),Uo=c(require("ws")),rs=c(require("browser-extension-manifest-fields"));function ss(t,e){t.clients.forEach(s=>{s.readyState===Uo.default.OPEN&&s.send(JSON.stringify(e))})}function Wo(t,e,s){if(!s||!e)return;let r=(0,rs.default)(e).locales,n=(0,rs.default)(e).scripts,i=(0,rs.default)(e).json;qo.default.basename(s)==="manifest.json"&&ss(t,{changedFile:"manifest.json"}),r?.forEach(o=>{o.includes(s)&&ss(t,{changedFile:"_locales"})}),Object.entries(n).forEach(([o,a])=>{let p=Array.isArray(a)?a:[a];Object.values(p).flatMap(f=>f).includes(s)&&o==="background/service_worker"&&ss(t,{changedFile:"service_worker"})}),Object.entries(i).forEach(([o,a])=>{a?.includes(s)&&o==="declarative_net_request"&&ss(t,{changedFile:"declarative_net_request"})})}var nr=c(require("path")),Ho=c(require("fs")),ns=c(require("ws"));var Re=c(require("path")),Jo=c(require("https")),rr=c(require("fs"));var Bo=t=>{if(!rr.default.existsSync(t))return;let e=Re.default.basename(t);return rr.default.readFileSync(Re.default.join(__dirname,"certs",e))};function zo(t,e){let s={key:Bo(Re.default.join(__dirname,"certs","localhost.key")),cert:Bo(Re.default.join(__dirname,"certs","localhost.cert"))},r=Jo.default.createServer(s,(n,i)=>{i.writeHead(200),i.end()});return r.listen(e,"127.0.0.1"),r.on("error",n=>{throw console.error(cn(t,e)),new Error(n.message)}),{server:r,port:e}}function Wp(t){return new Promise(e=>{let s=require("net").createServer();s.once("error",function(r){r.code==="EADDRINUSE"?e(!0):e(!1)}),s.once("listening",function(){s.close(),e(!1)}),s.listen(t)})}async function Go(t,e){let s=t.options.context||"",r=require(nr.default.join(s,"manifest.json")),n=r.name||"Extension.js",i;if(e.browser==="firefox"){let{server:o}=zo(n,e.port);i=new ns.default.Server({server:o})}else await Wp(e.port)?i=new ns.default.Server({noServer:!0}):i=new ns.default.Server({host:"localhost",port:e.port});if(i?i.on("connection",o=>{o.send(JSON.stringify({status:"serverReady"})),o.on("error",a=>{console.log(rn(n,a)),i?.close()}),o.on("close",()=>{i?.close()}),o.on("message",a=>{let p=JSON.parse(a.toString());if(p.status==="clientReady"){let l=require(nr.default.join(s,"manifest.json"));console.log(Fs(l,p)),console.log(""),console.log(tn(e.mode,e.browser,p.data?.management.enabled||!1)),Ms(e.browser)&&setTimeout(()=>{console.log(sn(e.browser))},2500)}})}):console.log("Failed to start WebSocket server."),e.browser==="firefox"&&!Ho.default.existsSync(ze)){let o=gn(r);console.log(Fs(r,o)),console.log(""),Ms("firefox")&&(console.log(an()),console.log(""))}return i}var ir=c(require("path")),Te=c(require("fs"));function Vo(t){let e=ir.default.resolve(__dirname,"./extensions/manager-extension/reload-service.js"),s=ir.default.resolve(__dirname,"./extensions/manager-extension-firefox/reload-service.js");Te.default.readFile(e,"utf8",(r,n)=>{if(r){console.error(`Error reading file: ${r.message}`);return}let i=n.replace(/__RELOAD_PORT__/g,t.toString());Te.default.writeFile(e,i,"utf8",o=>{o&&console.error(`Error writing to file: ${o.message}`)})}),Te.default.readFile(s,"utf8",(r,n)=>{if(r){console.error(`Error reading file: ${r.message}`);return}let i=n.replace(/__RELOAD_PORT__/g,t.toString());Te.default.writeFile(s,i,"utf8",o=>{o&&console.error(`Error writing to file: ${o.message}`)})})}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var qe=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;Vo(this.port);let s=await Go(e,{...this,mode:e.options.mode,browser:this.browser,stats:this.stats,port:this.port});e.hooks.watchRun.tapAsync("reload:create-web-socket-server",(r,n)=>{let o=(r.modifiedFiles||new Set).values().next().value;if(!o){n();return}let a=Ne.default.relative(Ne.default.dirname(this.manifestPath),o),p=Ne.default.relative(process.cwd(),Ne.default.dirname(o));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${a}\` (relative to ${p})`),this.manifestPath&&Wo(s,this.manifestPath,o),n()})}};var or=c(require("path"));function ar(t,e){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[or.default.dirname(e)],exclude:/node_modules/,use:[{loader:or.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:e}}]})}var cr=c(require("path"));function pr(t,e){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[cr.default.dirname(e)],exclude:/node_modules/,use:[{loader:cr.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:e}}]})}var is=require("webpack");var lr=c(require("content-security-policy-parser"));function Zo(t){let e=t.content_security_policy;if(!e)return"script-src 'self' 'unsafe-eval' blob: filesystem:; object-src 'self' blob: filesystem:; ";let s=(0,lr.default)(e);e="",s.get("script-src")||s.set("script-src",["'self' 'unsafe-eval' blob: filesystem:"]),s.get("script-src")?.includes("'unsafe-eval'")||s.set("script-src",["unsafe-eval"]);for(let r in s)e+=`${r} ${s.get(r)?.join(" ")};`;return e}function Xo(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self'; "};let s=(0,lr.default)(e.extension_pages||""),r="";for(let n in s)r+=`${n} ${s.get(n)?.join(" ")}; `;return{extension_pages:r.trim()}}function Yo(t){let e=["/*.json","/*.js","/*.css"],s=t.web_accessible_resources;if(!s||s.length===0)return e;let r=new Set(s);for(let n of e)r.has(n)||r.add(n);return Array.from(r)}function Ko(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function ur(t,e){return t.background?{background:{...t.background}}:e==="firefox"?{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 fr(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 s=z(e,this.manifestPath),r={...s,content_security_policy:s.manifest_version===3?Xo(s):Zo(s),...s.manifest_version===3?s.permissions?{permissions:[...new Set(["scripting",...s.permissions])]}:{permissions:["scripting"]}:{},...ur(s,this.browser),...fr(s),web_accessible_resources:s.manifest_version===3?Ko(s):Yo(s)},n=JSON.stringify(r,null,2),i=new is.sources.RawSource(n);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",i)}apply(e){e.hooks.thisCompilation.tap("run-chromium:apply-manifest-dev-defaults",s=>{s.hooks.processAssets.tap({name:"run-chromium:apply-manifest-dev-defaults",stage:is.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},r=>{if(!this.manifestPath){let n="No manifest.json found in your extension bundle. Unable to patch manifest.json.";s&&e.webpack.WebpackError&&s.errors.push(new e.webpack.WebpackError(`run-chromium: ${n}`));return}this.generateManifestPatches(s)})})}},Qo=mr;var dr=c(require("fs")),he=c(require("path")),ea=c(require("webpack-target-webextension"));var gr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,s,r){let n=he.default.resolve(__dirname,s==="firefox"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),i=he.default.dirname(this.manifestPath),o=r.background;if(s==="firefox"){let a=o&&o.scripts;if(a&&a.length>0){let p=he.default.join(i,a[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",n)}else if(r.manifest_version===3){let a=o&&o.service_worker;if(a){let p=he.default.join(i,a);this.ensureFileExists(p,"background.service_worker")}else this.addDefaultEntry(e,"background/service_worker",n)}else if(r.manifest_version===2){let a=o&&o.scripts;if(a&&a.length>0){let p=he.default.join(i,a[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",n)}}ensureFileExists(e,s){if(!dr.default.existsSync(e)&&this.manifestPath){let n=require(this.manifestPath).name||"Extension.js",i=nn(n,s,e);throw console.error(i),new Error(i)}}addDefaultEntry(e,s,r){e.options.entry={...e.options.entry,[s]:{import:[r]}}}getEntryName(e){if(e.background){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||!dr.default.lstatSync(this.manifestPath).isFile())return;let s=require(this.manifestPath);this.handleBackground(e,this.browser,s),new ea.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}},ta=gr;var hr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){(this.browser==="chrome"||this.browser==="edge")&&ar(e,this.manifestPath),this.browser==="firefox"&&pr(e,this.manifestPath),new Qo({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ta({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},sa=hr;var os=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 qe({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 ra=c(require("webpack")),as=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new ra.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var ps=require("webpack");var cs=class{browser;manifestPath;chromiumBasedBrowsers=["chrome","edge","opera","brave"];constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let s=this.chromiumBasedBrowsers,r=this.browser,n=JSON.parse(JSON.stringify(e),function(o,a){let p=o.indexOf(":");if(p===-1)return a;let l=o.substring(0,p);(l===r||l==="chromium"&&s.includes(r))&&(this[o.substring(p+1)]=a)});return JSON.stringify(n,null,2)}apply(e){e.hooks.compilation.tap("compatibility:browser-fields",s=>{s.hooks.processAssets.tap({name:"compatibility:browser-fields",stage:ps.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let r=z(s,this.manifestPath),n=this.patchManifest(r),i=new ps.sources.RawSource(n);s.updateAsset("manifest.json",i)})})}};var ls=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 as({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new cs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var da=c(require("fs"));var na=c(require("webpack")),ia=c(require("content-security-policy-parser"));function oa(t){let e=t.content_security_policy,s=t.content_security_policy?.extension_pages,r=n=>{if(!n)return;let i=(0,ia.default)(n);if(i.get("script-src")&&i.get("script-src")?.includes("'unsafe-eval'")){let o=t.name||"Extension.js";return qr(o)}};if(t.manifest_version===3){let n=e?r(s):void 0;if(n)return new na.default.WebpackError(n)}return null}var yr=c(require("webpack"));function aa(t,e){let s=t.web_accessible_resources;if(s){let r=s.some(o=>typeof o=="string"),n=s.some(o=>typeof o=="object"||o.resources||o.matches),i=t.name||"Extension.js";if(t.manifest_version===2&&!r)return new yr.default.WebpackError(Wr(i,e));if(t.manifest_version===3&&!n)return new yr.default.WebpackError(Br(i,e))}return null}var ca=c(require("webpack"));function pa(t,e){if(e==="firefox"&&t.background?.service_worker){let s=t.name||"Extension.js";return new ca.default.WebpackError(Nr(s))}return null}var la=c(require("path")),ua=c(require("fs")),fa=c(require("webpack"));function ma(t,e){let s=la.default.join(e.options.context||"","_locales"),r=t.name||"Extension.js";return ua.default.existsSync(s)&&!t.default_locale?new fa.default.WebpackError(Ur(r)):null}var us=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,s,r){let n=oa(s),i=aa(s,r),o=pa(s,r),a=ma(s,e);n&&e.errors.push(n),i&&e.errors.push(i),o&&e.options.mode==="production"&&e.errors.push(o),a&&e.errors.push(a)}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let n=this.options.manifestPath,i=JSON.parse(da.default.readFileSync(n,"utf-8")),o=this.options.browser||"chrome";this.handleRuntimeErrors(s,i,o),r()})}};var ka=c(require("fs")),ja=c(require("ajv"));var ga={$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 ha(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 ya=c(require("path")),ba=require("webpack");function wa(t,e,s){let r=t.options.context||"",n=ya.default.join(r,"manifest.json"),o=require(n).name||"Extension.js",a=e?.params.missingProperty;t.errors.push(new ba.WebpackError(Hr(o,s,a)))}var xa=c(require("path")),va=require("webpack");function _a(t,e,s){let r=t.options.context||"",n=xa.default.join(r,"manifest.json"),o=require(n).name||"Extension.js";t.warnings.push(new va.WebpackError(zr(o,e,s)))}var Pa=c(require("path")),Sa=require("webpack");function br(t,e,s){let r=t.options.context||"",n=Pa.default.join(r,"manifest.json"),o=require(n).name||"Extension.js";t.warnings.push(new Sa.WebpackError(Jr(o,s,e)))}var fs=class{options;constructor(e){this.options=e}handleSchemaErrors(e,s,r){let n=new ja.default;ha(n);let i={allOf:[ga]},o=n.compile(i),a=o(s),p=s.manifest_version===3;if(!a&&o.errors){let l=o.errors[0];if(l?.keyword==="required"){wa(e,l,r);return}p&&(l?.keyword==="type"&&_a(e,l,r),l?.keyword==="not"&&br(e,l,r))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let n=this.options.manifestPath,i=JSON.parse(ka.default.readFileSync(n,"utf-8")),o=this.options.browser||"chrome";this.handleSchemaErrors(s,i,o),r()})}};var wr=c(require("path"));var ms=c(require("webpack"));function $a(t,e){let s="Conflict: Multiple assets emit different content to the same filename ";if(e.message.includes(s)){let r=e.message.replace(s,"");if(r.startsWith("content_scripts"))return new ms.default.WebpackError(Gr(t,r))}return null}function Ea(t,e){let s=require(t),r="Module not found: Error:";if(e.message.includes(r)){let i=e.message.replace(r,"").split("'")[2];return new ms.default.WebpackError(Vr(s.name,i))}return null}function Da(t,e){let s=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new ms.default.WebpackError(Zr(s.name)):null}var ds=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=wr.default.join(wr.default.dirname(this.manifestPath),"package.json"),r=require(s).name;e.hooks.compilation.tap("develop:common-errors",n=>{n.hooks.afterSeal.tapAsync("develop:common-errors",i=>{n.errors.forEach((o,a)=>{let p=$a(r,o),l=Da(r,o),f=Ea(r,o);p&&(n.errors[a]=p),l&&(n.errors[a]=l),f&&(n.errors[a]=f)}),i()})})}};var gs=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new us({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new fs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new ds({manifestPath:this.manifestPath}).apply(e)}};var gc=c(require("os")),vr=c(require("path"));var Ka=c(require("fs")),Qa=require("child_process");var ne=c(require("path")),xs=c(require("fs"));var Ca={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}},La={...Ca},Fa={...Ca};var x=require("@colors/colors/safe");function $(t,e){let s=e==="warn"?(0,x.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,x.brightBlue)("\u25BA\u25BA\u25BA"):e==="error"?(0,x.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,x.brightGreen)("\u25BA\u25BA\u25BA");return`${(0,x.gray)("")}${s}`}function hs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ys(t,e){let s=hs(t),r=e=="null"?`${s} browser is not installed.
117
+
118
+ `:`Path to ${s} browser is not found.
119
+
120
+ ${(0,x.red)("NOT FOUND")} ${(0,x.underline)(e)}
121
+
122
+ `;return`${$(t,"error")} ${r}Either install the ${s} or choose a different browser via ${(0,x.brightYellow)("--browser")} flag.`}function bs(t){let e=hs(t);return`${$(t,"info")} \u{1F464} Creating ${e} profile directory...`}function Aa(t){return`${$(t,"success")} Instance already running.`}function Ia(t){return`${$(t,"success")} Instance exited.`}function Ma(t){return`${$(t,"error")} No Service Worker Support
123
+
124
+ Firefox does not support the ${(0,x.brightYellow)("background.service_worker")} field yet.
125
+ Update your manifest.json file to use ${(0,x.brightYellow)("background.scripts")} instead.
126
+
127
+ Read more: ${(0,x.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Oa(t,e){return`${$(t,"error")} Error launching ${hs(t)}. Error:
128
+
129
+ ${(0,x.red)(e)}`}function Ra(t,e){return`${$(t,"error")} ${(0,x.red)(e.stack)}`}function Ta(t){return`${$(t,"error")} Unable to connect to ${hs(t)}. Too many retries.`}function Na(t,e){return`${$(t,"error")} Error while installing temporary addon: ${(0,x.red)(e)}`}function qa(t,e){return`${$(t,"error")} The path is not a directory.
130
+
131
+ ${(0,x.gray)("PATH")} ${(0,x.underline)(e)}
132
+
133
+ Please provide a valid directory path.`}function Ua(t){return`${$(t,"error")} Error parsing message length.`}function Wa(t){return`${$(t,"error")} MessagingClient connection closed.`}function Ba(t,e){return`${$(t,"error")} Unexpected MessagingClient request without target actor: ${(0,x.brightYellow)(e)}`}function Ja(t){return`${$(t,"error")} MessagingClient connection closed.`}function za(t,e){return`${$(t,"error")} Target actor ${(0,x.brightYellow)(e)} already has an active request.`}function Ha(t,e){return`${$(t,"error")} Error parsing packet: ${(0,x.red)(e)}`}function Ga(t,e){return`${$(t,"error")} Message received without a sender actor: ${(0,x.brightYellow)(JSON.stringify(e))}`}function Va(t,e){return`${$(t,"error")} Received unexpected message: ${(0,x.red)(e)}`}var Za=c(require("progress"));function ws(t,e){let r=new Za.default(`${t} [:bar] :percent :etas`,{complete:"=",incomplete:" ",width:50,total:131072}),n=setInterval(()=>{let i=Math.random()*10*1024;r.tick(i),r.complete&&(clearInterval(n),e())},50)}function Xa(t,e,s){if(e||xs.default.existsSync(ne.default.resolve(__dirname,`run-${t}-profile`)))return e||ne.default.resolve(__dirname,`run-${t}-profile`);let n=JSON.stringify(t==="chrome"?La:Fa);return s||ws(bs(t),()=>{let i=ne.default.resolve(__dirname,`run-${t}-profile`),o=ne.default.join(i,"Default");xs.default.mkdirSync(o,{recursive:!0});let a=ne.default.join(o,"Preferences");xs.default.writeFileSync(a,n,"utf8")}),ne.default.resolve(__dirname,`run-${t}-profile`)}function Ya(t){return[`--load-extension=${(Array.isArray(t.extension)?t.extension:[t.extension]).join()}`,`--user-data-dir=${Xa(t.browser,t.userDataDir||t.profile)}`,"--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","--no-first-run","--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 be=class{extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;autoReload;stats;constructor(e){this.extension=e.extension,this.browser=e.browser,this.browserFlags=e.browserFlags||[],this.userDataDir=e.userDataDir,this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl}launchChromium(e){let s;switch(e){case"chrome":s=require(`${e}-location`);break;case"edge":s=require(`${e}-location`)();break;default:s=require(`${e}`);break}Ka.default.existsSync(s)||(console.error(ys(e,s)),process.exit());let r=Ya(this),n=this.startingUrl?[this.startingUrl,...r]:[...r],i=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,Qa.spawn)(s,n,{stdio:i});process.env.EXTENSION_ENV==="development"&&(o.stdout?.pipe(process.stdout),o.stderr?.pipe(process.stderr))}apply(e){let s=!1;e.hooks.done.tapAsync("run-browsers:module",(r,n)=>{if(r.compilation.errors.length>0){n();return}if(s){n();return}this.launchChromium(this.browser),s=!0,n()})}};var mc=c(require("fs")),dc=require("child_process");var Ue=c(require("fs")),vs=c(require("path")),ec=c(require("os")),tc=c(require("which")),sc=process.platform==="darwin",Jp=process.platform==="win32",zp=!sc&&!Jp;function Hp(){if(zp)try{return tc.default.sync("firefox")}catch{return null}else if(sc){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=vs.default.join(ec.default.homedir(),t.slice(1));return Ue.default.existsSync(t)?t:Ue.default.existsSync(e)?e:null}else{let t=vs.default.join("Mozilla Firefox","firefox.exe"),e=[process.env.LOCALAPPDATA,process.env.PROGRAMFILES,process.env["PROGRAMFILES(X86)"]];for(let r of e)if(r){let n=vs.default.join(r,t);if(Ue.default.existsSync(n))return n}let s=["C:\\Program Files\\Mozilla Firefox\\firefox.exe","C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"];for(let r of s)if(Ue.default.existsSync(r))return r;return null}}var _s=Hp();var nc=c(require("path")),Ps=c(require("fs")),xr=c(require("firefox-profile"));var Gp={"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 rc(t){return{...Gp,...t}}function ic(t,e){let s=rc(e);Object.keys(s).forEach(i=>{t.setPreference(i,s[i])});let n=Object.keys(e);return n.length>0&&n.forEach(i=>{t.setPreference(i,e[i])}),t.updatePreferences(),t}function Vp(t,e){let s=new xr.default({destinationDirectory:t});return ic(s,e)}function Zp(t,e,s){let r;if(Ps.default.statSync(e).isDirectory())r=e;else throw new Error(qa(t,e));let i=new xr.default({destinationDirectory:r});return ic(i,s)}function oc(t,e,s,r){let n,i=e||nc.default.resolve(__dirname,"run-firefox-data-dir");return Ps.default.existsSync(i)?n=Zp(t,i,s||{}):(r||ws(bs(t),()=>{}),Ps.default.mkdirSync(i,{recursive:!0}),n=Vp(i,s||{})),n}async function ac(t,e){let{browser:s,startingUrl:r,preferences:n,userDataDir:i,browserConsole:o=!1,browserFlags:a=[]}=e,p=oc(s,i,n),l=[];r&&l.push(`--url "${r}"`),o&&l.push("--jsconsole"),a&&l.push(...a);let f=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args "${a.join(" ")}"`,`--profile "${p.path()}"`,`--listen ${f}`,"--verbose"].join(" ")}var fc=c(require("path"));var cc=c(require("net")),pc=c(require("events"));function Xp(t,e){let s=e.toString(),r=s.indexOf(":");if(r<1)return{remainingData:e};let n=parseInt(s.substring(0,r),10);if(isNaN(n))return{remainingData:e,error:new Error(Ua(t)),fatal:!0};if(e.length-(r+1)<n)return{remainingData:e};let i=e.slice(r+1,r+1+n),o=e.slice(r+1+n);try{let a=JSON.parse(i.toString());return{remainingData:o,parsedMessage:a}}catch(a){return{remainingData:o,error:a,fatal:!1}}}var Ss=class extends pc.default{incomingData=Buffer.alloc(0);pendingRequests=[];activeRequests=new Map;connection;async connect(e){await new Promise((s,r)=>{try{let n={port:e,host:"127.0.0.1"},i=cc.default.createConnection(n,()=>{s()});this.connection=i,i.on("data",this.onData.bind(this)),i.on("error",r),i.on("end",this.onEnd.bind(this)),i.on("timeout",this.onTimeout.bind(this)),this.expectReply("root",{resolve:s,reject:r})}catch(n){r(n)}})}disconnect(){this.connection&&(this.connection.removeAllListeners(),this.connection.end(),this.rejectAllRequests(new Error(Wa("firefox"))))}rejectAllRequests(e){this.activeRequests.forEach(s=>{s.reject(e)}),this.activeRequests.clear(),this.pendingRequests.forEach(({deferred:s})=>{s.reject(e)}),this.pendingRequests=[]}async request(e){let s=typeof e=="string"?{to:"root",type:e}:e;if(!s.to)throw new Error(Ba("firefox",s.type));return await new Promise((r,n)=>{let i={resolve:r,reject:n};this.pendingRequests.push({request:s,deferred:i}),this.flushPendingRequests()})}flushPendingRequests(){this.pendingRequests=this.pendingRequests.filter(({request:e,deferred:s})=>{if(this.activeRequests.has(e.to))return!0;if(!this.connection)throw new Error(Ja("firefox"));try{let r=`${Buffer.from(JSON.stringify(e)).length}:${JSON.stringify(e)}`;this.connection.write(r),this.expectReply(e.to,s)}catch(r){s.reject(r)}return!1})}expectReply(e,s){if(this.activeRequests.has(e))throw new Error(za("firefox",e));this.activeRequests.set(e,s)}onData(e){for(this.incomingData=Buffer.concat([this.incomingData,e]);this.readMessage(););}readMessage(){let{remainingData:e,parsedMessage:s,error:r,fatal:n}=Xp("firefox",this.incomingData);return this.incomingData=e,r?(this.emit("error",new Error(Ha("firefox",r))),n&&this.disconnect(),!n):s?(this.handleMessage(s),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(Ga("firefox",e)));return}let s=this.activeRequests.get(e.from);s?(this.activeRequests.delete(e.from),e.error?s.reject(e):s.resolve(e),this.flushPendingRequests()):this.emit("error",new Error(Va("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function lc(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function uc(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var Yp=150,Kp=1e3,ks=class{options;constructor(e){this.options=e}async connectClient(e){let s;for(let r of Array.from({length:Yp}))try{let n=new Ss;return await n.connect(e),n}catch(n){if(uc("ECONNREFUSED",n))await new Promise(i=>setTimeout(i,Kp)),s=n;else throw console.error(Ra(this.options.browser,n.stack)),n}throw console.error(Ta(this.options.browser)),s}async installAddons(e){let{devtools:s}=this.options,r=Array.isArray(this.options.extension)?this.options.extension:[this.options.extension],n=e.options.devServer?.port,i=n?n+100:9222,o=await this.connectClient(i);for(let[a,p]of r.entries()){let l=fc.default.join(p.replace(/"/g,"")),f=a===0&&s;try{let g=await o.request({to:"root",type:"getRoot"});await o.request({to:g.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:f})}catch(g){let h=lc(g);throw new Error(Na(this.options.browser,h))}}}};process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var js=class{extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;autoReload;stats;constructor(e){this.extension=e.extension,this.browser=e.browser||"firefox",this.browserFlags=e.browserFlags||[],this.userDataDir=e.userDataDir,this.profile=e.profile,this.preferences=e.preferences,this.startingUrl=e.startingUrl}async launchFirefox(e){let s=`fx-runner start --binary "${_s}" --foreground --no-remote`;mc.default.existsSync(_s)||(console.error(ys(this.browser,_s)),process.exit());let r=await ac(e,this),n=`${s} ${r}`,i=(0,dc.exec)(n,(a,p,l)=>{if(a!=null)throw a;l.includes("Unable to move the cache")?console.log(Aa(this.browser)):(console.log(Ia(this.browser)),process.exit())});process.env.EXTENSION_ENV==="development"&&(i.stdout?.pipe(process.stdout),i.stderr?.pipe(process.stderr));let o=new ks(this);try{await o.installAddons(e)}catch(a){a?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Ma(this.browser)),process.exit(1)),console.error(Oa(this.browser,a)),process.exit(1)}}apply(e){let s=!1;e.hooks.done.tapAsync("run-chromium:module",async(r,n)=>{if(r.compilation.errors.length>0){n();return}if(s){n();return}await this.launchFirefox(e),s=!0,n()})}};var $s=class{static name="plugin-browsers";extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;constructor(e){this.extension=e.extension,this.browser=e.browser,this.browserFlags=e.browserFlags||[],this.userDataDir=e.userDataDir,this.profile=e.profile||"",this.preferences=e.preferences||{},this.startingUrl=e.startingUrl||""}getProfilePath(e,s,r){return r||(e.options.mode==="production"?vr.default.join(gc.default.tmpdir(),"extension-js",s,"profile"):vr.default.resolve(__dirname,`run-${s}-profile`))}apply(e){let s={stats:!0,extension:this.extension,browser:this.browser,browserFlags:this.browserFlags||[],userDataDir:this.getProfilePath(e,this.browser,this.userDataDir||this.profile)};switch(this.browser){case"chrome":{new be({...s,browser:"chrome"}).apply(e);break}case"edge":new be({...s,browser:"edge"}).apply(e);break;case"firefox":new js({...s,browser:"firefox"}).apply(e);break;default:{new be({...s,browser:this.browser}).apply(e);break}}}};var Ts=t=>`${t}/[name][ext]`;function U(t,e){let s=we.default.join(t,"manifest.json"),r=we.default.join(t,`dist/${e.browser}`),n=require(s);return{mode:e.mode,entry:{},target:"web",context:t,devtool:n.manifest_version===3?"cheap-source-map":"eval-cheap-source-map",output:{clean:{keep(i){return!i.startsWith("hot/background")}},path:r,publicPath:"/",hotUpdateChunkFilename:"hot/[id].[fullhash].hot-update.js",hotUpdateMainFilename:"hot/[runtime].[fullhash].hot-update.json",environment:{bigIntLiteral:!0,dynamicImport:!0},chunkFilename:i=>{let o=i.chunk?.runtime;return Ts(o)}},resolve:{modules:["node_modules",we.default.join(t,"node_modules")],extensions:[".js",".mjs",".jsx",".ts",".mts",".tsx",".json",".wasm",".less",".css",".sass",".scss"]},watchOptions:{ignored:/node_modules|dist/},plugins:[new Xe({manifestPath:s}),new rt({manifestPath:s,mode:e.mode}),new st({manifestPath:s,mode:e.mode}),new ct({manifestPath:s,mode:e.mode}),new gs({manifestPath:s,browser:e.browser}),new ls({manifestPath:s,browser:e.browser,polyfill:e.polyfill}),new ts({manifestPath:s,browser:e.browser,mode:e.mode}),new os({manifestPath:s,browser:e.browser,stats:!0,port:e.port||8e3}),new $s({extension:[r,e.browser==="firefox"?we.default.join(__dirname,"extensions","manager-extension-firefox"):we.default.join(__dirname,"extensions","manager-extension")],browser:e.browser,startingUrl:e.startingUrl,profile:e.profile||e.userDataDir,preferences:e.preferences,browserFlags:e.browserFlags?.filter(i=>!i.startsWith("--load-extension="))})],stats:{all:!1,errors:!0,warnings:!0},infrastructureLogging:{level:"none"},performance:{hints:!1,maxAssetSize:999e3,maxEntrypointSize:999e3},optimization:{minimize:e.mode==="production"},experiments:{css:e.mode==="production",asyncWebAssembly:!0}}}var ie=c(require("path")),Jc=c(require("go-git-it"));var We=c(require("path")),Es=c(require("fs")),m=require("@colors/colors/safe");function k(t){return`${t==="warn"?(0,m.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,m.brightBlue)("\u25BA\u25BA\u25BA"):t==="error"?(0,m.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,m.brightGreen)("\u25BA\u25BA\u25BA")}`}function Y(){return`${k("error")} Manifest file not found. Ensure the path to your extension exists and try again.`}function yc(t){let e=t==="firefox"?"Add-on":"Extension";return`${k("info")} Building ${X(t)} ${e} package...`}function bc(t,e){let s=We.default.join(t,"dist",e.browser||"chrome"),r=We.default.join(s,"manifest.json"),n=require(r),{name:i,version:o,hostPermissions:a,permissions:p}=n,l=hc(t,n).defaultLocale,f=hc(t,n).otherLocales.join(", "),g=`${l} ${f&&", "+f}`,h=a&&a.length,y=p&&p.length,j=Cs().version;return`
134
+ \u{1F9E9} ${(0,m.brightGreen)("Extension.js")} ${(0,m.gray)(`${j}`)}
135
+ Extension Name ${(0,m.gray)(i)}
136
+ Extension Version ${(0,m.gray)(o)}
137
+ Locales ${(0,m.gray)(g)}
138
+ Host Permissions ${(0,m.gray)(h?a.join(", "):"Browser defaults")}
139
+ Permissions ${(0,m.gray)(y?p.join(", "):"Browser defaults")}
140
+ `}function Ds(t,e){let s=t==="production"?m.magenta:m.magenta,r=e==="firefox"?"Add-on":"Extension";return`${k("success")} ${X(e)} ${r} running in ${s(t||"unknown")} mode.`}function wc(t){return`${k("info")} Previewing the extension on ${X(t)}...`}function xc(){return`${k("info")} Previewing the extension package...`}function vc(t,e,s){let r=e?.toJson(),n=We.default.join(t,"manifest.json"),i=JSON.parse(Es.default.readFileSync(n,"utf8")),o=r?.assets,a=`${k("info")} Building ${(0,m.brightGreen)(i.name)} extension using ${X(s)} defaults...
141
+
142
+ `,p=`
143
+ Build completed in ${((r?.time||0)/1e3).toFixed(2)} seconds.
144
+ `,l=`Build Target: ${(0,m.gray)(X(s))}
145
+ `,f=`Build Status: ${e?.hasErrors()?(0,m.red)("Failed"):(0,m.brightGreen)("Success")}
146
+ `,g=`
147
+ Version: ${(0,m.gray)(i.version)}
148
+ `,h=`Size: ${(0,m.gray)(Qp(o))}
149
+ `,y="";return y+=a,y+=el(o),y+=g,y+=h,y+=l,y+=f,y+=p,y}function _c(){return`${k("success")} No errors or warnings found. Your extension is ${(0,m.brightGreen)("ready for deployment")}.`}function Pc(t,e){return`${k("success")} Fetching data...
150
+
151
+ ${(0,m.gray)("URL")} ${(0,m.underline)(`https://github.com/${t}/${e}`)}`}function Sc(t){return`${k("success")} Downloading ${(0,m.brightGreen)(t)}...`}function kc(t){return`${k("success")} Creating a new browser extension...
152
+
153
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(`${process.cwd()}/${t}`)}`}function jc(t){return`${k("success")} No ${(0,m.brightYellow)(".gitignore")} found, zipping all the content inside path:
154
+
155
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function $c(t){return`${k("success")} Packaging source files. Files in ${(0,m.brightYellow)(".gitignore")} will be excluded...
156
+
157
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}.`}function Ec(t){return`${k("success")} Packaging extension distribution files...
158
+
159
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Dc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${e}`)}, Target Browser: ${`${X(t)}`}
160
+ \u2514\u2500 ${(0,m.underline)(`${s}`)} (source)
161
+ \u2514\u2500 ${(0,m.underline)(`${r}`)} (distribution)`}function Cc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}.${e}`)}, Target Browser: ${`${X(s)}`}
162
+ \u2514\u2500 ${(0,m.underline)(`${r}`)} (distribution)`}function Lc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}-source.${e}`)}, Target Browser: ${`${X(s)}`}
163
+ \u2514\u2500 ${(0,m.underline)(`${r}`)} (source)`}function Fc(t){return`${k("error")} Failed to compress extension package. ${t}`}function Ac(t){return`${k("info")} ${t.name} (v${t.version}) has no type definitions. Writing...`}function Ic(t){return`${k("error")} Failed to write the extension type definition. ${(0,m.red)(t)}`}function Mc(t){return`${k("success")} Downloading extension...
164
+
165
+ ${(0,m.gray)("URL")} ${(0,m.underline)(t)}`}function Oc(t){return`${k("success")} Unpackaging browser extension...
166
+
167
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Rc(){return`${k("success")} Browser extension unpackaged successfully. Compiling...`}function Tc(t){return`${k("error")} Failed to download or extract ZIP file. ${(0,m.red)(t)}`}function X(t){return t.charAt(0).toUpperCase()+t.slice(1)}function hc(t,e){let s=e.default_locale,r=We.default.join(t,"_locales");if(!Es.default.existsSync(r))return{defaultLocale:"Browser defaults",otherLocales:[]};let n=Es.default.readdirSync(r).filter(i=>i!==s);return{defaultLocale:s,otherLocales:n}}function Nc(t){return`${(t/1024).toFixed(2)}KB`}function Qp(t){let e=0;return t?.forEach(s=>{e+=s.size}),Nc(e)}function qc(t,e=""){let s="";return Object.keys(t).forEach((r,n,i)=>{let o=n===i.length-1,a=o?"\u2514\u2500":"\u251C\u2500",p=t[r].size?` (${Nc(t[r].size)})`:"";s+=`${(0,m.gray)(e)}${(0,m.gray)(a)} ${r}${(0,m.gray)(p)}
168
+ `,typeof t[r]=="object"&&!t[r].size&&(s+=qc(t[r],`${e}${o?" ":"| "}`))}),s}function el(t){let e={};return t?.forEach(s=>{let r=s.name.split("/"),n=e;r.forEach((i,o)=>{n[i]||(n[i]={}),o===r.length-1?n[i]={size:s.size}:n=n[i]})}),`.
169
+ ${qc(e)}`}var _r=c(require("fs/promises")),Pr=c(require("path")),Uc=c(require("axios")),Wc=c(require("adm-zip"));async function Bc(t,e){let s=t.split("?")[0];try{console.log(Mc(s));let r=await(0,Uc.default)({url:t,method:"GET",responseType:"arraybuffer"}),n=Pr.default.basename(s),i=Pr.default.join(e,`${n}.zip`);await _r.default.writeFile(i,r.data),console.log(Oc(i)),new Wc.default(i).extractAllTo(e,!0),await _r.default.unlink(i),console.log(Rc())}catch(r){throw console.error(Tc(r)),r}}var tl=t=>{try{return new URL(t),!0}catch{return!1}};async function sl(t,e){return await(0,Jc.default)(t,process.cwd(),e),ie.default.resolve(process.cwd(),ie.default.basename(t))}async function rl(t){return await Bc(t,process.cwd()),t=t.split("?")[0],ie.default.resolve(process.cwd(),ie.default.basename(t))}async function Q(t){if(!t)return process.cwd();if(tl(t)){let e=new URL(t);if(e.protocol.startsWith("http")){if(e.origin!=="https://github.com")return await rl(t);let s=e.pathname.split("/"),r=s.slice(1,3)[0],n=s.slice(1,3)[1];console.log(Pc(r,n));let i=ie.default.basename(e.pathname),o=await sl(t,Sc(i));return console.log(kc(i)),o}}return ie.default.resolve(process.cwd(),t)}var W=c(require("path")),zc=c(require("fs")),Hc=c(require("ignore")),Gc=c(require("tiny-glob")),Sr=c(require("adm-zip")),Vc=c(require("slugify"));function nl(t){try{return zc.default.readFileSync(t,"utf8")}catch{return""}}function il(t){return(0,Vc.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function ol(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function al(t,e){let s=il(e.zipFilename||t.name);return e.zipFilename?s:`${s}-${t.version}`}async function cl(t){let e=W.default.join(t,".gitignore"),s=nl(e),r=(0,Hc.default)();return s?r.add(s):console.log(jc(t)),(await(0,Gc.default)("**/*",{cwd:t,dot:!0})).filter(i=>!r.ignores(i))}async function Zc(t,{browser:e="chrome",...s}){try{let r=W.default.join(t,"dist"),n=W.default.join(r,e),i=s.zipSource?t:n,o=require(W.default.join(i,"manifest.json")),a=al(o,s),p=ol(e),l=W.default.join(n,`${a}.${p}`),f=W.default.join(r,`${a}-source.${p}`);if(s.zipSource){console.log(""),console.log($c(e));let g=new Sr.default;(await cl(t)).forEach(y=>{g.addLocalFile(W.default.join(t,y),W.default.dirname(y))}),g.writeZip(f)}if(s.zip){console.log(""),console.log(Ec(e));let g=new Sr.default;g.addLocalFolder(n),g.writeZip(l)}s.zip&&s.zipSource?(console.log(""),console.log(Dc(e,a,f,l))):s.zip?(console.log(""),console.log(Cc(a,p,e,l))):s.zipSource&&(console.log(""),console.log(Lc(a,p,e,f)))}catch(r){throw console.error(Fc(r)),r}}async function Qc(t,e){let s=await Q(t);!t?.startsWith("http")&&!Xc.default.existsSync(Yc.default.join(s,"manifest.json"))&&(console.log(Y()),process.exit(1));try{let r=e.browser||"chrome",n=U(s,{mode:"production",browser:r}),i=n.plugins?.filter(a=>a?.constructor.name!=="plugin-browsers"&&a?.constructor.name!=="plugin-reload"),o={...n,plugins:i};(0,Kc.default)(o).run(async(a,p)=>{a&&(console.error(a.stack||a),process.exit(1)),console.log(vc(s,p,r)),(e.zip||e.zipSource)&&await Zc(s,{...e,browser:r}),p?.hasErrors()?(console.log(p.toString({colors:!0})),process.exit(1)):console.log(_c())})}catch{process.exit(1)}}var rp=c(require("fs")),np=c(require("path"));var jr=c(require("path")),ep=c(require("webpack")),tp=c(require("webpack-dev-server"));function kr(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function sp(t,{...e}){let s=U(t,e),r=(0,ep.default)(s),n={host:"127.0.0.1",allowedHosts:"all",static:jr.default.join(t,"public"),compress:!0,devMiddleware:{writeToDisk:!0},watchFiles:Ke(t)?void 0:{paths:[jr.default.join(t,"**/*.html")],options:{usePolling:!0,interval:1e3}},client:{logging:process.env.EXTENSION_ENV==="development"?"error":"none",progress:!1,overlay:{errors:!1,warnings:!1}},headers:{"Access-Control-Allow-Origin":"*"},port:"auto",hot:"only"},i=new tp.default(n,r);i.startCallback(o=>{o!=null&&console.log(`Error in the Extension.js runner: ${o.stack||""}`)}),process.on("ERROR",()=>{kr(i)}),process.on("SIGINT",()=>{kr(i)}),process.on("SIGTERM",()=>{kr(i)})}var Be=c(require("path")),$r=c(require("fs/promises"));async function Er(t){let e=Be.default.join(t,"extension-env.d.ts"),s=Be.default.join(__dirname,"types"),r=Be.default.relative(t,s),n=process.env.EXTENSION_ENV==="development"?r:"extension-develop/dist/types",i=`// Required Extension.js types for TypeScript projects.
170
+ // This file is auto-generated and should not be excluded.
171
+ // If you need extra types, consider creating a new *.d.ts and
172
+ // referencing it in the "include" array of your tsconfig.json file.
173
+ // See https://www.typescriptlang.org/tsconfig#include for info.
174
+ /// <reference types="${n}/index.d.ts" />
175
+
176
+ // Polyfill types for browser.* APIs.
177
+ /// <reference types="${n}/polyfill.d.ts" />
178
+ `;try{await $r.default.access(e)}catch{let a=require(Be.default.join(t,"manifest.json"));console.log(Ac(a));try{await $r.default.writeFile(e,i)}catch(p){console.log(Ic(p))}}}async function ip(t,{...e}={browser:"chrome",mode:"development"}){let s=await Q(t);!t?.startsWith("http")&&!rp.default.existsSync(np.default.join(s,"manifest.json"))&&(console.log(Y()),process.exit(1));try{R(s)&&await Er(s),await sp(s,{...e})}catch{process.exit(1)}}var op=c(require("fs")),ap=c(require("path")),cp=c(require("webpack"));async function pp(t,e={mode:"production"}){let s=await Q(t);!t?.startsWith("http")&&!op.default.existsSync(ap.default.join(s,"manifest.json"))&&(console.log(Y()),process.exit(1));try{let r=e.browser||"chrome",n=U(s,{mode:"production",browser:r}),i=n.plugins?.filter(a=>a?.constructor.name==="plugin-browsers"),o={...n,plugins:i};console.log(wc(r)),(0,cp.default)(o).run((a,p)=>{a&&(console.error(a.stack||a),process.exit(1)),console.log(xc()),p?.hasErrors()?(console.log(p.toString({colors:!0})),process.exit(1)):setTimeout(()=>{console.log(Ds("production",r))},750)})}catch{process.exit(1)}}var lp=c(require("fs")),up=c(require("path")),fp=c(require("webpack"));async function mp(t,e={mode:"production"}){let s=await Q(t);!t?.startsWith("http")&&!lp.default.existsSync(up.default.join(s,"manifest.json"))&&(console.log(Y()),process.exit(1));try{let r=e.browser||"chrome",n=U(s,{mode:"production",browser:r});console.log(yc(r)),(0,fp.default)(n).run((i,o)=>{i&&(console.error(i.stack||i),process.exit(1)),o?.hasErrors()?(console.log(o.toString({colors:!0})),process.exit(1)):(console.log(bc(s,e)),setTimeout(()=>{console.log(Ds("production",r))},1500))})}catch{process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});
@@ -0,0 +1 @@
1
+ "use strict";var T=Object.create;var d=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var H=(t,e)=>{for(var r in e)d(t,r,{get:e[r],enumerable:!0})},P=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of B(e))!G.call(t,s)&&s!==r&&d(t,s,{get:()=>e[s],enumerable:!(o=V(e,s))||o.enumerable});return t};var l=(t,e,r)=>(r=t!=null?T(z(t)):{},P(e||!t||!t.__esModule?d(r,"default",{value:t,enumerable:!0}):r,t)),K=t=>P(d({},"__esModule",{value:!0}),t);var et={};H(et,{default:()=>N});module.exports=K(et);var q=l(require("path")),J=require("schema-utils");var _=require("@swc/core"),h=require("acorn"),v=l(require("acorn-walk")),y=require("astring");function Q(t,e){let r=t;for(let o=e.length-1;o>=0;o--){if(o===0)return r.type==="Identifier"&&r.name===e[o];if(r.type!=="MemberExpression"||r.property.type!=="Identifier"||r.property.name!==e[o])return!1;r=r.object}return!0}function n(t,e){let r=e.split(".");return Q(t,r)}function c(t,e){if(t.arguments.length===0)return;let r=t.arguments[0];t.arguments[0]={type:"CallExpression",callee:{type:"Identifier",name:e},arguments:[r]}}function f(t,e){if(t.arguments.length!==0){if(e==="chrome.devtools.panels.create"||e==="browser.devtools.panels.create")t.arguments[1]={type:"CallExpression",callee:{type:"Identifier",name:"r.solve"},arguments:[t.arguments[1]]},t.arguments[2]={type:"CallExpression",callee:{type:"Identifier",name:"r.solve"},arguments:[t.arguments[2]]};else if(e==="chrome.runtime.getURL"||e==="browser.runtime.getURL"){if(t.arguments[0].type==="Literal"&&t.arguments[0].value.includes("/_favicon/"))return;t.arguments[0]={type:"CallExpression",callee:{type:"Identifier",name:"r.solve"},arguments:[t.arguments[0]]}}}}function X(t,e,r,o){(n(t,`${o}.action.setIcon`)||n(t,`${o}.browserAction.setIcon`)||n(t,`${o}.pageAction.setIcon`)||n(t,`${o}.declarativeContent.SetIcon`)||n(t,`${o}.action.setPopup`)||n(t,`${o}.browserAction.setPopup`)||n(t,`${o}.pageAction.setPopup`)||n(t,`${o}.scriptBadge.setPopup`))&&c(r,"r.solve"),n(t,`${o}.devtools.panels.create`)&&f(r,`${o}.devtools.panels.create`),n(t,`${o}.downloads.download`)&&c(r,"r.solve"),n(t,`${o}.runtime.getURL`)&&f(r,`${o}.runtime.getURL`),(n(t,`${o}.scripting.insertCSS`)||n(t,`${o}.scripting.removeCSS`)||n(t,`${o}.scripting.executeScript`))&&c(r,"r.solve"),(n(t,`${o}.scripting.registerContentScripts`)||n(t,`${o}.declarativeContent.RequestContentScript`))&&c(r,"r.solve"),n(t,`${o}.declarativeContent.RequestContentScript`)&&c(r,"r.solve"),(n(t,`${o}.tabs.create`)||n(t,`${o}.tabs.executeScript`)||n(t,`${o}.tabs.insertCSS`)||n(t,`${o}.windows.create`))&&e.length>0&&c(r,"r.solve"),n(t,`${o}.sidePanel.setOptions`)&&c(r,"r.solve"),n(t,`${o}.notifications.create`)&&c(r,"r.solve")}function x(t,e){let r=(0,_.transformSync)(t,{module:{type:"es6"},minify:e.minify,jsc:{loose:!0,target:"es2016",parser:{syntax:e.typescript?"typescript":"ecmascript",jsx:!e.typescript&&e.jsx,tsx:e.typescript&&e.jsx,dynamicImport:!0},transform:{react:{runtime:"automatic",importSource:"react"}}}}),o=(0,h.parse)(r.code,{sourceType:"module",ecmaVersion:"latest"});return v.simple(o,{CallExpression(i){let a=["chrome","browser"],u=i.callee,g=i.arguments;a.forEach(p=>{X(u,g,i,p)})}}),(0,y.generate)(o)}var b=l(require("fs"));var m=l(require("path"));function A(t){if(!t||!t.background)return;let e=t.background.scripts;if(e)return e.map(r=>r)}function M(t){if(!t||!t.background)return;if(t.background.service_worker)return t.background.service_worker}function S(t){if(!t||!t.content_scripts)return{"content_scripts/content-0.js":void 0};let e=i=>{if(i.js?.length!==0)return i.js?.map(a=>a)},r=i=>{if(i.css?.length!==0)return i.css?.map(a=>a)},o={},s=t.content_scripts;for(let[i,a]of s.entries()){let u=e(a),g=r(a);o[`content_scripts/content-${i}`]=[...(u||[]).filter(p=>p!=null),...(g||[]).filter(p=>p!=null)]}return o}function k(t){return!t||!t.user_scripts||!t.user_scripts.api_script?void 0:t.user_scripts.api_script}function D(t){return!t||!t.action||!t.action.default_popup?void 0:t.action.default_popup}function w(t){return!t||!t.background||!t.background.page?void 0:t.background.page}function L(t){return!t||!t.browser_action||!t.browser_action.default_popup?void 0:t.browser_action.default_popup}function $(t){let e={newtab:void 0};return!t||!t.chrome_url_overrides?{"chrome_url_overrides/newtab.html":void 0}:(t.chrome_url_overrides.history&&(e={"chrome_url_overrides/history.html":t.chrome_url_overrides.history}),t.chrome_url_overrides.newtab&&(e={"chrome_url_overrides/newtab.html":t.chrome_url_overrides.newtab}),t.chrome_url_overrides.bookmarks&&(e={"chrome_url_overrides/bookmarks.html":t.chrome_url_overrides.bookmarks}),e)}function j(t){return!t||!t.devtools_page?void 0:t.devtools_page}function C(t){return t.options_page?t.options_page:!t||!t.options_ui||!t.options_ui.page?void 0:t.options_ui.page}function R(t){return!t||!t.page_action||!t.page_action.default_popup?void 0:t.page_action.default_popup}function E(t){if(!t||!t.sandbox||!t.sandbox.pages)return{"sandbox/page-0.html":void 0};let e=t.sandbox.pages,r={};for(let[o,s]of e.entries()){let i=s;r[`sandbox/page-${o}.html`]=i}return r}function I(t){return!t||!t.side_panel||!t.side_panel.default_path?void 0:t.side_panel.default_path}function O(t){return!t||!t.sidebar_action||!t.sidebar_action.default_panel?void 0:t.sidebar_action.default_panel}function F(t){return{"background/scripts.js":A(t),"background/service_worker.js":M(t),...S(t),"user_scripts/apiscript.js":k(t),"action/default_popup.html":D(t),"background/page.html":w(t),"browser_action/default_popup.html":L(t),...$(t),"devtools_page.html":j(t),"options_ui/page.html":C(t),"page_action/default_popup.html":R(t),...E(t),"side_panel/default_path.html":I(t),"sidebar_action/default_panel.html":O(t)}}function Y(t,e){let r=m.default.dirname(t);return Object.entries(e||{}).reduce((s,[i,a])=>{let u=m.default.relative(r,a);return s[i]=u,s},{})}function Z(t){let e=require(t);return F(e)}function U(t,e){let r=Y(t,e),o=Z(t);return{...r,...o}}function W(t,e){let r=t.getOptions(),{manifestPath:o,includeList:s}=r,i=JSON.stringify(U(o,s)),u=b.default.readFileSync(e,"utf8").replace('"__RESOLVER_MODULE_FILE_LIST__"',`${i}`);b.default.writeFileSync(e,u)}var tt={type:"object",properties:{test:{type:"string"},manifestPath:{type:"string"},includeList:{type:"object"},excludeList:{type:"object"},loaderOptions:{type:"object"}}};function N(t){let e=this.getOptions();if((0,J.validate)(tt,e,{name:"resolve:loader",baseDataPath:"options"}),new RegExp(e.test).test(this.resourcePath)){let r="resolver-module.js";if(this.resourcePath.includes("node_modules")||this.resourcePath.includes("dist/"))return t;let o=x(t,e),s=q.default.join(__dirname,r);return W(this,s),o}return t}
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of a(e))!g.call(r,n)&&n!==t&&p(r,n,{get:()=>e[n],enumerable:!(s=l(e,n))||s.enumerable});return r};var v=r=>y(p({},"__esModule",{value:!0}),r);var U={};d(U,{default:()=>R});module.exports=v(U);var c={resolverNotFoundError(){console.error('Could not resolve file path. Ensure the file exists in the "public" or "pages" directory.')},resolverHtmlError:r=>(console.error(`Could not resolve path ${r}. Either add it to the "public" directory or create a page in the "pages" directory.`),r),resolverJsError:r=>`Could not resolve path ${r}. Either add it to the "public" directory or create a script in the "scripts" directory.`,resolverStaticError:r=>`Could not resolve path ${r}. If you want to preserve this file path, add the file to the "public" directory.`};function u(r){let e=r.split("/"),t=[];for(let s of e)s===".."||s==="."||s!==""&&t.push(s);return t.join("/")}function h(r){return r?.endsWith(".html")?(console.error(c.resolverHtmlError(r)),r):r?.endsWith(".js")?(console.error(c.resolverJsError(r)),r):(r&&console.error(c.resolverStaticError(r)),r)}var E={data:"__RESOLVER_MODULE_FILE_LIST__"};function o(r){if(!r)return c.resolverNotFoundError(),"";if(r?.startsWith("http")||r?.startsWith("chrome://")||r?.startsWith("about:"))return r;if(r?.startsWith("chrome-extension://")){let s=chrome.runtime.getURL("");if(r.startsWith(s)){let n=r.replace(s,"");return chrome.runtime.getURL(o(n))}return r}if(r?.startsWith("/_favicon"))return r;let e=Object.entries(E.data).find(([s,n])=>{let i=u(r);return n===i||n===`pages/${i}`||n===`scripts/${i}`?s:!1}),t=u(r);return t.includes("public/")?"/"+t:e&&e.length?e[0]:(r!=="/"&&h(r),r)}function f(r){if(typeof r=="string")return o(r);let e=t=>({...t,...t?.path&&{path:typeof t.path=="string"?o(t.path):Object.entries(t.path).reduce((s,[n,i])=>(s[n]=o(i),s),{})},...t?.popup&&{popup:o(t.popup)},...t?.url&&{url:Array.isArray(t?.url)?t?.url.map(s=>o(s)):o(t?.url)},...t?.iconUrl&&{iconUrl:o(t.iconUrl)},...t?.files&&{files:t.files.map(s=>o(s))},...t?.js&&{js:Array.isArray(t.js)?t.js.map(s=>o(s)):t.js},...t?.css&&{css:Array.isArray(t.css)?t.css.map(s=>o(s)):t.css}});return Array.isArray(r)?r.map(t=>e(t)):{...e(r||{})}}var m={solve:f},R=m;
@@ -0,0 +1,7 @@
1
+ /** @type {import('stylelint').Config} */
2
+ const stylelintRootConfig = {
3
+ extends: [],
4
+ rules: {}
5
+ }
6
+
7
+ module.exports = stylelintRootConfig
@@ -0,0 +1,25 @@
1
+ const path = require('path')
2
+ const fs = require('fs')
3
+
4
+ const [, pathOrRemoteUrl] = process.argv.slice(2)
5
+ const projectDir = pathOrRemoteUrl.startsWith('http')
6
+ ? process.cwd() + path.basename(pathOrRemoteUrl)
7
+ : path.resolve(__dirname, pathOrRemoteUrl)
8
+
9
+ const tailwindConfig = path.join(projectDir, 'tailwind.config.js')
10
+
11
+ /** @type {import('tailwindcss').Config} */
12
+ const tailwindConfigData = fs.existsSync(tailwindConfig)
13
+ ? require(tailwindConfig)
14
+ : {content: []}
15
+
16
+ /** @type {import('tailwindcss').Config} */
17
+ const tailwindRootConfig = {
18
+ ...tailwindConfigData,
19
+ content: [
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
21
+ ...tailwindConfigData.content.map((file) => path.join(projectDir, file))
22
+ ]
23
+ }
24
+
25
+ module.exports = tailwindRootConfig
@@ -0,0 +1,7 @@
1
+ type CSSContentData = Readonly<Record<string, string>>
2
+
3
+ declare module '*.css' {
4
+ const content: CSSContentData
5
+
6
+ export default content
7
+ }