extension-develop 2.0.0-alpha.1 → 2.0.0-alpha.11

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 (210) hide show
  1. package/dist/ensure-hmr-for-scripts.js +2 -2
  2. package/dist/extensions/{manager-extension → chrome-manager-extension}/background.js +1 -1
  3. package/dist/extensions/{manager-extension → chrome-manager-extension}/manifest.json +2 -2
  4. package/dist/extensions/{manager-extension → chrome-manager-extension}/reload-service.js +10 -8
  5. package/dist/extensions/chromium-manager-extension/background.js +58 -0
  6. package/dist/extensions/chromium-manager-extension/define-initial-tab.js +67 -0
  7. package/dist/extensions/chromium-manager-extension/manifest.json +17 -0
  8. package/dist/extensions/chromium-manager-extension/pages/welcome.js +34 -0
  9. package/dist/extensions/chromium-manager-extension/reload-service.js +145 -0
  10. package/dist/extensions/edge-manager-extension/background.js +58 -0
  11. package/dist/extensions/edge-manager-extension/define-initial-tab.js +67 -0
  12. package/dist/extensions/edge-manager-extension/manifest.json +17 -0
  13. package/dist/extensions/edge-manager-extension/pages/sakura-dark.css +268 -0
  14. package/dist/extensions/edge-manager-extension/pages/sakura.css +267 -0
  15. package/dist/extensions/edge-manager-extension/pages/welcome.html +49 -0
  16. package/dist/extensions/edge-manager-extension/pages/welcome.js +34 -0
  17. package/dist/extensions/edge-manager-extension/public/logo.png +0 -0
  18. package/dist/extensions/edge-manager-extension/reload-service.js +145 -0
  19. package/dist/extensions/{manager-extension-firefox → firefox-manager-extension}/background.js +5 -16
  20. package/dist/extensions/{manager-extension-firefox → firefox-manager-extension}/define-initial-tab.js +17 -12
  21. package/dist/extensions/{manager-extension-firefox → firefox-manager-extension}/manifest.json +2 -2
  22. package/dist/extensions/firefox-manager-extension/pages/sakura-dark.css +268 -0
  23. package/dist/extensions/firefox-manager-extension/pages/sakura.css +267 -0
  24. package/dist/extensions/firefox-manager-extension/pages/welcome.html +49 -0
  25. package/dist/extensions/firefox-manager-extension/public/logo.png +0 -0
  26. package/dist/extensions/{manager-extension-firefox → firefox-manager-extension}/reload-service.js +1 -1
  27. package/dist/inject-chromium-client-loader.js +2 -2
  28. package/dist/inject-content-css-during-dev.js +3 -3
  29. package/dist/inject-firefox-client-loader.js +38 -43
  30. package/dist/minimum-firefox-file.mjs +1 -1
  31. package/dist/module.js +81 -85
  32. package/dist/run-chrome-profile/Default/BrowsingTopicsState +3 -3
  33. package/dist/run-chrome-profile/Default/Cache/Cache_Data/15145040f7f12f31_0 +0 -0
  34. package/dist/run-chrome-profile/Default/Cache/Cache_Data/878b0f723bb46fc9_0 +0 -0
  35. package/dist/run-chrome-profile/Default/Cache/Cache_Data/93d81321f8c35eab_0 +0 -0
  36. package/dist/run-chrome-profile/Default/Cache/Cache_Data/e85ac8952d7783d7_0 +0 -0
  37. package/dist/run-chrome-profile/Default/Cache/Cache_Data/index-dir/the-real-index +0 -0
  38. package/dist/run-chrome-profile/Default/Code Cache/js/0861135386d2c738_0 +0 -0
  39. package/dist/run-chrome-profile/Default/Code Cache/js/218fe828c74bdb99_0 +0 -0
  40. package/dist/run-chrome-profile/Default/Code Cache/js/a8bfd7ab3bf7adbd_0 +0 -0
  41. package/dist/run-chrome-profile/Default/Code Cache/js/index-dir/the-real-index +0 -0
  42. package/dist/run-chrome-profile/Default/Code Cache/wasm/index-dir/the-real-index +0 -0
  43. package/dist/run-chrome-profile/Default/Cookies +0 -0
  44. package/dist/run-chrome-profile/Default/DIPS +0 -0
  45. package/dist/run-chrome-profile/Default/DawnGraphiteCache/data_1 +0 -0
  46. package/dist/run-chrome-profile/Default/DawnGraphiteCache/index +0 -0
  47. package/dist/run-chrome-profile/Default/DawnWebGPUCache/data_1 +0 -0
  48. package/dist/run-chrome-profile/Default/DawnWebGPUCache/index +0 -0
  49. package/dist/run-chrome-profile/Default/Extension Rules/000003.log +0 -0
  50. package/dist/run-chrome-profile/Default/Extension Rules/LOG +3 -3
  51. package/dist/run-chrome-profile/Default/Extension Rules/LOG.old +3 -3
  52. package/dist/run-chrome-profile/Default/Extension Scripts/000003.log +0 -0
  53. package/dist/run-chrome-profile/Default/Extension Scripts/LOG +3 -3
  54. package/dist/run-chrome-profile/Default/Extension Scripts/LOG.old +3 -3
  55. package/dist/run-chrome-profile/Default/Extension State/000003.log +0 -0
  56. package/dist/run-chrome-profile/Default/Extension State/LOG +3 -3
  57. package/dist/run-chrome-profile/Default/Extension State/LOG.old +3 -3
  58. package/dist/run-chrome-profile/Default/Favicons +0 -0
  59. package/dist/run-chrome-profile/Default/GPUCache/data_0 +0 -0
  60. package/dist/run-chrome-profile/Default/GPUCache/data_1 +0 -0
  61. package/dist/run-chrome-profile/Default/GPUCache/data_2 +0 -0
  62. package/dist/run-chrome-profile/Default/GPUCache/index +0 -0
  63. package/dist/run-chrome-profile/Default/History +0 -0
  64. package/dist/run-chrome-profile/Default/Local Extension Settings/pbpgonifamlpcahjkkkfelffkegofkgg/000003.log +0 -0
  65. package/dist/run-chrome-profile/Default/Local Extension Settings/pbpgonifamlpcahjkkkfelffkegofkgg/LOG +3 -3
  66. package/dist/run-chrome-profile/Default/Local Extension Settings/pbpgonifamlpcahjkkkfelffkegofkgg/LOG.old +3 -3
  67. package/dist/run-chrome-profile/Default/Local Storage/leveldb/000003.log +0 -0
  68. package/dist/run-chrome-profile/Default/Local Storage/leveldb/LOG +3 -3
  69. package/dist/run-chrome-profile/Default/Local Storage/leveldb/LOG.old +3 -3
  70. package/dist/run-chrome-profile/Default/Network Persistent State +1 -1
  71. package/dist/run-chrome-profile/Default/Platform Notifications/LOG +3 -3
  72. package/dist/run-chrome-profile/Default/Platform Notifications/LOG.old +2 -3
  73. package/dist/run-chrome-profile/Default/Preferences +1 -1
  74. package/dist/run-chrome-profile/Default/Reporting and NEL and b/package/dist/run-chrome-profile/Default/Reporting → NEL +0 -0
  75. package/dist/run-chrome-profile/Default/Secure Preferences +1 -1
  76. package/dist/run-chrome-profile/Default/Service Worker/Database/000003.log +0 -0
  77. package/dist/run-chrome-profile/Default/Service Worker/Database/LOG +3 -3
  78. package/dist/run-chrome-profile/Default/Service Worker/Database/LOG.old +3 -3
  79. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/{297ecea5cebb5dfe_0 → 08b99d499107ba17_0} +0 -0
  80. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/2a0afd649b00527b_0 +0 -0
  81. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/{2cc80dabc69f58b6_0 → 67a473248953641b_0} +0 -0
  82. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/67a473248953641b_1 +0 -0
  83. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/{013888a1cda32b90_0 → 7b4fd8111178d5b1_0} +0 -0
  84. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/d0757ff92c7cde0a_0 +0 -0
  85. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/d0757ff92c7cde0a_1 +0 -0
  86. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/index-dir/the-real-index +0 -0
  87. package/dist/run-chrome-profile/Default/Session Storage/000003.log +0 -0
  88. package/dist/run-chrome-profile/Default/Session Storage/LOG +3 -3
  89. package/dist/run-chrome-profile/Default/Session Storage/LOG.old +3 -3
  90. package/dist/run-chrome-profile/Default/Sessions/Session_13369796364394711 +0 -0
  91. package/dist/run-chrome-profile/Default/Sessions/Session_13369796396690736 +0 -0
  92. package/dist/run-chrome-profile/Default/Sessions/Tabs_13369796364895748 +0 -0
  93. package/dist/run-chrome-profile/Default/Sessions/Tabs_13369796397211431 +0 -0
  94. package/dist/run-chrome-profile/Default/Shared Dictionary/cache/index-dir/the-real-index +0 -0
  95. package/dist/run-chrome-profile/Default/Site Characteristics Database/LOG +3 -3
  96. package/dist/run-chrome-profile/Default/Site Characteristics Database/LOG.old +3 -3
  97. package/dist/run-chrome-profile/Default/Sync Data/LevelDB/LOG +3 -3
  98. package/dist/run-chrome-profile/Default/Sync Data/LevelDB/LOG.old +3 -3
  99. package/dist/run-chrome-profile/Default/TransportSecurity +1 -1
  100. package/dist/run-chrome-profile/Default/Visited Links +0 -0
  101. package/dist/run-chrome-profile/Default/Web Data +0 -0
  102. package/dist/run-chrome-profile/Default/WebStorage/QuotaManager +0 -0
  103. package/dist/run-chrome-profile/Default/shared_proto_db/000003.log +0 -0
  104. package/dist/run-chrome-profile/Default/shared_proto_db/LOG +3 -3
  105. package/dist/run-chrome-profile/Default/shared_proto_db/LOG.old +3 -3
  106. package/dist/run-chrome-profile/Default/shared_proto_db/metadata/000003.log +0 -0
  107. package/dist/run-chrome-profile/Default/shared_proto_db/metadata/LOG +3 -3
  108. package/dist/run-chrome-profile/Default/shared_proto_db/metadata/LOG.old +3 -3
  109. package/dist/run-chrome-profile/GrShaderCache/data_0 +0 -0
  110. package/dist/run-chrome-profile/GrShaderCache/data_1 +0 -0
  111. package/dist/run-chrome-profile/GrShaderCache/data_2 +0 -0
  112. package/dist/run-chrome-profile/GrShaderCache/data_3 +0 -0
  113. package/dist/run-chrome-profile/GrShaderCache/index +0 -0
  114. package/dist/run-chrome-profile/GraphiteDawnCache/data_1 +0 -0
  115. package/dist/run-chrome-profile/GraphiteDawnCache/index +0 -0
  116. package/dist/run-chrome-profile/Last Version +1 -1
  117. package/dist/run-chrome-profile/Local State +1 -1
  118. package/dist/run-chrome-profile/ShaderCache/data_0 +0 -0
  119. package/dist/run-chrome-profile/ShaderCache/data_1 +0 -0
  120. package/dist/run-chrome-profile/ShaderCache/data_2 +0 -0
  121. package/dist/run-chrome-profile/ShaderCache/index +0 -0
  122. package/dist/run-chrome-profile/first_party_sets.db +0 -0
  123. package/dist/run-chrome-profile/optimization_guide_model_store/32/E6DC4029A1E4B4C1/616740573B202A03/model-info.pb +0 -0
  124. package/dist/run-chrome-profile/optimization_guide_model_store/32/E6DC4029A1E4B4C1/616740573B202A03/model.tflite +0 -0
  125. package/dist/run-chrome-profile/segmentation_platform/ukm_db +0 -0
  126. package/dist/run-chrome-profile/segmentation_platform/ukm_db-journal +0 -0
  127. package/package.json +3 -2
  128. package/dist/run-chrome-profile/Default/Cache/Cache_Data/036e8d82a2523a26_0 +0 -0
  129. package/dist/run-chrome-profile/Default/Cache/Cache_Data/257b9ada9582cd59_0 +0 -0
  130. package/dist/run-chrome-profile/Default/Cache/Cache_Data/8259bc2d7356bc5d_0 +0 -0
  131. package/dist/run-chrome-profile/Default/Cache/Cache_Data/c2880d01d9ca0897_0 +0 -0
  132. package/dist/run-chrome-profile/Default/Cache/Cache_Data/c52888c9a6d22991_0 +0 -0
  133. package/dist/run-chrome-profile/Default/Cache/Cache_Data/c7fae7b7f9b7a0bf_0 +0 -0
  134. package/dist/run-chrome-profile/Default/Code Cache/js/0ad47d0a74641b22_0 +0 -0
  135. package/dist/run-chrome-profile/Default/Code Cache/js/0fbcafeba7a5c5ed_0 +0 -0
  136. package/dist/run-chrome-profile/Default/Code Cache/js/195a67332db1fb6b_0 +0 -0
  137. package/dist/run-chrome-profile/Default/Code Cache/js/27866c80f227a32a_0 +0 -0
  138. package/dist/run-chrome-profile/Default/Code Cache/js/27e56546e417a182_0 +0 -0
  139. package/dist/run-chrome-profile/Default/Code Cache/js/3faea91e5564d655_0 +0 -0
  140. package/dist/run-chrome-profile/Default/Code Cache/js/4a213402db3f97ee_0 +0 -0
  141. package/dist/run-chrome-profile/Default/Code Cache/js/4c7708679c89a020_0 +0 -0
  142. package/dist/run-chrome-profile/Default/Code Cache/js/4ed8840c82a10bf8_0 +0 -0
  143. package/dist/run-chrome-profile/Default/Code Cache/js/5d469b2e72dff033_0 +0 -0
  144. package/dist/run-chrome-profile/Default/Code Cache/js/73ae4e72d479b847_0 +0 -0
  145. package/dist/run-chrome-profile/Default/Code Cache/js/95b17471b8555b5b_0 +0 -0
  146. package/dist/run-chrome-profile/Default/Code Cache/js/992c26a30322831b_0 +0 -0
  147. package/dist/run-chrome-profile/Default/Code Cache/js/a1bc84ca2dc9c9d8_0 +0 -0
  148. package/dist/run-chrome-profile/Default/Code Cache/js/af02e9170bb433a3_0 +0 -0
  149. package/dist/run-chrome-profile/Default/Code Cache/js/b5dc0ad71f1c8f44_0 +0 -0
  150. package/dist/run-chrome-profile/Default/Code Cache/js/b94fbb70162d5d28_0 +0 -0
  151. package/dist/run-chrome-profile/Default/Code Cache/js/baf8a70daa2269f3_0 +0 -0
  152. package/dist/run-chrome-profile/Default/Code Cache/js/be54fe001d56ed5d_0 +0 -0
  153. package/dist/run-chrome-profile/Default/Code Cache/js/c47232f2c415ea6f_0 +0 -0
  154. package/dist/run-chrome-profile/Default/Code Cache/js/d158ea025ea94688_0 +0 -0
  155. package/dist/run-chrome-profile/Default/Code Cache/js/d6eff9c5bab69b0a_0 +0 -0
  156. package/dist/run-chrome-profile/Default/Code Cache/js/dd2a2093670eef0f_0 +0 -0
  157. package/dist/run-chrome-profile/Default/Code Cache/js/e321489c3c662b3e_0 +0 -0
  158. package/dist/run-chrome-profile/Default/Code Cache/js/e658e73784a6d0b9_0 +0 -0
  159. package/dist/run-chrome-profile/Default/Code Cache/js/e9fbecf364affa6a_0 +0 -0
  160. package/dist/run-chrome-profile/Default/Code Cache/js/edcd059a7c35480a_0 +0 -0
  161. package/dist/run-chrome-profile/Default/Code Cache/js/f1fadc4174aa146d_0 +0 -0
  162. package/dist/run-chrome-profile/Default/Code Cache/js/f51fbbddfd2d7633_0 +0 -0
  163. package/dist/run-chrome-profile/Default/Code Cache/js/f90e2f63985a5ce0_0 +0 -0
  164. package/dist/run-chrome-profile/Default/Service Worker/ScriptCache/2cc80dabc69f58b6_1 +0 -0
  165. package/dist/run-chrome-profile/Default/Sessions/Session_13368811062401121 +0 -0
  166. package/dist/run-chrome-profile/Default/Sessions/Session_13368811144592394 +0 -0
  167. package/dist/run-chrome-profile/Default/Sessions/Tabs_13368811062857759 +0 -0
  168. package/dist/run-chrome-profile/Default/Sessions/Tabs_13368811145119608 +0 -0
  169. package/dist/types/css-content.d.ts +0 -7
  170. package/dist/types/css-modules.d.ts +0 -19
  171. package/dist/types/images.d.ts +0 -58
  172. package/dist/types/index.d.ts +0 -13
  173. package/dist/types/index.ts +0 -7
  174. package/dist/types/polyfill.d.ts +0 -1
  175. /package/dist/extensions/{manager-extension → chrome-manager-extension}/define-initial-tab.js +0 -0
  176. /package/dist/extensions/{manager-extension-firefox → chrome-manager-extension}/pages/sakura-dark.css +0 -0
  177. /package/dist/extensions/{manager-extension-firefox → chrome-manager-extension}/pages/sakura.css +0 -0
  178. /package/dist/extensions/{manager-extension-firefox → chrome-manager-extension}/pages/welcome.html +0 -0
  179. /package/dist/extensions/{manager-extension → chrome-manager-extension}/pages/welcome.js +0 -0
  180. /package/dist/extensions/{manager-extension-firefox → chrome-manager-extension}/public/logo.png +0 -0
  181. /package/dist/extensions/{manager-extension → chromium-manager-extension}/pages/sakura-dark.css +0 -0
  182. /package/dist/extensions/{manager-extension → chromium-manager-extension}/pages/sakura.css +0 -0
  183. /package/dist/extensions/{manager-extension → chromium-manager-extension}/pages/welcome.html +0 -0
  184. /package/dist/extensions/{manager-extension → chromium-manager-extension}/public/logo.png +0 -0
  185. /package/dist/extensions/{manager-extension-firefox → firefox-manager-extension}/pages/welcome.js +0 -0
  186. /package/dist/run-chrome-profile/optimization_guide_model_store/13/E6DC4029A1E4B4C1/{A2FF726319EAE26F → 7FB2BED5F58D342A}/model-info.pb +0 -0
  187. /package/dist/run-chrome-profile/optimization_guide_model_store/13/E6DC4029A1E4B4C1/{A2FF726319EAE26F → 7FB2BED5F58D342A}/model.tflite +0 -0
  188. /package/dist/run-chrome-profile/optimization_guide_model_store/15/E6DC4029A1E4B4C1/{DD2F3F59DBBFC161 → E2AEF611C74078E8}/VERSION.txt +0 -0
  189. /package/dist/run-chrome-profile/optimization_guide_model_store/15/E6DC4029A1E4B4C1/{DD2F3F59DBBFC161 → E2AEF611C74078E8}/model-info.pb +0 -0
  190. /package/dist/run-chrome-profile/optimization_guide_model_store/15/E6DC4029A1E4B4C1/{DD2F3F59DBBFC161 → E2AEF611C74078E8}/model.tflite +0 -0
  191. /package/dist/run-chrome-profile/optimization_guide_model_store/15/E6DC4029A1E4B4C1/{DD2F3F59DBBFC161 → E2AEF611C74078E8}/override_list.pb.gz +0 -0
  192. /package/dist/run-chrome-profile/optimization_guide_model_store/2/E6DC4029A1E4B4C1/{5C9CEB1B5864C075 → D87E159693F0EB16}/model-info.pb +0 -0
  193. /package/dist/run-chrome-profile/optimization_guide_model_store/2/E6DC4029A1E4B4C1/{5C9CEB1B5864C075 → D87E159693F0EB16}/model.tflite +0 -0
  194. /package/dist/run-chrome-profile/optimization_guide_model_store/20/E6DC4029A1E4B4C1/{53F9D90C8266B357 → 34B03CEAE0058949}/model-info.pb +0 -0
  195. /package/dist/run-chrome-profile/optimization_guide_model_store/20/E6DC4029A1E4B4C1/{53F9D90C8266B357 → 34B03CEAE0058949}/model.tflite +0 -0
  196. /package/dist/run-chrome-profile/optimization_guide_model_store/25/E6DC4029A1E4B4C1/{D93CB2CBA8635DD6 → 758FC3BEFF3CA2C1}/model-info.pb +0 -0
  197. /package/dist/run-chrome-profile/optimization_guide_model_store/25/E6DC4029A1E4B4C1/{D93CB2CBA8635DD6 → 758FC3BEFF3CA2C1}/model.tflite +0 -0
  198. /package/dist/run-chrome-profile/optimization_guide_model_store/25/E6DC4029A1E4B4C1/{D93CB2CBA8635DD6 → 758FC3BEFF3CA2C1}/visual_model_desktop.tflite +0 -0
  199. /package/dist/run-chrome-profile/optimization_guide_model_store/26/E6DC4029A1E4B4C1/{39FB7D5ADBDA7869 → 8D7B8C555280B305}/model-info.pb +0 -0
  200. /package/dist/run-chrome-profile/optimization_guide_model_store/26/E6DC4029A1E4B4C1/{39FB7D5ADBDA7869 → 8D7B8C555280B305}/model.tflite +0 -0
  201. /package/dist/run-chrome-profile/optimization_guide_model_store/31/E6DC4029A1E4B4C1/{78ED3668E901D315 → 8268F35943871DCC}/model-info.pb +0 -0
  202. /package/dist/run-chrome-profile/optimization_guide_model_store/31/E6DC4029A1E4B4C1/{78ED3668E901D315 → 8268F35943871DCC}/model.tflite +0 -0
  203. /package/dist/run-chrome-profile/optimization_guide_model_store/34/E6DC4029A1E4B4C1/{9C601F6F58B4BB6D → 07A53CCB3617518F}/model-info.pb +0 -0
  204. /package/dist/run-chrome-profile/optimization_guide_model_store/34/E6DC4029A1E4B4C1/{9C601F6F58B4BB6D → 07A53CCB3617518F}/model.tflite +0 -0
  205. /package/dist/run-chrome-profile/optimization_guide_model_store/40/E6DC4029A1E4B4C1/{D4BFFC1A4F34F105 → D09D4C34287503EC}/model-info.pb +0 -0
  206. /package/dist/run-chrome-profile/optimization_guide_model_store/40/E6DC4029A1E4B4C1/{D4BFFC1A4F34F105 → D09D4C34287503EC}/model.tflite +0 -0
  207. /package/dist/run-chrome-profile/optimization_guide_model_store/40/E6DC4029A1E4B4C1/{D4BFFC1A4F34F105 → D09D4C34287503EC}/ts.bin +0 -0
  208. /package/dist/run-chrome-profile/optimization_guide_model_store/40/E6DC4029A1E4B4C1/{D4BFFC1A4F34F105 → D09D4C34287503EC}/ts_spm.model +0 -0
  209. /package/dist/run-chrome-profile/optimization_guide_model_store/9/E6DC4029A1E4B4C1/{3D618C218E10133D → 74D0A314A35DB18B}/model-info.pb +0 -0
  210. /package/dist/run-chrome-profile/optimization_guide_model_store/9/E6DC4029A1E4B4C1/{3D618C218E10133D → 74D0A314A35DB18B}/model.tflite +0 -0
package/dist/module.js CHANGED
@@ -1,191 +1,187 @@
1
- "use strict";var bp=Object.create;var He=Object.defineProperty;var wp=Object.getOwnPropertyDescriptor;var xp=Object.getOwnPropertyNames;var vp=Object.getPrototypeOf,_p=Object.prototype.hasOwnProperty;var Sp=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pp=(t,e)=>{for(var s in e)He(t,s,{get:e[s],enumerable:!0})},Or=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xp(e))!_p.call(t,n)&&n!==s&&He(t,n,{get:()=>e[n],enumerable:!(r=wp(e,n))||r.enumerable});return t};var a=(t,e,s)=>(s=t!=null?bp(vp(t)):{},Or(e||!t||!t.__esModule?He(s,"default",{value:t,enumerable:!0}):s,t)),kp=t=>Or(He({},"__esModule",{value:!0}),t);var Ms=Sp((wl,Ep)=>{Ep.exports={license:"MIT",repository:{type:"git",url:"https://github.com/cezaraugusto/extension.git",directory:"programs/develop"},engines:{node:">=18"},name:"extension-develop",version:"2.0.0-alpha.1",description:"The develop step of Extension.js",main:"./dist/module.js",types:"./dist/module.d.ts",files:["dist"],author:{name:"Cezar Augusto",email:"boss@cezaraugusto.net",url:"https://cezaraugusto.com"},scripts:{clean:"rm -rf dist",watch:"tsup-node ./module.ts --format cjs --dts --target=node18 --watch",compile:"tsup-node ./module.ts --format cjs --dts --target=node18 --minify && bash install_scripts.sh",test:"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.ts'","test:build":"jest ./build.spec.ts --no-cache"},dependencies:{"@colors/colors":"^1.6.0","@swc/core":"^1.7.3","@types/firefox-webext-browser":"^120.0.4",acorn:"^8.12.1","acorn-walk":"^8.3.3","adm-zip":"^0.5.12",ajv:"^8.17.1",astring:"^1.8.6",axios:"^1.6.8","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":"^2.0.1",ignore:"^5.3.1","loader-utils":"^3.3.1",micromatch:"^4.0.7","mini-css-extract-plugin":"^2.8.1",parse5:"^7.1.2","parse5-utils":"^2.0.0",postcss:"^8.4.40",progress:"^2.0.3","schema-utils":"^4.2.0",slugify:"^1.6.6","style-loader":"^3.3.4","swc-loader":"^0.2.6","tiny-glob":"^0.2.9","vue-template-compiler":"^2.7.16","webextension-polyfill":"^0.12.0",webpack:"~5.92.0","webpack-dev-server":"^5.0.2","webpack-merge":"^6.0.1","webpack-target-webextension":"^1.1.2"},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","@prefresh/webpack":"^4.0.1","@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","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var hl={};Pp(hl,{extensionBuild:()=>ep,extensionDev:()=>ap,extensionPreview:()=>up,extensionStart:()=>yp});module.exports=kp(hl);var Zc=a(require("fs")),Yc=a(require("path")),Kc=a(require("webpack")),Qc=require("webpack-merge");var ve=a(require("path"));var gn=a(require("case-sensitive-paths-webpack-plugin"));var V=a(require("fs")),M=a(require("path")),mn=a(require("dotenv-webpack"));var Os=a(require("path")),f=require("@colors/colors/safe");var Tr=a(require("path")),Ve=Tr.default.join(process.cwd(),"node_modules/extension-develop/dist/certs");function w(t,e){return e==="error"?`${t} ${(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:`${e==="warn"?(0,f.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,f.cyan)("\u25BA\u25BA\u25BA"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)}`}function jp(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Rr(t,e){if(!!1)return`${e.hasErrors()?(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} Extension.js compiled ${e.hasErrors()?(0,f.red)("with errors"):(0,f.brightGreen)("successfully")} in ${t} ms.`}function Nr(t,e,s){return`${w(t,"info")} ${(0,f.magenta)(e)} Integration Found
1
+ "use strict";var $p=Object.create;var Ge=Object.defineProperty;var Cp=Object.getOwnPropertyDescriptor;var Dp=Object.getOwnPropertyNames;var Fp=Object.getPrototypeOf,Lp=Object.prototype.hasOwnProperty;var Ip=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Op=(t,e)=>{for(var s in e)Ge(t,s,{get:e[s],enumerable:!0})},Tr=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Dp(e))!Lp.call(t,i)&&i!==s&&Ge(t,i,{get:()=>e[i],enumerable:!(r=Cp(e,i))||r.enumerable});return t};var a=(t,e,s)=>(s=t!=null?$p(Fp(t)):{},Tr(e||!t||!t.__esModule?Ge(s,"default",{value:t,enumerable:!0}):s,t)),Ap=t=>Tr(Ge({},"__esModule",{value:!0}),t);var Us=Ip((Ol,Tp)=>{Tp.exports={license:"MIT",repository:{type:"git",url:"https://github.com/cezaraugusto/extension.git",directory:"programs/develop"},engines:{node:">=18"},name:"extension-develop",version:"2.0.0-alpha.11",description:"The develop step of Extension.js",main:"./dist/module.js",types:"./dist/module.d.ts",files:["dist"],author:{name:"Cezar Augusto",email:"boss@cezaraugusto.net",url:"https://cezaraugusto.com"},scripts:{clean:"rm -rf dist",watch:"tsup-node ./module.ts --format cjs --dts --target=node18 --watch",compile:"tsup-node ./module.ts --format cjs --dts --target=node18 --minify && bash install_scripts.sh",test:"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.ts'","test:coverage":"jest --no-cache --testPathPattern='webpack/.*/__spec__/.*\\.spec\\.ts' --coverage","test:build":"jest ./build.spec.ts --no-cache"},dependencies:{"@colors/colors":"^1.6.0","@swc/core":"^1.7.3","@types/firefox-webext-browser":"^120.0.4",acorn:"^8.12.1","acorn-walk":"^8.3.3","adm-zip":"^0.5.12",ajv:"^8.17.1",astring:"^1.8.6",axios:"^1.6.8","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":"2.0.4",ignore:"^5.3.1","loader-utils":"^3.3.1",micromatch:"^4.0.7","mini-css-extract-plugin":"^2.8.1",parse5:"^7.1.2","parse5-utils":"^2.0.0",postcss:"^8.4.40",progress:"^2.0.3","schema-utils":"^4.2.0",slugify:"^1.6.6","style-loader":"^3.3.4","swc-loader":"^0.2.6","tiny-glob":"^0.2.9","vue-template-compiler":"^2.7.16","webextension-polyfill":"^0.12.0",webpack:"~5.92.0","webpack-dev-server":"^5.0.2","webpack-merge":"^6.0.1","webpack-target-webextension":"^1.1.2"},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","@prefresh/webpack":"^4.0.1","@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","vue-loader":"^17.4.2","vue-style-loader":"^4.1.3","vue-template-compiler":"^2.7.16"}}});var Dl={};Op(Dl,{extensionBuild:()=>ap,extensionDev:()=>yp,extensionPreview:()=>_p,extensionStart:()=>jp});module.exports=Ap(Dl);var rp=a(require("fs")),ip=a(require("path")),np=a(require("webpack")),op=require("webpack-merge");var Je=a(require("path"));var hi=a(require("case-sensitive-paths-webpack-plugin"));var V=a(require("fs")),M=a(require("path")),di=a(require("dotenv-webpack"));var Ws=a(require("path")),f=require("@colors/colors/safe");var Rr=a(require("path")),Xe=Rr.default.join(process.cwd(),"node_modules/extension-develop/dist/certs"),Se=["chrome","edge"],Mp=["firefox"],Ll=[...Se,...Mp];function w(t,e){return e==="error"?`${t} ${(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`:`${e==="warn"?(0,f.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,f.cyan)("\u25BA\u25BA\u25BA"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${t}`}function Nr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function qr(t,e,s){if(!!1)return`${s.hasErrors()?(0,f.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,f.brightGreen)("\u25BA\u25BA\u25BA")} ${(0,f.cyan)(t)} compiled ${s.hasErrors()?(0,f.red)("with errors"):(0,f.brightGreen)("successfully")} in ${e} ms.`}function Ur(t,e,s){return`${w(t,"info")} ${(0,f.magenta)(e)} Integration Found
2
2
 
3
- Installing required setup dependencies via ${(0,f.brightYellow)(s)}. This is a one time operation...`}function qr(t){return`${w(t,"info")} loaded ${(0,f.brightYellow)("env")} file successfully.`}function v(t,e){return`${w(t,"info")} is using ${(0,f.magenta)(e)}.`}function P(t,e){return`${w(t,"success")} You Are All Set
3
+ Installing required setup dependencies via ${(0,f.brightYellow)(s)}. This is a one time operation...`}function Wr(t){return`${w(t,"info")} loaded ${(0,f.brightYellow)("env")} file successfully.`}function v(t,e){return`${w(t,"info")} is using ${(0,f.magenta)(e)}.`}function E(t,e){return`${w(t,"success")} You Are All Set
4
4
 
5
- Run the program again to start hacking with ${(0,f.magenta)(e)} support.`}function Ur(t,e){return`${w(t,"info")} Installing Root Dependencies
5
+ Run the program again to start hacking with ${(0,f.magenta)(e)} support.`}function Br(t,e){return`${w(t,"info")} Installing Root Dependencies
6
6
 
7
- Installing ${(0,f.magenta)(e)} dependencies in Extension.js root. This only happens for authors and contributors.`}function Wr(t,e){return`${w(t,"success")} ${e} Dependencies Installed ${(0,f.brightGreen)("Successfully")}.`}function Br(t,e,s){return`${w(t,"error")} ${(0,f.magenta)(e)} Installation Error
7
+ Installing ${(0,f.magenta)(e)} dependencies in Extension.js root. This only happens for authors and contributors.`}function Jr(t,e){return`${w(t,"success")} ${e} Dependencies Installed ${(0,f.brightGreen)("Successfully")}.`}function zr(t,e,s){return`${w(t,"error")} ${(0,f.magenta)(e)} Installation Error
8
8
 
9
- Failed to detect package manager or install ${(0,f.magenta)(e)} dependencies: ${(0,f.red)(s?.toString()||"")}`}function Jr(t){return`${w(t,"error")} No Service Worker Support
9
+ Failed to detect package manager or install ${(0,f.magenta)(e)} dependencies: ${(0,f.red)(s?.toString()||"")}`}function Hr(t){return`${w(t,"error")} No Service Worker Support
10
10
 
11
11
  Firefox does not support the ${(0,f.brightYellow)("background.service_worker")} field yet.
12
12
  Update your manifest.json file to use ${(0,f.brightYellow)("background.scripts")} instead.
13
13
 
14
- Read more: ${(0,f.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function zr(t){return`${w(t,"error")} Insecure Content-Security-Policy
14
+ Read more: ${(0,f.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Vr(t){return`${w(t,"error")} Insecure Content-Security-Policy
15
15
 
16
- Manifest includes insecure content-security-policy value ${(0,f.brightYellow)("'unsafe-eval'")} in directive ${(0,f.brightBlue)("'script-src'")}.`}function Hr(t){return`${w(t,"error")} No Default Locale Specified
16
+ Manifest includes insecure content-security-policy value ${(0,f.brightYellow)("'unsafe-eval'")} in directive ${(0,f.brightBlue)("'script-src'")}.`}function Gr(t){return`${w(t,"error")} No Default Locale Specified
17
17
 
18
- Localization used, but ${(0,f.brightYellow)("default_locale")} wasn't specified in the manifest.`}function Se(t){return t==="chrome"?(0,f.underline)("https://developer.chrome.com/docs/extensions/reference/manifest"):(0,f.underline)("https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json")}function Vr(t,e){return`${w(t,"error")} Wrong Manifest Field Type
18
+ Localization used, but ${(0,f.brightYellow)("default_locale")} wasn't specified in the manifest.`}function Pe(t){return t==="chrome"?(0,f.underline)("https://developer.chrome.com/docs/extensions/reference/manifest"):(0,f.underline)("https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json")}function Xr(t,e){return`${w(t,"error")} Wrong Manifest Field Type
19
19
 
20
20
  Field ${(0,f.brightYellow)("web_accessible_resources")} must be a string array in Manifest version 2.
21
21
 
22
- Read more: ${Se(e)}`}function Gr(t,e){return`${w(t,"error")} Wrong Manifest Field Type
22
+ Read more: ${Pe(e)}`}function Zr(t,e){return`${w(t,"error")} Wrong Manifest Field Type
23
23
 
24
24
  Field ${(0,f.brightYellow)("web_accessible_resources")} must be an array of objects in Manifest version 3.
25
25
 
26
- Read more: ${Se(e)}`}function Xr(t,e,s){let n=s?.schemaPath?.split("/"),i=n?.slice(n.length-2).shift();return`${w(t,"error")} Deprecated Field
26
+ Read more: ${Pe(e)}`}function Yr(t,e,s){let i=s?.schemaPath?.split("/"),n=i?.slice(i.length-2).shift();return`${w(t,"error")} Deprecated Field
27
27
 
28
- Field ${(0,f.brightYellow)(i||"")} is deprecated in Manifest V3. Update your manifest.json file to run your extension.
28
+ Field ${(0,f.brightYellow)(n||"")} is deprecated in Manifest V3. Update your manifest.json file to run your extension.
29
29
 
30
- Read more: ${Se(e)}`}function Zr(t,e,s){let r=e?.instancePath.replaceAll("/",".").slice(1)||"",n=e?.params.type;return`${w(t,"error")} Invalid Manifest Field
30
+ Read more: ${Pe(e)}`}function Kr(t,e,s){let r=e?.instancePath.replaceAll("/",".").slice(1)||"",i=e?.params.type;return`${w(t,"error")} Invalid Manifest Field
31
31
 
32
- Field ${(0,f.brightYellow)(r)} must be of type ${(0,f.brightBlue)(n)}.
32
+ Field ${(0,f.brightYellow)(r)} must be of type ${(0,f.brightBlue)(i)}.
33
33
 
34
- Read more: ${Se(s)}`}function Yr(t,e,s){return`${w(t,"error")} Missing Required Manifest Field
34
+ Read more: ${Pe(s)}`}function Qr(t,e,s){return`${w(t,"error")} Missing Required Manifest Field
35
35
 
36
36
  Field ${(0,f.brightYellow)(s||"")} is required. Update your manifest.json file to run your extension.
37
37
 
38
- Read more: ${Se(e)}`}function Kr(t,e){let s=e.split(".").pop(),r=`${w(t,"error")} Content Script Import
38
+ Read more: ${Pe(e)}`}function ei(t,e){let s=e.split(".").pop(),r=`${w(t,"error")} Content Script Import
39
39
 
40
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 Qr(t){return`${w(t,"error")} Top Level Await In Non-ECMAScript Module
41
+ Remove the duplicate entry and try again.`;if(e.startsWith("content_scripts"))return r}function ti(t){return`${w(t,"error")} Top Level Await In Non-ECMAScript Module
42
42
 
43
43
  Top-level await is only supported in ECMAScript modules.
44
44
  To use it in your extension, make sure to set ${(0,f.brightYellow)('"type": "module"')}
45
- in your package.json or use the ${(0,f.brightYellow)(".mjs")} extension for your script files.`}function Ge(t,e,s){if(!e)throw new Error("This operation is impossible. Please report a bug.");switch(Os.default.extname(s)){case".js":case".ts":case".jsx":case".tsx":return $p(t,e,s);case".css":case".scss":case".sass":case".less":return Cp(t,e,s);default:return Dp(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"),o=t.includes("content_scripts")?`(index ${n})
45
+ in your package.json or use the ${(0,f.brightYellow)(".mjs")} extension for your script files.`}function Ze(t,e,s){if(!e)throw new Error("This operation is impossible. Please report a bug.");switch(Ws.default.extname(s)){case".js":case".ts":case".jsx":case".tsx":return Rp(t,e,s);case".css":case".scss":case".sass":case".less":return Np(t,e,s);default:return qp(t,e,s)}}function ae(t,e,s){let r=e.startsWith("content_scripts")?"content_scripts":e.replace("/","."),i=e.split("-")[1],n=e.startsWith("pages"),o=t.includes("content_scripts")?`(index ${i})
46
46
 
47
47
  `:r;return`${w(t,"error")} File Not Found
48
48
 
49
- ${i?`Check the ${(0,f.brightYellow)("pages")} folder in your project root directory.
49
+ ${n?`Check the ${(0,f.brightYellow)("pages")} folder in your project root directory.
50
50
 
51
51
  `:`Check the ${(0,f.brightYellow)(o)} field in your manifest.json file.
52
52
 
53
- `}${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Xe(t,e,s){return`${w(t,"error")} File Not Found
53
+ `}${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Ye(t,e,s){return`${w(t,"error")} File Not Found
54
54
 
55
55
  Check the ${(0,f.brightYellow)(e)} field in your manifest.json file.
56
56
 
57
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function en(t){return`${w(t,"error")} Manifest Not Found
57
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function si(t){return`${w(t,"error")} Manifest Not Found
58
58
 
59
- Ensure you have a manifest.json file at the root directory of your project.`}function tn(t,e){return`${w(t,"error")} Invalid Manifest
59
+ Ensure you have a manifest.json file at the root directory of your project.`}function ri(t,e){return`${w(t,"error")} Invalid Manifest
60
60
 
61
- Update your manifest.json file and try again. `+e}function sn(t,e,s){let r=s&&`${(0,f.gray)("PATH")} ${(0,f.red)("REMOVED")} ${(0,f.underline)(s)}
62
- `,n=e&&`${(0,f.gray)("PATH")} ${(0,f.brightGreen)("ADDED")} ${(0,f.underline)(e)}`;return`${w(t,"error")} Manifest Entry Point Modification
61
+ Update your manifest.json file and try again. `+e}function ii(t,e){let s=e&&`${(0,f.gray)("PATH")} ${(0,f.red)("REMOVED")} ${(0,f.underline)(e)}
62
+ `,r=t&&`${(0,f.gray)("PATH")} ${(0,f.brightGreen)("ADDED")} ${(0,f.underline)(t)}`;return`Manifest Entry Point Modification
63
63
 
64
64
  Changing the path of ${(0,f.brightYellow)("<script>")} or ${(0,f.brightYellow)('<link rel="stylesheet">')} files after compilation requires a server restart.
65
65
 
66
- `+r+n}function rn(t,e,s,r,n){let i=t.charAt(0).toUpperCase()+t.slice(1);return`${w("manifest.json","error")} Manifest Entry Point Modification
66
+ `+s+r}function ni(t,e,s,r,i){let n=t.charAt(0).toUpperCase()+t.slice(1);return`${w("manifest.json","error")} Manifest Entry Point Modification
67
67
 
68
- ${i} ${(0,f.brightYellow)(r)} in the ${(0,f.underline)(s+"/")} folder after compilation requires a server restart.
68
+ ${n} ${(0,f.brightYellow)(r)} in the ${(0,f.underline)(s+"/")} folder after compilation requires a server restart.
69
69
 
70
- ${(0,f.gray)("PATH")} ${(0,f.underline)(n)}`}function nn(t){return`${w(t,"warn")}`+v(t,"TypeScript").replace(".",`but no config file was found. Creating ${(0,f.brightYellow)("tsconfig.json")}...`)}function Ts(t,e){let s=t.name||"Extension.js";if(!e.data)return`
70
+ ${(0,f.gray)("PATH")} ${(0,f.underline)(i)}`}function oi(t){return`${w(t,"warn")}`+v(t,"TypeScript").replace(".",`but no config file was found. Creating ${(0,f.brightYellow)("tsconfig.json")}...`)}function Bs(t,e,s){let r=t.name||"Extension.js",i;switch(e){case"chrome":i="chrome://extensions";break;case"edge":i="edge://extensions";break;case"firefox":i="about:debugging#/runtime/this-firefox";break;default:i=""}if(!s.data)return`
71
71
 
72
- ${(0,f.bold)((0,f.red)("ERROR"))} in ${w(s,"error")} No data received from the extension client.
72
+ ${(0,f.bold)((0,f.red)("ERROR"))} in ${w(r,"error")} No data received from the extension client.
73
73
 
74
74
  This error happens when the program can't get the data from your extension.
75
- Ensure your extension is enabled in your browser and that no hanging browser
76
- instance is open.
75
+ There are many reasons this might happen. To fix, ensure that:
77
76
 
78
- If that is not the case, restart the extension package within the browser and try again.
77
+ - Your extension is set as enabled in ${(0,f.underline)(i)}
78
+ - No previous ${Nr(e)} browser instance is open
79
79
 
80
- If nothing helps and the issue persists, please report a bug:
80
+ If that is not the case, restart both the ${(0,f.cyan)(t.name||"")} and the
81
+ ${(0,f.brightYellow)("Manager Extension")} in ${(0,f.underline)(i)} and try again.
81
82
 
82
- `+(0,f.underline)("https://github.com/extension-js/extension.js/issues");let{id:r,management:n}=e.data;if(!n&&process.env.EXTENSION_ENV==="development")return`${w(s,"error")} No management API info received from client. Investigate.`;let{name:i,version:o}=n,c=Ms().version;return`
83
- \u{1F9E9} ${(0,f.brightGreen)("Extension.js")} ${(0,f.gray)(`${c}`)}
84
- Extension Name ${(0,f.gray)(i)}
85
- Extension Version ${(0,f.gray)(o)}
86
- Extension ID ${(0,f.gray)(r)}`}function on(t){return`This is your first run using Extension.js via ${jp(t)}. Welcome! \u{1F389}
83
+ If the issue still persists, please report a bug:
87
84
 
88
- \u{1F9E9} Learn more at ${(0,f.underline)("https://extension.js.org")}`}function an(t,e){return`${w(t,"error")} WebSocket: ${e}`}function cn(t,e,s){return`
85
+ `+(0,f.underline)("https://github.com/extension-js/extension.js/issues");let{id:n,management:o}=s.data;if(!o&&process.env.EXTENSION_ENV==="development")return`${w(r,"error")} No management API info received from client. Investigate.`;let{name:c,version:p}=o,l=Us().version;return`
86
+ \u{1F9E9} ${(0,f.brightGreen)("Extension.js")} ${(0,f.gray)(`${l}`)}
87
+ Extension Name ${(0,f.gray)(c)}
88
+ Extension Version ${(0,f.gray)(p)}
89
+ Extension ID ${(0,f.gray)(n)}`}function ai(t){return`This is your first run using Extension.js via ${Nr(t)}. Welcome! \u{1F389}
90
+
91
+ \u{1F9E9} Learn more at ${(0,f.underline)("https://extension.js.org")}`}function ci(t,e){return`${w(t,"error")} WebSocket: ${e}`}function pi(t,e,s){return`
89
92
 
90
93
  ${(0,f.bold)((0,f.red)("ERROR"))} in ${w(t,"error")} File Not Found
91
94
 
92
95
  Check the ${(0,f.brightYellow)(e.replace("/","."))} field in your manifest.json file.
93
96
 
94
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}}`}function pn(t,e){return`${w(t,"error")} HTML Entry Point Modification
97
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}}`}function li(t,e){return`${w(t,"error")} HTML Entry Point Modification
95
98
 
96
99
  Changing the path of ${(0,f.brightYellow)("<script>")} or ${(0,f.brightYellow)('<link rel="stylesheet">')} files after compilation requires a server restart.
97
100
 
98
- ${(0,f.gray)("PATH")} ${e}`}function $p(t,e,s){return`${w(t,"error")} File Not Found
101
+ ${(0,f.gray)("PATH")} ${e}`}function Rp(t,e,s){return`${w(t,"error")} File Not Found
99
102
 
100
103
  Check your ${(0,f.brightYellow)("<script>")} tags in ${(0,f.underline)(e)}.
101
104
 
102
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Cp(t,e,s){return`${w(t,"error")} File Not Found
105
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Np(t,e,s){return`${w(t,"error")} File Not Found
103
106
 
104
107
  Check your ${(0,f.brightYellow)("<link>")} tags in ${(0,f.underline)(e)}.
105
108
 
106
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function Dp(t,e,s){let r=Os.default.extname(s);return`${w(t,"error")} File Not Found
109
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function qp(t,e,s){let r=Ws.default.extname(s);return`${w(t,"error")} File Not Found
107
110
 
108
111
  Check your ${(0,f.brightYellow)("*"+r)} assets in ${(0,f.underline)(e)}.
109
112
 
110
- ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function ln(){return`This is your first run using Extension.js. Welcome! \u{1F389}
111
-
112
- ${(0,f.brightYellow)("Note")}: Firefox requires a secure certificate for localhost connections,
113
- needed for the reloader to work. By default, your manifest.json file
114
- is not being watched. To enable this feature, run:
113
+ ${(0,f.red)("NOT FOUND")} ${(0,f.underline)(s)}`}function fi(){return`${(0,f.brightYellow)("Note")}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.
114
+ By default, your ${(0,f.brightYellow)("manifest.json")} file is not being watched. To enable this feature, run:
115
115
 
116
116
  npx -y mkcert-cli \\
117
- ${(0,f.brightGreen)("--outDir")} ${(0,f.gray)(Ve)} \\
118
- ${(0,f.brightGreen)("--cert")} ${(0,f.gray)("localhost.cert")} \\
119
- ${(0,f.brightGreen)("--key")} ${(0,f.gray)("localhost.key")}
117
+ ${(0,f.brightGreen)("--outDir")} ${(0,f.underline)(Xe)} \\
118
+ ${(0,f.brightGreen)("--cert")} ${(0,f.brightYellow)("localhost.cert")} \\
119
+ ${(0,f.brightGreen)("--key")} ${(0,f.brightYellow)("localhost.key")}
120
120
 
121
- This will create a secure certificate via ${(0,f.bold)("mkcert")}
122
- enabling the secure connection needed for Firefox.
121
+ This will enable the secure certificate needed for Firefox via ${(0,f.bold)("mkcert")}.
123
122
 
124
- Learn more: ${(0,f.underline)("https://extension.js.org")}`}function fn(t,e){return`${w(t,"error")} Default port ${e} in use, choose a new port. `}function un(t){return`${w(t,"error")} No Extension Id Specified
123
+ Learn more about ${(0,f.bold)("mkcert")}: ${(0,f.underline)("https://github.com/FiloSottile/mkcert")}`}function ui(t,e){return`${w(t,"error")} Default port ${e} in use, choose a new port. `}function mi(t){return`${w(t,"error")} No Extension Id Specified
125
124
 
126
125
  For MAIN world content scripts, you must specify an extension ID.
127
126
  Otherwise, the content script won't reload on changes.
128
- Add an ${(0,f.brightYellow)("id")} field to your manifest.json file and try again.`}var Ze=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=M.default.dirname(this.manifestPath),n=require(this.manifestPath).name||"Extension.js";(V.default.existsSync(M.default.join(s,".env"))||V.default.existsSync(M.default.join(s,".env.example"))||V.default.existsSync(M.default.join(s,".env.local"))||V.default.existsSync(M.default.join(s,".env.defaults")))&&(console.log(qr(n)),new mn.default({path:V.default.existsSync(M.default.join(s,".env"))?M.default.join(s,".env"):V.default.existsSync(M.default.join(s,".env.local"))?M.default.join(s,".env.local"):M.default.join(s,".env.example"),allowEmptyValues:!0,defaults:V.default.existsSync(M.default.join(s,".env.defaults")),systemvars:!0}).apply(e))}};var Rs=a(require("fs")),dn=a(require("path")),Ye=class{apply(e){let s=dn.default.join(e.options.output.path||"","hot");Rs.default.existsSync(s)&&(Rs.default.rmSync(s,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanHotUpdatesPlugin] Removed old hot-update files before compilation."))}};var Ke=class{static name="plugin-compilation";manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){new gn.default().apply(e),new Ze({manifestPath:this.manifestPath}).apply(e),new Ye().apply(e),e.hooks.done.tap("develop:brand",s=>{s.compilation.name=void 0;let r=s.endTime-s.startTime;console.log(Rr(r,s))})}};var Mn=a(require("path")),On=a(require("mini-css-extract-plugin"));var Dn=a(require("mini-css-extract-plugin"));var ae=a(require("path")),ke=a(require("fs"));var Pe=a(require("path")),Qe=a(require("fs")),Ns=require("child_process"),hn=require("detect-package-manager");function yn(t,e){return Object.values(e||{}).some(s=>s===t)}function h(t,e,s){let r=Pe.default.extname(e),i=S(e,{exclude:s})?Pe.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")),qs(i||"")}function qs(t){return t.replace(/\\/g,"/")}function S(t,e={}){if(!e)return!1;let s=qs(t);return Object.values(e).some(r=>{if(typeof r!="string")return!1;let n=qs(r);return s.endsWith(n)})}function G(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,hn.detect)();console.log(Nr(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,Ns.execSync)(n,{stdio:"inherit"}),await new Promise(i=>setTimeout(i,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Ur(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,Ns.execSync)(n,{stdio:"inherit"})),console.log(Wr(t,e))}catch(r){console.error(Br(t,e,r))}}function et(t){let e=Pe.default.join(t,"package.json");if(!Qe.default.existsSync(e))return!1;let s=JSON.parse(Qe.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 Us(t){return!Qe.default.existsSync(Pe.default.resolve(__dirname,`run-${t}-profile`))}function bn(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 wn=!1;function tt(t){let e=ae.default.join(t,"package.json"),s=ae.default.join(t,"manifest.json");if(!ke.default.existsSync(e))return!1;let r=Lp(t),n=require(e),i=n.devDependencies&&n.devDependencies.tailwindcss,o=n.dependencies&&n.dependencies.tailwindcss,c=!!r&&!!(i||o);if(c&&!wn){let l=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(l,"Tailwind")),wn=!0}return c}function Lp(t){let e=ae.default.join(t,"tailwind.config.mjs"),s=ae.default.join(t,"tailwind.config.cjs"),r=ae.default.join(t,"tailwind.config.js");if(ke.default.existsSync(e))return e;if(ke.default.existsSync(s))return s;if(ke.default.existsSync(r))return r}var st=a(require("path")),vn=a(require("fs"));var xn=!1;function Ee(t){let e=st.default.join(t,"package.json"),s=st.default.join(t,"manifest.json");if(!vn.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(!xn){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"SASS")),xn=!0}return!0}return!1}async function _n(t,e){if(!Ee(t))return[];try{require.resolve("sass-loader")}catch{let r=["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"],n=require(st.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 A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!0})}]}]}var rt=a(require("path")),Pn=a(require("fs"));var Sn=!1;function je(t){let e=rt.default.join(t,"package.json"),s=rt.default.join(t,"manifest.json"),n=require(s).name||"Extension.js";if(!Pn.default.existsSync(e))return!1;let i=require(e),o=i.devDependencies&&i.devDependencies.less,c=i.dependencies&&i.dependencies.less;return o||c?(Sn||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"LESS")),Sn=!0),!0):!1}async function kn(t,e){if(!je(t))return[];try{require.resolve("less-loader")}catch{let r=require(rt.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 A(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var pe=a(require("path")),nt=a(require("fs"));var ce=!1;function Fp(t){let e=pe.default.join(t,"package.json"),s=pe.default.join(t,"manifest.json");if(!nt.default.existsSync(e))return!1;let 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(nt.default.existsSync(e)){let o=require(e);if(o.dependencies&&o.dependencies.postcss||o.devDependencies&&o.devDependencies.postcss)return ce||(process.env.EXTENSION_ENV==="development"&&console.log(v(i,"PostCSS")),ce=!0),!0}for(let o of r)if(nt.default.existsSync(pe.default.join(t,o)))return ce||(process.env.EXTENSION_ENV==="development"&&console.log(v(i,"PostCSS")),ce=!0),!0;return tt(t)?(ce||(process.env.EXTENSION_ENV==="development"&&console.log(v(i,"PostCSS")),ce=!0),!0):!1}async function En(t,e){if(!Fp(t))return{};try{require.resolve("postcss-loader")}catch{let r=require(pe.default.join(t,"package.json")).name;!Ee(t)&&!je(t)&&await _(r,"PostCSS",["postcss","postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),console.log(P(r,"PostCSS")),process.exit(0)}return{loader:require.resolve("postcss-loader"),options:{postcssOptions:{parser:require.resolve("postcss-scss"),ident:"postcss",config:pe.default.resolve(t,"postcss.config.js"),plugins:[require.resolve("postcss-flexbugs-fixes"),[require.resolve("postcss-preset-env"),{autoprefixer:{flexbox:"no-2009"},stage:3}].filter(Boolean),require.resolve("postcss-normalize")].filter(Boolean)},sourceMap:e.mode==="development"}}}var it=a(require("path")),$n=a(require("fs"));var jn=!1;function $e(t){let e=it.default.join(t,"package.json"),s=it.default.join(t,"manifest.json");if(!$n.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies.vue,i=r.dependencies&&r.dependencies.vue;if((n||i)&&!jn){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Vue")),jn=!0}return!!n||!!i}async function Cn(t){if(!$e(t))return;try{require.resolve("vue-loader")}catch{let n=["typescript"],o=require(it.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 A(t,e){let s=Dn.default.loader,r=[e.useMiniCssExtractPlugin?s:$e(t)?require.resolve("vue-style-loader"):require.resolve("style-loader"),{loader:require.resolve("css-loader"),options:{importLoaders:1}}].filter(Boolean);if(tt(t)||Ee(t)||je(t)){let n=await En(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 C=a(require("path")),O=a(require("fs"));function In(t){let e=C.default.join(t,"stylelint.config.json"),s=C.default.join(t,".stylelintrc.js file"),r=C.default.join(t,"stylelint.config.mjs"),n=C.default.join(t,".stylelintrc.mjs"),i=C.default.join(t,"stylelint.config.cjs"),o=C.default.join(t,".stylelintrc.cjs"),c=C.default.join(t,".stylelintrc.json"),p=C.default.join(t,".stylelintrc"),l=C.default.join(t,".stylelintrc.yml"),u=C.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(c))return c;if(O.default.existsSync(p))return p;if(O.default.existsSync(l))return l;if(O.default.existsSync(u))return u}var Ln=!1;function Fn(t){let e=C.default.join(t,"package.json"),s=C.default.join(t,"manifest.json");if(!O.default.existsSync(e))return!1;let n=!!In(t);if(n&&!Ln){let o=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(o,"Stylelint")),Ln=!0}return n}async function An(t){if(!Fn(t))return[];try{require.resolve("stylelint")}catch{let r=["stylelint","stylelint-webpack-plugin","stylelint-config-standard-scss"],n=require(C.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:Fn(t)?In(t):C.default.join(__dirname,"stylelint.config.json"),files:"**/*.{css,scss,sass,less}",exclude:["node_modules",C.default.join(t,"node_modules")]})]}var ot=class t{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Mn.default.dirname(this.manifestPath),r=[new On.default];r.forEach(p=>p.apply(e));let n=await An(s);r.push(...n);let i=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]},{test:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]}];e.options.plugins=[...e.options.plugins,...r].filter(Boolean);let o=await _n(s,this.mode),c=await kn(s,this.mode);i.push(...o),i.push(...c),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 at=class{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async apply(e){let s={test:/\.svg$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2048}}},n=[...e.options.module.rules.some(i=>i&&i.test instanceof RegExp&&i.test.test(".svg")&&i.use!==void 0)?[]:[s],{test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"}},{test:/\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(csv|tsv)$/i,use:[require.resolve("csv-loader")],generator:{filename:"assets/[name][ext]"}}];e.options.module.rules=[...e.options.module.rules,...n].filter(Boolean)}};var Ws=a(require("path"));var fe=a(require("path")),lt=a(require("fs"));var ct=a(require("path")),Rn=a(require("fs"));var Tn=!1;function X(t){let e=ct.default.join(t,"package.json"),s=ct.default.join(t,"manifest.json");if(!Rn.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 c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Preact")),Tn=!0}return!!n||!!i}async function Nn(t){if(!X(t))return;try{require.resolve("@prefresh/webpack")}catch{let r=["@prefresh/webpack"],i=require(ct.default.join(t,"manifest.json")).name||"Extension.js";await _(i,"Preact",r),console.log(P(i,"Preact")),process.exit(0)}return{plugins:[new(require("@prefresh/webpack"))],loaders:void 0,alias:{react:"preact/compat","react-dom/test-utils":"preact/test-utils","react-dom":"preact/compat","react/jsx-runtime":"preact/jsx-runtime"}}}var le=a(require("path")),pt=a(require("fs"));var qn=!1;function R(t){let e=le.default.join(t,"package.json");if(!pt.default.existsSync(e))return!1;let s=Ap(t),r=require(e),n=require(le.default.join(t,"manifest.json")),i=n.name||"Extension.js",o=r.devDependencies&&r.devDependencies.typescript,c=r.dependencies&&r.dependencies.typescript;return qn||((o||c)&&(s?process.env.EXTENSION_ENV==="development"&&console.log(v(i,"TypeScript")):(console.log(nn(n)),Mp(t))),qn=!0),!!s&&!!(o||c)}function Ip(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:et(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 Ap(t){let e=le.default.join(t,"tsconfig.json");if(pt.default.existsSync(e))return e}function Mp(t){pt.default.writeFileSync(le.default.join(t,"tsconfig.json"),JSON.stringify(Ip(t,{mode:"development"}),null,2))}async function Un(t){if(!R(t))return!1;try{require.resolve("typescript")}catch{let s=["typescript"],n=require(le.default.join(t,"manifest.json")).name||"Extension.js";await _(n,"TypeScript",s),console.log(P(n,"TypeScript")),process.exit(0)}return!0}var Wn=!1,Bn=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function Op(t){let e=fe.default.join(t,"package.json"),s=fe.default.join(t,"manifest.json");if(!lt.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies["babel-core"],i=r.dependencies&&r.dependencies["babel-core"],o=Bn.some(c=>lt.default.existsSync(fe.default.join(t,c)))||!!n||!!i;if(o&&!Wn){let p=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(v(p,"Babel")),Wn=!0}return o}function Tp(t){for(let e of Bn){let s=fe.default.join(t,e);if(lt.default.existsSync(s))return s}}function Rp(t,e){let s=require("babel-preset-modern-browser-extension").default;return{cacheDirectory:!1,cacheCompression:!1,babelrc:!1,configFile:Tp(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"&&X(t)&&require.resolve("react-refresh/babel")].filter(Boolean)}}async function Jn(t,e){if(!Op(e))return;try{require.resolve("babel-loader")}catch{let o=["@babel/core","babel-loader","babel-preset-modern-browser-extension"],p=require(fe.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 Un(e);return{plugins:void 0,loaders:[{test:s,include:e,exclude:/node_modules/,loader:require.resolve("babel-loader"),options:Rp(e,{mode:r,typescript:n})}],alias:void 0}}var ft=a(require("path")),Hn=a(require("fs"));var zn=!1;function ue(t){let e=ft.default.join(t,"package.json"),s=ft.default.join(t,"manifest.json");if(!Hn.default.existsSync(e))return!1;let r=require(e),n=r.devDependencies&&r.devDependencies.react,i=r.dependencies&&r.dependencies.react;if((n||i)&&!zn){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"React")),zn=!0}return!!n||!!i}async function Vn(t){if(!ue(t))return;try{require.resolve("@pmmmwh/react-refresh-webpack-plugin")}catch{let r=["react-refresh","@pmmmwh/react-refresh-webpack-plugin","react-refresh-typescript"],i=require(ft.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"))({overlay:!1})],loaders:void 0,alias:void 0}}var ut=class t{static name="plugin-js-frameworks";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Ws.default.dirname(this.manifestPath),r=await Jn(e,s),n=await Vn(s),i=await Nn(s),o=await Cn(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:[Ws.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)&&(ue(s)||X(s)),jsx:!R(s)&&(ue(s)||X(s)),dynamicImport:!0},transform:{react:{development:this.mode==="development",refresh:this.mode==="development",runtime:"automatic",importSource:"react"}}}}}},...r?.loaders||[],...n?.loaders||[],...i?.loaders||[],...o?.loaders||[],...e.options.module.rules].filter(Boolean),n?.plugins?.forEach(c=>c.apply(e)),i?.plugins?.forEach(c=>c.apply(e)),o?.plugins?.forEach(c=>c.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 Te=a(require("path"));var Fi=a(require("path"));var Gn=a(require("path"));function Xn(t,e){if(!e||!e.action||!e.action.default_popup)return;let s=e.action.default_popup;return Gn.default.join(t,s)}var Zn=a(require("path"));function Yn(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let s=e.browser_action.default_popup;return Zn.default.join(t,s)}var mt=a(require("path"));function Kn(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":mt.default.join(t,r)}}if(e.chrome_url_overrides.newtab){let r=e.chrome_url_overrides.newtab;s={"chrome_url_overrides/newtab":mt.default.join(t,r)}}if(e.chrome_url_overrides.bookmarks){let r=e.chrome_url_overrides.bookmarks;s={"chrome_url_overrides/bookmarks":mt.default.join(t,r)}}return s}var Qn=a(require("path"));function ei(t,e){if(!e||!e.devtools_page)return;let s=e.devtools_page;return Qn.default.join(t,s)}var Bs=a(require("path"));function ti(t,e){if(e.options_page){let r=e.options_page;return Bs.default.join(t,r)}if(!e||!e.options_ui||!e.options_ui.page)return;let s=e.options_ui.page;return Bs.default.join(t,s)}var si=a(require("path"));function ri(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let s=e.page_action.default_popup;return si.default.join(t,s)}var ni=a(require("path"));function ii(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}`]=ni.default.join(t,i);return r}var oi=a(require("path"));function ai(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let s=e.side_panel.default_path;return oi.default.join(t,s)}var ci=a(require("path"));function pi(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let s=e.sidebar_action.default_panel;return ci.default.join(t,s)}function Ce(t,e){return{"action/default_popup":Xn(t,e),"browser_action/default_popup":Yn(t,e),...Kn(t,e),devtools_page:ei(t,e),"options_ui/page":ti(t,e),"page_action/default_popup":ri(t,e),...ii(t,e),"side_panel/default_path":ai(t,e),"sidebar_action/default_panel":pi(t,e)}}var Js=a(require("path"));function li(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Js.default.join(t,e.action.default_icon);let s=[];for(let r in e.action.default_icon)s.push(Js.default.join(t,e.action.default_icon[r]));return s}var zs=a(require("path"));function fi(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let s=[];if(typeof e.browser_action.default_icon=="string")return zs.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]=zs.default.join(t,e.browser_action.default_icon[r]);s.push(n)}return s}var Hs=a(require("path"));function ui(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=Hs.default.join(t,s.light)),s.dark&&(s.dark=Hs.default.join(t,s.dark)),s.size&&delete s.size;return e.browser_action.theme_icons}}var mi=a(require("path"));function di(t,e){if(!e||!e.icons)return;let s=[];for(let r in e.icons){let n=mi.default.join(t,e.icons[r]);s.push(n)}return s}var Vs=a(require("path"));function gi(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return Vs.default.join(t,e.page_action.default_icon);let s=[];for(let r in e.page_action.default_icon){let n=Vs.default.join(t,e.page_action.default_icon[r]);s.push(n)}return s}var hi=a(require("path"));function yi(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:hi.default.join(t,e.sidebar_action.default_icon)}function bi(t,e){return{action:li(t,e),browser_action:fi(t,e),"browser_action/theme_icons":ui(t,e),icons:di(t,e),page_action:gi(t,e),sidebar_action:yi(t,e)}}var wi=a(require("path"));function xi(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}`]=wi.default.join(t,n.path)}),s)}var vi=a(require("path"));function _i(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let s=e.storage.managed_schema;return vi.default.join(t,s)}function Si(t,e){return{...xi(t,e),"storage/managed_schema":_i(t,e)}}var Pi=a(require("path"));function ki(t,e){if(!e||!e.background)return;let s=e.background.scripts;if(s)return s.map(r=>Pi.default.join(t,r))}var Ei=a(require("path"));function ji(t,e){if(!e||!e.background)return;let s=e.background.service_worker;if(s)return Ei.default.join(t,s)}var Gs=a(require("path"));function $i(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=>Gs.default.join(t,o))},r=i=>{if(i.css?.length!==0)return i.css?.map(o=>Gs.default.join(t,o))},n={};for(let[i,o]of e.content_scripts.entries()){let c=s(o),p=r(o);n[`content_scripts/content-${i}`]=[...(c||[]).filter(l=>l!=null),...(p||[]).filter(l=>l!=null)]}return n}var Ci=a(require("path"));function Di(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let s=e.user_scripts.api_script;return Ci.default.join(t,s)}function De(t,e){return{"background/scripts":ki(t,e),"background/service_worker":ji(t,e),...$i(t,e),"user_scripts/api_script":Di(t,e)}}function Li(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function Np(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 Ii({manifestPath:t}){let e=Fi.default.dirname(t),s=require(t),r=Np(s);return{html:Ce(e,r),icons:bi(e,r),json:Si(e,r),scripts:De(e,r),web_accessible_resources:Li(r)}}var me=a(require("path"));var dt=a(require("fs")),Le=a(require("path"));function gt(t,e){if(!dt.default.existsSync(t)||!dt.default.statSync(t).isDirectory())return[];let s=[];function r(n){let i=dt.default.readdirSync(n,{withFileTypes:!0});for(let o of i){let c=Le.default.join(n,o.name);o.isDirectory()?r(c):o.isFile()&&e(o.name)&&s.push(c)}}return r(t),s}function ht(t,e,s=""){return!e||!e.length?{}:e.reduce((r,n)=>{let i=Le.default.extname(n),o=Le.default.basename(n,i),c=s?`${s}/${o}`:Le.default.relative(t,n);return{...r,[c]:n}},{})}function Ai({manifestPath:t}){let e=me.default.dirname(t),s={public:me.default.join(e,"public"),pages:me.default.join(e,"pages"),scripts:me.default.join(e,"scripts")},r={public:gt(s.public,()=>!0),pages:gt(s.pages,i=>i.endsWith(".html")),scripts:gt(s.scripts,i=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(me.default.extname(i)))};return{public:ht(e,r.public),pages:ht(e,r.pages,"pages"),scripts:ht(e,r.scripts,"scripts")}}var yt=a(require("path")),Mi=a(require("webpack")),bt=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 Mi.default.ProvidePlugin({r:[yt.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(yt.default.resolve(__dirname,"./resolver-loader.js")),include:[yt.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 Oi=a(require("fs")),xt=a(require("webpack")),Ti=require("webpack");var wt=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:xt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let r=this.manifestPath,n;try{let c=Oi.default.readFileSync(r,"utf-8");n=JSON.parse(c)}catch(c){let l=require(this.manifestPath).name||"Extension.js";s.errors.push(new xt.default.WebpackError(tn(l,c)));return}let i=JSON.stringify(n,null,2);s.emitAsset("manifest.json",new Ti.sources.RawSource(i))})})}};var Pt=require("webpack");var go=a(require("path"));function Ri(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 Ni=a(require("path"));var vt=t=>Ni.default.basename(t);function qi(t,e){return t.browser_action&&{browser_action:{...t.browser_action,...t.browser_action.default_popup&&{default_popup:h("browser_action/default_popup.html",t.browser_action.default_popup,e)},...t.browser_action.default_icon&&{default_icon:typeof t.browser_action.default_icon=="string"?h(`icons/${vt(t.browser_action.default_icon)}`,t.browser_action.default_icon,e):Object.fromEntries(Object.entries(t.browser_action.default_icon).map(([s,r])=>[s,h(`icons/${vt(r)}`,r,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(s=>({...s,...s.light&&{light:h(`browser_action/${vt(s.light)}`,s.light,e)},...s.dark&&{dark:h(`browser_action/${vt(s.dark)}`,s.dark,e)}}))}}}}function Ui(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&&h(`declarative_net_request/${s.id}.json`,s.path,e)}))}}}function Wi(t,e){return{...Ri(t,e),...qi(t,e),...Ui(t,e)}}var Ji=a(require("path"));var Bi=t=>Ji.default.basename(t);function zi(t,e){return t.action&&{action:{...t.action,...t.action.default_popup&&{default_popup:h("action/default_popup.html",t.action.default_popup,e)},...t.action.default_icon&&{default_icon:typeof t.action.default_icon=="string"?h(`action/${Bi(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([s,r])=>[s,h(`action/${Bi(r)}`,r,e)]))}}}}function Hi(t,e){return t.background&&t.background.service_worker&&{background:{...t.background,...t.background.service_worker&&{service_worker:h("background/service_worker.js",t.background.service_worker,e)}}}}function _t(t,e){return t.side_panel&&{side_panel:{...t.side_panel.default_path&&{default_path:h("side_panel/default_path.html",t.side_panel.default_path,e)}}}}function Vi(t,e){return{...zi(t,e),...Hi(t,e),..._t(t,e)}}function Gi(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function Xi(t,e){return t.chrome_url_overrides&&{chrome_url_overrides:{...t.chrome_url_overrides.bookmarks&&{bookmarks:h("chrome_url_overrides/bookmarks.html",t.chrome_url_overrides.bookmarks,e)},...t.chrome_url_overrides.history&&{history:h("chrome_url_overrides/history.html",t.chrome_url_overrides.history,e)},...t.chrome_url_overrides.newtab&&{newtab:h("chrome_url_overrides/newtab.html",t.chrome_url_overrides.newtab,e)}}}}function Zi(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=>h(`content_scripts/content-${r}.js`,o,e))],css:[...i.map(o=>h(`content_scripts/content-${r}.css`,o,e))]}})}}function Yi(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var Ki=a(require("path"));var qp=t=>Ki.default.basename(t);function Qi(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([s,r])=>[s,h(`icons/${qp(r)}`,r,e)]))}}function eo(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function to(t,e){return t.options_ui&&{options_ui:{...t.options_ui,...t.options_ui.page&&{page:h("options_ui/page.html",t.options_ui.page,e)}}}}var ro=a(require("path"));var so=t=>ro.default.basename(t);function no(t,e){return t.page_action&&{page_action:{...t.page_action,...t.page_action.default_popup&&{default_popup:h("page_action/default_popup.html",t.page_action.default_popup,e)},...t.page_action.default_icon&&{default_icon:typeof t.page_action.default_icon=="string"?h(`icons/${so(t.page_action.default_icon)}`,t.page_action.default_icon,e):Object.fromEntries(Object.entries(t.page_action.default_icon).map(([s,r])=>[s,h(`icons/${so(r)}`,r,e)]))}}}}function io(t,e){return t.sandbox&&{sandbox:{...t.sandbox,...t.sandbox.pages&&{pages:t.sandbox.pages.map((s,r)=>h(`sandbox/page-${r}.html`,s,e))}}}}var oo=a(require("path"));var Up=t=>oo.default.basename(t);function ao(t,e){return t.sidebar_action&&{sidebar_action:{...t.sidebar_action,...t.sidebar_action.default_panel&&{default_panel:h("sidebar_action/default_panel.html",t.sidebar_action.default_panel,e)},...t.sidebar_action.default_icon&&{default_icon:h(`icons/${Up(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function co(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var po=a(require("path"));var Wp=t=>po.default.basename(t);function lo(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${Wp(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function fo(t,e){return t.user_scripts&&{user_scripts:{...t.user_scripts,...t.user_scripts.api_script&&{api_script:h("user_scripts/api_script.js",t.user_scripts.api_script,e)}}}}function uo(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function mo(t,e){return{...Gi(t,e),...Xi(t,e),...Zi(t,e),...Yi(t,e),...Qi(t,e),...eo(t,e),...to(t,e),...no(t,e),...io(t,e),..._t(t,e),...ao(t,e),...co(t,e),...lo(t,e),...fo(t,e),...uo(t)}}function ho(t,e,s){let r=e||require(t),n=c=>Array.isArray(c)?c.map(p=>i(p)):typeof c=="string"?[i(c)]:[],i=c=>{let p=go.default.dirname(t),l=c.replace(p,"");return l.startsWith("/")?l.slice(1):l},o=Object.entries(s).flatMap(([,c])=>n(c));return JSON.stringify({...r,...mo(r,o),...Wi(r,o),...Vi(r,o)},null,2)}var St=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=[h(`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:Pt.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(s.errors.length>0)return;let r=G(s,this.manifestPath),n=ho(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),c=new Pt.sources.RawSource(o);s.updateAsset("manifest.json",c)})})}};var yo=a(require("fs")),kt=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=>{yo.default.existsSync(n)&&(r.has(n)||(r.add(n),s.fileDependencies.add(n)))})})}};var bo=a(require("fs")),wo=a(require("path")),jt=a(require("webpack"));var Et=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",c=Object.entries(this.includeList||{});for(let[p,l]of c)if(l){let u=this.extractPaths(l);for(let d of u){let g=wo.default.extname(d),j=require(this.manifestPath).name||"Extension.js",$=oe(j,p,d);bo.default.existsSync(d)||(r.includes(g)?e.errors.push(new s($)):n.includes(g)?e.errors.push(new s($)):i.includes(g)?e.errors.push(new s($)):g===o?e.errors.push(new s($)):e.errors.push(new s($)))}}}apply(e){e.hooks.compilation.tap("manifest:check-manifest-files",s=>{s.hooks.processAssets.tap({name:"compatibility:check-manifest-files",stage:jt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let r=jt.default.WebpackError;this.handleErrors(s,r)})})}};var xo=a(require("fs")),Ct=a(require("webpack"));var $t=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=`${i}/package.json`;if(!xo.default.existsSync(o)){r();return}let c=require(this.manifestPath),p=this.flattenAndSort(Object.values(Ce(i,c))),l=this.flattenAndSort(Object.values(De(i,c)));s.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",u=>{u.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:Ct.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let g=u.getAsset("manifest.json")?.source.source().toString(),y=JSON.parse(g||"{}"),j=this.flattenAndSort(Object.values(Ce(i,y))),$=this.flattenAndSort(Object.values(De(i,y)));if(l.toString()!==$.toString()||p.toString()!==j.toString()){let q=p.filter(W=>!j.includes(W))[0],U=j.filter(W=>!p.includes(W))[0],H=require(this.manifestPath).name,_e=sn(H,U,q);u.errors.push(new Ct.default.WebpackError(_e))}})})}r()})}};var Dt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new wt({manifestPath:this.manifestPath}).apply(e),new Et({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new St({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new kt([this.manifestPath]).apply(e),new $t({manifestPath:this.manifestPath,includeList:this.includeList}).apply(e)}};var Qs=a(require("path"));var Zs=a(require("fs")),It=a(require("webpack")),ko=require("webpack");var vo=a(require("fs")),ge=a(require("path")),_o=a(require("parse5-utils"));var de=a(require("parse5-utils"));function Lt(t){try{return new URL(t),!0}catch{return!1}}function Fe(t,e){let{childNodes:s=[]}=t;for(let r of s)if(r.nodeName==="script"){let n=de.default.getAttribute(r,"src");if(!n||Lt(n))continue;e({filePath:n,childNode:r,assetType:"script"})}else if(r.nodeName==="link"){let n=de.default.getAttribute(r,"href"),i=de.default.getAttribute(r,"rel");if(!n||Lt(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=de.default.getAttribute(r,"href");if(!n||Lt(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=de.default.getAttribute(r,"src");if(!n||Lt(n))continue;e({filePath:n,childNode:r,assetType:"staticSrc"})}else Fe(r,e)}function D(t,e){let s={css:[],js:[],static:[]};if(!t)return s;let r=e||vo.default.readFileSync(t,{encoding:"utf8"}),n=_o.default.parse(r),i=(o,c)=>ge.default.join(ge.default.dirname(o),c.startsWith("/")?ge.default.relative(ge.default.dirname(o),c):c);for(let o of n.childNodes)if(o.nodeName==="html"){for(let c of o.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&Fe(c,({filePath:p,assetType:l})=>{let u=i(t,p);switch(l){case"script":s.js?.push(u);break;case"css":s.css?.push(u);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;s.static?.push(u);break;default:break}});return{css:s.css,js:s.js,static:s.static}}}function So(t,e,s){let r=Object.keys(t).find(i=>{let o=t[i];return t[i]===e||D(o)?.js?.includes(e)||D(o)?.css?.includes(e)})||"",n=Xs(e);return r?`/${r.replace(n,"")}${s}`:`${e.replace(n,"")}${s}`}function Xs(t){switch(ge.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 Z(t,e,s){return s?`/${t}${e}`:`${t}${e}`}function Po(t,e){return Object.values(e||{}).some(s=>s===t)}var Ft=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:It.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let i=Object.entries(this.includeList||{});for(let o of i){let[c,p]=o;if(p){if(!Zs.default.existsSync(p)){let u=oe(r,c,p);n.warnings.push(new It.default.WebpackError(u));return}let l=Zs.default.readFileSync(p,"utf8");if(!S(p,this.excludeList)){let u=new ko.sources.RawSource(l),d=Z(c,".html");n.emitAsset(d,u)}}}})})}};var At=a(require("fs")),he=a(require("path")),Eo=a(require("webpack")),Ie=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-assets-to-compilation",s=>{s.hooks.processAssets.tap({name:"html:add-assets-to-compilation",stage:Ie.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,c=i+".html";if(o){let p=s.getAsset(c);if(p){let l=p.source.source().toString(),u=D(o,l)?.static,d=[...new Set(u)];for(let g of d)if(!g.includes("public/")){if(!At.default.existsSync(g)&&!Po(g,this.includeList)&&!he.default.basename(g).startsWith("#")){let U=Ge(require(this.manifestPath).name,o,g);s.warnings.push(new Eo.default.WebpackError(U));return}let y=At.default.readFileSync(g),j=new Ie.sources.RawSource(y),$=he.default.join("assets",he.default.basename(g));if(!s.getAsset($))if(g.endsWith(".html")){let q=D(g),U=[...q?.js||[],...q?.css||[],...q?.static||[]];s.emitAsset($,j),U.forEach(H=>{let _e=At.default.readFileSync(H),W=new Ie.sources.RawSource(_e),Mr=he.default.join("assets",he.default.basename(H));s.getAsset(Mr)||s.emitAsset(Mr,W)})}else s.emitAsset($,j)}}}}})})}};var jo=a(require("path")),Ys=a(require("fs"));var Ot=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(!Ys.default.existsSync(i))return;let o=D(i),c=o?.js||[],p=o?.css||[],l=[...c,...p].filter(u=>!S(u,this.excludeList));if(e.options.mode==="development"){let u=jo.default.resolve(__dirname,"minimum-script-file.mjs");l.push(u)}Ys.default.existsSync(i)&&(S(i,this.excludeList)||(e.options.entry={...e.options.entry,[n]:{import:l}}))}}}};var Rt=require("webpack");var Ks=a(require("fs")),Y=a(require("path")),L=a(require("parse5-utils"));function $o(t,e,s,r,n){let i=Ks.default.readFileSync(s,{encoding:"utf8"}),o=L.default.parse(i),c=!!t.getAsset(e+".css"),p=!1;for(let l of o.childNodes)if(l.nodeName==="html"){for(let u of l.childNodes){if((u.nodeName==="head"||u.nodeName==="body")&&Fe(u,({filePath:d,childNode:g,assetType:y})=>{let j=Y.default.dirname(s),$=Y.default.resolve(j,d),q=Xs($),U=S(Y.default.resolve(j,d),n),H=Y.default.join("/",Y.default.normalize(d)),_e=yn($,r);switch(y){case"script":{U?l=L.default.setAttribute(g,"src",H):(l=L.default.remove(g),p=!0);break}case"css":{U?l=L.default.setAttribute(g,"href",H):(l=L.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(U)l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",H);else if(_e){let W=So(r,$,q);l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",W)}else{let W=Y.default.join("assets",Y.default.basename($,q));Ks.default.existsSync($)&&(l=L.default.setAttribute(g,y==="staticSrc"?"src":"href",Z(W,"",!0)))}break}default:break}}),u.nodeName==="head"&&c&&t.options.mode==="production"){let d=L.default.createNode("link");d.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:Z(e,".css",!0)}],L.default.append(u,d)}if(u.nodeName==="body"&&(p||t.options.mode!=="production")){let d=L.default.createNode("script");d.attrs=[{name:"src",value:Z(e,".js",!0)}],L.default.append(u,d)}}return L.default.serialize(o)}}var Tt=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:Rt.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 c=$o(s,i,o,r,this.excludeList||{});if(!S(o,this.excludeList)&&c){let p=new Rt.sources.RawSource(c),l=Z(i,".html");s.updateAsset(l,p)}}}})})}};var Co=a(require("fs")),Do=require("webpack");var Nt=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:Do.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=D(i),c=new Set(s.fileDependencies);if(Co.default.existsSync(i)){let p=[i,...o?.static||[]];for(let l of p)c.has(l)||(c.add(l),l===i&&s.fileDependencies.add(l))}}}})})}};var Lo=a(require("fs"));var qt=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(!Lo.default.existsSync(n)){let o=require(this.manifestPath).name||"Extension.js";console.error(oe(o,s,n)),process.exit(1)}this.initialHtmlAssets[n]={js:D(n)?.js||[],css:D(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 c=D(o)?.js||[],p=D(o)?.css||[],{js:l,css:u}=this.initialHtmlAssets[o];if(this.hasEntriesChanged(p,u)||this.hasEntriesChanged(c,l)){let d=require(this.manifestPath).name;console.log(pn(d,o))}}n()})}};var Fo=a(require("fs")),Io=require("webpack");function Jp(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[,c]=o;if(c){if(!Fo.default.existsSync(c))return null;let p=D(c),l=p?.js||[],u=p?.css||[];if(l.includes(i)||u.includes(i)){let d=Ge(require(t).name,c,i);return new Io.WebpackError(d)}}}return null}var Ut=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=Jp(this.manifestPath,this.includeList||{},r);i&&(s.errors[n]=i)})})})}};var Wt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Ft({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),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 Tt({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:[Qs.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(Qs.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),new Nt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new qt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Ut({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var se=a(require("path"));var er=a(require("fs")),Ao=a(require("path"));function Mo(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(n=>{let i=er.default.existsSync(n)&&!S(n,e),o=Ao.default.extname(n);return i&&n.includes(o)})}function Oo(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(n=>er.default.existsSync(n)&&!S(n,e)&&(n.endsWith(".css")||n.endsWith(".scss")||n.endsWith(".sass")||n.endsWith(".less")))}var Bt=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=Mo(i,this.excludeList),c=Oo(i,this.excludeList),p=[...o];e.options.mode==="production"&&p.push(...c),(c.length||o.length)&&(e.options.entry={...e.options.entry,[n]:{import:p}})}}};var te=require("webpack"),zp=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],Hp=[...zp,`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 } }`],Jt=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=Vp();return r.addRuntimeModule(n,i),!0})})}};function Vp(){class t extends te.RuntimeModule{constructor(){super("publicPath",te.RuntimeModule.STAGE_BASIC)}generate(){let s=this.compilation?.outputOptions.publicPath;return te.Template.asString([...Hp,`var path = ${JSON.stringify(this.compilation?.getPath(s||"",{hash:this.compilation.hash||"XXXX"}))}`,`${te.RuntimeGlobals.publicPath} = typeof importScripts === 'function' || !(isBrowser || isChrome) ? path : runtime.runtime.getURL(path);`])}}return new t}var zt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let s=require(this.manifestPath);if(s.content_scripts?.some(r=>r.world&&r.world.toLowerCase()==="main")){if(s.id||(console.error(un(s.name||"")),process.exit(1)),this.browser==="firefox"){e.options.output.publicPath=`moz-extension://${s.id}/`;return}e.options.output.publicPath=`${this.browser}-extension://${s.id}/`}}};var Ht=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Bt({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:[se.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(se.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:[se.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(se.default.join(__dirname,"add-hmr-accept-code.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]}),e.options.mode==="production"&&new Jt().apply(e),new zt({manifestPath:this.manifestPath,browser:this.browser||"chrome",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:[se.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:se.default.resolve(__dirname,"./add-query-param-to-imported-css.js"),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]})}};var sr=a(require("path")),Ae=a(require("fs")),rr=a(require("webpack")),Me=require("webpack");var ye=a(require("path")),Vt=a(require("fs"));function tr(t){let e=ye.default.join(ye.default.dirname(t),"_locales"),s=[];if(Vt.default.existsSync(e))for(let r of Vt.default.readdirSync(e)){let n=ye.default.join(e,r);for(let i of Vt.default.readdirSync(n))s.push(ye.default.join(ye.default.dirname(t),"_locales",r,i))}return s}var Gt=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:Me.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let n=require(this.manifestPath).name||"Extension.js";if(!Ae.default.existsSync(this.manifestPath)){s.errors.push(new rr.default.WebpackError(en(n)));return}if(s.errors.length>0)return;let i=tr(this.manifestPath);for(let o of Object.entries(i||[])){let[c,p]=o,l=p;if(l){if(!Ae.default.existsSync(l)){s.warnings.push(new rr.default.WebpackError(Xe(n,c,l)));return}let u=Ae.default.readFileSync(l),d=new Me.sources.RawSource(u),g=e.options.context||sr.default.dirname(this.manifestPath);if(!S(l,this.excludeList)){let y=sr.default.relative(g,l);s.emitAsset(y,d)}}}})}),e.hooks.thisCompilation.tap("locales:module",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Me.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=tr(this.manifestPath);for(let n of Object.entries(r||[])){let[,i]=n;if(i){let o=new Set(s.fileDependencies),c=r||[];for(let p of c)Ae.default.existsSync(p)&&(o.has(p)||(o.add(p),s.fileDependencies.add(p)))}}})})}};var Xt=a(require("fs")),To=a(require("webpack")),Oe=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:Oe.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,c=Array.isArray(o)?o:[o];for(let p of c)if(p&&!S(p,this.excludeList)){if(!Xt.default.existsSync(p)){let g=require(this.manifestPath).name||"Extension.js";s.warnings.push(new To.default.WebpackError(Xe(g,i,p)));return}let l=Xt.default.readFileSync(p),u=new Oe.sources.RawSource(l);s.emitAsset(i+".json",u)}}})}),e.hooks.thisCompilation.tap("json:module",s=>{s.hooks.processAssets.tap({name:"json:module",stage:Oe.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 c of o)if(c){let p=new Set(s.fileDependencies);S(c,this.excludeList)||Xt.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var nr=a(require("fs")),Ro=a(require("path")),Kt=require("webpack");var Yt=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:Kt.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 c=Array.isArray(o)?typeof o[0]=="string"?o:o.map(Object.values).flat():[o];for(let p of c)if(p){if(!nr.default.existsSync(p))continue;if(!S(p,this.excludeList)){let l=nr.default.readFileSync(p),u=new Kt.sources.RawSource(l),d=Ro.default.basename(p),y=`${i.endsWith("theme_icons")?i.replace("theme_icons",""):i}/${d}`;s.emitAsset(y,u)}}}})})}};var No=a(require("fs")),qo=require("webpack"),Qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("icons:add-to-file-dependencies",s=>{s.hooks.processAssets.tap({name:"icons:add-to-file-dependencies",stage:qo.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 c of o)if(c){let p=new Set(s.fileDependencies);No.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var es=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Yt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Qt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ss=require("webpack");var ts=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}generateManifestPatches(e,s){let r=G(e,this.manifestPath),n=r.web_accessible_resources||[],i=r.web_accessible_resources||[];for(let[p,l]of Object.entries(s)){let u=r.content_scripts?.find(d=>d.js&&d.js.some(g=>g.includes(p)));if(u){let d=u.matches||[];if(r.manifest_version===3){let g=n.find(y=>y.matches.some(j=>d.includes(j)));g?l.forEach(y=>{g.resources.includes(y)||g.resources.push(y)}):n.push({resources:l.filter(y=>!y.endsWith(".map")),matches:d})}else l.forEach(g=>{i.includes(g)||i.push(g)})}}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),c=new ss.sources.RawSource(o);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",c)}apply(e){e.hooks.thisCompilation.tap("plugin-extension:feature-web-resources",s=>{s.hooks.processAssets.tap({name:"plugin-extension:feature-web-resources",stage:ss.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{let r=[],n=Object.keys(this.includeList||{});for(let c of n.filter(Boolean))c.startsWith("content_scripts")&&(Array.isArray(c)?r.push(...c):typeof c=="string"&&r.push(c));let i=s.chunkGraph,o={};s.entrypoints.forEach((c,p)=>{if(r.includes(p)){let l=[];c.chunks.forEach(u=>{Array.from(i.getChunkModulesIterable(u)).forEach(g=>{i.getModuleChunks(g).forEach(y=>{y.auxiliaryFiles.forEach(j=>{l.includes(j)||l.push(j)})})})}),o[p]=l}}),this.generateManifestPatches(s,o)})})}};var F=a(require("fs")),I=a(require("path")),Uo=a(require("chokidar")),rs=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let s=I.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=I.default.join(e,n),o=I.default.join(s,n);F.default.statSync(i).isDirectory()?this.copyFolder(i,o):this.copyFile(i,o)})}apply(e){let s=I.default.dirname(this.options.manifestPath),r=I.default.join(s,"public"),n=e.options.output?.path||"";F.default.existsSync(r)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let i=I.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=I.default.join(s,"public"),o=Uo.default.watch(i,{ignoreInitial:!0});o.on("add",c=>{let p=I.default.join(n,I.default.relative(s,c));this.copyFile(c,p)}),o.on("change",c=>{let p=I.default.join(n,I.default.relative(s,c));this.copyFile(c,p)}),o.on("unlink",c=>{let p=I.default.join(n,I.default.relative(s,c));F.default.existsSync(p)&&F.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{o.close().catch(console.error)})}))}};var N=a(require("path")),ir=a(require("chokidar"));var ns=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,s,r){let n=N.relative(process.cwd(),s),p=rn(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=N.dirname(this.manifestPath),r=N.join(s,"pages"),n=N.join(s,"scripts"),i=ir.watch(r,{ignoreInitial:!0}),o=ir.watch(n,{ignoreInitial:!0}),c=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=>{c?.includes(N.extname(p))&&this.throwCompilationError("scripts",p,!0)}),o.on("unlink",p=>{c?.includes(N.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{i.close().catch(console.error),o.close().catch(console.error)})})}};var is=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:s}=this.options;new rs({manifestPath:s}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new ns(s).apply(e)}};var os=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=Ii({manifestPath:s}),n=Ai({manifestPath:s});new bt({manifestPath:s,includeList:{...n?.pages||{},...n?.scripts||{}},excludeList:n.public,loaderOptions:{jsx:ue(Te.default.dirname(this.manifestPath))||X(Te.default.dirname(this.manifestPath))||$e(Te.default.dirname(this.manifestPath)),typescript:R(Te.default.dirname(this.manifestPath)),minify:this.mode==="production"}}).apply(e),new Dt({browser:this.browser,manifestPath:s,includeList:{...r.html,...r.icons,...r.json,...r.scripts},excludeList:n.public}).apply(e),new Wt({manifestPath:s,includeList:{...r.html,...n.pages},excludeList:{...n.public,...n.scripts}}).apply(e),new Ht({manifestPath:s,browser:this.browser,includeList:{...r.scripts,...n.scripts},excludeList:{...n.public,...n.pages}}).apply(e),new Gt({manifestPath:s}).apply(e),new Zt({manifestPath:s,includeList:r.json,excludeList:n.public}).apply(e),new es({manifestPath:s,includeList:r.icons,excludeList:n.public}).apply(e),new ts({manifestPath:s,includeList:{...r.scripts,...n.scripts},excludeList:n.public}).apply(e),new is({manifestPath:s}).apply(e)}};var qe=a(require("path"));var Wo=a(require("path")),Bo=a(require("ws")),cs=a(require("browser-extension-manifest-fields"));function as(t,e){t.clients.forEach(s=>{s.readyState===Bo.default.OPEN&&s.send(JSON.stringify(e))})}function Jo(t,e,s){if(!s||!e)return;let r=(0,cs.default)(e).locales,n=(0,cs.default)(e).scripts,i=(0,cs.default)(e).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}Wo.default.basename(s)==="manifest.json"&&as(t,{changedFile:"manifest.json"}),r?.forEach(o=>{o.includes(s)&&as(t,{changedFile:"_locales"})}),Object.entries(n).forEach(([o,c])=>{let p=Array.isArray(c)?c:[c];Object.values(p).flatMap(u=>u).includes(s)&&o==="background/service_worker"&&as(t,{changedFile:"service_worker"})}),Object.entries(i).forEach(([o,c])=>{c?.includes(s)&&o==="declarative_net_request"&&as(t,{changedFile:"declarative_net_request"})})}var ar=a(require("path")),Go=a(require("fs")),ps=a(require("ws"));var Re=a(require("path")),Ho=a(require("https")),or=a(require("fs"));var zo=t=>{if(!or.default.existsSync(t))return;let e=Re.default.basename(t);return or.default.readFileSync(Re.default.join(__dirname,"certs",e))};function Vo(t,e){let s={key:zo(Re.default.join(__dirname,"certs","localhost.key")),cert:zo(Re.default.join(__dirname,"certs","localhost.cert"))},r=Ho.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(fn(t,e)),new Error(n.message)}),{server:r,port:e}}function Gp(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 Xo(t,e){let s=t.options.context||"",r=require(ar.default.join(s,"manifest.json")),n=r.name||"Extension.js",i;if(e.browser==="firefox"){let{server:o}=Vo(n,e.port+1);i=new ps.default.Server({server:o})}else await Gp(e.port)?i=new ps.default.Server({noServer:!0}):i=new ps.default.Server({host:"localhost",port:e.port});if(i?i.on("connection",o=>{o.send(JSON.stringify({status:"serverReady"})),o.on("error",c=>{console.log(an(n,c)),i?.close()}),o.on("close",()=>{i?.close()}),o.on("message",c=>{let p=JSON.parse(c.toString());if(p.status==="clientReady"){let l=require(ar.default.join(s,"manifest.json"));console.log(Ts(l,p)),console.log(""),Us(e.browser)&&setTimeout(()=>{console.log(on(e.browser))},2500)}})}):console.log("Failed to start WebSocket server."),e.browser==="firefox"&&!Go.default.existsSync(Ve)){let o=bn(r);console.log(Ts(r,o)),console.log(""),Us("firefox")&&(console.log(ln()),console.log(""))}return i}var cr=a(require("path")),Ne=a(require("fs"));function Zo(t){let e=cr.default.resolve(__dirname,"./extensions/manager-extension/reload-service.js"),s=cr.default.resolve(__dirname,"./extensions/manager-extension-firefox/reload-service.js");Ne.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());Ne.default.writeFile(e,i,"utf8",o=>{o&&console.error(`Error writing to file: ${o.message}`)})}),Ne.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());Ne.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 Ue=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;Zo(this.port);let s=await Xo(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 c=qe.default.relative(qe.default.dirname(this.manifestPath),o),p=qe.default.relative(process.cwd(),qe.default.dirname(o));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&Jo(s,this.manifestPath,o),n()})}};var pr=a(require("path"));function lr(t,e){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[pr.default.dirname(e)],exclude:/node_modules/,use:[{loader:pr.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:e}}]})}var fr=a(require("path"));function ur(t,e){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[fr.default.dirname(e)],exclude:/node_modules/,use:[{loader:fr.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:e}}]})}var ls=require("webpack");var mr=a(require("content-security-policy-parser"));function Yo(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,mr.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 Ko(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self'; "};let s=(0,mr.default)(e.extension_pages||""),r="";for(let n in s)r+=`${n} ${s.get(n)?.join(" ")}; `;return{extension_pages:r.trim()}}function Qo(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 ea(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function dr(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 gr(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 hr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}generateManifestPatches(e){let s=G(e,this.manifestPath),r={...s,content_security_policy:s.manifest_version===3?Ko(s):Yo(s),...s.manifest_version===3?s.permissions?{permissions:[...new Set(["scripting",...s.permissions])]}:{permissions:["scripting"]}:{},...dr(s,this.browser),...gr(s),web_accessible_resources:s.manifest_version===3?ea(s):Qo(s)},n=JSON.stringify(r,null,2),i=new ls.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:ls.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)})})}},ta=hr;var yr=a(require("fs")),be=a(require("path")),sa=a(require("webpack-target-webextension"));var br=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,s,r){let n=be.default.resolve(__dirname,s==="firefox"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),i=be.default.dirname(this.manifestPath),o=r.background;if(s==="firefox"){o=r["gecko:background"]||r["firefox:background"]||o;let c=o?.scripts||o?.["gecko:scripts"]||o?.["firefox:scripts"];if(c&&c.length>0){let p=be.default.join(i,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",n)}else if(o=r["chromium:background"]||r["chrome:background"]||r["edge:background"]||o,r.manifest_version===3){let c=o?.service_worker||o?.["chromium:service_worker"]||o?.["chrome:service_worker"]||o?.["edge:service_worker"];if(c){let p=be.default.join(i,c);this.ensureFileExists(p,"background.service_worker")}else this.addDefaultEntry(e,"background/service_worker",n)}else if(r.manifest_version===2){let c=o?.scripts||o?.["chromium:scripts"]||o?.["chrome:scripts"]||o?.["edge:scripts"];if(c&&c.length>0){let p=be.default.join(i,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",n)}}ensureFileExists(e,s){if(!yr.default.existsSync(e)&&this.manifestPath){let n=require(this.manifestPath).name||"Extension.js",i=cn(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||!yr.default.lstatSync(this.manifestPath).isFile())return;let s=require(this.manifestPath);this.handleBackground(e,this.browser,s),new sa.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}},ra=br;var wr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){(this.browser==="chrome"||this.browser==="edge")&&lr(e,this.manifestPath),this.browser==="firefox"&&ur(e,this.manifestPath),new ta({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ra({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},na=wr;var fs=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 Ue({manifestPath:this.manifestPath,browser:this.browser,port:this.port,stats:this.stats}).apply(e),e.options.mode==="development"&&new na({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var ia=a(require("webpack")),us=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new ia.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var ds=require("webpack");var ms=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,c){let p=o.indexOf(":");if(p===-1)return c;let l=o.substring(0,p);(l===r||l==="chromium"&&s.includes(r))&&(this[o.substring(p+1)]=c)});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:ds.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let r=G(s,this.manifestPath),n=this.patchManifest(r),i=new ds.sources.RawSource(n);s.updateAsset("manifest.json",i)})})}};var gs=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 us({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new ms({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var ha=a(require("fs"));var oa=a(require("webpack")),aa=a(require("content-security-policy-parser"));function ca(t){let e=t.content_security_policy,s=t.content_security_policy?.extension_pages,r=n=>{if(!n)return;let i=(0,aa.default)(n);if(i.get("script-src")&&i.get("script-src")?.includes("'unsafe-eval'")){let o=t.name||"Extension.js";return zr(o)}};if(t.manifest_version===3){let n=e?r(s):void 0;if(n)return new oa.default.WebpackError(n)}return null}var xr=a(require("webpack"));function pa(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 xr.default.WebpackError(Vr(i,e));if(t.manifest_version===3&&!n)return new xr.default.WebpackError(Gr(i,e))}return null}var la=a(require("webpack"));function fa(t,e){if(e==="firefox"&&t.background?.service_worker){let s=t.name||"Extension.js";return new la.default.WebpackError(Jr(s))}return null}var ua=a(require("path")),ma=a(require("fs")),da=a(require("webpack"));function ga(t,e){let s=ua.default.join(e.options.context||"","_locales"),r=t.name||"Extension.js";return ma.default.existsSync(s)&&!t.default_locale?new da.default.WebpackError(Hr(r)):null}var hs=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,s,r){let n=ca(s),i=pa(s,r),o=fa(s,r),c=ga(s,e);n&&e.errors.push(n),i&&e.errors.push(i),o&&e.options.mode==="production"&&e.errors.push(o),c&&e.errors.push(c)}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let n=this.options.manifestPath,i=JSON.parse(ha.default.readFileSync(n,"utf-8")),o=this.options.browser||"chrome";this.handleRuntimeErrors(s,i,o),r()})}};var ja=a(require("fs")),$a=a(require("ajv"));var ya={$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 ba(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 wa=a(require("path")),xa=require("webpack");function va(t,e,s){let r=t.options.context||"",n=wa.default.join(r,"manifest.json"),o=require(n).name||"Extension.js",c=e?.params.missingProperty;t.errors.push(new xa.WebpackError(Yr(o,s,c)))}var _a=a(require("path")),Sa=require("webpack");function Pa(t,e,s){let r=t.options.context||"",n=_a.default.join(r,"manifest.json"),o=require(n).name||"Extension.js";t.warnings.push(new Sa.WebpackError(Zr(o,e,s)))}var ka=a(require("path")),Ea=require("webpack");function vr(t,e,s){let r=t.options.context||"",n=ka.default.join(r,"manifest.json"),o=require(n).name||"Extension.js";t.warnings.push(new Ea.WebpackError(Xr(o,s,e)))}var ys=class{options;constructor(e){this.options=e}handleSchemaErrors(e,s,r){let n=new $a.default;ba(n);let i={allOf:[ya]},o=n.compile(i),c=o(s),p=s.manifest_version===3;if(!c&&o.errors){let l=o.errors[0];if(l?.keyword==="required"){va(e,l,r);return}p&&(l?.keyword==="type"&&Pa(e,l,r),l?.keyword==="not"&&vr(e,l,r))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let n=this.options.manifestPath,i=JSON.parse(ja.default.readFileSync(n,"utf-8")),o=this.options.browser||"chrome";this.handleSchemaErrors(s,i,o),r()})}};var La=a(require("fs")),Sr=a(require("path"));var _r=a(require("webpack"));function Ca(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 _r.default.WebpackError(Kr(t,r))}return null}function Da(t,e){let s=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new _r.default.WebpackError(Qr(s.name)):null}var bs=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=Sr.default.join(Sr.default.dirname(this.manifestPath),"package.json");if(!La.default.existsSync(s))return;let r=require(s).name;e.hooks.compilation.tap("develop:common-errors",n=>{n.hooks.afterSeal.tapAsync("develop:common-errors",i=>{n.errors.forEach((o,c)=>{let p=Ca(r,o),l=Da(r,o);p&&(n.errors[c]=p),l&&(n.errors[c]=l)}),i()})})}};var ws=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new hs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new ys({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new bs({manifestPath:this.manifestPath}).apply(e)}};var yc=a(require("os")),kr=a(require("path"));var ec=a(require("fs")),tc=require("child_process");var re=a(require("path")),Ps=a(require("fs"));var Fa={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}},Ia={...Fa},Aa={...Fa};var x=require("@colors/colors/safe");function k(t,e){let s=e==="warn"?(0,x.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,x.cyan)("\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 We(t){return t.charAt(0).toUpperCase()+t.slice(1)}function xs(t,e){let s=t==="firefox"?"Add-on":"Extension";return`${k(t,"info")} ${We(t)} ${s} running in ${(0,x.cyan)(e||"unknown")} mode.`}function vs(t,e){let s=We(t),r=e=="null"?`${s} browser is not installed.
127
+ Add an ${(0,f.brightYellow)("id")} field to your manifest.json file and try again.`}var Ke=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=M.default.dirname(this.manifestPath),i=require(this.manifestPath).name||"Extension.js";(V.default.existsSync(M.default.join(s,".env"))||V.default.existsSync(M.default.join(s,".env.example"))||V.default.existsSync(M.default.join(s,".env.local"))||V.default.existsSync(M.default.join(s,".env.defaults")))&&(console.log(Wr(i)),new di.default({path:V.default.existsSync(M.default.join(s,".env"))?M.default.join(s,".env"):V.default.existsSync(M.default.join(s,".env.local"))?M.default.join(s,".env.local"):M.default.join(s,".env.example"),allowEmptyValues:!0,defaults:V.default.existsSync(M.default.join(s,".env.defaults")),systemvars:!0}).apply(e))}};var Js=a(require("fs")),gi=a(require("path")),Qe=class{apply(e){let s=gi.default.join(e.options.output.path||"","hot");Js.default.existsSync(s)&&(Js.default.rmSync(s,{recursive:!0,force:!0}),process.env.EXTENSION_ENV==="development"&&console.log("[CleanHotUpdatesPlugin] Removed old hot-update files before compilation."))}};var et=class{static name="plugin-compilation";manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){new hi.default().apply(e),new Ke({manifestPath:this.manifestPath}).apply(e),new Qe().apply(e),e.hooks.done.tap("develop:brand",s=>{s.compilation.name=void 0;let r=s.endTime-s.startTime,i=require(this.manifestPath).name;console.log(qr(i,r,s))})}};var Ti=a(require("path")),Ri=a(require("mini-css-extract-plugin"));var Li=a(require("mini-css-extract-plugin"));var ce=a(require("path")),ke=a(require("fs"));var te=a(require("path")),tt=a(require("fs")),zs=require("child_process"),yi=require("detect-package-manager");function bi(t,e){return Object.values(e||{}).some(s=>s===t)}function h(t,e,s){let r=te.default.extname(e),n=P(e,s)?te.default.normalize(e):t;return[".js",".jsx",".tsx",".ts"].includes(r)&&(n=n.replace(r,".js")),[".html",".njk",".nunjucks"].includes(r)&&(n=n.replace(r,".html")),[".css",".scss",".sass",".less"].includes(r)&&(n=n.replace(r,".css")),Hs(n||"")}function Hs(t){return t.replace(/\\/g,"/")}function P(t,e={}){if(!e)return!1;let s=te.default.normalize(Hs(t));return Object.values(e).some(i=>typeof i!="string"?!1:Hs(i).includes(s))}function G(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=process.env.npm_execpath||"",i=await(0,yi.detect)(),n=r.split(te.default.sep).pop()?.toLowerCase()||i;console.log(Ur(t,e,n));let o="";n==="yarn"?o=`yarn --silent add ${s.join(" ")} --cwd ${__dirname} --optional`:n==="npm"||n==="npx"?o=`npm --silent install ${s.join(" ")} --prefix ${__dirname} --save-optional`:n==="pnpm"||n==="pnpx"?o=`pnpm --silent add ${s.join(" ")} --prefix ${__dirname} --save-optional`:o=`${n} --silent install ${s.join(" ")} --cwd ${__dirname} --optional`,(0,zs.execSync)(o,{stdio:"inherit"}),await new Promise(c=>setTimeout(c,2e3)),process.env.EXTENSION_ENV==="development"&&(console.log(Br(t,e)),n==="yarn"?o="yarn install --silent > /dev/null 2>&1":n==="npm"?o="npm install --silent > /dev/null 2>&1":n==="pnpm"?o="pnpm install --silent > /dev/null 2>&1":o=`${n} install --silent > /dev/null 2>&1`,(0,zs.execSync)(o,{stdio:"inherit"})),console.log(Jr(t,e))}catch(r){console.error(zr(t,e,r))}}function st(t){let e=te.default.join(t,"package.json");if(!tt.default.existsSync(e))return!1;let s=JSON.parse(tt.default.readFileSync(e,"utf-8")),r=["react","vue","@angular/core","svelte","solid-js","preact"],i=s.dependencies||{},n=s.devDependencies||{};for(let o of r)if(i[o]||n[o])return!0;return!1}function wi(t){return!tt.default.existsSync(te.default.resolve(__dirname,`run-${t}-profile`))}function xi(t){let e=t.name?.replace(/ /g,"-").toLowerCase();return{data:{id:`${e}@extension-js`,manifest:t,management:{id:`${e}@extension-js`,mayDisable:!0,optionsUrl:"",installType:"development",type:"extension",enabled:!0,name:t.name||"",description:t.description||"",version:t.version||"",hostPermissions:t.host_permissions||[],permissions:t.permissions||[],offlineEnabled:t.offline_enabled||!1,shortName:t.short_name||"",isApp:t.app&&t.app.background&&t.app.background.scripts}}}}function rt(t,e){return JSON.parse(JSON.stringify(t),function(i,n){let o=i.indexOf(":");if(o===-1)return n;let c=i.substring(0,o);(c===e||c==="chromium"&&Se.includes(e))&&(this[i.substring(o+1)]=n)})}var vi=!1;function it(t){let e=ce.default.join(t,"package.json"),s=ce.default.join(t,"manifest.json");if(!ke.default.existsSync(e))return!1;let r=Up(t),i=require(e),n=i.devDependencies&&i.devDependencies.tailwindcss,o=i.dependencies&&i.dependencies.tailwindcss,c=!!r&&!!(n||o);if(c&&!vi){let l=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(l,"Tailwind")),vi=!0}return c}function Up(t){let e=ce.default.join(t,"tailwind.config.mjs"),s=ce.default.join(t,"tailwind.config.cjs"),r=ce.default.join(t,"tailwind.config.js");if(ke.default.existsSync(e))return e;if(ke.default.existsSync(s))return s;if(ke.default.existsSync(r))return r}var nt=a(require("path")),Si=a(require("fs"));var _i=!1;function Ee(t){let e=nt.default.join(t,"package.json"),s=nt.default.join(t,"manifest.json");if(!Si.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.sass,n=r.dependencies&&r.dependencies.sass;if(i||n){if(!_i){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"SASS")),_i=!0}return!0}return!1}async function Pi(t,e){if(!Ee(t))return[];try{require.resolve("sass-loader")}catch{let r=["postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"],i=require(nt.default.join(t,"package.json")).name;await _(i,"PostCSS",r),await _(i,"SASS",["sass","sass-loader","resolve-url-loader"]),console.log(E(i,"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 A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]},{test:/\.module\.(s(a|c)ss)$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"sass-loader",mode:e,useMiniCssExtractPlugin:!0})}]}]}var ot=a(require("path")),Ei=a(require("fs"));var ki=!1;function je(t){let e=ot.default.join(t,"package.json"),s=ot.default.join(t,"manifest.json"),i=require(s).name||"Extension.js";if(!Ei.default.existsSync(e))return!1;let n=require(e),o=n.devDependencies&&n.devDependencies.less,c=n.dependencies&&n.dependencies.less;return o||c?(ki||(process.env.EXTENSION_ENV==="development"&&console.log(v(i,"LESS")),ki=!0),!0):!1}async function ji(t,e){if(!je(t))return[];try{require.resolve("less-loader")}catch{let r=require(ot.default.join(t,"package.json")).name;await _(r,"LESS",["less","less-loader","resolve-url-loader"]),console.log(E(r,"LESS")),process.exit(0)}return[{test:/\.less$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:!1})},{use:await A(t,{loader:"less-loader",mode:e,useMiniCssExtractPlugin:e==="production"})}]}]}var le=a(require("path")),at=a(require("fs"));var pe=!1;function Wp(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=[".postcssrc",".postcssrc.json",".postcssrc.yaml",".postcssrc.yml",".postcssrc.js",".postcssrc.cjs","postcss.config.js","postcss.config.cjs"],n=require(s).name||"Extension.js";if(at.default.existsSync(e)){let o=require(e);if(o.dependencies&&o.dependencies.postcss||o.devDependencies&&o.devDependencies.postcss)return pe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),pe=!0),!0}for(let o of r)if(at.default.existsSync(le.default.join(t,o)))return pe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),pe=!0),!0;return it(t)?(pe||(process.env.EXTENSION_ENV==="development"&&console.log(v(n,"PostCSS")),pe=!0),!0):!1}async function $i(t,e){if(!Wp(t))return{};try{require.resolve("postcss-loader")}catch{let r=require(le.default.join(t,"package.json")).name;!Ee(t)&&!je(t)&&await _(r,"PostCSS",["postcss","postcss-loader","postcss-scss","postcss-flexbugs-fixes","postcss-preset-env","postcss-normalize"]),console.log(E(r,"PostCSS")),process.exit(0)}return{loader:require.resolve("postcss-loader"),options:{postcssOptions:{parser:require.resolve("postcss-scss"),ident:"postcss",config:le.default.resolve(t,"postcss.config.js"),plugins:[require.resolve("postcss-flexbugs-fixes"),[require.resolve("postcss-preset-env"),{autoprefixer:{flexbox:"no-2009"},stage:3}].filter(Boolean),require.resolve("postcss-normalize")].filter(Boolean)},sourceMap:e.mode==="development"}}}var ct=a(require("path")),Di=a(require("fs"));var Ci=!1;function $e(t){let e=ct.default.join(t,"package.json"),s=ct.default.join(t,"manifest.json");if(!Di.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.vue,n=r.dependencies&&r.dependencies.vue;if((i||n)&&!Ci){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Vue")),Ci=!0}return!!i||!!n}async function Fi(t){if(!$e(t))return;try{require.resolve("vue-loader")}catch{let i=["typescript"],o=require(ct.default.join(t,"manifest.json")).name||"Extension.js";await _(o,"TypeScript",i),await _(o,"Vue",["vue-loader","@vue/compiler-sfc","vue-template-compiler","vue-style-loader"]),console.log(E(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 A(t,e){let s=Li.default.loader,r=[e.useMiniCssExtractPlugin?s:$e(t)?require.resolve("vue-style-loader"):require.resolve("style-loader"),{loader:require.resolve("css-loader"),options:{importLoaders:1}}].filter(Boolean);if(it(t)||Ee(t)||je(t)){let i=await $i(t,e);i.loader&&r.push(i)}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 C=a(require("path")),T=a(require("fs"));function Ai(t){let e=C.default.join(t,"stylelint.config.json"),s=C.default.join(t,".stylelintrc.js file"),r=C.default.join(t,"stylelint.config.mjs"),i=C.default.join(t,".stylelintrc.mjs"),n=C.default.join(t,"stylelint.config.cjs"),o=C.default.join(t,".stylelintrc.cjs"),c=C.default.join(t,".stylelintrc.json"),p=C.default.join(t,".stylelintrc"),l=C.default.join(t,".stylelintrc.yml"),u=C.default.join(t,".stylelintrc.yaml");if(T.default.existsSync(e))return e;if(T.default.existsSync(s))return s;if(T.default.existsSync(r))return r;if(T.default.existsSync(i))return i;if(T.default.existsSync(n))return n;if(T.default.existsSync(o))return o;if(T.default.existsSync(c))return c;if(T.default.existsSync(p))return p;if(T.default.existsSync(l))return l;if(T.default.existsSync(u))return u}var Ii=!1;function Oi(t){let e=C.default.join(t,"package.json"),s=C.default.join(t,"manifest.json");if(!T.default.existsSync(e))return!1;let i=!!Ai(t);if(i&&!Ii){let o=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(o,"Stylelint")),Ii=!0}return i}async function Mi(t){if(!Oi(t))return[];try{require.resolve("stylelint")}catch{let r=["stylelint","stylelint-webpack-plugin","stylelint-config-standard-scss"],i=require(C.default.join(t,"package.json")).name;await _(i,"Stylelint",r),console.log(E(i,"Stylelint")),process.exit(0)}let e=require("stylelint-webpack-plugin");return[new e({context:t,configFile:Oi(t)?Ai(t):C.default.join(__dirname,"stylelint.config.json"),files:"**/*.{css,scss,sass,less}",exclude:["node_modules",C.default.join(t,"node_modules")]})]}var pt=class t{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Ti.default.dirname(this.manifestPath),r=[new Ri.default];r.forEach(p=>p.apply(e));let i=await Mi(s);r.push(...i);let n=[{test:/\.css$/,exclude:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]},{test:/\.module\.css$/,oneOf:[{resourceQuery:/is_content_css_import=true/,use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:!1})},{use:await A(s,{mode:this.mode,useMiniCssExtractPlugin:this.mode==="production"})}]}];e.options.plugins=[...e.options.plugins,...r].filter(Boolean);let o=await Pi(s,this.mode),c=await ji(s,this.mode);n.push(...o),n.push(...c),e.options.module.rules=[...e.options.module.rules,...n].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 lt=class{static name="plugin-css";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async apply(e){let s={test:/\.svg$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2048}}},i=[...e.options.module.rules.some(n=>n&&n.test instanceof RegExp&&n.test.test(".svg")&&n.use!==void 0)?[]:[s],{test:/\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(woff|woff2|eot|ttf|otf)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"}},{test:/\.(txt|md|csv|tsv|xml|pdf|docx|doc|xls|xlsx|ppt|pptx|zip|gz|gzip|tgz)$/i,type:"asset/resource",generator:{filename:"assets/[name][ext]"},parser:{dataUrlCondition:{maxSize:2*1024}}},{test:/\.(csv|tsv)$/i,use:[require.resolve("csv-loader")],generator:{filename:"assets/[name][ext]"}}];e.options.module.rules=[...e.options.module.rules,...i].filter(Boolean)}};var Vs=a(require("path"));var ue=a(require("path")),mt=a(require("fs"));var ft=a(require("path")),qi=a(require("fs"));var Ni=!1;function X(t){let e=ft.default.join(t,"package.json"),s=ft.default.join(t,"manifest.json");if(!qi.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.preact,n=r.dependencies&&r.dependencies.preact;if((i||n)&&!Ni){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"Preact")),Ni=!0}return!!i||!!n}async function Ui(t){if(!X(t))return;try{require.resolve("@prefresh/webpack")}catch{let r=["@prefresh/webpack"],n=require(ft.default.join(t,"manifest.json")).name||"Extension.js";await _(n,"Preact",r),console.log(E(n,"Preact")),process.exit(0)}return{plugins:[new(require("@prefresh/webpack"))],loaders:void 0,alias:{react:"preact/compat","react-dom/test-utils":"preact/test-utils","react-dom":"preact/compat","react/jsx-runtime":"preact/jsx-runtime"}}}var fe=a(require("path")),ut=a(require("fs"));var Wi=!1;function R(t){let e=fe.default.join(t,"package.json");if(!ut.default.existsSync(e))return!1;let s=Jp(t),r=require(e),i=require(fe.default.join(t,"manifest.json")),n=i.name||"Extension.js",o=r.devDependencies&&r.devDependencies.typescript,c=r.dependencies&&r.dependencies.typescript;return Wi||((o||c)&&(s?process.env.EXTENSION_ENV==="development"&&console.log(v(n,"TypeScript")):(console.log(oi(i)),zp(t))),Wi=!0),!!s&&!!(o||c)}function Bp(t,e){return{compilerOptions:{allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,jsx:st(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 Jp(t){let e=fe.default.join(t,"tsconfig.json");if(ut.default.existsSync(e))return e}function zp(t){ut.default.writeFileSync(fe.default.join(t,"tsconfig.json"),JSON.stringify(Bp(t,{mode:"development"}),null,2))}async function Bi(t){if(!R(t))return!1;try{require.resolve("typescript")}catch{let s=["typescript"],i=require(fe.default.join(t,"manifest.json")).name||"Extension.js";await _(i,"TypeScript",s),console.log(E(i,"TypeScript")),process.exit(0)}return!0}var Ji=!1,zi=[".babelrc",".babelrc.json",".babelrc.js",".babelrc.cjs","babel.config.json","babel.config.js","babel.config.cjs"];function Hp(t){let e=ue.default.join(t,"package.json"),s=ue.default.join(t,"manifest.json");if(!mt.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies["babel-core"],n=r.dependencies&&r.dependencies["babel-core"],o=zi.some(c=>mt.default.existsSync(ue.default.join(t,c)))||!!i||!!n;if(o&&!Ji){let p=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&process.env.EXTENSION_ENV==="development"&&console.log(v(p,"Babel")),Ji=!0}return o}function Vp(t){for(let e of zi){let s=ue.default.join(t,e);if(mt.default.existsSync(s))return s}}function Gp(t,e){let s=require("babel-preset-modern-browser-extension").default;return{cacheDirectory:!1,cacheCompression:!1,babelrc:!1,configFile:Vp(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"&&X(t)&&require.resolve("react-refresh/babel")].filter(Boolean)}}async function Hi(t,e){if(!Hp(e))return;try{require.resolve("babel-loader")}catch{let o=["@babel/core","babel-loader","babel-preset-modern-browser-extension"],p=require(ue.default.join(e,"manifest.json")).name||"Extension.js";await _(p,"Babel",o),console.log(E(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,i=await Bi(e);return{plugins:void 0,loaders:[{test:s,include:e,exclude:/node_modules/,loader:require.resolve("babel-loader"),options:Gp(e,{mode:r,typescript:i})}],alias:void 0}}var dt=a(require("path")),Gi=a(require("fs"));var Vi=!1;function me(t){let e=dt.default.join(t,"package.json"),s=dt.default.join(t,"manifest.json");if(!Gi.default.existsSync(e))return!1;let r=require(e),i=r.devDependencies&&r.devDependencies.react,n=r.dependencies&&r.dependencies.react;if((i||n)&&!Vi){let c=require(s).name||"Extension.js";process.env.EXTENSION_ENV==="development"&&console.log(v(c,"React")),Vi=!0}return!!i||!!n}async function Xi(t){if(!me(t))return;try{require.resolve("@pmmmwh/react-refresh-webpack-plugin")}catch{let r=["react-refresh","@pmmmwh/react-refresh-webpack-plugin","react-refresh-typescript"],n=require(dt.default.join(t,"manifest.json")).name||"Extension.js";await _(n,"React",r),console.log(E(n,"React")),process.exit(0)}return{plugins:[new(require("@pmmmwh/react-refresh-webpack-plugin"))({overlay:!1})],loaders:void 0,alias:void 0}}var gt=class t{static name="plugin-js-frameworks";manifestPath;mode;constructor(e){this.manifestPath=e.manifestPath,this.mode=e.mode}async configureOptions(e){let s=Vs.default.dirname(this.manifestPath),r=await Hi(e,s),i=await Xi(s),n=await Ui(s),o=await Fi(s);e.options.resolve.alias={...r?.alias||{},...i?.alias||{},...n?.alias||{},...o?.alias||{},...e.options.resolve.alias},e.options.module.rules=[{test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[Vs.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)&&(me(s)||X(s)),jsx:!R(s)&&(me(s)||X(s)),dynamicImport:!0},transform:{react:{development:this.mode==="development",refresh:this.mode==="development",runtime:"automatic",importSource:"react"}}}}}},...r?.loaders||[],...i?.loaders||[],...n?.loaders||[],...o?.loaders||[],...e.options.module.rules].filter(Boolean),i?.plugins?.forEach(c=>c.apply(e)),n?.plugins?.forEach(c=>c.apply(e)),o?.plugins?.forEach(c=>c.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 Te=a(require("path"));var An=a(require("path"));var Zi=a(require("path"));function Yi(t,e){if(!e||!e.action||!e.action.default_popup)return;let s=e.action.default_popup;return Zi.default.join(t,s)}var Ki=a(require("path"));function Qi(t,e){if(!e||!e.browser_action||!e.browser_action.default_popup)return;let s=e.browser_action.default_popup;return Ki.default.join(t,s)}var ht=a(require("path"));function en(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":ht.default.join(t,r)}}if(e.chrome_url_overrides.newtab){let r=e.chrome_url_overrides.newtab;s={"chrome_url_overrides/newtab":ht.default.join(t,r)}}if(e.chrome_url_overrides.bookmarks){let r=e.chrome_url_overrides.bookmarks;s={"chrome_url_overrides/bookmarks":ht.default.join(t,r)}}return s}var tn=a(require("path"));function sn(t,e){if(!e||!e.devtools_page)return;let s=e.devtools_page;return tn.default.join(t,s)}var Gs=a(require("path"));function rn(t,e){if(e.options_page){let r=e.options_page;return Gs.default.join(t,r)}if(!e||!e.options_ui||!e.options_ui.page)return;let s=e.options_ui.page;return Gs.default.join(t,s)}var nn=a(require("path"));function on(t,e){if(!e||!e.page_action||!e.page_action.default_popup)return;let s=e.page_action.default_popup;return nn.default.join(t,s)}var an=a(require("path"));function cn(t,e){if(!e||!e.sandbox||!e.sandbox.pages)return{"sandbox/page-0":void 0};let s=e.sandbox.pages,r={};for(let[i,n]of s.entries())r[`sandbox/page-${i}`]=an.default.join(t,n);return r}var pn=a(require("path"));function ln(t,e){if(!e||!e.side_panel||!e.side_panel.default_path)return;let s=e.side_panel.default_path;return pn.default.join(t,s)}var fn=a(require("path"));function un(t,e){if(!e||!e.sidebar_action||!e.sidebar_action.default_panel)return;let s=e.sidebar_action.default_panel;return fn.default.join(t,s)}function Ce(t,e){return{"action/default_popup":Yi(t,e),"browser_action/default_popup":Qi(t,e),...en(t,e),devtools_page:sn(t,e),"options_ui/page":rn(t,e),"page_action/default_popup":on(t,e),...cn(t,e),"side_panel/default_path":ln(t,e),"sidebar_action/default_panel":un(t,e)}}var Xs=a(require("path"));function mn(t,e){if(!e||!e.action||!e.action.default_icon)return;if(typeof e.action.default_icon=="string")return Xs.default.join(t,e.action.default_icon);let s=[];for(let r in e.action.default_icon)s.push(Xs.default.join(t,e.action.default_icon[r]));return s}var Zs=a(require("path"));function dn(t,e){if(!e||!e.browser_action||!e.browser_action.default_icon)return;let s=[];if(typeof e.browser_action.default_icon=="string")return Zs.default.join(t,e.browser_action.default_icon);for(let r in e.browser_action.default_icon){let i=e.browser_action.default_icon[r]=Zs.default.join(t,e.browser_action.default_icon[r]);s.push(i)}return s}var Ys=a(require("path"));function gn(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=Ys.default.join(t,s.light)),s.dark&&(s.dark=Ys.default.join(t,s.dark)),s.size&&delete s.size;return e.browser_action.theme_icons}}var hn=a(require("path"));function yn(t,e){if(!e||!e.icons)return;let s=[];for(let r in e.icons){let i=hn.default.join(t,e.icons[r]);s.push(i)}return s}var Ks=a(require("path"));function bn(t,e){if(!e||!e.page_action||!e.page_action.default_icon)return;if(typeof e.page_action.default_icon=="string")return Ks.default.join(t,e.page_action.default_icon);let s=[];for(let r in e.page_action.default_icon){let i=Ks.default.join(t,e.page_action.default_icon[r]);s.push(i)}return s}var wn=a(require("path"));function xn(t,e){return!e||!e.sidebar_action||!e.sidebar_action.default_icon?void 0:wn.default.join(t,e.sidebar_action.default_icon)}function vn(t,e){return{action:mn(t,e),browser_action:dn(t,e),"browser_action/theme_icons":gn(t,e),icons:yn(t,e),page_action:bn(t,e),sidebar_action:xn(t,e)}}var _n=a(require("path"));function Sn(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(i=>{s[`declarative_net_request/${i.id}`]=_n.default.join(t,i.path)}),s)}var Pn=a(require("path"));function kn(t,e){if(!e||!e.storage||!e.storage.managed_schema)return;let s=e.storage.managed_schema;return Pn.default.join(t,s)}function En(t,e){return{...Sn(t,e),"storage/managed_schema":kn(t,e)}}var jn=a(require("path"));function $n(t,e){if(!e||!e.background)return;let s=e.background.scripts;if(s)return s.map(r=>jn.default.join(t,r))}var Cn=a(require("path"));function Dn(t,e){if(!e||!e.background)return;let s=e.background.service_worker;if(s)return Cn.default.join(t,s)}var Qs=a(require("path"));function Fn(t,e){if(!e||!e.content_scripts)return{"content_scripts/content-0":void 0};let s=n=>{if(n.js?.length!==0)return n.js?.map(o=>Qs.default.join(t,o))},r=n=>{if(n.css?.length!==0)return n.css?.map(o=>Qs.default.join(t,o))},i={};for(let[n,o]of e.content_scripts.entries()){let c=s(o),p=r(o);i[`content_scripts/content-${n}`]=[...(c||[]).filter(l=>l!=null),...(p||[]).filter(l=>l!=null)]}return i}var Ln=a(require("path"));function In(t,e){if(!e||!e.user_scripts||!e.user_scripts.api_script)return;let s=e.user_scripts.api_script;return Ln.default.join(t,s)}function De(t,e){return{"background/scripts":$n(t,e),"background/service_worker":Dn(t,e),...Fn(t,e),"user_scripts/api_script":In(t,e)}}function On(t){if(!(!t||!t.web_accessible_resources||!t.web_accessible_resources.length))return t.web_accessible_resources}function Xp(t){function e(s){let r={};for(let i in s)if(s.hasOwnProperty(i)){let n=i.includes(":")?i.split(":")[1]:i;typeof s[i]=="object"&&!Array.isArray(s[i])?r[n]=e(s[i]):r[n]=s[i]}return r}return e(t)}function Mn({manifestPath:t}){let e=An.default.dirname(t),s=require(t),r=Xp(s);return{html:Ce(e,r),icons:vn(e,r),json:En(e,r),scripts:De(e,r),web_accessible_resources:On(r)}}var de=a(require("path"));var yt=a(require("fs")),Fe=a(require("path"));function bt(t,e){if(!yt.default.existsSync(t)||!yt.default.statSync(t).isDirectory())return[];let s=[];function r(i){let n=yt.default.readdirSync(i,{withFileTypes:!0});for(let o of n){let c=Fe.default.join(i,o.name);o.isDirectory()?r(c):o.isFile()&&e(o.name)&&s.push(c)}}return r(t),s}function wt(t,e,s=""){return!e||!e.length?{}:e.reduce((r,i)=>{let n=Fe.default.extname(i),o=Fe.default.basename(i,n),c=s?`${s}/${o}`:Fe.default.relative(t,i);return{...r,[c]:i}},{})}function Tn({manifestPath:t}){let e=de.default.dirname(t),s={public:de.default.join(e,"public"),pages:de.default.join(e,"pages"),scripts:de.default.join(e,"scripts")},r={public:bt(s.public,()=>!0),pages:bt(s.pages,n=>n.endsWith(".html")),scripts:bt(s.scripts,n=>[".js",".mjs",".jsx",".mjsx",".ts",".mts",".tsx",".mtsx"].includes(de.default.extname(n)))};return{public:wt(e,r.public),pages:wt(e,r.pages,"pages"),scripts:wt(e,r.scripts,"scripts")}}var xt=a(require("path")),Rn=a(require("webpack")),vt=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 Rn.default.ProvidePlugin({r:[xt.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(xt.default.resolve(__dirname,"./resolver-loader.js")),include:[xt.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 Nn=a(require("fs")),St=a(require("webpack")),qn=require("webpack");var _t=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:St.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let r=this.manifestPath,i;try{let c=Nn.default.readFileSync(r,"utf-8");i=JSON.parse(c)}catch(c){let l=require(this.manifestPath).name||"Extension.js";s.errors.push(new St.default.WebpackError(ri(l,c)));return}let n=JSON.stringify(i,null,2);s.emitAsset("manifest.json",new qn.sources.RawSource(n))})})}};var jt=require("webpack");function Un(t,e){return t.background&&t.background.scripts&&{background:{...t.background,...t.background.scripts&&{scripts:[...t.background.scripts.map(s=>h("background/scripts.js",s,e))]}}}}var Wn=a(require("path"));var Pt=t=>Wn.default.basename(t);function Bn(t,e){return t.browser_action&&{browser_action:{...t.browser_action,...t.browser_action.default_popup&&{default_popup:h("browser_action/default_popup.html",t.browser_action.default_popup,e)},...t.browser_action.default_icon&&{default_icon:typeof t.browser_action.default_icon=="string"?h(`icons/${Pt(t.browser_action.default_icon)}`,t.browser_action.default_icon,e):Object.fromEntries(Object.entries(t.browser_action.default_icon).map(([s,r])=>[s,h(`icons/${Pt(r)}`,r,e)]))},...t.browser_action.theme_icons&&{theme_icons:t.browser_action.theme_icons.map(s=>({...s,...s.light&&{light:h(`browser_action/${Pt(s.light)}`,s.light,e)},...s.dark&&{dark:h(`browser_action/${Pt(s.dark)}`,s.dark,e)}}))}}}}function Jn(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&&h(`declarative_net_request/${s.id}.json`,s.path,e)}))}}}function zn(t,e){return{...Un(t,e),...Bn(t,e),...Jn(t,e)}}var Vn=a(require("path"));var Hn=t=>Vn.default.basename(t);function Gn(t,e){return t.action&&{action:{...t.action,...t.action.default_popup&&{default_popup:h("action/default_popup.html",t.action.default_popup,e)},...t.action.default_icon&&{default_icon:typeof t.action.default_icon=="string"?h(`action/${Hn(t.action.default_icon)}`,t.action.default_icon,e):Object.fromEntries(Object.entries(t.action.default_icon).map(([s,r])=>[s,h(`action/${Hn(r)}`,r,e)]))}}}}function Xn(t,e){return t.background&&t.background.service_worker&&{background:{...t.background,...t.background.service_worker&&{service_worker:h("background/service_worker.js",t.background.service_worker,e)}}}}function kt(t,e){return t.side_panel&&{side_panel:{...t.side_panel.default_path&&{default_path:h("side_panel/default_path.html",t.side_panel.default_path,e)}}}}function Zn(t,e){return{...Gn(t,e),...Xn(t,e),...kt(t,e)}}function Yn(t,e){return t.background&&t.background.page&&{background:{...t.background,...t.background.page&&{page:h("background/page.html",t.background.page,e)}}}}function Kn(t,e){return t.chrome_url_overrides&&{chrome_url_overrides:{...t.chrome_url_overrides.bookmarks&&{bookmarks:h("chrome_url_overrides/bookmarks.html",t.chrome_url_overrides.bookmarks,e)},...t.chrome_url_overrides.history&&{history:h("chrome_url_overrides/history.html",t.chrome_url_overrides.history,e)},...t.chrome_url_overrides.newtab&&{newtab:h("chrome_url_overrides/newtab.html",t.chrome_url_overrides.newtab,e)}}}}function Qn(t,e){return t.content_scripts&&{content_scripts:t.content_scripts.map((s,r)=>{let i=[...new Set(s.js)],n=[...new Set(s.css)];return{...s,js:[...i.map(o=>h(`content_scripts/content-${r}.js`,o,e))],css:[...n.map(o=>h(`content_scripts/content-${r}.css`,o,e))]}})}}function eo(t,e){return t.devtools_page&&{devtools_page:h("devtools_page.html",t.devtools_page,e)}}var to=a(require("path"));var Zp=t=>to.default.basename(t);function so(t,e){return t.icons&&{icons:Object.fromEntries(Object.entries(t.icons).map(([s,r])=>[s,h(`icons/${Zp(r)}`,r,e)]))}}function ro(t,e){return t.options_page&&{options_page:h("options_ui/page.html",t.options_page,e)}}function io(t,e){return t.options_ui&&{options_ui:{...t.options_ui,...t.options_ui.page&&{page:h("options_ui/page.html",t.options_ui.page,e)}}}}var oo=a(require("path"));var no=t=>oo.default.basename(t);function ao(t,e){return t.page_action&&{page_action:{...t.page_action,...t.page_action.default_popup&&{default_popup:h("page_action/default_popup.html",t.page_action.default_popup,e)},...t.page_action.default_icon&&{default_icon:typeof t.page_action.default_icon=="string"?h(`icons/${no(t.page_action.default_icon)}`,t.page_action.default_icon,e):Object.fromEntries(Object.entries(t.page_action.default_icon).map(([s,r])=>[s,h(`icons/${no(r)}`,r,e)]))}}}}function co(t,e){return t.sandbox&&{sandbox:{...t.sandbox,...t.sandbox.pages&&{pages:t.sandbox.pages.map((s,r)=>h(`sandbox/page-${r}.html`,s,e))}}}}var po=a(require("path"));var Yp=t=>po.default.basename(t);function lo(t,e){return t.sidebar_action&&{sidebar_action:{...t.sidebar_action,...t.sidebar_action.default_panel&&{default_panel:h("sidebar_action/default_panel.html",t.sidebar_action.default_panel,e)},...t.sidebar_action.default_icon&&{default_icon:h(`icons/${Yp(t.sidebar_action.default_icon)}`,t.sidebar_action.default_icon,e)}}}}function fo(t,e){return t.storage&&{storage:{...t.storage.managed_schema&&{managed_schema:h("storage/managed_schema.json",t.storage.managed_schema,e)}}}}var uo=a(require("path"));var Kp=t=>uo.default.basename(t);function mo(t,e){return t.theme&&{theme:{...t.theme,...t.theme.images&&{images:{...t.theme.images,theme_frame:h(`theme/images/${Kp(t.theme.images.theme_frame)}`,t.theme.images.theme_frame,e)}}}}}function go(t,e){return t.user_scripts&&{user_scripts:{...t.user_scripts,...t.user_scripts.api_script&&{api_script:h("user_scripts/api_script.js",t.user_scripts.api_script,e)}}}}function ho(t){return t.web_accessible_resources&&t.web_accessible_resources.length&&{web_accessible_resources:t.web_accessible_resources}}function yo(t,e){return{...Yn(t,e),...Kn(t,e),...Qn(t,e),...eo(t,e),...so(t,e),...ro(t,e),...io(t,e),...ao(t,e),...co(t,e),...kt(t,e),...lo(t,e),...fo(t,e),...mo(t,e),...go(t,e),...ho(t)}}function bo(t,e,s){let r=e||require(t);return JSON.stringify({...r,...yo(r,s),...zn(r,s),...Zn(r,s)},null,2)}var Et=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=[h(`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:jt.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},()=>{if(s.errors.length>0)return;let r=G(s,this.manifestPath),i=bo(this.manifestPath,r,this.excludeList||{}),n={...r,...JSON.parse(i)};e.options.mode!=="production"&&n.content_scripts&&(n.content_scripts=this.applyDevOverrides(n));let o=JSON.stringify(n,null,2),c=new jt.sources.RawSource(o);s.updateAsset("manifest.json",c)})})}};var wo=a(require("fs")),$t=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(i=>{wo.default.existsSync(i)&&(r.has(i)||(r.add(i),s.fileDependencies.add(i)))})})}};var xo=a(require("fs")),vo=a(require("path")),Dt=a(require("webpack"));var Ct=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 i=e;i.light&&r.push(i.light),i.dark&&r.push(i.dark)}return r}handleErrors(e,s){let r=[".png",".jpg",".jpeg",".svg",".gif",".webp"],i=[".json"],n=[".js",".ts",".jsx",".tsx",".mjs",".cjs"],o=".html",c=Object.entries(this.includeList||{});for(let[p,l]of c)if(l){let u=this.extractPaths(l);for(let d of u){let g=vo.default.extname(d),$=require(this.manifestPath).name||"Extension.js",k=ae($,p,d);xo.default.existsSync(d)||(r.includes(g)?e.errors.push(new s(k)):i.includes(g)?e.errors.push(new s(k)):n.includes(g)?e.errors.push(new s(k)):g===o?e.errors.push(new s(k)):e.errors.push(new s(k)))}}}apply(e){e.hooks.compilation.tap("manifest:check-manifest-files",s=>{s.hooks.processAssets.tap({name:"compatibility:check-manifest-files",stage:Dt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT},()=>{let r=Dt.default.WebpackError;this.handleErrors(s,r)})})}};var _o=a(require("fs")),Lt=a(require("webpack"));var Ft=class{manifestPath;browser;includeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList}flattenAndSort(e){return e.flat(1/0).sort()}apply(e){e.hooks.watchRun.tapAsync("manifest:throw-if-recompile-is-needed",(s,r)=>{if((s.modifiedFiles||new Set).has(this.manifestPath)){let n=s.options.context||"",o=`${n}/package.json`;if(!_o.default.existsSync(o)){r();return}let c=require(this.manifestPath),p=rt(c,this.browser),l=this.flattenAndSort(Object.values(Ce(n,p))),u=this.flattenAndSort(Object.values(De(n,p)));s.hooks.thisCompilation.tap("manifest:throw-if-recompile-is-needed",d=>{d.hooks.processAssets.tap({name:"manifest:check-manifest-files",stage:Lt.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY},()=>{let y=d.getAsset("manifest.json")?.source.source().toString(),$=JSON.parse(y||"{}"),k=this.flattenAndSort(Object.values(Ce(n,$))),U=this.flattenAndSort(Object.values(De(n,$)));if(u.toString()!==U.toString()||l.toString()!==k.toString()){let W=l.filter(B=>!k.includes(B))[0],H=k.filter(B=>!l.includes(B))[0],_e=ii(H,W);d.errors.push(new Lt.default.WebpackError(_e))}})})}r()})}};var It=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new _t({manifestPath:this.manifestPath}).apply(e),new Ct({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Et({manifestPath:this.manifestPath,excludeList:this.excludeList}).apply(e),new $t([this.manifestPath]).apply(e),new Ft({manifestPath:this.manifestPath,browser:this.browser,includeList:this.includeList}).apply(e)}};var ir=a(require("path"));var tr=a(require("fs")),Mt=a(require("webpack")),jo=require("webpack");var So=a(require("fs")),he=a(require("path")),Po=a(require("parse5-utils"));var ge=a(require("parse5-utils"));function Ot(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 i=ge.default.getAttribute(r,"src");if(!i||Ot(i))continue;e({filePath:i,childNode:r,assetType:"script"})}else if(r.nodeName==="link"){let i=ge.default.getAttribute(r,"href"),n=ge.default.getAttribute(r,"rel");if(!i||Ot(i))continue;e(n==="dns-prefetch"||n==="icon"||n==="manifest"||n==="modulepreload"||n==="preconnect"||n==="prefetch"||n==="preload"||n==="prerender"?{filePath:i,childNode:r,assetType:"staticHref"}:{filePath:i,childNode:r,assetType:"css"})}else if(r.nodeName==="a"||r.nodeName==="area"){let i=ge.default.getAttribute(r,"href");if(!i||Ot(i))continue;e({filePath:i,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 i=ge.default.getAttribute(r,"src");if(!i||Ot(i))continue;e({filePath:i,childNode:r,assetType:"staticSrc"})}else Le(r,e)}function D(t,e){let s={css:[],js:[],static:[]};if(!t)return s;let r=e||So.default.readFileSync(t,{encoding:"utf8"}),i=Po.default.parse(r),n=(o,c)=>he.default.join(he.default.dirname(o),c.startsWith("/")?he.default.relative(he.default.dirname(o),c):c);for(let o of i.childNodes)if(o.nodeName==="html"){for(let c of o.childNodes)(c.nodeName==="head"||c.nodeName==="body")&&Le(c,({filePath:p,assetType:l})=>{let u=n(t,p);switch(l){case"script":s.js?.push(u);break;case"css":s.css?.push(u);break;case"staticSrc":case"staticHref":if(p.startsWith("#"))break;s.static?.push(u);break;default:break}});return{css:s.css,js:s.js,static:s.static}}}function ko(t,e,s){let r=Object.keys(t).find(n=>{let o=t[n];return t[n]===e||D(o)?.js?.includes(e)||D(o)?.css?.includes(e)})||"",i=er(e);return r?`/${r.replace(i,"")}${s}`:`${e.replace(i,"")}${s}`}function er(t){switch(he.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 Z(t,e,s){return s?`/${t}${e}`:`${t}${e}`}function Eo(t,e){return Object.values(e||{}).some(s=>s===t)}var At=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",i=>{i.hooks.processAssets.tap({name:"AddAssetsToCompilationPlugin",stage:Mt.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{let n=Object.entries(this.includeList||{});for(let o of n){let[c,p]=o;if(p){if(!tr.default.existsSync(p)){let u=ae(r,c,p);i.warnings.push(new Mt.default.WebpackError(u));return}let l=tr.default.readFileSync(p,"utf8");if(!P(p,this.excludeList)){let u=new jo.sources.RawSource(l),d=Z(c,".html");i.emitAsset(d,u)}}}})})}};var Tt=a(require("fs")),ye=a(require("path")),$o=a(require("webpack")),Ie=require("webpack");var Rt=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:Ie.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL},()=>{if(s.errors.length>0)return;let r=Object.entries(this.includeList||{});for(let i of r){let[n,o]=i,c=n+".html";if(o){let p=s.getAsset(c);if(p){let l=p.source.source().toString(),u=D(o,l)?.static,d=[...new Set(u)];for(let g of d)if(!g.includes("public/")){if(!Tt.default.existsSync(g)&&!Eo(g,this.includeList)&&!ye.default.basename(g).startsWith("#")){let W=Ze(require(this.manifestPath).name,o,g);s.warnings.push(new $o.default.WebpackError(W));return}let y=Tt.default.readFileSync(g),$=new Ie.sources.RawSource(y),k=ye.default.join("assets",ye.default.basename(g));if(!s.getAsset(k))if(g.endsWith(".html")){let U=D(g),W=[...U?.js||[],...U?.css||[],...U?.static||[]];s.emitAsset(k,$),W.forEach(H=>{let _e=Tt.default.readFileSync(H),B=new Ie.sources.RawSource(_e),Mr=ye.default.join("assets",ye.default.basename(H));s.getAsset(Mr)||s.emitAsset(Mr,B)})}else s.emitAsset(k,$)}}}}})})}};var Co=a(require("path")),sr=a(require("fs"));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[i,n]=r;if(n){if(!sr.default.existsSync(n))return;let o=D(n),c=o?.js||[],p=o?.css||[],l=[...c,...p].filter(u=>!P(u,this.excludeList));if(e.options.mode==="development"){let u=Co.default.resolve(__dirname,"minimum-script-file.mjs");l.push(u)}sr.default.existsSync(n)&&(P(n,this.excludeList)||(e.options.entry={...e.options.entry,[i]:{import:l}}))}}}};var Ut=require("webpack");var rr=a(require("fs")),Y=a(require("path")),F=a(require("parse5-utils"));function Do(t,e,s,r,i){let n=rr.default.readFileSync(s,{encoding:"utf8"}),o=F.default.parse(n),c=!!t.getAsset(e+".css"),p=!1;for(let l of o.childNodes)if(l.nodeName==="html"){for(let u of l.childNodes){if((u.nodeName==="head"||u.nodeName==="body")&&Le(u,({filePath:d,childNode:g,assetType:y})=>{let $=Y.default.dirname(s),k=Y.default.resolve($,d),U=er(k),W=P(Y.default.resolve($,d),i),H=Y.default.join("/",Y.default.normalize(d)),_e=bi(k,r);switch(y){case"script":{W?l=F.default.setAttribute(g,"src",H):(l=F.default.remove(g),p=!0);break}case"css":{W?l=F.default.setAttribute(g,"href",H):(l=F.default.remove(g),c=!0);break}case"staticHref":case"staticSrc":{if(W)l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",H);else if(_e){let B=ko(r,k,U);l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",B)}else{let B=Y.default.join("assets",Y.default.basename(k,U));rr.default.existsSync(k)&&(l=F.default.setAttribute(g,y==="staticSrc"?"src":"href",Z(B,"",!0)))}break}default:break}}),u.nodeName==="head"&&c&&t.options.mode==="production"){let d=F.default.createNode("link");d.attrs=[{name:"rel",value:"stylesheet"},{name:"href",value:Z(e,".css",!0)}],F.default.append(u,d)}if(u.nodeName==="body"&&(p||t.options.mode!=="production")){let d=F.default.createNode("script");d.attrs=[{name:"src",value:Z(e,".js",!0)}],F.default.append(u,d)}}return F.default.serialize(o)}}var qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("html:update-html-file",s=>{s.hooks.processAssets.tap({name:"html:update-html-file",stage:Ut.Compilation.PROCESS_ASSETS_STAGE_DERIVED},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[n,o]=i;if(o){let c=Do(s,n,o,r,this.excludeList||{});if(!P(o,this.excludeList)&&c){let p=new Ut.sources.RawSource(c),l=Z(n,".html");s.updateAsset(l,p)}}}})})}};var Fo=a(require("fs")),Lo=require("webpack");var Wt=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:Lo.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[,n]=i;if(n){let o=D(n),c=new Set(s.fileDependencies);if(Fo.default.existsSync(n)){let p=[n,...o?.static||[]];for(let l of p)c.has(l)||(c.add(l),l===n&&s.fileDependencies.add(l))}}}})})}};var Io=a(require("fs"));var Bt=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 i=r;if(i){if(!Io.default.existsSync(i)){let o=require(this.manifestPath).name||"Extension.js";console.error(ae(o,s,i)),process.exit(1)}this.initialHtmlAssets[i]={js:D(i)?.js||[],css:D(i)?.css||[]}}})}apply(e){let s=this.includeList||{};this.storeInitialHtmlAssets(s),e.hooks.make.tapAsync("html:throw-if-recompile-is-needed",(r,i)=>{let n=e.modifiedFiles||new Set,o=Array.from(n)[0];if(o&&this.initialHtmlAssets[o]){let c=D(o)?.js||[],p=D(o)?.css||[],{js:l,css:u}=this.initialHtmlAssets[o];if(this.hasEntriesChanged(p,u)||this.hasEntriesChanged(c,l)){let d=require(this.manifestPath).name;console.log(li(d,o))}}i()})}};var Oo=a(require("fs")),Ao=require("webpack");function el(t,e,s){let r="Module not found: Error: Can't resolve ",n=s.message.replace(r,"").split("'")[1];if(s.message.includes(r))for(let o of Object.entries(e)){let[,c]=o;if(c){if(!Oo.default.existsSync(c))return null;let p=D(c),l=p?.js||[],u=p?.css||[];if(l.includes(n)||u.includes(n)){let d=Ze(require(t).name,c,n);return new Ao.WebpackError(d)}}}return null}var Jt=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,i)=>{let n=el(this.manifestPath,this.includeList||{},r);n&&(s.errors[i]=n)})})})}};var zt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new At({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Rt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Nt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new qt({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:[ir.default.dirname(this.manifestPath)],exclude:/node_modules/,use:[{loader:require.resolve(ir.default.join(__dirname,"ensure-hmr-for-scripts.js")),options:{manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}}]}),new Wt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Bt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new Jt({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var re=a(require("path"));var nr=a(require("fs")),Mo=a(require("path"));function To(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>{let n=nr.default.existsSync(i)&&!P(i,e),o=Mo.default.extname(i);return n&&(o===".js"||o===".mjs"||o===".jsx"||o===".ts"||o===".tsx")})}function Ro(t,e){return(Array.isArray(t)?t||[]:t?[t]:[]).filter(i=>nr.default.existsSync(i)&&!P(i,e)&&(i.endsWith(".css")||i.endsWith(".scss")||i.endsWith(".sass")||i.endsWith(".less")))}var Ht=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[i,n]=r,o=To(n,this.excludeList),c=Ro(n,this.excludeList),p=[...o];e.options.mode==="production"&&p.push(...c),(c.length||o.length)&&(e.options.entry={...e.options.entry,[i]:{import:p}})}}};var se=require("webpack"),tl=['var isBrowser = !!(() => { try { return browser.runtime.getURL("/") } catch(e) {} })()','var isChrome = !!(() => { try { return chrome.runtime.getURL("/") } catch(e) {} })()'],sl=[...tl,`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 } }`],Vt=class t{apply(e){let{RuntimeGlobals:s}=e.webpack;e.hooks.compilation.tap("PublicPathRuntimeModule",r=>{r.hooks.runtimeRequirementInTree.for(s.publicPath).tap(t.name,i=>{let n=rl();return r.addRuntimeModule(i,n),!0})})}};function rl(){class t extends se.RuntimeModule{constructor(){super("publicPath",se.RuntimeModule.STAGE_BASIC)}generate(){let s=this.compilation?.outputOptions.publicPath;return se.Template.asString([...sl,`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 Gt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList||{},this.excludeList=e.excludeList||{}}apply(e){let s=require(this.manifestPath);if(s.content_scripts?.some(r=>r.world&&r.world.toLowerCase()==="main")){if(s.id||(console.error(mi(s.name||"")),process.exit(1)),this.browser==="firefox"){e.options.output.publicPath=`moz-extension://${s.id}/`;return}e.options.output.publicPath=`${this.browser}-extension://${s.id}/`}}};var Xt=class{manifestPath;browser;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome",this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new Ht({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 Vt().apply(e),new Gt({manifestPath:this.manifestPath,browser:this.browser||"chrome",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:re.default.resolve(__dirname,"./add-query-param-to-imported-css.js"),options:{manifestPath:this.manifestPath,includeList:this.includeList||{},excludeList:this.excludeList||{}}}]})}};var ar=a(require("path")),Oe=a(require("fs")),cr=a(require("webpack")),Ae=require("webpack");var be=a(require("path")),Zt=a(require("fs"));function or(t){let e=be.default.join(be.default.dirname(t),"_locales"),s=[];if(Zt.default.existsSync(e))for(let r of Zt.default.readdirSync(e)){let i=be.default.join(e,r);for(let n of Zt.default.readdirSync(i))s.push(be.default.join(be.default.dirname(t),"_locales",r,n))}return s}var Yt=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:Ae.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{let i=require(this.manifestPath).name||"Extension.js";if(!Oe.default.existsSync(this.manifestPath)){s.errors.push(new cr.default.WebpackError(si(i)));return}if(s.errors.length>0)return;let n=or(this.manifestPath);for(let o of Object.entries(n||[])){let[c,p]=o,l=p;if(l){if(!Oe.default.existsSync(l)){s.warnings.push(new cr.default.WebpackError(Ye(i,c,l)));return}let u=Oe.default.readFileSync(l),d=new Ae.sources.RawSource(u),g=e.options.context||ar.default.dirname(this.manifestPath);if(!P(l,this.excludeList)){let y=ar.default.relative(g,l);s.emitAsset(y,d)}}}})}),e.hooks.thisCompilation.tap("locales:module",s=>{s.hooks.processAssets.tap({name:"locales:module",stage:Ae.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=or(this.manifestPath);for(let i of Object.entries(r||[])){let[,n]=i;if(n){let o=new Set(s.fileDependencies),c=r||[];for(let p of c)Oe.default.existsSync(p)&&(o.has(p)||(o.add(p),s.fileDependencies.add(p)))}}})})}};var Kt=a(require("fs")),No=a(require("webpack")),Me=require("webpack");var Qt=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){e.hooks.thisCompilation.tap("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 i of Object.entries(r)){let[n,o]=i,c=Array.isArray(o)?o:[o];for(let p of c)if(p&&!P(p,this.excludeList)){if(!Kt.default.existsSync(p)){let g=require(this.manifestPath).name||"Extension.js";s.warnings.push(new No.default.WebpackError(Ye(g,n,p)));return}let l=Kt.default.readFileSync(p),u=new Me.sources.RawSource(l);s.emitAsset(n+".json",u)}}})}),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 i of Object.entries(r)){let[,n]=i,o=Array.isArray(n)?n:[n];for(let c of o)if(c){let p=new Set(s.fileDependencies);P(c,this.excludeList)||Kt.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var pr=a(require("fs")),qo=a(require("path")),ts=require("webpack");var es=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:ts.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER},()=>{if(s.errors.length>0)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[n,o]=i;if(o===void 0)continue;let c=Array.isArray(o)?typeof o[0]=="string"?o:o.map(Object.values).flat():[o];for(let p of c)if(p){if(!pr.default.existsSync(p))continue;if(!P(p,this.excludeList)){let l=pr.default.readFileSync(p),u=new ts.sources.RawSource(l),d=qo.default.basename(p),y=`${n.endsWith("theme_icons")?n.replace("theme_icons",""):n}/${d}`;s.emitAsset(y,u)}}}})})}};var Uo=a(require("fs")),Wo=require("webpack"),ss=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:Wo.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},()=>{if(s.errors?.length)return;let r=this.includeList||{};for(let i of Object.entries(r)){let[,n]=i,o=Array.isArray(n)?typeof n[0]=="string"?n:n.map(Object.values).flat():[n];for(let c of o)if(c){let p=new Set(s.fileDependencies);Uo.default.existsSync(c)&&(p.has(c)||(p.add(c),s.fileDependencies.add(c)))}}})})}};var rs=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}apply(e){new es({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e),new ss({manifestPath:this.manifestPath,includeList:this.includeList,excludeList:this.excludeList}).apply(e)}};var ns=require("webpack");var is=class{manifestPath;includeList;excludeList;constructor(e){this.manifestPath=e.manifestPath,this.includeList=e.includeList,this.excludeList=e.excludeList}generateManifestPatches(e,s){let r=G(e,this.manifestPath),i=r.web_accessible_resources||[],n=r.web_accessible_resources||[];for(let[p,l]of Object.entries(s)){let u=r.content_scripts?.find(d=>d.js&&d.js.some(g=>g.includes(p)));if(u){let d=u.matches||[];if(r.manifest_version===3){let g=i.find(y=>y.matches.some($=>d.includes($)));g?l.forEach(y=>{g.resources.includes(y)||g.resources.push(y)}):i.push({resources:l.filter(y=>!y.endsWith(".map")),matches:d})}else l.forEach(g=>{n.includes(g)||n.push(g)})}}r.manifest_version===3?r.web_accessible_resources=i:r.web_accessible_resources=Array.from(new Set(n));let o=JSON.stringify(r,null,2),c=new ns.sources.RawSource(o);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",c)}apply(e){e.hooks.thisCompilation.tap("plugin-extension:feature-web-resources",s=>{s.hooks.processAssets.tap({name:"plugin-extension:feature-web-resources",stage:ns.Compilation.PROCESS_ASSETS_STAGE_ANALYSE},()=>{let r=[],i=Object.keys(this.includeList||{});for(let c of i.filter(Boolean))c.startsWith("content_scripts")&&(Array.isArray(c)?r.push(...c):typeof c=="string"&&r.push(c));let n=s.chunkGraph,o={};s.entrypoints.forEach((c,p)=>{if(r.includes(p)){let l=[];c.chunks.forEach(u=>{Array.from(n.getChunkModulesIterable(u)).forEach(g=>{n.getModuleChunks(g).forEach(y=>{y.auxiliaryFiles.forEach($=>{l.includes($)||l.push($)})})})}),o[p]=l}}),this.generateManifestPatches(s,o)})})}};var L=a(require("fs")),I=a(require("path")),Bo=a(require("chokidar")),os=class{options;constructor(e){this.options=e}ensureDirectoryExistence(e){let s=I.default.dirname(e);if(L.default.existsSync(s))return!0;L.default.mkdirSync(s,{recursive:!0})}copyFile(e,s){this.ensureDirectoryExistence(s),L.default.copyFileSync(e,s)}copyFolder(e,s){L.default.existsSync(s)||L.default.mkdirSync(s,{recursive:!0}),L.default.readdirSync(e).forEach(i=>{let n=I.default.join(e,i),o=I.default.join(s,i);L.default.statSync(n).isDirectory()?this.copyFolder(n,o):this.copyFile(n,o)})}apply(e){let s=I.default.dirname(this.options.manifestPath),r=I.default.join(s,"public"),i=e.options.output?.path||"";L.default.existsSync(r)&&(e.hooks.afterEmit.tap("special-folders:copy-public-folder",()=>{let n=I.default.join(i,"public");L.default.existsSync(n)||L.default.mkdirSync(n,{recursive:!0}),L.default.existsSync(r)&&this.copyFolder(r,n)}),e.options.mode!=="production"&&e.hooks.afterPlugins.tap("special-folders:copy-public-folder",()=>{let n=I.default.join(s,"public"),o=Bo.default.watch(n,{ignoreInitial:!0});o.on("add",c=>{let p=I.default.join(i,I.default.relative(s,c));this.copyFile(c,p)}),o.on("change",c=>{let p=I.default.join(i,I.default.relative(s,c));this.copyFile(c,p)}),o.on("unlink",c=>{let p=I.default.join(i,I.default.relative(s,c));L.default.existsSync(p)&&L.default.unlinkSync(p)}),e.hooks.watchClose.tap("special-folders:copy-public-folder",()=>{o.close().catch(console.error)})}))}};var N=a(require("path")),lr=a(require("chokidar"));var as=class{manifestPath;constructor(e){this.manifestPath=e}throwCompilationError(e,s,r){let i=N.relative(process.cwd(),s),p=ni(r?"Adding":"Removing",r?"added":"removed",e,e==="pages"?"HTML pages":"script files",i);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=N.dirname(this.manifestPath),r=N.join(s,"pages"),i=N.join(s,"scripts"),n=lr.watch(r,{ignoreInitial:!0}),o=lr.watch(i,{ignoreInitial:!0}),c=e.options.resolve?.extensions;n.on("add",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p,!0)}),n.on("unlink",p=>{p.endsWith(".html")&&this.throwCompilationError("pages",p)}),o.on("add",p=>{c?.includes(N.extname(p))&&this.throwCompilationError("scripts",p,!0)}),o.on("unlink",p=>{c?.includes(N.extname(p))&&this.throwCompilationError("scripts",p)}),e.hooks.watchClose.tap("WarnUponFolderChanges",()=>{n.close().catch(console.error),o.close().catch(console.error)})})}};var cs=class{static name="plugin-special-folders";options;constructor(e){this.options=e}apply(e){let{manifestPath:s}=this.options;new os({manifestPath:s}).apply(e),e.options.mode==="development"&&e.options.watchOptions&&new as(s).apply(e)}};var ps=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=Mn({manifestPath:s}),i=Tn({manifestPath:s});new vt({manifestPath:s,includeList:{...i?.pages||{},...i?.scripts||{}},excludeList:i.public,loaderOptions:{jsx:me(Te.default.dirname(this.manifestPath))||X(Te.default.dirname(this.manifestPath))||$e(Te.default.dirname(this.manifestPath)),typescript:R(Te.default.dirname(this.manifestPath)),minify:this.mode==="production"}}).apply(e),new It({browser:this.browser,manifestPath:s,includeList:{...r.html,...r.icons,...r.json,...r.scripts},excludeList:i.public}).apply(e),new zt({manifestPath:s,includeList:{...r.html,...i.pages},excludeList:{...i.public,...i.scripts}}).apply(e),new Xt({manifestPath:s,browser:this.browser,includeList:{...r.scripts,...i.scripts},excludeList:{...i.public,...i.pages}}).apply(e),new Yt({manifestPath:s}).apply(e),new Qt({manifestPath:s,includeList:r.json,excludeList:i.public}).apply(e),new rs({manifestPath:s,includeList:r.icons,excludeList:i.public}).apply(e),new is({manifestPath:s,includeList:{...r.scripts,...i.scripts},excludeList:i.public}).apply(e),new cs({manifestPath:s}).apply(e)}};var qe=a(require("path"));var Jo=a(require("path")),zo=a(require("ws")),fs=a(require("browser-extension-manifest-fields"));function ls(t,e){t.clients.forEach(s=>{s.readyState===zo.default.OPEN&&s.send(JSON.stringify(e))})}function Ho(t,e,s){if(!s||!e)return;let r=(0,fs.default)(e).locales,i=(0,fs.default)(e).scripts,n=(0,fs.default)(e).json;if(!t){process.env.EXTENSION_ENV==="development"&&console.error("WebSocket server is not running.");return}Jo.default.basename(s)==="manifest.json"&&ls(t,{changedFile:"manifest.json"}),r?.forEach(o=>{o.includes(s)&&ls(t,{changedFile:"_locales"})}),Object.entries(i).forEach(([o,c])=>{let p=Array.isArray(c)?c:[c];Object.values(p).flatMap(u=>u).includes(s)&&o==="background/service_worker"&&ls(t,{changedFile:"service_worker"})}),Object.entries(n).forEach(([o,c])=>{c?.includes(s)&&o==="declarative_net_request"&&ls(t,{changedFile:"declarative_net_request"})})}var ur=a(require("path")),Zo=a(require("fs")),Ne=a(require("ws"));var Re=a(require("path")),il=a(require("http")),Go=a(require("https")),fr=a(require("fs"));var Vo=t=>{if(!fr.default.existsSync(t))return;let e=Re.default.basename(t);return fr.default.readFileSync(Re.default.join(__dirname,"certs",e))};function Xo(t,e){let s={key:Vo(Re.default.join(__dirname,"certs","localhost.key")),cert:Vo(Re.default.join(__dirname,"certs","localhost.cert"))},r=Go.default.createServer(s,(i,n)=>{n.writeHead(200),n.end()});return r.on("error",i=>{throw console.error(ui(t,e)),new Error(i.message)}),{server:r,port:e}}function nl(t,e,s){switch(s){case"chrome":return new Ne.default.Server({host:"localhost",port:e});case"edge":return new Ne.default.Server({host:"localhost",port:e+1});case"firefox":return new Ne.default.Server({server:Xo(t,e+2).server});default:return new Ne.default.Server({host:"localhost",port:8888})}}async function Yo(t,e){let s=t.options.context||"",r=require(ur.default.join(s,"manifest.json")),i=r.name||"Extension.js",n=e.port||8e3,o=nl(i,n,e.browser);if(o.on("connection",c=>{c.send(JSON.stringify({status:"serverReady"})),c.on("error",p=>{console.log(ci(i,p))}),c.on("message",p=>{let l=JSON.parse(p.toString());if(l.status==="clientReady"){let u=require(ur.default.join(s,"manifest.json"));setTimeout(()=>{console.log(Bs(u,e.browser,l)),console.log("")},2500),wi(e.browser)&&setTimeout(()=>{console.log(ai(e.browser))},5e3)}})}),e.browser==="firefox"&&!Zo.default.existsSync(Xe)){let c=xi(r);console.log(Bs(r,e.browser,c)),console.log(""),console.log(fi()),console.log("")}return o}var Ko=a(require("path")),mr=a(require("fs"));function Qo(t,e){let s=Ko.default.resolve(__dirname,`./extensions/${t}-manager-extension/reload-service.js`);try{let r=mr.default.readFileSync(s,"utf8"),i=r.replace(/__RELOAD_PORT__/g,e.toString());i!==r&&mr.default.writeFileSync(s,i,"utf8")}catch(r){console.error(`Error processing file: ${r.message}`)}}process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Ue=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;Qo(this.browser,this.port);let s=await Yo(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,i)=>{let o=(r.modifiedFiles||new Set).values().next().value;if(!o){i();return}let c=qe.default.relative(qe.default.dirname(this.manifestPath),o),p=qe.default.relative(process.cwd(),qe.default.dirname(o));process.env.EXTENSION_ENV==="development"&&console.info(`\u25BA\u25BA Updated file \`${c}\` (relative to ${p})`),this.manifestPath&&Ho(s,this.manifestPath,o),i()})}};var dr=a(require("path"));function ea(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[dr.default.dirname(s)],exclude:/node_modules/,use:[{loader:dr.default.resolve(__dirname,"./inject-chromium-client-loader"),options:{manifestPath:s,browser:e}}]})}var gr=a(require("path"));function ta(t,e,s){t.options.module.rules.push({test:/\.(js|mjs|jsx|mjsx|ts|mts|tsx|mtsx)$/,include:[gr.default.dirname(s)],exclude:/node_modules/,use:[{loader:gr.default.resolve(__dirname,"./inject-firefox-client-loader"),options:{manifestPath:s,browser:e}}]})}var ms=require("webpack");var hr=a(require("content-security-policy-parser"));function sa(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,hr.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 ra(t){let e=t.content_security_policy;if(!e)return{extension_pages:"script-src 'self'; object-src 'self'; "};let s=(0,hr.default)(e.extension_pages||""),r="";for(let i in s)r+=`${i} ${s.get(i)?.join(" ")}; `;return{extension_pages:r.trim()}}function ia(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 i of e)r.has(i)||r.add(i);return Array.from(r)}function na(t){let e=["/*.json","/*.js","/*.css"];return[...t.web_accessible_resources||[],{resources:e,matches:["<all_urls>"]}]}function yr(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 br(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 us=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}generateManifestPatches(e){let s=G(e,this.manifestPath),r={...s,content_security_policy:s.manifest_version===3?ra(s):sa(s),...s.manifest_version===3?s.permissions?{permissions:[...new Set(["scripting",...s.permissions])]}:{permissions:["scripting"]}:{},...yr(s,this.browser),...br(s),web_accessible_resources:s.manifest_version===3?na(s):ia(s)},i=JSON.stringify(r,null,2),n=new ms.sources.RawSource(i);e.getAsset("manifest.json")&&e.updateAsset("manifest.json",n)}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:ms.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE},r=>{if(!this.manifestPath){let i="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: ${i}`));return}this.generateManifestPatches(s)})})}};var wr=a(require("fs")),we=a(require("path")),oa=a(require("webpack-target-webextension"));var ds=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}handleBackground(e,s,r){let i=we.default.resolve(__dirname,s==="firefox"?"minimum-firefox-file.mjs":"minimum-chromium-file.mjs"),n=we.default.dirname(this.manifestPath),o=r.background;if(s==="firefox"){o=r["gecko:background"]||r["firefox:background"]||o;let c=o?.scripts||o?.["gecko:scripts"]||o?.["firefox:scripts"];if(c&&c.length>0){let p=we.default.join(n,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",i)}else if(o=r["chromium:background"]||r["chrome:background"]||r["edge:background"]||o,r.manifest_version===3){let c=o?.service_worker||o?.["chromium:service_worker"]||o?.["chrome:service_worker"]||o?.["edge:service_worker"];if(c){let p=we.default.join(n,c);this.ensureFileExists(p,"background.service_worker")}else this.addDefaultEntry(e,"background/service_worker",i)}else if(r.manifest_version===2){let c=o?.scripts||o?.["chromium:scripts"]||o?.["chrome:scripts"]||o?.["edge:scripts"];if(c&&c.length>0){let p=we.default.join(n,c[0]);this.ensureFileExists(p,"background.scripts")}else this.addDefaultEntry(e,"background/script",i)}}ensureFileExists(e,s){if(!wr.default.existsSync(e)&&this.manifestPath){let i=require(this.manifestPath).name||"Extension.js",n=pi(i,s,e);throw console.error(n),new Error(n)}}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||!wr.default.lstatSync(this.manifestPath).isFile())return;let s=require(this.manifestPath);this.handleBackground(e,this.browser,s),new oa.default({background:this.getEntryName(s),weakRuntimeCheck:!0}).apply(e)}};var xr=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){Se.includes(this.browser)&&ea(e,this.browser,this.manifestPath),this.browser==="firefox"&&ta(e,this.browser,this.manifestPath),new us({manifestPath:this.manifestPath,browser:this.browser}).apply(e),new ds({manifestPath:this.manifestPath,browser:this.browser}).apply(e)}},aa=xr;var gs=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 Ue({manifestPath:this.manifestPath,browser:this.browser,port:this.port,stats:this.stats}).apply(e),e.options.mode==="development"&&new aa({manifestPath:this.manifestPath,browser:this.browser,autoReload:this.autoReload,stats:this.stats}).apply(e)}};var ca=a(require("webpack")),hs=class{manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser}apply(e){new ca.default.ProvidePlugin({browser:require.resolve("webextension-polyfill")}).apply(e)}};var bs=require("webpack");var ys=class{browser;manifestPath;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}patchManifest(e){let s=rt(e,this.browser);return JSON.stringify(s,null,2)}apply(e){e.hooks.compilation.tap("compatibility:browser-fields",s=>{s.hooks.processAssets.tap({name:"compatibility:browser-fields",stage:bs.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE},()=>{let r=G(s,this.manifestPath),i=this.patchManifest(r),n=new bs.sources.RawSource(i);s.updateAsset("manifest.json",n)})})}};var ws=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 hs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new ys({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e)}};var wa=a(require("fs"));var pa=a(require("webpack")),la=a(require("content-security-policy-parser"));function fa(t){let e=t.content_security_policy,s=t.content_security_policy?.extension_pages,r=i=>{if(!i)return;let n=(0,la.default)(i);if(n.get("script-src")&&n.get("script-src")?.includes("'unsafe-eval'")){let o=t.name||"Extension.js";return Vr(o)}};if(t.manifest_version===3){let i=e?r(s):void 0;if(i)return new pa.default.WebpackError(i)}return null}var vr=a(require("webpack"));function ua(t,e){let s=t.web_accessible_resources;if(s){let r=s.some(o=>typeof o=="string"),i=s.some(o=>typeof o=="object"||o.resources||o.matches),n=t.name||"Extension.js";if(t.manifest_version===2&&!r)return new vr.default.WebpackError(Xr(n,e));if(t.manifest_version===3&&!i)return new vr.default.WebpackError(Zr(n,e))}return null}var ma=a(require("webpack"));function da(t,e){if(e==="firefox"&&t.background?.service_worker){let s=t.name||"Extension.js";return new ma.default.WebpackError(Hr(s))}return null}var ga=a(require("path")),ha=a(require("fs")),ya=a(require("webpack"));function ba(t,e){let s=ga.default.join(e.options.context||"","_locales"),r=t.name||"Extension.js";return ha.default.existsSync(s)&&!t.default_locale?new ya.default.WebpackError(Gr(r)):null}var xs=class{options;constructor(e){this.options=e}handleRuntimeErrors(e,s,r){let i=fa(s),n=ua(s,r),o=da(s,r),c=ba(s,e);i&&e.errors.push(i),n&&e.errors.push(n),o&&e.options.mode==="production"&&e.errors.push(o),c&&e.errors.push(c)}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let i=this.options.manifestPath,n=JSON.parse(wa.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleRuntimeErrors(s,n,o),r()})}};var Da=a(require("fs")),Fa=a(require("ajv"));var xa={$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 va(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 _a=a(require("path")),Sa=require("webpack");function Pa(t,e,s){let r=t.options.context||"",i=_a.default.join(r,"manifest.json"),o=require(i).name||"Extension.js",c=e?.params.missingProperty;t.errors.push(new Sa.WebpackError(Qr(o,s,c)))}var ka=a(require("path")),Ea=require("webpack");function ja(t,e,s){let r=t.options.context||"",i=ka.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new Ea.WebpackError(Kr(o,e,s)))}var $a=a(require("path")),Ca=require("webpack");function _r(t,e,s){let r=t.options.context||"",i=$a.default.join(r,"manifest.json"),o=require(i).name||"Extension.js";t.warnings.push(new Ca.WebpackError(Yr(o,s,e)))}var vs=class{options;constructor(e){this.options=e}handleSchemaErrors(e,s,r){let i=new Fa.default;va(i);let n={allOf:[xa]},o=i.compile(n),c=o(s),p=s.manifest_version===3;if(!c&&o.errors){let l=o.errors[0];if(l?.keyword==="required"){Pa(e,l,r);return}p&&(l?.keyword==="type"&&ja(e,l,r),l?.keyword==="not"&&_r(e,l,r))}}apply(e){e.hooks.afterCompile.tapAsync("CompatPlugin (module)",(s,r)=>{let i=this.options.manifestPath,n=JSON.parse(Da.default.readFileSync(i,"utf-8")),o=this.options.browser||"chrome";this.handleSchemaErrors(s,n,o),r()})}};var Oa=a(require("fs")),Pr=a(require("path"));var Sr=a(require("webpack"));function La(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 Sr.default.WebpackError(ei(t,r))}return null}function Ia(t,e){let s=require(t);return e.message.includes("Top-level-await is only supported in EcmaScript Modules")?new Sr.default.WebpackError(ti(s.name)):null}var _s=class{manifestPath;constructor(e){this.manifestPath=e.manifestPath}apply(e){let s=Pr.default.join(Pr.default.dirname(this.manifestPath),"package.json");if(!Oa.default.existsSync(s))return;let r=require(s).name;e.hooks.compilation.tap("develop:common-errors",i=>{i.hooks.afterSeal.tapAsync("develop:common-errors",n=>{i.errors.forEach((o,c)=>{let p=La(r,o),l=Ia(r,o);p&&(i.errors[c]=p),l&&(i.errors[c]=l)}),n()})})}};var Ss=class{static name="plugin-errors";manifestPath;browser;constructor(e){this.manifestPath=e.manifestPath,this.browser=e.browser||"chrome"}apply(e){new xs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new vs({manifestPath:this.manifestPath,browser:this.browser||"chrome"}).apply(e),new _s({manifestPath:this.manifestPath}).apply(e)}};var xc=a(require("os")),Er=a(require("path"));var rc=a(require("fs")),ic=require("child_process");var ie=a(require("path")),$s=a(require("fs"));var Aa={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}},Ma={...Aa},Ta={...Aa};var x=require("@colors/colors/safe");function j(t,e){let s=e==="warn"?(0,x.brightYellow)("\u25BA\u25BA\u25BA"):e==="info"?(0,x.cyan)("\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 We(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ps(t,e){let s=t==="firefox"?"Add-on":"Extension";return`${j(t,"success")} ${We(t)} ${s} running in ${(0,x.cyan)(e||"unknown")} mode.`}function ks(t,e){let s=We(t),r=e=="null"?`${s} browser is not installed.
129
128
 
130
129
  `:`Path to ${s} browser is not found.
131
130
 
132
131
  ${(0,x.red)("NOT FOUND")} ${(0,x.underline)(e)}
133
132
 
134
- `;return`${k(t,"error")} ${r}Either install the ${s} or choose a different browser via ${(0,x.brightYellow)("--browser")} flag.`}function _s(t){let e=We(t);return`${k(t,"info")} \u{1F464} Creating ${e} profile directory...`}function Ma(t){return`${k(t,"success")} Instance already running.`}function Oa(t){return`${k(t,"success")} Instance exited.`}function Ta(t){return`${k(t,"error")} No Service Worker Support
133
+ `;return`${j(t,"error")} ${r}Either install the ${s} or choose a different browser via ${(0,x.brightYellow)("--browser")} flag.`}function Es(t){let e=We(t);return`${j(t,"info")} Creating new ${e} user profile...`}function Ra(t){return`${j(t,"success")} Instance already running.`}function Na(t){return`${j(t,"info")} Instance exited.`}function qa(t){return`${j(t,"error")} No Service Worker Support
135
134
 
136
135
  Firefox does not support the ${(0,x.brightYellow)("background.service_worker")} field yet.
137
136
  Update your manifest.json file to use ${(0,x.brightYellow)("background.scripts")} instead.
138
137
 
139
- Read more: ${(0,x.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Ra(t,e){return`${k(t,"error")} Error launching ${We(t)}. Error:
138
+ Read more: ${(0,x.underline)("https://bugzilla.mozilla.org/show_bug.cgi?id=1573659")}.`}function Ua(t,e){return`${j(t,"error")} Error launching ${We(t)}. Error:
140
139
 
141
- ${(0,x.red)(e)}`}function Na(t,e){return`${k(t,"error")} ${(0,x.red)(e.stack)}`}function qa(t){return`${k(t,"error")} Unable to connect to ${We(t)}. Too many retries.`}function Ua(t,e){return`${k(t,"error")} Error while installing temporary addon: ${(0,x.red)(e)}`}function Wa(t,e){return`${k(t,"error")} The path is not a directory.
140
+ ${(0,x.red)(e)}`}function Wa(t,e){return`${j(t,"error")} ${(0,x.red)(e.stack)}`}function Ba(t){return`${j(t,"error")} Unable to connect to ${We(t)}. Too many retries.`}function Ja(t,e){return`${j(t,"error")} Error while installing temporary addon: ${(0,x.red)(e)}`}function za(t,e){return`${j(t,"error")} The path is not a directory.
142
141
 
143
142
  ${(0,x.gray)("PATH")} ${(0,x.underline)(e)}
144
143
 
145
- Please provide a valid directory path.`}function Ba(t){return`${k(t,"error")} Error parsing message length.`}function Ja(t){return`${k(t,"error")} MessagingClient connection closed.`}function za(t,e){return`${k(t,"error")} Unexpected MessagingClient request without target actor: ${(0,x.brightYellow)(e)}`}function Ha(t){return`${k(t,"error")} MessagingClient connection closed.`}function Va(t,e){return`${k(t,"error")} Target actor ${(0,x.brightYellow)(e)} already has an active request.`}function Ga(t,e){return`${k(t,"error")} Error parsing packet: ${(0,x.red)(e)}`}function Xa(t,e){return`${k(t,"error")} Message received without a sender actor: ${(0,x.brightYellow)(JSON.stringify(e))}`}function Za(t,e){return`${k(t,"error")} Received unexpected message: ${(0,x.red)(e)}`}var Ya=a(require("progress"));function Ss(t,e){let r=new Ya.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 Ka(t,e,s){if(Ps.default.existsSync(re.default.resolve(__dirname,`run-${t}-profile`)))return e||re.default.resolve(__dirname,`run-${t}-profile`);let n=JSON.stringify(t==="chrome"?Ia:Aa);return s||Ss(_s(t),()=>{let i=re.default.resolve(__dirname,`run-${t}-profile`),o=re.default.join(i,"Default");Ps.default.mkdirSync(o,{recursive:!0});let c=re.default.join(o,"Preferences");Ps.default.writeFileSync(c,n,"utf8")}),re.default.resolve(__dirname,`run-${t}-profile`)}function Qa(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],s=Ka(t.browser,t.profile,!1);return[`--load-extension=${e.join()}`,`--user-data-dir=${s}`,"--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 xe=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||e.userDataDir,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}ec.default.existsSync(s)||(console.error(vs(e,s)),process.exit());let r=Qa(this),n=this.startingUrl?[this.startingUrl,...r]:[...r],i=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,tc.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),console.log(xs(this.browser,r.compilation.options.mode)),s=!0,n()})}};var gc=a(require("fs")),hc=require("child_process");var Be=a(require("fs")),ks=a(require("path")),sc=a(require("os")),rc=a(require("which")),nc=process.platform==="darwin",Zp=process.platform==="win32",Yp=!nc&&!Zp;function Kp(){if(Yp)try{return rc.default.sync("firefox")}catch{return null}else if(nc){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=ks.default.join(sc.default.homedir(),t.slice(1));return Be.default.existsSync(t)?t:Be.default.existsSync(e)?e:null}else{let t=ks.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=ks.default.join(r,t);if(Be.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(Be.default.existsSync(r))return r;return null}}var Es=Kp();var oc=a(require("path")),js=a(require("fs")),Pr=a(require("firefox-profile"));var Qp={"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 ic(t){return{...Qp,...t}}function ac(t,e){let s=ic(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 el(t,e){let s=new Pr.default({destinationDirectory:t});return ac(s,e)}function tl(t,e,s){let r;if(js.default.statSync(e).isDirectory())r=e;else throw new Error(Wa(t,e));let i=new Pr.default({destinationDirectory:r});return ac(i,s)}function cc(t,e,s,r){let n,i=e||oc.default.resolve(__dirname,"run-firefox-data-dir");return js.default.existsSync(i)?n=tl(t,i,s||{}):(r||Ss(_s(t),()=>{}),js.default.mkdirSync(i,{recursive:!0}),n=el(i,s||{})),n}async function pc(t,e){let{browser:s,startingUrl:r,preferences:n,userDataDir:i,browserConsole:o=!1,browserFlags:c=[]}=e,p=cc(s,i,n),l=[];r&&l.push(`--url "${r}"`),o&&l.push("--jsconsole"),c&&l.push(...c);let u=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args "${c.join(" ")}"`,`--profile "${p.path()}"`,`--listen ${u}`,"--verbose"].join(" ")}var dc=a(require("path"));var lc=a(require("net")),fc=a(require("events"));function sl(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(Ba(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 c=JSON.parse(i.toString());return{remainingData:o,parsedMessage:c}}catch(c){return{remainingData:o,error:c,fatal:!1}}}var $s=class extends fc.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=lc.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(Ja("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(za("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(Ha("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(Va("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}=sl("firefox",this.incomingData);return this.incomingData=e,r?(this.emit("error",new Error(Ga("firefox",r))),n&&this.disconnect(),!n):s?(this.handleMessage(s),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(Xa("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(Za("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function uc(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function mc(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var rl=150,nl=1e3,Cs=class{options;constructor(e){this.options=e}async connectClient(e){let s;for(let r of Array.from({length:rl}))try{let n=new $s;return await n.connect(e),n}catch(n){if(mc("ECONNREFUSED",n))await new Promise(i=>setTimeout(i,nl)),s=n;else throw console.error(Na(this.options.browser,n.stack)),n}throw console.error(qa(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[c,p]of r.entries()){let l=dc.default.join(p.replace(/"/g,"")),u=c===0&&s;try{let d=await o.request({to:"root",type:"getRoot"});await o.request({to:d.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:u})}catch(d){let g=uc(d);throw new Error(Ua(this.options.browser,g))}}}};process.on("SIGINT",()=>{process.exit()});process.on("SIGTERM",()=>{process.exit()});var Ds=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 "${Es}" --foreground --no-remote`;gc.default.existsSync(Es)||(console.error(vs(this.browser,Es)),process.exit());let r=await pc(e,this),n=`${s} ${r}`,i=(0,hc.exec)(n,(c,p,l)=>{if(c!=null)throw c;l.includes("Unable to move the cache")?console.log(Ma(this.browser)):(console.log(Oa(this.browser)),process.exit())});process.env.EXTENSION_ENV==="development"&&(i.stdout?.pipe(process.stdout),i.stderr?.pipe(process.stderr));let o=new Cs(this);try{await o.installAddons(e)}catch(c){c?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(Ta(this.browser)),process.exit(1)),console.error(Ra(this.browser,c)),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),console.log(xs(this.browser,r.compilation.options.mode)),s=!0,n()})}};var Ls=class{static name="plugin-browsers";extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;constructor(e){this.extension=[...e.extension,...e.browserFlags?.filter(s=>!s.startsWith("--load-extension="))||[]],this.browser=e.browser,this.browserFlags=e.browserFlags?.filter(s=>!s.startsWith("--load-extension="))||[],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"?kr.default.join(yc.default.tmpdir(),"extension-js",s,"profile"):kr.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 xe({...s,browser:"chrome"}).apply(e);break}case"edge":new xe({...s,browser:"edge"}).apply(e);break;case"firefox":new Ds({...s,browser:"firefox"}).apply(e);break;default:{new xe({...s,browser:this.browser}).apply(e);break}}}};function B(t,e){let s=ve.default.join(t,"manifest.json"),r=ve.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}},resolve:{modules:["node_modules",ve.default.join(t,"node_modules")],extensions:[".js",".mjs",".jsx",".ts",".mts",".tsx",".json",".wasm",".less",".css",".sass",".scss"]},watchOptions:{ignored:/node_modules|dist/},module:{rules:[]},plugins:[new Ke({manifestPath:s}),new at({manifestPath:s,mode:e.mode}),new ot({manifestPath:s,mode:e.mode}),new ut({manifestPath:s,mode:e.mode}),process.env.EXTENSION_ENV==="development"&&new ws({manifestPath:s,browser:e.browser}),new gs({manifestPath:s,browser:e.browser,polyfill:e.polyfill}),new os({manifestPath:s,browser:e.browser,mode:e.mode}),new fs({manifestPath:s,browser:e.browser,stats:!0,port:e.port||8e3}),!e.noOpen&&new Ls({extension:[r,e.browser==="firefox"?ve.default.join(__dirname,"extensions","manager-extension-firefox"):ve.default.join(__dirname,"extensions","manager-extension")],browser:e.browser,startingUrl:e.startingUrl,profile:e.profile||e.userDataDir,preferences:e.preferences,browserFlags:e.browserFlags})].filter(Boolean),stats:{all:!1,errors:!0,warnings:!0},infrastructureLogging:{level:"none"},performance:{hints:!1,maxAssetSize:999e3,maxEntrypointSize:999e3},optimization:{minimize:e.mode==="production"},experiments:{asyncWebAssembly:!0}}}var ie=a(require("path")),Jc=a(require("go-git-it"));var Je=a(require("path")),Fs=a(require("fs")),m=require("@colors/colors/safe");function E(t){return`${t==="warn"?(0,m.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,m.magenta)("\u25BA\u25BA\u25BA"):t==="error"?(0,m.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,m.brightGreen)("\u25BA\u25BA\u25BA")}`}function K(){return`${E("error")} Manifest file not found. Ensure the path to your extension exists and try again.`}function Is(t){let e=t==="firefox"?"Add-on":"Extension";return`${E("info")} Building ${ne(t)} ${e} package...`}function As(t,e){let s=Je.default.join(t,"dist",e.browser||"chrome"),r=Je.default.join(s,"manifest.json"),n=require(r),{name:i,version:o,hostPermissions:c,permissions:p}=n,l=bc(t,n).defaultLocale,u=bc(t,n).otherLocales.join(", "),d=`${l} ${u&&", "+u}`,g=c&&c.length,y=p&&p.length,j=Ms().version;return`
146
- \u{1F9E9} ${(0,m.brightGreen)("Extension.js")} ${(0,m.gray)(`${j}`)}
147
- Extension Name ${(0,m.gray)(i)}
144
+ Please provide a valid directory path.`}function Ha(t){return`${j(t,"error")} Error parsing message length.`}function Va(t){return`${j(t,"error")} MessagingClient connection closed.`}function Ga(t,e){return`${j(t,"error")} Unexpected MessagingClient request without target actor: ${(0,x.brightYellow)(e)}`}function Xa(t){return`${j(t,"error")} MessagingClient connection closed.`}function Za(t,e){return`${j(t,"error")} Target actor ${(0,x.brightYellow)(e)} already has an active request.`}function Ya(t,e){return`${j(t,"error")} Error parsing packet: ${(0,x.red)(e)}`}function Ka(t,e){return`${j(t,"error")} Message received without a sender actor: ${(0,x.brightYellow)(JSON.stringify(e))}`}function Qa(t,e){return`${j(t,"error")} Received unexpected message: ${(0,x.red)(e)}`}var ec=a(require("progress"));function js(t,e){let r=new ec.default(`${t} [:bar] :percent :etas`,{complete:"=",incomplete:" ",width:50,total:131072}),i=setInterval(()=>{let n=Math.random()*10*1024;r.tick(n),r.complete&&(clearInterval(i),e())},50)}function tc(t,e,s){if($s.default.existsSync(ie.default.resolve(__dirname,`run-${t}-profile`)))return e||ie.default.resolve(__dirname,`run-${t}-profile`);let i=JSON.stringify(t==="chrome"?Ma:Ta);return s||js(Es(t),()=>{let n=ie.default.resolve(__dirname,`run-${t}-profile`),o=ie.default.join(n,"Default");$s.default.mkdirSync(o,{recursive:!0});let c=ie.default.join(o,"Preferences");$s.default.writeFileSync(c,i,"utf8")}),ie.default.resolve(__dirname,`run-${t}-profile`)}function sc(t){let e=Array.isArray(t.extension)?t.extension:[t.extension],s=tc(t.browser,t.profile,!1);return[`--load-extension=${e.join()}`,`--user-data-dir=${s}`,"--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 ve=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||e.userDataDir,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}rc.default.existsSync(s)||(console.error(ks(e,s)),process.exit());let r=sc(this),i=this.startingUrl?[this.startingUrl,...r]:[...r],n=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,ic.spawn)(s,i,{stdio:n});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,i)=>{if(r.compilation.errors.length>0){i();return}if(s){i();return}this.launchChromium(this.browser),setTimeout(()=>{console.log(Ps(this.browser,r.compilation.options.mode))},2e3),s=!0,i()})}};var bc=a(require("fs")),wc=require("child_process");var Be=a(require("fs")),Cs=a(require("path")),nc=a(require("os")),oc=a(require("which")),ac=process.platform==="darwin",al=process.platform==="win32",cl=!ac&&!al;function pl(){if(cl)try{return oc.default.sync("firefox")}catch{return null}else if(ac){let t="/Applications/Firefox.app/Contents/MacOS/firefox",e=Cs.default.join(nc.default.homedir(),t.slice(1));return Be.default.existsSync(t)?t:Be.default.existsSync(e)?e:null}else{let t=Cs.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 i=Cs.default.join(r,t);if(Be.default.existsSync(i))return i}let s=["C:\\Program Files\\Mozilla Firefox\\firefox.exe","C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"];for(let r of s)if(Be.default.existsSync(r))return r;return null}}var Ds=pl();var pc=a(require("path")),Fs=a(require("fs")),kr=a(require("firefox-profile"));var ll={"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 cc(t){return{...ll,...t}}function lc(t,e){let s=cc(e);Object.keys(s).forEach(n=>{t.setPreference(n,s[n])});let i=Object.keys(e);return i.length>0&&i.forEach(n=>{t.setPreference(n,e[n])}),t.updatePreferences(),t}function fl(t,e){let s=new kr.default({destinationDirectory:t});return lc(s,e)}function ul(t,e,s){let r;if(Fs.default.statSync(e).isDirectory())r=e;else throw new Error(za(t,e));let n=new kr.default({destinationDirectory:r});return lc(n,s)}function fc(t,e,s,r){let i,n=e||pc.default.resolve(__dirname,"run-firefox-data-dir");return Fs.default.existsSync(n)?i=ul(t,n,s||{}):(r||js(Es(t),()=>{}),Fs.default.mkdirSync(n,{recursive:!0}),i=fl(n,s||{})),i}async function uc(t,e){let{browser:s,startingUrl:r,preferences:i,userDataDir:n,browserConsole:o=!1,browserFlags:c=[]}=e,p=fc(s,n,i),l=[];r&&l.push(`--url "${r}"`),o&&l.push("--jsconsole"),c&&l.push(...c);let u=t.options.devServer?.port?t.options.devServer?.port+100:9222;return[`--binary-args "${c.join(" ")}"`,`--profile "${p.path()}"`,`--listen ${u}`,"--verbose"].join(" ")}var yc=a(require("path"));var mc=a(require("net")),dc=a(require("events"));function ml(t,e){let s=e.toString(),r=s.indexOf(":");if(r<1)return{remainingData:e};let i=parseInt(s.substring(0,r),10);if(isNaN(i))return{remainingData:e,error:new Error(Ha(t)),fatal:!0};if(e.length-(r+1)<i)return{remainingData:e};let n=e.slice(r+1,r+1+i),o=e.slice(r+1+i);try{let c=JSON.parse(n.toString());return{remainingData:o,parsedMessage:c}}catch(c){return{remainingData:o,error:c,fatal:!1}}}var Ls=class extends dc.default{incomingData=Buffer.alloc(0);pendingRequests=[];activeRequests=new Map;connection;async connect(e){await new Promise((s,r)=>{try{let i={port:e,host:"127.0.0.1"},n=mc.default.createConnection(i,()=>{s()});this.connection=n,n.on("data",this.onData.bind(this)),n.on("error",r),n.on("end",this.onEnd.bind(this)),n.on("timeout",this.onTimeout.bind(this)),this.expectReply("root",{resolve:s,reject:r})}catch(i){r(i)}})}disconnect(){this.connection&&(this.connection.removeAllListeners(),this.connection.end(),this.rejectAllRequests(new Error(Va("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(Ga("firefox",s.type));return await new Promise((r,i)=>{let n={resolve:r,reject:i};this.pendingRequests.push({request:s,deferred:n}),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(Xa("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:i}=ml("firefox",this.incomingData);return this.incomingData=e,r?(this.emit("error",new Error(Ya("firefox",r))),i&&this.disconnect(),!i):s?(this.handleMessage(s),!0):!1}handleMessage(e){if(!e.from){this.emit("error",new Error(Ka("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(Qa("firefox",JSON.stringify(e))))}onError(e){this.emit("error",e)}onEnd(){this.emit("end")}onTimeout(){this.emit("timeout")}};function gc(t){return t instanceof Error?String(t):`${t.error}: ${t.message}`}function hc(t,e){return Array.isArray(t)&&t.includes(e.code)?!0:e.code===t}var dl=150,gl=1e3,Is=class{options;constructor(e){this.options=e}async connectClient(e){let s;for(let r of Array.from({length:dl}))try{let i=new Ls;return await i.connect(e),i}catch(i){if(hc("ECONNREFUSED",i))await new Promise(n=>setTimeout(n,gl)),s=i;else throw console.error(Wa(this.options.browser,i.stack)),i}throw console.error(Ba(this.options.browser)),s}async installAddons(e){let{devtools:s}=this.options,r=Array.isArray(this.options.extension)?this.options.extension:[this.options.extension],i=e.options.devServer?.port,n=i?i+100:9222,o=await this.connectClient(n);for(let[c,p]of r.entries()){let l=yc.default.join(p.replace(/"/g,"")),u=c===0&&s;try{let d=await o.request({to:"root",type:"getRoot"});await o.request({to:d.addonsActor,type:"installTemporaryAddon",addonPath:l,openDevTools:u})}catch(d){let g=gc(d);throw new Error(Ja(this.options.browser,g))}}}};var ne=null;process.on("SIGINT",()=>{ne&&ne.kill("SIGINT"),process.exit()});process.on("SIGTERM",()=>{ne&&ne.kill("SIGTERM"),process.exit()});var Os=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 "${Ds}" --foreground --no-remote`;bc.default.existsSync(Ds)||(console.error(ks(this.browser,Ds)),process.exit());let r=await uc(e,this),i=`${s} ${r}`;ne=(0,wc.exec)(i,(o,c,p)=>{if(o!=null)throw o;p.includes("Unable to move the cache")?console.log(Ra(this.browser)):(console.log(Na(this.browser)),process.exit())}),process.env.EXTENSION_ENV==="development"&&(ne.stdout?.pipe(process.stdout),ne.stderr?.pipe(process.stderr));let n=new Is(this);try{await n.installAddons(e)}catch(o){o?.toString()?.includes("background.service_worker is currently disabled")&&(console.error(qa(this.browser)),process.exit(1)),console.error(Ua(this.browser,o)),process.exit(1)}}apply(e){let s=!1;e.hooks.done.tapAsync("run-firefox:module",async(r,i)=>{if(r.compilation.errors.length>0){i();return}if(s){i();return}setTimeout(()=>{console.log(Ps(this.browser,r.compilation.options.mode))},2e3),await this.launchFirefox(e),s=!0,i()})}};var As=class{static name="plugin-browsers";extension;browser;browserFlags;userDataDir;profile;preferences;startingUrl;constructor(e){this.extension=[...e.extension,...e.browserFlags?.filter(s=>!s.startsWith("--load-extension="))||[]],this.browser=e.browser,this.browserFlags=e.browserFlags?.filter(s=>!s.startsWith("--load-extension="))||[],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"?Er.default.join(xc.default.tmpdir(),"extension-js",s,"profile"):Er.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 ve({...s,browser:"chrome"}).apply(e);break}case"edge":new ve({...s,browser:"edge"}).apply(e);break;case"firefox":new Os({...s,browser:"firefox"}).apply(e);break;default:{new ve({...s,browser:this.browser}).apply(e);break}}}};function J(t,e){let s=Je.default.join(t,"manifest.json"),r=Je.default.join(t,`dist/${e.browser}`),i=require(s);return{mode:e.mode||"development",entry:{},target:"web",context:t,devtool:i.manifest_version===3?"cheap-source-map":"eval-cheap-source-map",output:{clean:{keep(n){return!n.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}},resolve:{modules:["node_modules",Je.default.join(t,"node_modules")],extensions:[".js",".mjs",".jsx",".ts",".mts",".tsx",".json",".wasm",".less",".css",".sass",".scss"]},watchOptions:{ignored:/node_modules|dist/},module:{rules:[]},plugins:[new et({manifestPath:s}),new lt({manifestPath:s,mode:e.mode}),new pt({manifestPath:s,mode:e.mode}),new gt({manifestPath:s,mode:e.mode}),process.env.EXTENSION_ENV==="development"&&new Ss({manifestPath:s,browser:e.browser}),new ws({manifestPath:s,browser:e.browser,polyfill:e.polyfill}),new ps({manifestPath:s,browser:e.browser,mode:e.mode}),new gs({manifestPath:s,browser:e.browser,stats:!0,port:e.port||8e3}),!e.noOpen&&new As({extension:[r,Je.default.join(__dirname,"extensions",`${e.browser}-manager-extension`)],browser:e.browser,startingUrl:e.startingUrl,profile:e.profile||e.userDataDir,preferences:e.preferences,browserFlags:e.browserFlags})].filter(Boolean),stats:{all:!1,errors:!0,warnings:!0},infrastructureLogging:{level:"none"},performance:{hints:!1,maxAssetSize:999e3,maxEntrypointSize:999e3},optimization:{minimize:e.mode==="production"},experiments:{asyncWebAssembly:!0}}}var He=a(require("path")),Yc=a(require("go-git-it"));var ze=a(require("path")),Ms=a(require("fs")),m=require("@colors/colors/safe");function S(t){return`${t==="warn"?(0,m.brightYellow)("\u25BA\u25BA\u25BA"):t==="info"?(0,m.magenta)("\u25BA\u25BA\u25BA"):t==="error"?(0,m.red)("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E"):(0,m.brightGreen)("\u25BA\u25BA\u25BA")}`}function K(){return`${S("error")} Manifest file not found. Ensure the path to your extension exists and try again.`}function Ts(t){let e=t==="firefox"?"Add-on":"Extension";return`${S("info")} Building ${oe(t)} ${e} package...`}function Rs(t,e){let s=ze.default.join(t,"dist",e.browser||"chrome"),r=ze.default.join(s,"manifest.json"),i=require(r),{name:n,version:o,hostPermissions:c,permissions:p}=i,l=vc(t,i).defaultLocale,u=vc(t,i).otherLocales.join(", "),d=`${l} ${u&&", "+u}`,g=c&&c.length,y=p&&p.length,$=Us().version;return`
145
+ \u{1F9E9} ${(0,m.brightGreen)("Extension.js")} ${(0,m.gray)(`${$}`)}
146
+ Extension Name ${(0,m.gray)(n)}
148
147
  Extension Version ${(0,m.gray)(o)}
149
148
  Locales ${(0,m.gray)(d)}
150
149
  Host Permissions ${(0,m.gray)(g?c.join(", "):"Browser defaults")}
151
150
  Permissions ${(0,m.gray)(y?p.join(", "):"Browser defaults")}
152
- `}function wc(t,e){let s=t==="production"?m.magenta:m.magenta,r=e==="firefox"?"Add-on":"Extension";return`${E("success")} ${ne(e)} ${r} running in ${s(t||"unknown")} mode.`}function xc(t,e,s){let r=e?.toJson(),n=Je.default.join(t,"manifest.json"),i=JSON.parse(Fs.default.readFileSync(n,"utf8")),o=r?.assets,c=`${E("info")} Building ${(0,m.cyan)(i.name)} extension using ${ne(s)} defaults...
151
+ `}function _c(t,e){let s=t==="production"?m.magenta:m.magenta,r=e==="firefox"?"Add-on":"Extension";return`${S("success")} ${oe(e)} ${r} ready for ${s(t||"unknown")}.`}function Sc(t,e,s){let r=e?.toJson(),i=ze.default.join(t,"manifest.json"),n=JSON.parse(Ms.default.readFileSync(i,"utf8")),o=r?.assets,c=`${S("info")} Building ${(0,m.cyan)(n.name)} extension using ${oe(s)} defaults...
153
152
 
154
153
  `,p=`
155
- Build completed in ${((r?.time||0)/1e3).toFixed(2)} seconds.
156
- `,l=`Build Target: ${(0,m.gray)(ne(s))}
154
+ Build completed in ${((r?.time||0)/1e3).toFixed(2)} seconds.`,l=`Build Target: ${(0,m.gray)(oe(s))}
157
155
  `,u=`Build Status: ${e?.hasErrors()?(0,m.red)("Failed"):(0,m.brightGreen)("Success")}
158
156
  `,d=`
159
- Version: ${(0,m.gray)(i.version)}
160
- `,g=`Size: ${(0,m.gray)(il(o))}
161
- `,y="";return y+=c,y+=ol(o),y+=d,y+=g,y+=l,y+=u,y+=p,y}function vc(){return`${E("success")} No errors or warnings found. Your extension is ${(0,m.brightGreen)("ready for deployment")}.`}function _c(t,e){return`${E("success")} Fetching data...
157
+ Version: ${(0,m.gray)(n.version)}
158
+ `,g=`Size: ${(0,m.gray)(hl(o))}
159
+ `,y="";return y+=c,y+=yl(o),y+=d,y+=g,y+=l,y+=u,y+=p,y}function Pc(){return`${S("success")} No errors or warnings found. Your extension is ${(0,m.brightGreen)("ready for deployment")}.`}function kc(t,e){return`${S("info")} Fetching data...
162
160
 
163
- ${(0,m.gray)("URL")} ${(0,m.underline)(`https://github.com/${t}/${e}`)}`}function Sc(t){return`${E("success")} Downloading ${(0,m.cyan)(t)}...`}function Pc(t){return`
164
- ${E("success")} Creating a new browser extension...
161
+ ${(0,m.gray)("URL")} ${(0,m.underline)(`https://github.com/${t}/${e}`)}`}function Ec(t){return`${S("info")} Downloading ${(0,m.cyan)(t)}...`}function jc(t){return`
162
+ ${S("info")} Creating a new browser extension...
165
163
 
166
- ${(0,m.gray)("PATH")} ${(0,m.underline)(`${process.cwd()}/${t}`)}`}function kc(t){return`${E("success")} No ${(0,m.brightYellow)(".gitignore")} found, zipping all the content inside path:
164
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(`${process.cwd()}/${t}`)}`}function $c(t){return`${S("info")} No ${(0,m.brightYellow)(".gitignore")} found, zipping all the content inside path:
167
165
 
168
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Ec(t){return`${E("success")} Packaging source files. Files in ${(0,m.brightYellow)(".gitignore")} will be excluded...
166
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Cc(t){return`${S("info")} Packaging source files. Files in ${(0,m.brightYellow)(".gitignore")} will be excluded...
169
167
 
170
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}.`}function jc(t){return`${E("success")} Packaging extension distribution files...
168
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}.`}function Dc(t){return`${S("info")} Packaging extension distribution files...
171
169
 
172
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function $c(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${e}`)}, Target Browser: ${`${ne(t)}`}
170
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Fc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${e}`)}, Target Browser: ${`${oe(t)}`}
173
171
  ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${s}`)} (source)
174
- ${(0,m.gray)("\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: ${`${ne(s)}`}
175
- ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} (distribution)`}function Dc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}-source.${e}`)}, Target Browser: ${`${ne(s)}`}
176
- ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} (source)`}function Lc(t){return`${E("error")} Failed to compress extension package. ${t}`}function Fc(t){return`${E("info")} ${t.name} (v${t.version}) has no type definitions. Writing...`}function Ic(t){return`${E("error")} Failed to write the extension type definition. ${(0,m.red)(t)}`}function Ac(t){return`${E("success")} Downloading extension...
177
-
178
- ${(0,m.gray)("URL")} ${(0,m.underline)(t)}`}function Mc(t){return`${E("success")} Unpackaging browser extension...
179
-
180
- ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Oc(){return`${E("success")} Browser extension unpackaged successfully. Compiling...`}function Tc(t){return`${E("error")} Failed to download or extract ZIP file. ${(0,m.red)(t)}`}function ne(t){return t.charAt(0).toUpperCase()+t.slice(1)}function bc(t,e){let s=e.default_locale,r=Je.default.join(t,"_locales");if(!Fs.default.existsSync(r))return{defaultLocale:"Browser defaults",otherLocales:[]};let n=Fs.default.readdirSync(r).filter(i=>i!==s);return{defaultLocale:s,otherLocales:n}}function Rc(t){return`${(t/1024).toFixed(2)}KB`}function il(t){let e=0;return t?.forEach(s=>{e+=s.size}),Rc(e)}function Nc(t,e=""){let s="";return Object.keys(t).forEach((r,n,i)=>{let o=n===i.length-1,c=o?"\u2514\u2500":"\u251C\u2500",p=t[r].size?` (${Rc(t[r].size)})`:"";s+=`${(0,m.gray)(e)}${(0,m.gray)(c)} ${r}${(0,m.gray)(p)}
181
- `,typeof t[r]=="object"&&!t[r].size&&(s+=Nc(t[r],`${e}${o?" ":(0,m.gray)("\u2502 ")}`))}),s}function ol(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]})}),`.
182
- ${Nc(e)}`}function qc(t){return`${E("info")} is using ${(0,m.magenta)(t)}. ${(0,m.brightYellow)("This is very experimental")}.`}var Er=a(require("fs/promises")),jr=a(require("path")),Uc=a(require("axios")),Wc=a(require("adm-zip"));async function Bc(t,e){let s=t.split("?")[0];try{console.log(Ac(s));let r=await(0,Uc.default)({url:t,method:"GET",responseType:"arraybuffer"}),n=jr.default.basename(s),i=jr.default.join(e,`${n}.zip`);await Er.default.writeFile(i,r.data),console.log(Mc(i)),new Wc.default(i).extractAllTo(e,!0),await Er.default.unlink(i),console.log(Oc())}catch(r){throw console.error(Tc(r)),r}}var al=t=>{try{return new URL(t),!0}catch{return!1}};async function cl(t,e){return await(0,Jc.default)(t,process.cwd(),e),ie.default.resolve(process.cwd(),ie.default.basename(t))}async function pl(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(al(t)){let e=new URL(t);if(e.protocol.startsWith("http")){if(e.origin!=="https://github.com")return await pl(t);let s=e.pathname.split("/"),r=s.slice(1,3)[0],n=s.slice(1,3)[1];console.log(_c(r,n));let i=ie.default.basename(e.pathname),o=await cl(t,Sc(i));return console.log(Pc(i)),o}}return ie.default.resolve(process.cwd(),t)}var z=a(require("path")),zc=a(require("fs")),Hc=a(require("ignore")),Vc=a(require("tiny-glob")),$r=a(require("adm-zip")),Gc=a(require("slugify"));function ll(t){try{return zc.default.readFileSync(t,"utf8")}catch{return""}}function fl(t){return(0,Gc.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function ul(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function ml(t,e){let s=fl(e.zipFilename||t.name);return e.zipFilename?s:`${s}-${t.version}`}async function dl(t){let e=z.default.join(t,".gitignore"),s=ll(e),r=(0,Hc.default)();return s?r.add(s):console.log(kc(t)),(await(0,Vc.default)("**/*",{cwd:t,dot:!0})).filter(i=>!r.ignores(i))}async function Xc(t,{browser:e="chrome",...s}){try{let r=z.default.join(t,"dist"),n=z.default.join(r,e),i=s.zipSource?t:n,o=require(z.default.join(i,"manifest.json")),c=ml(o,s),p=ul(e),l=z.default.join(n,`${c}.${p}`),u=z.default.join(r,`${c}-source.${p}`);if(s.zipSource){console.log(""),console.log(Ec(e));let d=new $r.default;(await dl(t)).forEach(y=>{d.addLocalFile(z.default.join(t,y),z.default.dirname(y))}),d.writeZip(u)}if(s.zip){console.log(""),console.log(jc(l));let d=new $r.default;d.addLocalFolder(n),d.writeZip(l)}s.zip&&s.zipSource?(console.log(""),console.log($c(e,c,u,l))):s.zip?(console.log(""),console.log(Cc(c,p,e,l))):s.zipSource&&(console.log(""),console.log(Dc(c,p,e,u)))}catch(r){throw console.error(Lc(r)),r}}var Cr=a(require("fs")),Dr=a(require("path"));function ee(t){let e=Dr.default.join(t,"extension.config.js");if(Cr.default.existsSync(e)&&gl(t)){let s=require(e);if(s&&s!=null&&s&&typeof s.config=="function")return s.config}return s=>s}function gl(t){let e=Dr.default.join(t,"extension.config.js");return Cr.default.existsSync(e)?(console.log(qc("extension.config.js")),!0):!1}async function ep(t,e){let s=await Q(t);!t?.startsWith("http")&&!Zc.default.existsSync(Yc.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{let r=e?.browser||"chrome",n=B(s,{...e,browser:r,mode:"production"}),i=n.plugins?.filter(u=>u?.constructor.name!=="plugin-browsers"&&u?.constructor.name!=="plugin-reload"),c=ee(s)({...n,plugins:i}),p=(0,Qc.merge)(c),l=(0,Kc.default)(p);await new Promise((u,d)=>{l.run(async(g,y)=>{if(g)return console.error(g.stack||g),d(g);console.log(xc(s,y,r)),(e?.zip||e?.zipSource)&&await Xc(s,{...e,browser:r}),y?.hasErrors()?(console.log(y.toString({colors:!0})),process.exit(1)):(console.log(vc()),u())})})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var ip=a(require("fs")),op=a(require("path"));var Fr=a(require("path")),tp=a(require("webpack")),sp=a(require("webpack-dev-server")),rp=require("webpack-merge");function Lr(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function np(t,{...e}){let s=B(t,e),n=ee(t)(s),i=(0,rp.merge)(n),o=(0,tp.default)(i),c={host:"127.0.0.1",allowedHosts:"all",static:Fr.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:et(t)?void 0:{paths:[Fr.default.join(t,"**/*.html")],options:{usePolling:!0,interval:1e3}},client:{logging:process.env.EXTENSION_ENV==="development"?"error":"none",progress:!1,overlay:!1},headers:{"Access-Control-Allow-Origin":"*"},port:"auto",hot:"only"},p=new sp.default(c,o);p.startCallback(l=>{l!=null&&console.log(`Error in the Extension.js runner: ${l.stack||""}`)}),process.on("ERROR",()=>{Lr(p)}),process.on("SIGINT",()=>{Lr(p)}),process.on("SIGTERM",()=>{Lr(p)})}var ze=a(require("path")),Ir=a(require("fs/promises"));async function Ar(t){let e=ze.default.join(t,"extension-env.d.ts"),s=ze.default.join(__dirname,"types"),r=ze.default.relative(t,s),n=process.env.EXTENSION_ENV==="development"?r:"extension-develop/dist/types",i=`// Required Extension.js types for TypeScript projects.
172
+ ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} (distribution)`}function Lc(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}.${e}`)}, Target Browser: ${`${oe(s)}`}
173
+ ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} ${(0,m.gray)("(distribution)")}`}function Ic(t,e,s,r){return`\u{1F4E6} Package name: ${(0,m.brightYellow)(`${t}-source.${e}`)}, Target Browser: ${`${oe(s)}`}
174
+ ${(0,m.gray)("\u2514\u2500")} ${(0,m.underline)(`${r}`)} (source)`}function Oc(t){return`${S("error")} Failed to compress extension package. ${t}`}function Ac(t){return`${S("info")} ${t.name} (v${t.version}) has no type definitions. Writing...`}function Mc(t){return`${S("error")} Failed to write the extension type definition. ${(0,m.red)(t)}`}function Tc(t){return`${S("info")} Downloading extension...
175
+ ${(0,m.gray)("URL")} ${(0,m.underline)(t)}`}function Rc(t){return`${S("info")} Unpackaging browser extension...
176
+ ${(0,m.gray)("PATH")} ${(0,m.underline)(t)}`}function Nc(){return`${S("info")} Browser extension unpackaged ${(0,m.brightGreen)("successfully")}. Compiling...`}function qc(t){return`${S("error")} Failed to download or extract ZIP file. ${(0,m.red)(t)}`}function oe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function vc(t,e){let s=e.default_locale,r=ze.default.join(t,"_locales");if(!Ms.default.existsSync(r))return{defaultLocale:"Browser defaults",otherLocales:[]};let i=Ms.default.readdirSync(r).filter(n=>n!==s);return{defaultLocale:s,otherLocales:i}}function Uc(t){return`${(t/1024).toFixed(2)}KB`}function hl(t){let e=0;return t?.forEach(s=>{e+=s.size}),Uc(e)}function Wc(t,e=""){let s="";return Object.keys(t).forEach((r,i,n)=>{let o=i===n.length-1,c=o?"\u2514\u2500":"\u251C\u2500",p=t[r].size?` (${Uc(t[r].size)})`:"";s+=`${(0,m.gray)(e)}${(0,m.gray)(c)} ${r}${(0,m.gray)(p)}
177
+ `,typeof t[r]=="object"&&!t[r].size&&(s+=Wc(t[r],`${e}${o?" ":(0,m.gray)("\u2502 ")}`))}),s}function yl(t){let e={};return t?.forEach(s=>{let r=s.name.split("/"),i=e;r.forEach((n,o)=>{i[n]||(i[n]={}),o===r.length-1?i[n]={size:s.size}:i=i[n]})}),`.
178
+ ${Wc(e)}`}function Bc(t){return`${S("info")} is using ${(0,m.magenta)(t)}. ${(0,m.brightYellow)("This is very experimental")}.`}function Jc(t){return`${S("info")} Installing ${(0,m.cyan)(t)} dependencies...`}function zc(t,e,s){return`Command ${t} ${e.join(" ")} failed with exit code ${s}`}function Hc(t){return`${S("info")} Can't install project dependencies. ${t.message||t.toString()}`}var Ns=a(require("path")),Vc=a(require("axios")),Gc=a(require("adm-zip"));var jr=a(require("stream")),Xc=require("util"),bl=(0,Xc.promisify)(jr.default.pipeline);async function Zc(t,e){let s=t.split("?")[0];try{console.log(Tc(s));let r=await(0,Vc.default)({url:t,method:"GET",responseType:"stream"}),i=Ns.default.extname(s),n=Ns.default.basename(s,i),o=Ns.default.join(e,n);console.log(Rc(o));let c=[];await bl(r.data,new jr.default.Writable({write(u,d,g){c.push(u),g()}}));let p=Buffer.concat(c);return new Gc.default(p).extractAllTo(o,!0),console.log(Nc()),o}catch(r){throw console.error(qc(r)),r}}var wl=t=>{try{return new URL(t),!0}catch{return!1}};async function xl(t,e){return await(0,Yc.default)(t,process.cwd(),e),He.default.resolve(process.cwd(),He.default.basename(t))}async function vl(t){return await Zc(t,process.cwd())}async function Q(t){if(!t)return process.cwd();if(wl(t)){let e=new URL(t);if(e.protocol.startsWith("http")){if(e.origin!=="https://github.com")return await vl(t);let s=e.pathname.split("/"),r=s.slice(1,3)[0],i=s.slice(1,3)[1];console.log(kc(r,i));let n=He.default.basename(e.pathname),o=await xl(t,Ec(n));return console.log(jc(n)),o}}return He.default.resolve(process.cwd(),t)}var z=a(require("path")),Kc=a(require("fs")),Qc=a(require("ignore")),ep=a(require("tiny-glob")),$r=a(require("adm-zip")),tp=a(require("slugify"));function _l(t){try{return Kc.default.readFileSync(t,"utf8")}catch{return""}}function Sl(t){return(0,tp.default)(t,{replacement:"-",remove:/[^a-zA-Z0-9 ]/g,lower:!0})}function Pl(t){switch(t){case"opera":return"crx";case"firefox":return"xpi";default:return"zip"}}function kl(t,e){let s=Sl(e.zipFilename||t.name);return e.zipFilename?s:`${s}-${t.version}`}async function El(t){let e=z.default.join(t,".gitignore"),s=_l(e),r=(0,Qc.default)();return s?r.add(s):console.log($c(t)),(await(0,ep.default)("**/*",{cwd:t,dot:!0})).filter(n=>!r.ignores(n))}async function sp(t,{browser:e="chrome",...s}){try{let r=z.default.join(t,"dist"),i=z.default.join(r,e),n=s.zipSource?t:i,o=require(z.default.join(n,"manifest.json")),c=kl(o,s),p=Pl(e),l=z.default.join(i,`${c}.${p}`),u=z.default.join(r,`${c}-source.${p}`);if(s.zipSource){console.log(""),console.log(Cc(e));let d=new $r.default;(await El(t)).forEach(y=>{d.addLocalFile(z.default.join(t,y),z.default.dirname(y))}),d.writeZip(u)}if(s.zip){console.log(""),console.log(Dc(l));let d=new $r.default;d.addLocalFolder(i),d.writeZip(l)}s.zip&&s.zipSource?(console.log(""),console.log(Fc(e,c,u,l))):s.zip?(console.log(""),console.log(Lc(c,p,e,l))):s.zipSource&&(console.log(""),console.log(Ic(c,p,e,u)))}catch(r){throw console.error(Oc(r)),r}}var Cr=a(require("fs")),Dr=a(require("path"));function ee(t){let e=Dr.default.join(t,"extension.config.js");if(Cr.default.existsSync(e)&&jl(t)){let s=require(e);if(s&&s!=null&&s&&typeof s.config=="function")return s.config}return s=>s}function jl(t){let e=Dr.default.join(t,"extension.config.js");return Cr.default.existsSync(e)?(console.log(Bc("extension.config.js")),!0):!1}async function ap(t,e){let s=await Q(t);!t?.startsWith("http")&&!rp.default.existsSync(ip.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{let r=e?.browser||"chrome",i=J(s,{...e,browser:r,mode:"production"}),n=i.plugins?.filter(u=>u?.constructor.name!=="plugin-browsers"&&u?.constructor.name!=="plugin-reload"),c=ee(s)({...i,plugins:n}),p=(0,op.merge)(c),l=(0,np.default)(p);await new Promise((u,d)=>{l.run(async(g,y)=>{if(g)return console.error(g.stack||g),d(g);console.log(Sc(s,y,r)),(e?.zip||e?.zipSource)&&await sp(s,{...e,browser:r}),y?.hasErrors()?(console.log(y.toString({colors:!0})),process.exit(1)):(console.log(Pc()),u())})})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var Or=a(require("fs")),Ar=a(require("path"));var Lr=a(require("path")),cp=a(require("webpack")),pp=a(require("webpack-dev-server")),lp=require("webpack-merge");function Fr(t){t.stop().then(()=>{process.exit()}).catch(e=>{console.log(`Error in the Extension.js runner: ${e.stack||""}`)})}async function fp(t,{...e}){let s=J(t,{...e,mode:"development"}),i=ee(t)(s),n=(0,lp.merge)(i),o=(0,cp.default)(n),c={host:"127.0.0.1",allowedHosts:"all",static:Lr.default.join(t,"public"),compress:!1,devMiddleware:{writeToDisk:!0},watchFiles:st(t)?void 0:{paths:[Lr.default.join(t,"**/*.html")],options:{usePolling:!0,interval:1e3}},client:{logging:process.env.EXTENSION_ENV==="development"?"error":"none",progress:!1,overlay:!1},headers:{"Access-Control-Allow-Origin":"*"},port:"auto",hot:"only"},p=new pp.default(c,o);p.startCallback(l=>{l!=null&&console.log(`Error in the Extension.js runner: ${l.stack||""}`)}),process.on("ERROR",()=>{Fr(p)}),process.on("SIGINT",()=>{Fr(p)}),process.on("SIGTERM",()=>{Fr(p)})}var qs=a(require("path")),Ve=a(require("fs/promises"));async function up(t){let e=qs.default.join(t,"extension-env.d.ts"),s=process.env.EXTENSION_ENV==="development"?qs.default.resolve(process.cwd(),"programs/cli/types"):"extension/dist/types",r=`// Required Extension.js types for TypeScript projects.
183
179
  // This file is auto-generated and should not be excluded.
184
- // If you need extra types, consider creating a new *.d.ts and
180
+ // If you need additional types, consider creating a new *.d.ts file and
185
181
  // referencing it in the "include" array of your tsconfig.json file.
186
- // See https://www.typescriptlang.org/tsconfig#include for info.
187
- /// <reference types="${n}/index.d.ts" />
182
+ // See https://www.typescriptlang.org/tsconfig#include for more information.
183
+ /// <reference types="${s}/index.d.ts" />
188
184
 
189
185
  // Polyfill types for browser.* APIs.
190
- /// <reference types="${n}/polyfill.d.ts" />
191
- `;try{await Ir.default.access(e)}catch{let c=require(ze.default.join(t,"manifest.json"));console.log(Fc(c));try{await Ir.default.writeFile(e,i)}catch(p){console.log(Ic(p))}}}async function ap(t,e){let s=await Q(t);!t?.startsWith("http")&&!ip.default.existsSync(op.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{R(s)&&await Ar(s),await np(s,{...e,mode:"development",browser:e.browser||"chrome"})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var cp=a(require("fs")),pp=a(require("path")),lp=a(require("webpack")),fp=require("webpack-merge");async function up(t,e){let s=await Q(t);!t?.startsWith("http")&&!cp.default.existsSync(pp.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{let r=e.browser||"chrome",n=B(s,{...e,browser:r,mode:"production"}),i=n.plugins?.filter(u=>u?.constructor.name==="plugin-browsers");console.log(Is(r));let c=ee(s)({...n,plugins:i}),p=(0,fp.merge)(c);(0,lp.default)(p).run(async(u,d)=>{u&&(console.error(u.stack||u),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):console.log(As(s,{browser:r,mode:"production"}))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var mp=a(require("fs")),dp=a(require("path")),gp=a(require("webpack")),hp=require("webpack-merge");async function yp(t,e){let s=await Q(t);!t?.startsWith("http")&&!mp.default.existsSync(dp.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{let r=e.browser||"chrome",n=B(s,{...e,browser:r,mode:"production"}),i=n.plugins?.filter(u=>u?.constructor.name!=="plugin-reload");console.log(Is(r));let c=ee(s)({...n,plugins:i}),p=(0,hp.merge)(c);(0,gp.default)(p).run((u,d)=>{u&&(console.error(u.stack||u),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):(console.log(As(s,e)),setTimeout(()=>{console.log(wc("production",r))},1500))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});
186
+ /// <reference types="${s}/polyfill.d.ts" />
187
+ `;try{await Ve.default.access(e),(await Ve.default.readFile(e,"utf8")).includes("develop/dist/types")&&await Ve.default.writeFile(e,r)}catch{let n=require(qs.default.join(t,"manifest.json"));console.log(Ac(n));try{await Ve.default.writeFile(e,r)}catch(o){console.log(Mc(o))}}}var Ir=a(require("path")),mp=require("cross-spawn"),dp=a(require("fs")),gp=require("detect-package-manager");async function $l(){let t=process.env.npm_execpath||"",e=await(0,gp.detect)(),s=t.split(Ir.default.sep).pop()?.toLowerCase()||e,r="npm";switch(s.includes("pnpx")&&(r="pnpm"),s.includes("npx")&&(r="npm"),s){case"yarn":r="yarn";break;case"pnpm":r="pnpm";break;default:r="npm"}return r}function Cl(){return["install"]}async function hp(t){let e=Ir.default.join(t,"node_modules"),s=await $l(),r=Cl(),i=process.cwd();try{process.chdir(t),await dp.default.promises.mkdir(e,{recursive:!0});let n=process.env.EXTENSION_ENV==="development"?"inherit":"ignore",o=(0,mp.spawn)(s,r,{stdio:n});await new Promise((c,p)=>{o.on("close",l=>{l!==0?p(new Error(zc(s,r,l))):c()}),o.on("error",l=>{p(l)})})}catch(n){console.error(Hc(n)),process.exit(1)}finally{process.chdir(i)}}async function yp(t,e){let s=await Q(t),r=Ar.default.join(s,"manifest.json");!t?.startsWith("http")&&!Or.default.existsSync(r)&&(console.log(K()),process.exit(1));try{R(s)&&await up(s);let i=Ar.default.join(s,"node_modules");if(!Or.default.existsSync(i)){let n=require(r).name;console.log(Jc(n)),await hp(s)}setTimeout(async()=>{await fp(s,{...e,mode:"development",browser:e.browser||"chrome"})},50)}catch(i){process.env.EXTENSION_ENV==="development"&&console.error(i),process.exit(1)}}var bp=a(require("fs")),wp=a(require("path")),xp=a(require("webpack")),vp=require("webpack-merge");async function _p(t,e){let s=await Q(t);!t?.startsWith("http")&&!bp.default.existsSync(wp.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{let r=e.browser||"chrome",i=J(s,{...e,browser:r,mode:"production"}),n=i.plugins?.filter(u=>u?.constructor.name==="plugin-browsers");console.log(Ts(r));let c=ee(s)({...i,plugins:n}),p=(0,vp.merge)(c);(0,xp.default)(p).run(async(u,d)=>{u&&(console.error(u.stack||u),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):console.log(Rs(s,{browser:r,mode:"production"}))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}var Sp=a(require("fs")),Pp=a(require("path")),kp=a(require("webpack")),Ep=require("webpack-merge");async function jp(t,e){let s=await Q(t);!t?.startsWith("http")&&!Sp.default.existsSync(Pp.default.join(s,"manifest.json"))&&(console.log(K()),process.exit(1));try{let r=e.browser||"chrome",i=J(s,{...e,browser:r,mode:"production"}),n=i.plugins?.filter(u=>u?.constructor.name!=="plugin-reload");console.log(Ts(r));let c=ee(s)({...i,plugins:n}),p=(0,Ep.merge)(c);(0,kp.default)(p).run((u,d)=>{u&&(console.error(u.stack||u),process.exit(1)),d?.hasErrors()?(console.log(d.toString({colors:!0})),process.exit(1)):(console.log(Rs(s,e)),setTimeout(()=>{console.log(_c("production",r))},1500))})}catch(r){process.env.EXTENSION_ENV==="development"&&console.error(r),process.exit(1)}}0&&(module.exports={extensionBuild,extensionDev,extensionPreview,extensionStart});