@agents-inc/cli 0.32.1

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 (497) hide show
  1. package/CHANGELOG.md +462 -0
  2. package/LICENSE +21 -0
  3. package/README.md +179 -0
  4. package/config/skills-matrix.yaml +926 -0
  5. package/config/stacks.yaml +2186 -0
  6. package/dist/chunk-3ZOIOVKT.js +365 -0
  7. package/dist/chunk-3ZOIOVKT.js.map +1 -0
  8. package/dist/chunk-4RAY5AOI.js +78 -0
  9. package/dist/chunk-4RAY5AOI.js.map +1 -0
  10. package/dist/chunk-5PIKNCZX.js +234 -0
  11. package/dist/chunk-5PIKNCZX.js.map +1 -0
  12. package/dist/chunk-66UDJBF6.js +96 -0
  13. package/dist/chunk-66UDJBF6.js.map +1 -0
  14. package/dist/chunk-7SOPVGDV.js +24 -0
  15. package/dist/chunk-7SOPVGDV.js.map +1 -0
  16. package/dist/chunk-A27LOC4Z.js +95 -0
  17. package/dist/chunk-A27LOC4Z.js.map +1 -0
  18. package/dist/chunk-B2UBHA66.js +301 -0
  19. package/dist/chunk-B2UBHA66.js.map +1 -0
  20. package/dist/chunk-BZN2Z5P7.js +882 -0
  21. package/dist/chunk-BZN2Z5P7.js.map +1 -0
  22. package/dist/chunk-BZQBJP34.js +186 -0
  23. package/dist/chunk-BZQBJP34.js.map +1 -0
  24. package/dist/chunk-DC5AK3LW.js +105 -0
  25. package/dist/chunk-DC5AK3LW.js.map +1 -0
  26. package/dist/chunk-DHET7RCE.js +50 -0
  27. package/dist/chunk-DHET7RCE.js.map +1 -0
  28. package/dist/chunk-EMJ2ZKS7.js +346 -0
  29. package/dist/chunk-EMJ2ZKS7.js.map +1 -0
  30. package/dist/chunk-FJQRVFMB.js +48 -0
  31. package/dist/chunk-FJQRVFMB.js.map +1 -0
  32. package/dist/chunk-FZGYSLJL.js +85 -0
  33. package/dist/chunk-FZGYSLJL.js.map +1 -0
  34. package/dist/chunk-H566H3MQ.js +87 -0
  35. package/dist/chunk-H566H3MQ.js.map +1 -0
  36. package/dist/chunk-IYG2LAIM.js +90 -0
  37. package/dist/chunk-IYG2LAIM.js.map +1 -0
  38. package/dist/chunk-IZZ4IIEG.js +29 -0
  39. package/dist/chunk-IZZ4IIEG.js.map +1 -0
  40. package/dist/chunk-JMVWYAHT.js +63 -0
  41. package/dist/chunk-JMVWYAHT.js.map +1 -0
  42. package/dist/chunk-LAPCUV4D.js +191 -0
  43. package/dist/chunk-LAPCUV4D.js.map +1 -0
  44. package/dist/chunk-LGUI3PMO.js +109 -0
  45. package/dist/chunk-LGUI3PMO.js.map +1 -0
  46. package/dist/chunk-MM7NK5N2.js +4542 -0
  47. package/dist/chunk-MM7NK5N2.js.map +1 -0
  48. package/dist/chunk-N6S7ZRIL.js +31 -0
  49. package/dist/chunk-N6S7ZRIL.js.map +1 -0
  50. package/dist/chunk-O4D67NN7.js +24 -0
  51. package/dist/chunk-O4D67NN7.js.map +1 -0
  52. package/dist/chunk-ODUOU55D.js +56 -0
  53. package/dist/chunk-ODUOU55D.js.map +1 -0
  54. package/dist/chunk-OGJIZ6QH.js +497 -0
  55. package/dist/chunk-OGJIZ6QH.js.map +1 -0
  56. package/dist/chunk-OMV7TLWD.js +340 -0
  57. package/dist/chunk-OMV7TLWD.js.map +1 -0
  58. package/dist/chunk-PBEHPQLK.js +146 -0
  59. package/dist/chunk-PBEHPQLK.js.map +1 -0
  60. package/dist/chunk-QPTOIZAT.js +32 -0
  61. package/dist/chunk-QPTOIZAT.js.map +1 -0
  62. package/dist/chunk-R3XFQKPG.js +111 -0
  63. package/dist/chunk-R3XFQKPG.js.map +1 -0
  64. package/dist/chunk-R74PZWQS.js +69 -0
  65. package/dist/chunk-R74PZWQS.js.map +1 -0
  66. package/dist/chunk-SO22IQPY.js +45 -0
  67. package/dist/chunk-SO22IQPY.js.map +1 -0
  68. package/dist/chunk-T4EXUIBY.js +19 -0
  69. package/dist/chunk-T4EXUIBY.js.map +1 -0
  70. package/dist/chunk-U3IGFMCY.js +31 -0
  71. package/dist/chunk-U3IGFMCY.js.map +1 -0
  72. package/dist/chunk-UICL22RT.js +318 -0
  73. package/dist/chunk-UICL22RT.js.map +1 -0
  74. package/dist/chunk-UX2H2K2G.js +183 -0
  75. package/dist/chunk-UX2H2K2G.js.map +1 -0
  76. package/dist/chunk-W2ZSCZ2U.js +93 -0
  77. package/dist/chunk-W2ZSCZ2U.js.map +1 -0
  78. package/dist/chunk-WEUVWHMA.js +189 -0
  79. package/dist/chunk-WEUVWHMA.js.map +1 -0
  80. package/dist/chunk-XY3XDVMI.js +15599 -0
  81. package/dist/chunk-XY3XDVMI.js.map +1 -0
  82. package/dist/chunk-YND42IXK.js +233 -0
  83. package/dist/chunk-YND42IXK.js.map +1 -0
  84. package/dist/chunk-YZTWZVGX.js +41 -0
  85. package/dist/chunk-YZTWZVGX.js.map +1 -0
  86. package/dist/chunk-Z4TWOP3H.js +81 -0
  87. package/dist/chunk-Z4TWOP3H.js.map +1 -0
  88. package/dist/cli/defaults/agent-mappings.yaml +271 -0
  89. package/dist/commands/build/marketplace.js +252 -0
  90. package/dist/commands/build/marketplace.js.map +1 -0
  91. package/dist/commands/build/plugins.js +114 -0
  92. package/dist/commands/build/plugins.js.map +1 -0
  93. package/dist/commands/build/stack.js +153 -0
  94. package/dist/commands/build/stack.js.map +1 -0
  95. package/dist/commands/compile.js +354 -0
  96. package/dist/commands/compile.js.map +1 -0
  97. package/dist/commands/config/get.js +61 -0
  98. package/dist/commands/config/get.js.map +1 -0
  99. package/dist/commands/config/index.js +23 -0
  100. package/dist/commands/config/index.js.map +1 -0
  101. package/dist/commands/config/path.js +34 -0
  102. package/dist/commands/config/path.js.map +1 -0
  103. package/dist/commands/config/set-project.js +61 -0
  104. package/dist/commands/config/set-project.js.map +1 -0
  105. package/dist/commands/config/show.js +14 -0
  106. package/dist/commands/config/show.js.map +1 -0
  107. package/dist/commands/config/unset-project.js +57 -0
  108. package/dist/commands/config/unset-project.js.map +1 -0
  109. package/dist/commands/diff.js +742 -0
  110. package/dist/commands/diff.js.map +1 -0
  111. package/dist/commands/doctor.js +370 -0
  112. package/dist/commands/doctor.js.map +1 -0
  113. package/dist/commands/edit.js +301 -0
  114. package/dist/commands/edit.js.map +1 -0
  115. package/dist/commands/eject.js +262 -0
  116. package/dist/commands/eject.js.map +1 -0
  117. package/dist/commands/import/skill.js +361 -0
  118. package/dist/commands/import/skill.js.map +1 -0
  119. package/dist/commands/info.js +217 -0
  120. package/dist/commands/info.js.map +1 -0
  121. package/dist/commands/init.js +443 -0
  122. package/dist/commands/init.js.map +1 -0
  123. package/dist/commands/list.js +49 -0
  124. package/dist/commands/list.js.map +1 -0
  125. package/dist/commands/new/agent.js +224 -0
  126. package/dist/commands/new/agent.js.map +1 -0
  127. package/dist/commands/new/skill.js +199 -0
  128. package/dist/commands/new/skill.js.map +1 -0
  129. package/dist/commands/outdated.js +176 -0
  130. package/dist/commands/outdated.js.map +1 -0
  131. package/dist/commands/search.js +288 -0
  132. package/dist/commands/search.js.map +1 -0
  133. package/dist/commands/uninstall.js +302 -0
  134. package/dist/commands/uninstall.js.map +1 -0
  135. package/dist/commands/update.js +304 -0
  136. package/dist/commands/update.js.map +1 -0
  137. package/dist/commands/validate.js +389 -0
  138. package/dist/commands/validate.js.map +1 -0
  139. package/dist/commands/version/bump.js +79 -0
  140. package/dist/commands/version/bump.js.map +1 -0
  141. package/dist/commands/version/index.js +54 -0
  142. package/dist/commands/version/index.js.map +1 -0
  143. package/dist/commands/version/set.js +86 -0
  144. package/dist/commands/version/set.js.map +1 -0
  145. package/dist/commands/version/show.js +54 -0
  146. package/dist/commands/version/show.js.map +1 -0
  147. package/dist/components/common/confirm.js +9 -0
  148. package/dist/components/common/confirm.js.map +1 -0
  149. package/dist/components/common/confirm.test.js +203 -0
  150. package/dist/components/common/confirm.test.js.map +1 -0
  151. package/dist/components/common/message.js +20 -0
  152. package/dist/components/common/message.js.map +1 -0
  153. package/dist/components/common/spinner.js +14 -0
  154. package/dist/components/common/spinner.js.map +1 -0
  155. package/dist/components/skill-search/skill-search.js +12 -0
  156. package/dist/components/skill-search/skill-search.js.map +1 -0
  157. package/dist/components/wizard/category-grid.js +11 -0
  158. package/dist/components/wizard/category-grid.js.map +1 -0
  159. package/dist/components/wizard/category-grid.test.js +997 -0
  160. package/dist/components/wizard/category-grid.test.js.map +1 -0
  161. package/dist/components/wizard/domain-selection.js +14 -0
  162. package/dist/components/wizard/domain-selection.js.map +1 -0
  163. package/dist/components/wizard/help-modal.js +10 -0
  164. package/dist/components/wizard/help-modal.js.map +1 -0
  165. package/dist/components/wizard/menu-item.js +10 -0
  166. package/dist/components/wizard/menu-item.js.map +1 -0
  167. package/dist/components/wizard/search-modal.js +11 -0
  168. package/dist/components/wizard/search-modal.js.map +1 -0
  169. package/dist/components/wizard/search-modal.test.js +218 -0
  170. package/dist/components/wizard/search-modal.test.js.map +1 -0
  171. package/dist/components/wizard/section-progress.js +10 -0
  172. package/dist/components/wizard/section-progress.js.map +1 -0
  173. package/dist/components/wizard/section-progress.test.js +192 -0
  174. package/dist/components/wizard/section-progress.test.js.map +1 -0
  175. package/dist/components/wizard/source-grid.js +14 -0
  176. package/dist/components/wizard/source-grid.js.map +1 -0
  177. package/dist/components/wizard/source-grid.test.js +504 -0
  178. package/dist/components/wizard/source-grid.test.js.map +1 -0
  179. package/dist/components/wizard/stack-selection.js +17 -0
  180. package/dist/components/wizard/stack-selection.js.map +1 -0
  181. package/dist/components/wizard/step-build.js +17 -0
  182. package/dist/components/wizard/step-build.js.map +1 -0
  183. package/dist/components/wizard/step-build.test.js +600 -0
  184. package/dist/components/wizard/step-build.test.js.map +1 -0
  185. package/dist/components/wizard/step-confirm.js +12 -0
  186. package/dist/components/wizard/step-confirm.js.map +1 -0
  187. package/dist/components/wizard/step-confirm.test.js +366 -0
  188. package/dist/components/wizard/step-confirm.test.js.map +1 -0
  189. package/dist/components/wizard/step-refine.js +10 -0
  190. package/dist/components/wizard/step-refine.js.map +1 -0
  191. package/dist/components/wizard/step-refine.test.js +237 -0
  192. package/dist/components/wizard/step-refine.test.js.map +1 -0
  193. package/dist/components/wizard/step-settings.js +17 -0
  194. package/dist/components/wizard/step-settings.js.map +1 -0
  195. package/dist/components/wizard/step-settings.test.js +243 -0
  196. package/dist/components/wizard/step-settings.test.js.map +1 -0
  197. package/dist/components/wizard/step-sources.js +20 -0
  198. package/dist/components/wizard/step-sources.js.map +1 -0
  199. package/dist/components/wizard/step-sources.test.js +294 -0
  200. package/dist/components/wizard/step-sources.test.js.map +1 -0
  201. package/dist/components/wizard/step-stack.js +19 -0
  202. package/dist/components/wizard/step-stack.js.map +1 -0
  203. package/dist/components/wizard/step-stack.test.js +357 -0
  204. package/dist/components/wizard/step-stack.test.js.map +1 -0
  205. package/dist/components/wizard/view-title.js +10 -0
  206. package/dist/components/wizard/view-title.js.map +1 -0
  207. package/dist/components/wizard/wizard-layout.js +16 -0
  208. package/dist/components/wizard/wizard-layout.js.map +1 -0
  209. package/dist/components/wizard/wizard-tabs.js +14 -0
  210. package/dist/components/wizard/wizard-tabs.js.map +1 -0
  211. package/dist/components/wizard/wizard-tabs.test.js +294 -0
  212. package/dist/components/wizard/wizard-tabs.test.js.map +1 -0
  213. package/dist/components/wizard/wizard.js +35 -0
  214. package/dist/components/wizard/wizard.js.map +1 -0
  215. package/dist/config/skills-matrix.yaml +926 -0
  216. package/dist/config/stacks.yaml +2186 -0
  217. package/dist/hooks/init.js +40 -0
  218. package/dist/hooks/init.js.map +1 -0
  219. package/dist/index.js +10 -0
  220. package/dist/index.js.map +1 -0
  221. package/dist/magic-string.es-RGXYGAW3.js +1316 -0
  222. package/dist/magic-string.es-RGXYGAW3.js.map +1 -0
  223. package/dist/source-manager-SBPPLOQQ.js +16 -0
  224. package/dist/source-manager-SBPPLOQQ.js.map +1 -0
  225. package/dist/src/agents/_templates/agent.liquid +140 -0
  226. package/dist/src/agents/developer/api-developer/agent.yaml +12 -0
  227. package/dist/src/agents/developer/api-developer/critical-reminders.md +23 -0
  228. package/dist/src/agents/developer/api-developer/critical-requirements.md +11 -0
  229. package/dist/src/agents/developer/api-developer/examples.md +72 -0
  230. package/dist/src/agents/developer/api-developer/intro.md +22 -0
  231. package/dist/src/agents/developer/api-developer/output-format.md +359 -0
  232. package/dist/src/agents/developer/api-developer/workflow.md +471 -0
  233. package/dist/src/agents/developer/cli-developer/agent.yaml +12 -0
  234. package/dist/src/agents/developer/cli-developer/critical-reminders.md +28 -0
  235. package/dist/src/agents/developer/cli-developer/critical-requirements.md +15 -0
  236. package/dist/src/agents/developer/cli-developer/examples.md +68 -0
  237. package/dist/src/agents/developer/cli-developer/intro.md +23 -0
  238. package/dist/src/agents/developer/cli-developer/output-format.md +216 -0
  239. package/dist/src/agents/developer/cli-developer/workflow.md +509 -0
  240. package/dist/src/agents/developer/web-architecture/agent.yaml +12 -0
  241. package/dist/src/agents/developer/web-architecture/critical-reminders.md +27 -0
  242. package/dist/src/agents/developer/web-architecture/critical-requirements.md +35 -0
  243. package/dist/src/agents/developer/web-architecture/examples.md +187 -0
  244. package/dist/src/agents/developer/web-architecture/intro.md +35 -0
  245. package/dist/src/agents/developer/web-architecture/output-format.md +261 -0
  246. package/dist/src/agents/developer/web-architecture/workflow.md +599 -0
  247. package/dist/src/agents/developer/web-developer/agent.yaml +12 -0
  248. package/dist/src/agents/developer/web-developer/critical-reminders.md +17 -0
  249. package/dist/src/agents/developer/web-developer/critical-requirements.md +15 -0
  250. package/dist/src/agents/developer/web-developer/examples.md +109 -0
  251. package/dist/src/agents/developer/web-developer/intro.md +5 -0
  252. package/dist/src/agents/developer/web-developer/output-format.md +213 -0
  253. package/dist/src/agents/developer/web-developer/workflow.md +459 -0
  254. package/dist/src/agents/meta/agent-summoner/agent.yaml +12 -0
  255. package/dist/src/agents/meta/agent-summoner/critical-reminders.md +31 -0
  256. package/dist/src/agents/meta/agent-summoner/critical-requirements.md +27 -0
  257. package/dist/src/agents/meta/agent-summoner/examples.md +176 -0
  258. package/dist/src/agents/meta/agent-summoner/intro.md +9 -0
  259. package/dist/src/agents/meta/agent-summoner/output-format.md +115 -0
  260. package/dist/src/agents/meta/agent-summoner/workflow.md +1540 -0
  261. package/dist/src/agents/meta/documentor/agent.yaml +11 -0
  262. package/dist/src/agents/meta/documentor/critical-reminders.md +23 -0
  263. package/dist/src/agents/meta/documentor/critical-requirements.md +13 -0
  264. package/dist/src/agents/meta/documentor/examples.md +147 -0
  265. package/dist/src/agents/meta/documentor/intro.md +11 -0
  266. package/dist/src/agents/meta/documentor/output-format.md +237 -0
  267. package/dist/src/agents/meta/documentor/workflow.md +1271 -0
  268. package/dist/src/agents/meta/skill-summoner/agent.yaml +13 -0
  269. package/dist/src/agents/meta/skill-summoner/critical-reminders.md +73 -0
  270. package/dist/src/agents/meta/skill-summoner/critical-requirements.md +62 -0
  271. package/dist/src/agents/meta/skill-summoner/examples.md +116 -0
  272. package/dist/src/agents/meta/skill-summoner/intro.md +5 -0
  273. package/dist/src/agents/meta/skill-summoner/output-format.md +279 -0
  274. package/dist/src/agents/meta/skill-summoner/workflow.md +1485 -0
  275. package/dist/src/agents/migration/cli-migrator/agent.yaml +12 -0
  276. package/dist/src/agents/migration/cli-migrator/anti-patterns.md +158 -0
  277. package/dist/src/agents/migration/cli-migrator/conversion-mappings.md +63 -0
  278. package/dist/src/agents/migration/cli-migrator/critical-reminders.md +17 -0
  279. package/dist/src/agents/migration/cli-migrator/critical-requirements.md +13 -0
  280. package/dist/src/agents/migration/cli-migrator/intro.md +15 -0
  281. package/dist/src/agents/migration/cli-migrator/output-format.md +164 -0
  282. package/dist/src/agents/migration/cli-migrator/workflow.md +230 -0
  283. package/dist/src/agents/pattern/pattern-scout/agent.yaml +10 -0
  284. package/dist/src/agents/pattern/pattern-scout/critical-reminders.md +58 -0
  285. package/dist/src/agents/pattern/pattern-scout/critical-requirements.md +17 -0
  286. package/dist/src/agents/pattern/pattern-scout/examples.md +93 -0
  287. package/dist/src/agents/pattern/pattern-scout/intro.md +3 -0
  288. package/dist/src/agents/pattern/pattern-scout/output-format.md +196 -0
  289. package/dist/src/agents/pattern/pattern-scout/workflow.md +1901 -0
  290. package/dist/src/agents/pattern/web-pattern-critique/agent.yaml +12 -0
  291. package/dist/src/agents/pattern/web-pattern-critique/critical-reminders.md +13 -0
  292. package/dist/src/agents/pattern/web-pattern-critique/critical-requirements.md +11 -0
  293. package/dist/src/agents/pattern/web-pattern-critique/examples.md +56 -0
  294. package/dist/src/agents/pattern/web-pattern-critique/intro.md +5 -0
  295. package/dist/src/agents/pattern/web-pattern-critique/output-format.md +257 -0
  296. package/dist/src/agents/pattern/web-pattern-critique/workflow.md +674 -0
  297. package/dist/src/agents/planning/web-pm/agent.yaml +12 -0
  298. package/dist/src/agents/planning/web-pm/critical-reminders.md +21 -0
  299. package/dist/src/agents/planning/web-pm/critical-requirements.md +17 -0
  300. package/dist/src/agents/planning/web-pm/examples.md +85 -0
  301. package/dist/src/agents/planning/web-pm/intro.md +3 -0
  302. package/dist/src/agents/planning/web-pm/output-format.md +228 -0
  303. package/dist/src/agents/planning/web-pm/workflow.md +393 -0
  304. package/dist/src/agents/researcher/api-researcher/agent.yaml +10 -0
  305. package/dist/src/agents/researcher/api-researcher/critical-reminders.md +27 -0
  306. package/dist/src/agents/researcher/api-researcher/critical-requirements.md +13 -0
  307. package/dist/src/agents/researcher/api-researcher/examples.md +116 -0
  308. package/dist/src/agents/researcher/api-researcher/intro.md +32 -0
  309. package/dist/src/agents/researcher/api-researcher/output-format.md +135 -0
  310. package/dist/src/agents/researcher/api-researcher/workflow.md +261 -0
  311. package/dist/src/agents/researcher/web-researcher/agent.yaml +10 -0
  312. package/dist/src/agents/researcher/web-researcher/critical-reminders.md +23 -0
  313. package/dist/src/agents/researcher/web-researcher/critical-requirements.md +11 -0
  314. package/dist/src/agents/researcher/web-researcher/examples.md +126 -0
  315. package/dist/src/agents/researcher/web-researcher/intro.md +31 -0
  316. package/dist/src/agents/researcher/web-researcher/output-format.md +112 -0
  317. package/dist/src/agents/researcher/web-researcher/workflow.md +322 -0
  318. package/dist/src/agents/reviewer/api-reviewer/agent.yaml +12 -0
  319. package/dist/src/agents/reviewer/api-reviewer/critical-reminders.md +16 -0
  320. package/dist/src/agents/reviewer/api-reviewer/critical-requirements.md +13 -0
  321. package/dist/src/agents/reviewer/api-reviewer/examples.md +54 -0
  322. package/dist/src/agents/reviewer/api-reviewer/intro.md +22 -0
  323. package/dist/src/agents/reviewer/api-reviewer/output-format.md +288 -0
  324. package/dist/src/agents/reviewer/api-reviewer/workflow.md +369 -0
  325. package/dist/src/agents/reviewer/cli-reviewer/agent.yaml +12 -0
  326. package/dist/src/agents/reviewer/cli-reviewer/critical-reminders.md +17 -0
  327. package/dist/src/agents/reviewer/cli-reviewer/critical-requirements.md +13 -0
  328. package/dist/src/agents/reviewer/cli-reviewer/examples.md +83 -0
  329. package/dist/src/agents/reviewer/cli-reviewer/intro.md +21 -0
  330. package/dist/src/agents/reviewer/cli-reviewer/output-format.md +330 -0
  331. package/dist/src/agents/reviewer/cli-reviewer/workflow.md +294 -0
  332. package/dist/src/agents/reviewer/web-reviewer/agent.yaml +12 -0
  333. package/dist/src/agents/reviewer/web-reviewer/critical-reminders.md +17 -0
  334. package/dist/src/agents/reviewer/web-reviewer/critical-requirements.md +11 -0
  335. package/dist/src/agents/reviewer/web-reviewer/examples.md +79 -0
  336. package/dist/src/agents/reviewer/web-reviewer/intro.md +20 -0
  337. package/dist/src/agents/reviewer/web-reviewer/output-format.md +253 -0
  338. package/dist/src/agents/reviewer/web-reviewer/workflow.md +228 -0
  339. package/dist/src/agents/tester/cli-tester/agent.yaml +12 -0
  340. package/dist/src/agents/tester/cli-tester/critical-reminders.md +19 -0
  341. package/dist/src/agents/tester/cli-tester/critical-requirements.md +17 -0
  342. package/dist/src/agents/tester/cli-tester/examples.md +80 -0
  343. package/dist/src/agents/tester/cli-tester/intro.md +19 -0
  344. package/dist/src/agents/tester/cli-tester/output-format.md +232 -0
  345. package/dist/src/agents/tester/cli-tester/workflow.md +304 -0
  346. package/dist/src/agents/tester/web-tester/agent.yaml +12 -0
  347. package/dist/src/agents/tester/web-tester/critical-reminders.md +15 -0
  348. package/dist/src/agents/tester/web-tester/critical-requirements.md +11 -0
  349. package/dist/src/agents/tester/web-tester/examples.md +68 -0
  350. package/dist/src/agents/tester/web-tester/intro.md +18 -0
  351. package/dist/src/agents/tester/web-tester/output-format.md +252 -0
  352. package/dist/src/agents/tester/web-tester/workflow.md +507 -0
  353. package/dist/stores/wizard-store.js +13 -0
  354. package/dist/stores/wizard-store.js.map +1 -0
  355. package/dist/stores/wizard-store.test.js +689 -0
  356. package/dist/stores/wizard-store.test.js.map +1 -0
  357. package/package.json +134 -0
  358. package/src/agents/_templates/agent.liquid +140 -0
  359. package/src/agents/developer/api-developer/agent.yaml +12 -0
  360. package/src/agents/developer/api-developer/critical-reminders.md +23 -0
  361. package/src/agents/developer/api-developer/critical-requirements.md +11 -0
  362. package/src/agents/developer/api-developer/examples.md +72 -0
  363. package/src/agents/developer/api-developer/intro.md +22 -0
  364. package/src/agents/developer/api-developer/output-format.md +359 -0
  365. package/src/agents/developer/api-developer/workflow.md +471 -0
  366. package/src/agents/developer/cli-developer/agent.yaml +12 -0
  367. package/src/agents/developer/cli-developer/critical-reminders.md +28 -0
  368. package/src/agents/developer/cli-developer/critical-requirements.md +15 -0
  369. package/src/agents/developer/cli-developer/examples.md +68 -0
  370. package/src/agents/developer/cli-developer/intro.md +23 -0
  371. package/src/agents/developer/cli-developer/output-format.md +216 -0
  372. package/src/agents/developer/cli-developer/workflow.md +509 -0
  373. package/src/agents/developer/web-architecture/agent.yaml +12 -0
  374. package/src/agents/developer/web-architecture/critical-reminders.md +27 -0
  375. package/src/agents/developer/web-architecture/critical-requirements.md +35 -0
  376. package/src/agents/developer/web-architecture/examples.md +187 -0
  377. package/src/agents/developer/web-architecture/intro.md +35 -0
  378. package/src/agents/developer/web-architecture/output-format.md +261 -0
  379. package/src/agents/developer/web-architecture/workflow.md +599 -0
  380. package/src/agents/developer/web-developer/agent.yaml +12 -0
  381. package/src/agents/developer/web-developer/critical-reminders.md +17 -0
  382. package/src/agents/developer/web-developer/critical-requirements.md +15 -0
  383. package/src/agents/developer/web-developer/examples.md +109 -0
  384. package/src/agents/developer/web-developer/intro.md +5 -0
  385. package/src/agents/developer/web-developer/output-format.md +213 -0
  386. package/src/agents/developer/web-developer/workflow.md +459 -0
  387. package/src/agents/meta/agent-summoner/agent.yaml +12 -0
  388. package/src/agents/meta/agent-summoner/critical-reminders.md +31 -0
  389. package/src/agents/meta/agent-summoner/critical-requirements.md +27 -0
  390. package/src/agents/meta/agent-summoner/examples.md +176 -0
  391. package/src/agents/meta/agent-summoner/intro.md +9 -0
  392. package/src/agents/meta/agent-summoner/output-format.md +115 -0
  393. package/src/agents/meta/agent-summoner/workflow.md +1540 -0
  394. package/src/agents/meta/documentor/agent.yaml +11 -0
  395. package/src/agents/meta/documentor/critical-reminders.md +23 -0
  396. package/src/agents/meta/documentor/critical-requirements.md +13 -0
  397. package/src/agents/meta/documentor/examples.md +147 -0
  398. package/src/agents/meta/documentor/intro.md +11 -0
  399. package/src/agents/meta/documentor/output-format.md +237 -0
  400. package/src/agents/meta/documentor/workflow.md +1271 -0
  401. package/src/agents/meta/skill-summoner/agent.yaml +13 -0
  402. package/src/agents/meta/skill-summoner/critical-reminders.md +73 -0
  403. package/src/agents/meta/skill-summoner/critical-requirements.md +62 -0
  404. package/src/agents/meta/skill-summoner/examples.md +116 -0
  405. package/src/agents/meta/skill-summoner/intro.md +5 -0
  406. package/src/agents/meta/skill-summoner/output-format.md +279 -0
  407. package/src/agents/meta/skill-summoner/workflow.md +1485 -0
  408. package/src/agents/migration/cli-migrator/agent.yaml +12 -0
  409. package/src/agents/migration/cli-migrator/anti-patterns.md +158 -0
  410. package/src/agents/migration/cli-migrator/conversion-mappings.md +63 -0
  411. package/src/agents/migration/cli-migrator/critical-reminders.md +17 -0
  412. package/src/agents/migration/cli-migrator/critical-requirements.md +13 -0
  413. package/src/agents/migration/cli-migrator/intro.md +15 -0
  414. package/src/agents/migration/cli-migrator/output-format.md +164 -0
  415. package/src/agents/migration/cli-migrator/workflow.md +230 -0
  416. package/src/agents/pattern/pattern-scout/agent.yaml +10 -0
  417. package/src/agents/pattern/pattern-scout/critical-reminders.md +58 -0
  418. package/src/agents/pattern/pattern-scout/critical-requirements.md +17 -0
  419. package/src/agents/pattern/pattern-scout/examples.md +93 -0
  420. package/src/agents/pattern/pattern-scout/intro.md +3 -0
  421. package/src/agents/pattern/pattern-scout/output-format.md +196 -0
  422. package/src/agents/pattern/pattern-scout/workflow.md +1901 -0
  423. package/src/agents/pattern/web-pattern-critique/agent.yaml +12 -0
  424. package/src/agents/pattern/web-pattern-critique/critical-reminders.md +13 -0
  425. package/src/agents/pattern/web-pattern-critique/critical-requirements.md +11 -0
  426. package/src/agents/pattern/web-pattern-critique/examples.md +56 -0
  427. package/src/agents/pattern/web-pattern-critique/intro.md +5 -0
  428. package/src/agents/pattern/web-pattern-critique/output-format.md +257 -0
  429. package/src/agents/pattern/web-pattern-critique/workflow.md +674 -0
  430. package/src/agents/planning/web-pm/agent.yaml +12 -0
  431. package/src/agents/planning/web-pm/critical-reminders.md +21 -0
  432. package/src/agents/planning/web-pm/critical-requirements.md +17 -0
  433. package/src/agents/planning/web-pm/examples.md +85 -0
  434. package/src/agents/planning/web-pm/intro.md +3 -0
  435. package/src/agents/planning/web-pm/output-format.md +228 -0
  436. package/src/agents/planning/web-pm/workflow.md +393 -0
  437. package/src/agents/researcher/api-researcher/agent.yaml +10 -0
  438. package/src/agents/researcher/api-researcher/critical-reminders.md +27 -0
  439. package/src/agents/researcher/api-researcher/critical-requirements.md +13 -0
  440. package/src/agents/researcher/api-researcher/examples.md +116 -0
  441. package/src/agents/researcher/api-researcher/intro.md +32 -0
  442. package/src/agents/researcher/api-researcher/output-format.md +135 -0
  443. package/src/agents/researcher/api-researcher/workflow.md +261 -0
  444. package/src/agents/researcher/web-researcher/agent.yaml +10 -0
  445. package/src/agents/researcher/web-researcher/critical-reminders.md +23 -0
  446. package/src/agents/researcher/web-researcher/critical-requirements.md +11 -0
  447. package/src/agents/researcher/web-researcher/examples.md +126 -0
  448. package/src/agents/researcher/web-researcher/intro.md +31 -0
  449. package/src/agents/researcher/web-researcher/output-format.md +112 -0
  450. package/src/agents/researcher/web-researcher/workflow.md +322 -0
  451. package/src/agents/reviewer/api-reviewer/agent.yaml +12 -0
  452. package/src/agents/reviewer/api-reviewer/critical-reminders.md +16 -0
  453. package/src/agents/reviewer/api-reviewer/critical-requirements.md +13 -0
  454. package/src/agents/reviewer/api-reviewer/examples.md +54 -0
  455. package/src/agents/reviewer/api-reviewer/intro.md +22 -0
  456. package/src/agents/reviewer/api-reviewer/output-format.md +288 -0
  457. package/src/agents/reviewer/api-reviewer/workflow.md +369 -0
  458. package/src/agents/reviewer/cli-reviewer/agent.yaml +12 -0
  459. package/src/agents/reviewer/cli-reviewer/critical-reminders.md +17 -0
  460. package/src/agents/reviewer/cli-reviewer/critical-requirements.md +13 -0
  461. package/src/agents/reviewer/cli-reviewer/examples.md +83 -0
  462. package/src/agents/reviewer/cli-reviewer/intro.md +21 -0
  463. package/src/agents/reviewer/cli-reviewer/output-format.md +330 -0
  464. package/src/agents/reviewer/cli-reviewer/workflow.md +294 -0
  465. package/src/agents/reviewer/web-reviewer/agent.yaml +12 -0
  466. package/src/agents/reviewer/web-reviewer/critical-reminders.md +17 -0
  467. package/src/agents/reviewer/web-reviewer/critical-requirements.md +11 -0
  468. package/src/agents/reviewer/web-reviewer/examples.md +79 -0
  469. package/src/agents/reviewer/web-reviewer/intro.md +20 -0
  470. package/src/agents/reviewer/web-reviewer/output-format.md +253 -0
  471. package/src/agents/reviewer/web-reviewer/workflow.md +228 -0
  472. package/src/agents/tester/cli-tester/agent.yaml +12 -0
  473. package/src/agents/tester/cli-tester/critical-reminders.md +19 -0
  474. package/src/agents/tester/cli-tester/critical-requirements.md +17 -0
  475. package/src/agents/tester/cli-tester/examples.md +80 -0
  476. package/src/agents/tester/cli-tester/intro.md +19 -0
  477. package/src/agents/tester/cli-tester/output-format.md +232 -0
  478. package/src/agents/tester/cli-tester/workflow.md +304 -0
  479. package/src/agents/tester/web-tester/agent.yaml +12 -0
  480. package/src/agents/tester/web-tester/critical-reminders.md +15 -0
  481. package/src/agents/tester/web-tester/critical-requirements.md +11 -0
  482. package/src/agents/tester/web-tester/examples.md +68 -0
  483. package/src/agents/tester/web-tester/intro.md +18 -0
  484. package/src/agents/tester/web-tester/output-format.md +252 -0
  485. package/src/agents/tester/web-tester/workflow.md +507 -0
  486. package/src/schemas/agent-frontmatter.schema.json +84 -0
  487. package/src/schemas/agent.schema.json +93 -0
  488. package/src/schemas/hooks.schema.json +47 -0
  489. package/src/schemas/marketplace.schema.json +119 -0
  490. package/src/schemas/metadata.schema.json +113 -0
  491. package/src/schemas/plugin.schema.json +130 -0
  492. package/src/schemas/project-config.schema.json +125 -0
  493. package/src/schemas/project-source-config.schema.json +81 -0
  494. package/src/schemas/skill-frontmatter.schema.json +42 -0
  495. package/src/schemas/skills-matrix.schema.json +467 -0
  496. package/src/schemas/stack.schema.json +191 -0
  497. package/src/schemas/stacks.schema.json +111 -0
@@ -0,0 +1,1316 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ init_esm_shims
4
+ } from "./chunk-DHET7RCE.js";
5
+
6
+ // node_modules/magic-string/dist/magic-string.es.mjs
7
+ init_esm_shims();
8
+
9
+ // node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
10
+ init_esm_shims();
11
+ var comma = ",".charCodeAt(0);
12
+ var semicolon = ";".charCodeAt(0);
13
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
14
+ var intToChar = new Uint8Array(64);
15
+ var charToInt = new Uint8Array(128);
16
+ for (let i = 0; i < chars.length; i++) {
17
+ const c = chars.charCodeAt(i);
18
+ intToChar[i] = c;
19
+ charToInt[c] = i;
20
+ }
21
+ function encodeInteger(builder, num, relative) {
22
+ let delta = num - relative;
23
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
24
+ do {
25
+ let clamped = delta & 31;
26
+ delta >>>= 5;
27
+ if (delta > 0) clamped |= 32;
28
+ builder.write(intToChar[clamped]);
29
+ } while (delta > 0);
30
+ return num;
31
+ }
32
+ var bufLength = 1024 * 16;
33
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
34
+ decode(buf) {
35
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
36
+ return out.toString();
37
+ }
38
+ } : {
39
+ decode(buf) {
40
+ let out = "";
41
+ for (let i = 0; i < buf.length; i++) {
42
+ out += String.fromCharCode(buf[i]);
43
+ }
44
+ return out;
45
+ }
46
+ };
47
+ var StringWriter = class {
48
+ constructor() {
49
+ this.pos = 0;
50
+ this.out = "";
51
+ this.buffer = new Uint8Array(bufLength);
52
+ }
53
+ write(v) {
54
+ const { buffer } = this;
55
+ buffer[this.pos++] = v;
56
+ if (this.pos === bufLength) {
57
+ this.out += td.decode(buffer);
58
+ this.pos = 0;
59
+ }
60
+ }
61
+ flush() {
62
+ const { buffer, out, pos } = this;
63
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
64
+ }
65
+ };
66
+ function encode(decoded) {
67
+ const writer = new StringWriter();
68
+ let sourcesIndex = 0;
69
+ let sourceLine = 0;
70
+ let sourceColumn = 0;
71
+ let namesIndex = 0;
72
+ for (let i = 0; i < decoded.length; i++) {
73
+ const line = decoded[i];
74
+ if (i > 0) writer.write(semicolon);
75
+ if (line.length === 0) continue;
76
+ let genColumn = 0;
77
+ for (let j = 0; j < line.length; j++) {
78
+ const segment = line[j];
79
+ if (j > 0) writer.write(comma);
80
+ genColumn = encodeInteger(writer, segment[0], genColumn);
81
+ if (segment.length === 1) continue;
82
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
83
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
84
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
85
+ if (segment.length === 4) continue;
86
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
87
+ }
88
+ }
89
+ return writer.flush();
90
+ }
91
+
92
+ // node_modules/magic-string/dist/magic-string.es.mjs
93
+ var BitSet = class _BitSet {
94
+ constructor(arg) {
95
+ this.bits = arg instanceof _BitSet ? arg.bits.slice() : [];
96
+ }
97
+ add(n2) {
98
+ this.bits[n2 >> 5] |= 1 << (n2 & 31);
99
+ }
100
+ has(n2) {
101
+ return !!(this.bits[n2 >> 5] & 1 << (n2 & 31));
102
+ }
103
+ };
104
+ var Chunk = class _Chunk {
105
+ constructor(start, end, content) {
106
+ this.start = start;
107
+ this.end = end;
108
+ this.original = content;
109
+ this.intro = "";
110
+ this.outro = "";
111
+ this.content = content;
112
+ this.storeName = false;
113
+ this.edited = false;
114
+ {
115
+ this.previous = null;
116
+ this.next = null;
117
+ }
118
+ }
119
+ appendLeft(content) {
120
+ this.outro += content;
121
+ }
122
+ appendRight(content) {
123
+ this.intro = this.intro + content;
124
+ }
125
+ clone() {
126
+ const chunk = new _Chunk(this.start, this.end, this.original);
127
+ chunk.intro = this.intro;
128
+ chunk.outro = this.outro;
129
+ chunk.content = this.content;
130
+ chunk.storeName = this.storeName;
131
+ chunk.edited = this.edited;
132
+ return chunk;
133
+ }
134
+ contains(index) {
135
+ return this.start < index && index < this.end;
136
+ }
137
+ eachNext(fn) {
138
+ let chunk = this;
139
+ while (chunk) {
140
+ fn(chunk);
141
+ chunk = chunk.next;
142
+ }
143
+ }
144
+ eachPrevious(fn) {
145
+ let chunk = this;
146
+ while (chunk) {
147
+ fn(chunk);
148
+ chunk = chunk.previous;
149
+ }
150
+ }
151
+ edit(content, storeName, contentOnly) {
152
+ this.content = content;
153
+ if (!contentOnly) {
154
+ this.intro = "";
155
+ this.outro = "";
156
+ }
157
+ this.storeName = storeName;
158
+ this.edited = true;
159
+ return this;
160
+ }
161
+ prependLeft(content) {
162
+ this.outro = content + this.outro;
163
+ }
164
+ prependRight(content) {
165
+ this.intro = content + this.intro;
166
+ }
167
+ reset() {
168
+ this.intro = "";
169
+ this.outro = "";
170
+ if (this.edited) {
171
+ this.content = this.original;
172
+ this.storeName = false;
173
+ this.edited = false;
174
+ }
175
+ }
176
+ split(index) {
177
+ const sliceIndex = index - this.start;
178
+ const originalBefore = this.original.slice(0, sliceIndex);
179
+ const originalAfter = this.original.slice(sliceIndex);
180
+ this.original = originalBefore;
181
+ const newChunk = new _Chunk(index, this.end, originalAfter);
182
+ newChunk.outro = this.outro;
183
+ this.outro = "";
184
+ this.end = index;
185
+ if (this.edited) {
186
+ newChunk.edit("", false);
187
+ this.content = "";
188
+ } else {
189
+ this.content = originalBefore;
190
+ }
191
+ newChunk.next = this.next;
192
+ if (newChunk.next) newChunk.next.previous = newChunk;
193
+ newChunk.previous = this;
194
+ this.next = newChunk;
195
+ return newChunk;
196
+ }
197
+ toString() {
198
+ return this.intro + this.content + this.outro;
199
+ }
200
+ trimEnd(rx) {
201
+ this.outro = this.outro.replace(rx, "");
202
+ if (this.outro.length) return true;
203
+ const trimmed = this.content.replace(rx, "");
204
+ if (trimmed.length) {
205
+ if (trimmed !== this.content) {
206
+ this.split(this.start + trimmed.length).edit("", void 0, true);
207
+ if (this.edited) {
208
+ this.edit(trimmed, this.storeName, true);
209
+ }
210
+ }
211
+ return true;
212
+ } else {
213
+ this.edit("", void 0, true);
214
+ this.intro = this.intro.replace(rx, "");
215
+ if (this.intro.length) return true;
216
+ }
217
+ }
218
+ trimStart(rx) {
219
+ this.intro = this.intro.replace(rx, "");
220
+ if (this.intro.length) return true;
221
+ const trimmed = this.content.replace(rx, "");
222
+ if (trimmed.length) {
223
+ if (trimmed !== this.content) {
224
+ const newChunk = this.split(this.end - trimmed.length);
225
+ if (this.edited) {
226
+ newChunk.edit(trimmed, this.storeName, true);
227
+ }
228
+ this.edit("", void 0, true);
229
+ }
230
+ return true;
231
+ } else {
232
+ this.edit("", void 0, true);
233
+ this.outro = this.outro.replace(rx, "");
234
+ if (this.outro.length) return true;
235
+ }
236
+ }
237
+ };
238
+ function getBtoa() {
239
+ if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
240
+ return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
241
+ } else if (typeof Buffer === "function") {
242
+ return (str) => Buffer.from(str, "utf-8").toString("base64");
243
+ } else {
244
+ return () => {
245
+ throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
246
+ };
247
+ }
248
+ }
249
+ var btoa = /* @__PURE__ */ getBtoa();
250
+ var SourceMap = class {
251
+ constructor(properties) {
252
+ this.version = 3;
253
+ this.file = properties.file;
254
+ this.sources = properties.sources;
255
+ this.sourcesContent = properties.sourcesContent;
256
+ this.names = properties.names;
257
+ this.mappings = encode(properties.mappings);
258
+ if (typeof properties.x_google_ignoreList !== "undefined") {
259
+ this.x_google_ignoreList = properties.x_google_ignoreList;
260
+ }
261
+ if (typeof properties.debugId !== "undefined") {
262
+ this.debugId = properties.debugId;
263
+ }
264
+ }
265
+ toString() {
266
+ return JSON.stringify(this);
267
+ }
268
+ toUrl() {
269
+ return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
270
+ }
271
+ };
272
+ function guessIndent(code) {
273
+ const lines = code.split("\n");
274
+ const tabbed = lines.filter((line) => /^\t+/.test(line));
275
+ const spaced = lines.filter((line) => /^ {2,}/.test(line));
276
+ if (tabbed.length === 0 && spaced.length === 0) {
277
+ return null;
278
+ }
279
+ if (tabbed.length >= spaced.length) {
280
+ return " ";
281
+ }
282
+ const min = spaced.reduce((previous, current) => {
283
+ const numSpaces = /^ +/.exec(current)[0].length;
284
+ return Math.min(numSpaces, previous);
285
+ }, Infinity);
286
+ return new Array(min + 1).join(" ");
287
+ }
288
+ function getRelativePath(from, to) {
289
+ const fromParts = from.split(/[/\\]/);
290
+ const toParts = to.split(/[/\\]/);
291
+ fromParts.pop();
292
+ while (fromParts[0] === toParts[0]) {
293
+ fromParts.shift();
294
+ toParts.shift();
295
+ }
296
+ if (fromParts.length) {
297
+ let i = fromParts.length;
298
+ while (i--) fromParts[i] = "..";
299
+ }
300
+ return fromParts.concat(toParts).join("/");
301
+ }
302
+ var toString = Object.prototype.toString;
303
+ function isObject(thing) {
304
+ return toString.call(thing) === "[object Object]";
305
+ }
306
+ function getLocator(source) {
307
+ const originalLines = source.split("\n");
308
+ const lineOffsets = [];
309
+ for (let i = 0, pos = 0; i < originalLines.length; i++) {
310
+ lineOffsets.push(pos);
311
+ pos += originalLines[i].length + 1;
312
+ }
313
+ return function locate(index) {
314
+ let i = 0;
315
+ let j = lineOffsets.length;
316
+ while (i < j) {
317
+ const m = i + j >> 1;
318
+ if (index < lineOffsets[m]) {
319
+ j = m;
320
+ } else {
321
+ i = m + 1;
322
+ }
323
+ }
324
+ const line = i - 1;
325
+ const column = index - lineOffsets[line];
326
+ return { line, column };
327
+ };
328
+ }
329
+ var wordRegex = /\w/;
330
+ var Mappings = class {
331
+ constructor(hires) {
332
+ this.hires = hires;
333
+ this.generatedCodeLine = 0;
334
+ this.generatedCodeColumn = 0;
335
+ this.raw = [];
336
+ this.rawSegments = this.raw[this.generatedCodeLine] = [];
337
+ this.pending = null;
338
+ }
339
+ addEdit(sourceIndex, content, loc, nameIndex) {
340
+ if (content.length) {
341
+ const contentLengthMinusOne = content.length - 1;
342
+ let contentLineEnd = content.indexOf("\n", 0);
343
+ let previousContentLineEnd = -1;
344
+ while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
345
+ const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
346
+ if (nameIndex >= 0) {
347
+ segment2.push(nameIndex);
348
+ }
349
+ this.rawSegments.push(segment2);
350
+ this.generatedCodeLine += 1;
351
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
352
+ this.generatedCodeColumn = 0;
353
+ previousContentLineEnd = contentLineEnd;
354
+ contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
355
+ }
356
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
357
+ if (nameIndex >= 0) {
358
+ segment.push(nameIndex);
359
+ }
360
+ this.rawSegments.push(segment);
361
+ this.advance(content.slice(previousContentLineEnd + 1));
362
+ } else if (this.pending) {
363
+ this.rawSegments.push(this.pending);
364
+ this.advance(content);
365
+ }
366
+ this.pending = null;
367
+ }
368
+ addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
369
+ let originalCharIndex = chunk.start;
370
+ let first = true;
371
+ let charInHiresBoundary = false;
372
+ while (originalCharIndex < chunk.end) {
373
+ if (original[originalCharIndex] === "\n") {
374
+ loc.line += 1;
375
+ loc.column = 0;
376
+ this.generatedCodeLine += 1;
377
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
378
+ this.generatedCodeColumn = 0;
379
+ first = true;
380
+ charInHiresBoundary = false;
381
+ } else {
382
+ if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
383
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
384
+ if (this.hires === "boundary") {
385
+ if (wordRegex.test(original[originalCharIndex])) {
386
+ if (!charInHiresBoundary) {
387
+ this.rawSegments.push(segment);
388
+ charInHiresBoundary = true;
389
+ }
390
+ } else {
391
+ this.rawSegments.push(segment);
392
+ charInHiresBoundary = false;
393
+ }
394
+ } else {
395
+ this.rawSegments.push(segment);
396
+ }
397
+ }
398
+ loc.column += 1;
399
+ this.generatedCodeColumn += 1;
400
+ first = false;
401
+ }
402
+ originalCharIndex += 1;
403
+ }
404
+ this.pending = null;
405
+ }
406
+ advance(str) {
407
+ if (!str) return;
408
+ const lines = str.split("\n");
409
+ if (lines.length > 1) {
410
+ for (let i = 0; i < lines.length - 1; i++) {
411
+ this.generatedCodeLine++;
412
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
413
+ }
414
+ this.generatedCodeColumn = 0;
415
+ }
416
+ this.generatedCodeColumn += lines[lines.length - 1].length;
417
+ }
418
+ };
419
+ var n = "\n";
420
+ var warned = {
421
+ insertLeft: false,
422
+ insertRight: false,
423
+ storeName: false
424
+ };
425
+ var MagicString = class _MagicString {
426
+ constructor(string, options = {}) {
427
+ const chunk = new Chunk(0, string.length, string);
428
+ Object.defineProperties(this, {
429
+ original: { writable: true, value: string },
430
+ outro: { writable: true, value: "" },
431
+ intro: { writable: true, value: "" },
432
+ firstChunk: { writable: true, value: chunk },
433
+ lastChunk: { writable: true, value: chunk },
434
+ lastSearchedChunk: { writable: true, value: chunk },
435
+ byStart: { writable: true, value: {} },
436
+ byEnd: { writable: true, value: {} },
437
+ filename: { writable: true, value: options.filename },
438
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
439
+ sourcemapLocations: { writable: true, value: new BitSet() },
440
+ storedNames: { writable: true, value: {} },
441
+ indentStr: { writable: true, value: void 0 },
442
+ ignoreList: { writable: true, value: options.ignoreList },
443
+ offset: { writable: true, value: options.offset || 0 }
444
+ });
445
+ this.byStart[0] = chunk;
446
+ this.byEnd[string.length] = chunk;
447
+ }
448
+ addSourcemapLocation(char) {
449
+ this.sourcemapLocations.add(char);
450
+ }
451
+ append(content) {
452
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
453
+ this.outro += content;
454
+ return this;
455
+ }
456
+ appendLeft(index, content) {
457
+ index = index + this.offset;
458
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
459
+ this._split(index);
460
+ const chunk = this.byEnd[index];
461
+ if (chunk) {
462
+ chunk.appendLeft(content);
463
+ } else {
464
+ this.intro += content;
465
+ }
466
+ return this;
467
+ }
468
+ appendRight(index, content) {
469
+ index = index + this.offset;
470
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
471
+ this._split(index);
472
+ const chunk = this.byStart[index];
473
+ if (chunk) {
474
+ chunk.appendRight(content);
475
+ } else {
476
+ this.outro += content;
477
+ }
478
+ return this;
479
+ }
480
+ clone() {
481
+ const cloned = new _MagicString(this.original, { filename: this.filename, offset: this.offset });
482
+ let originalChunk = this.firstChunk;
483
+ let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
484
+ while (originalChunk) {
485
+ cloned.byStart[clonedChunk.start] = clonedChunk;
486
+ cloned.byEnd[clonedChunk.end] = clonedChunk;
487
+ const nextOriginalChunk = originalChunk.next;
488
+ const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
489
+ if (nextClonedChunk) {
490
+ clonedChunk.next = nextClonedChunk;
491
+ nextClonedChunk.previous = clonedChunk;
492
+ clonedChunk = nextClonedChunk;
493
+ }
494
+ originalChunk = nextOriginalChunk;
495
+ }
496
+ cloned.lastChunk = clonedChunk;
497
+ if (this.indentExclusionRanges) {
498
+ cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
499
+ }
500
+ cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
501
+ cloned.intro = this.intro;
502
+ cloned.outro = this.outro;
503
+ return cloned;
504
+ }
505
+ generateDecodedMap(options) {
506
+ options = options || {};
507
+ const sourceIndex = 0;
508
+ const names = Object.keys(this.storedNames);
509
+ const mappings = new Mappings(options.hires);
510
+ const locate = getLocator(this.original);
511
+ if (this.intro) {
512
+ mappings.advance(this.intro);
513
+ }
514
+ this.firstChunk.eachNext((chunk) => {
515
+ const loc = locate(chunk.start);
516
+ if (chunk.intro.length) mappings.advance(chunk.intro);
517
+ if (chunk.edited) {
518
+ mappings.addEdit(
519
+ sourceIndex,
520
+ chunk.content,
521
+ loc,
522
+ chunk.storeName ? names.indexOf(chunk.original) : -1
523
+ );
524
+ } else {
525
+ mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
526
+ }
527
+ if (chunk.outro.length) mappings.advance(chunk.outro);
528
+ });
529
+ if (this.outro) {
530
+ mappings.advance(this.outro);
531
+ }
532
+ return {
533
+ file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
534
+ sources: [
535
+ options.source ? getRelativePath(options.file || "", options.source) : options.file || ""
536
+ ],
537
+ sourcesContent: options.includeContent ? [this.original] : void 0,
538
+ names,
539
+ mappings: mappings.raw,
540
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
541
+ };
542
+ }
543
+ generateMap(options) {
544
+ return new SourceMap(this.generateDecodedMap(options));
545
+ }
546
+ _ensureindentStr() {
547
+ if (this.indentStr === void 0) {
548
+ this.indentStr = guessIndent(this.original);
549
+ }
550
+ }
551
+ _getRawIndentString() {
552
+ this._ensureindentStr();
553
+ return this.indentStr;
554
+ }
555
+ getIndentString() {
556
+ this._ensureindentStr();
557
+ return this.indentStr === null ? " " : this.indentStr;
558
+ }
559
+ indent(indentStr, options) {
560
+ const pattern = /^[^\r\n]/gm;
561
+ if (isObject(indentStr)) {
562
+ options = indentStr;
563
+ indentStr = void 0;
564
+ }
565
+ if (indentStr === void 0) {
566
+ this._ensureindentStr();
567
+ indentStr = this.indentStr || " ";
568
+ }
569
+ if (indentStr === "") return this;
570
+ options = options || {};
571
+ const isExcluded = {};
572
+ if (options.exclude) {
573
+ const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
574
+ exclusions.forEach((exclusion) => {
575
+ for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
576
+ isExcluded[i] = true;
577
+ }
578
+ });
579
+ }
580
+ let shouldIndentNextCharacter = options.indentStart !== false;
581
+ const replacer = (match) => {
582
+ if (shouldIndentNextCharacter) return `${indentStr}${match}`;
583
+ shouldIndentNextCharacter = true;
584
+ return match;
585
+ };
586
+ this.intro = this.intro.replace(pattern, replacer);
587
+ let charIndex = 0;
588
+ let chunk = this.firstChunk;
589
+ while (chunk) {
590
+ const end = chunk.end;
591
+ if (chunk.edited) {
592
+ if (!isExcluded[charIndex]) {
593
+ chunk.content = chunk.content.replace(pattern, replacer);
594
+ if (chunk.content.length) {
595
+ shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
596
+ }
597
+ }
598
+ } else {
599
+ charIndex = chunk.start;
600
+ while (charIndex < end) {
601
+ if (!isExcluded[charIndex]) {
602
+ const char = this.original[charIndex];
603
+ if (char === "\n") {
604
+ shouldIndentNextCharacter = true;
605
+ } else if (char !== "\r" && shouldIndentNextCharacter) {
606
+ shouldIndentNextCharacter = false;
607
+ if (charIndex === chunk.start) {
608
+ chunk.prependRight(indentStr);
609
+ } else {
610
+ this._splitChunk(chunk, charIndex);
611
+ chunk = chunk.next;
612
+ chunk.prependRight(indentStr);
613
+ }
614
+ }
615
+ }
616
+ charIndex += 1;
617
+ }
618
+ }
619
+ charIndex = chunk.end;
620
+ chunk = chunk.next;
621
+ }
622
+ this.outro = this.outro.replace(pattern, replacer);
623
+ return this;
624
+ }
625
+ insert() {
626
+ throw new Error(
627
+ "magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
628
+ );
629
+ }
630
+ insertLeft(index, content) {
631
+ if (!warned.insertLeft) {
632
+ console.warn(
633
+ "magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
634
+ );
635
+ warned.insertLeft = true;
636
+ }
637
+ return this.appendLeft(index, content);
638
+ }
639
+ insertRight(index, content) {
640
+ if (!warned.insertRight) {
641
+ console.warn(
642
+ "magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
643
+ );
644
+ warned.insertRight = true;
645
+ }
646
+ return this.prependRight(index, content);
647
+ }
648
+ move(start, end, index) {
649
+ start = start + this.offset;
650
+ end = end + this.offset;
651
+ index = index + this.offset;
652
+ if (index >= start && index <= end) throw new Error("Cannot move a selection inside itself");
653
+ this._split(start);
654
+ this._split(end);
655
+ this._split(index);
656
+ const first = this.byStart[start];
657
+ const last = this.byEnd[end];
658
+ const oldLeft = first.previous;
659
+ const oldRight = last.next;
660
+ const newRight = this.byStart[index];
661
+ if (!newRight && last === this.lastChunk) return this;
662
+ const newLeft = newRight ? newRight.previous : this.lastChunk;
663
+ if (oldLeft) oldLeft.next = oldRight;
664
+ if (oldRight) oldRight.previous = oldLeft;
665
+ if (newLeft) newLeft.next = first;
666
+ if (newRight) newRight.previous = last;
667
+ if (!first.previous) this.firstChunk = last.next;
668
+ if (!last.next) {
669
+ this.lastChunk = first.previous;
670
+ this.lastChunk.next = null;
671
+ }
672
+ first.previous = newLeft;
673
+ last.next = newRight || null;
674
+ if (!newLeft) this.firstChunk = first;
675
+ if (!newRight) this.lastChunk = last;
676
+ return this;
677
+ }
678
+ overwrite(start, end, content, options) {
679
+ options = options || {};
680
+ return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
681
+ }
682
+ update(start, end, content, options) {
683
+ start = start + this.offset;
684
+ end = end + this.offset;
685
+ if (typeof content !== "string") throw new TypeError("replacement content must be a string");
686
+ if (this.original.length !== 0) {
687
+ while (start < 0) start += this.original.length;
688
+ while (end < 0) end += this.original.length;
689
+ }
690
+ if (end > this.original.length) throw new Error("end is out of bounds");
691
+ if (start === end)
692
+ throw new Error(
693
+ "Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead"
694
+ );
695
+ this._split(start);
696
+ this._split(end);
697
+ if (options === true) {
698
+ if (!warned.storeName) {
699
+ console.warn(
700
+ "The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
701
+ );
702
+ warned.storeName = true;
703
+ }
704
+ options = { storeName: true };
705
+ }
706
+ const storeName = options !== void 0 ? options.storeName : false;
707
+ const overwrite = options !== void 0 ? options.overwrite : false;
708
+ if (storeName) {
709
+ const original = this.original.slice(start, end);
710
+ Object.defineProperty(this.storedNames, original, {
711
+ writable: true,
712
+ value: true,
713
+ enumerable: true
714
+ });
715
+ }
716
+ const first = this.byStart[start];
717
+ const last = this.byEnd[end];
718
+ if (first) {
719
+ let chunk = first;
720
+ while (chunk !== last) {
721
+ if (chunk.next !== this.byStart[chunk.end]) {
722
+ throw new Error("Cannot overwrite across a split point");
723
+ }
724
+ chunk = chunk.next;
725
+ chunk.edit("", false);
726
+ }
727
+ first.edit(content, storeName, !overwrite);
728
+ } else {
729
+ const newChunk = new Chunk(start, end, "").edit(content, storeName);
730
+ last.next = newChunk;
731
+ newChunk.previous = last;
732
+ }
733
+ return this;
734
+ }
735
+ prepend(content) {
736
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
737
+ this.intro = content + this.intro;
738
+ return this;
739
+ }
740
+ prependLeft(index, content) {
741
+ index = index + this.offset;
742
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
743
+ this._split(index);
744
+ const chunk = this.byEnd[index];
745
+ if (chunk) {
746
+ chunk.prependLeft(content);
747
+ } else {
748
+ this.intro = content + this.intro;
749
+ }
750
+ return this;
751
+ }
752
+ prependRight(index, content) {
753
+ index = index + this.offset;
754
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
755
+ this._split(index);
756
+ const chunk = this.byStart[index];
757
+ if (chunk) {
758
+ chunk.prependRight(content);
759
+ } else {
760
+ this.outro = content + this.outro;
761
+ }
762
+ return this;
763
+ }
764
+ remove(start, end) {
765
+ start = start + this.offset;
766
+ end = end + this.offset;
767
+ if (this.original.length !== 0) {
768
+ while (start < 0) start += this.original.length;
769
+ while (end < 0) end += this.original.length;
770
+ }
771
+ if (start === end) return this;
772
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
773
+ if (start > end) throw new Error("end must be greater than start");
774
+ this._split(start);
775
+ this._split(end);
776
+ let chunk = this.byStart[start];
777
+ while (chunk) {
778
+ chunk.intro = "";
779
+ chunk.outro = "";
780
+ chunk.edit("");
781
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
782
+ }
783
+ return this;
784
+ }
785
+ reset(start, end) {
786
+ start = start + this.offset;
787
+ end = end + this.offset;
788
+ if (this.original.length !== 0) {
789
+ while (start < 0) start += this.original.length;
790
+ while (end < 0) end += this.original.length;
791
+ }
792
+ if (start === end) return this;
793
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
794
+ if (start > end) throw new Error("end must be greater than start");
795
+ this._split(start);
796
+ this._split(end);
797
+ let chunk = this.byStart[start];
798
+ while (chunk) {
799
+ chunk.reset();
800
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
801
+ }
802
+ return this;
803
+ }
804
+ lastChar() {
805
+ if (this.outro.length) return this.outro[this.outro.length - 1];
806
+ let chunk = this.lastChunk;
807
+ do {
808
+ if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
809
+ if (chunk.content.length) return chunk.content[chunk.content.length - 1];
810
+ if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
811
+ } while (chunk = chunk.previous);
812
+ if (this.intro.length) return this.intro[this.intro.length - 1];
813
+ return "";
814
+ }
815
+ lastLine() {
816
+ let lineIndex = this.outro.lastIndexOf(n);
817
+ if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
818
+ let lineStr = this.outro;
819
+ let chunk = this.lastChunk;
820
+ do {
821
+ if (chunk.outro.length > 0) {
822
+ lineIndex = chunk.outro.lastIndexOf(n);
823
+ if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
824
+ lineStr = chunk.outro + lineStr;
825
+ }
826
+ if (chunk.content.length > 0) {
827
+ lineIndex = chunk.content.lastIndexOf(n);
828
+ if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
829
+ lineStr = chunk.content + lineStr;
830
+ }
831
+ if (chunk.intro.length > 0) {
832
+ lineIndex = chunk.intro.lastIndexOf(n);
833
+ if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
834
+ lineStr = chunk.intro + lineStr;
835
+ }
836
+ } while (chunk = chunk.previous);
837
+ lineIndex = this.intro.lastIndexOf(n);
838
+ if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
839
+ return this.intro + lineStr;
840
+ }
841
+ slice(start = 0, end = this.original.length - this.offset) {
842
+ start = start + this.offset;
843
+ end = end + this.offset;
844
+ if (this.original.length !== 0) {
845
+ while (start < 0) start += this.original.length;
846
+ while (end < 0) end += this.original.length;
847
+ }
848
+ let result = "";
849
+ let chunk = this.firstChunk;
850
+ while (chunk && (chunk.start > start || chunk.end <= start)) {
851
+ if (chunk.start < end && chunk.end >= end) {
852
+ return result;
853
+ }
854
+ chunk = chunk.next;
855
+ }
856
+ if (chunk && chunk.edited && chunk.start !== start)
857
+ throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
858
+ const startChunk = chunk;
859
+ while (chunk) {
860
+ if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
861
+ result += chunk.intro;
862
+ }
863
+ const containsEnd = chunk.start < end && chunk.end >= end;
864
+ if (containsEnd && chunk.edited && chunk.end !== end)
865
+ throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
866
+ const sliceStart = startChunk === chunk ? start - chunk.start : 0;
867
+ const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
868
+ result += chunk.content.slice(sliceStart, sliceEnd);
869
+ if (chunk.outro && (!containsEnd || chunk.end === end)) {
870
+ result += chunk.outro;
871
+ }
872
+ if (containsEnd) {
873
+ break;
874
+ }
875
+ chunk = chunk.next;
876
+ }
877
+ return result;
878
+ }
879
+ // TODO deprecate this? not really very useful
880
+ snip(start, end) {
881
+ const clone = this.clone();
882
+ clone.remove(0, start);
883
+ clone.remove(end, clone.original.length);
884
+ return clone;
885
+ }
886
+ _split(index) {
887
+ if (this.byStart[index] || this.byEnd[index]) return;
888
+ let chunk = this.lastSearchedChunk;
889
+ let previousChunk = chunk;
890
+ const searchForward = index > chunk.end;
891
+ while (chunk) {
892
+ if (chunk.contains(index)) return this._splitChunk(chunk, index);
893
+ chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
894
+ if (chunk === previousChunk) return;
895
+ previousChunk = chunk;
896
+ }
897
+ }
898
+ _splitChunk(chunk, index) {
899
+ if (chunk.edited && chunk.content.length) {
900
+ const loc = getLocator(this.original)(index);
901
+ throw new Error(
902
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} \u2013 "${chunk.original}")`
903
+ );
904
+ }
905
+ const newChunk = chunk.split(index);
906
+ this.byEnd[index] = chunk;
907
+ this.byStart[index] = newChunk;
908
+ this.byEnd[newChunk.end] = newChunk;
909
+ if (chunk === this.lastChunk) this.lastChunk = newChunk;
910
+ this.lastSearchedChunk = chunk;
911
+ return true;
912
+ }
913
+ toString() {
914
+ let str = this.intro;
915
+ let chunk = this.firstChunk;
916
+ while (chunk) {
917
+ str += chunk.toString();
918
+ chunk = chunk.next;
919
+ }
920
+ return str + this.outro;
921
+ }
922
+ isEmpty() {
923
+ let chunk = this.firstChunk;
924
+ do {
925
+ if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim())
926
+ return false;
927
+ } while (chunk = chunk.next);
928
+ return true;
929
+ }
930
+ length() {
931
+ let chunk = this.firstChunk;
932
+ let length = 0;
933
+ do {
934
+ length += chunk.intro.length + chunk.content.length + chunk.outro.length;
935
+ } while (chunk = chunk.next);
936
+ return length;
937
+ }
938
+ trimLines() {
939
+ return this.trim("[\\r\\n]");
940
+ }
941
+ trim(charType) {
942
+ return this.trimStart(charType).trimEnd(charType);
943
+ }
944
+ trimEndAborted(charType) {
945
+ const rx = new RegExp((charType || "\\s") + "+$");
946
+ this.outro = this.outro.replace(rx, "");
947
+ if (this.outro.length) return true;
948
+ let chunk = this.lastChunk;
949
+ do {
950
+ const end = chunk.end;
951
+ const aborted = chunk.trimEnd(rx);
952
+ if (chunk.end !== end) {
953
+ if (this.lastChunk === chunk) {
954
+ this.lastChunk = chunk.next;
955
+ }
956
+ this.byEnd[chunk.end] = chunk;
957
+ this.byStart[chunk.next.start] = chunk.next;
958
+ this.byEnd[chunk.next.end] = chunk.next;
959
+ }
960
+ if (aborted) return true;
961
+ chunk = chunk.previous;
962
+ } while (chunk);
963
+ return false;
964
+ }
965
+ trimEnd(charType) {
966
+ this.trimEndAborted(charType);
967
+ return this;
968
+ }
969
+ trimStartAborted(charType) {
970
+ const rx = new RegExp("^" + (charType || "\\s") + "+");
971
+ this.intro = this.intro.replace(rx, "");
972
+ if (this.intro.length) return true;
973
+ let chunk = this.firstChunk;
974
+ do {
975
+ const end = chunk.end;
976
+ const aborted = chunk.trimStart(rx);
977
+ if (chunk.end !== end) {
978
+ if (chunk === this.lastChunk) this.lastChunk = chunk.next;
979
+ this.byEnd[chunk.end] = chunk;
980
+ this.byStart[chunk.next.start] = chunk.next;
981
+ this.byEnd[chunk.next.end] = chunk.next;
982
+ }
983
+ if (aborted) return true;
984
+ chunk = chunk.next;
985
+ } while (chunk);
986
+ return false;
987
+ }
988
+ trimStart(charType) {
989
+ this.trimStartAborted(charType);
990
+ return this;
991
+ }
992
+ hasChanged() {
993
+ return this.original !== this.toString();
994
+ }
995
+ _replaceRegexp(searchValue, replacement) {
996
+ function getReplacement(match, str) {
997
+ if (typeof replacement === "string") {
998
+ return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
999
+ if (i === "$") return "$";
1000
+ if (i === "&") return match[0];
1001
+ const num = +i;
1002
+ if (num < match.length) return match[+i];
1003
+ return `$${i}`;
1004
+ });
1005
+ } else {
1006
+ return replacement(...match, match.index, str, match.groups);
1007
+ }
1008
+ }
1009
+ function matchAll(re, str) {
1010
+ let match;
1011
+ const matches = [];
1012
+ while (match = re.exec(str)) {
1013
+ matches.push(match);
1014
+ }
1015
+ return matches;
1016
+ }
1017
+ if (searchValue.global) {
1018
+ const matches = matchAll(searchValue, this.original);
1019
+ matches.forEach((match) => {
1020
+ if (match.index != null) {
1021
+ const replacement2 = getReplacement(match, this.original);
1022
+ if (replacement2 !== match[0]) {
1023
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
1024
+ }
1025
+ }
1026
+ });
1027
+ } else {
1028
+ const match = this.original.match(searchValue);
1029
+ if (match && match.index != null) {
1030
+ const replacement2 = getReplacement(match, this.original);
1031
+ if (replacement2 !== match[0]) {
1032
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
1033
+ }
1034
+ }
1035
+ }
1036
+ return this;
1037
+ }
1038
+ _replaceString(string, replacement) {
1039
+ const { original } = this;
1040
+ const index = original.indexOf(string);
1041
+ if (index !== -1) {
1042
+ if (typeof replacement === "function") {
1043
+ replacement = replacement(string, index, original);
1044
+ }
1045
+ if (string !== replacement) {
1046
+ this.overwrite(index, index + string.length, replacement);
1047
+ }
1048
+ }
1049
+ return this;
1050
+ }
1051
+ replace(searchValue, replacement) {
1052
+ if (typeof searchValue === "string") {
1053
+ return this._replaceString(searchValue, replacement);
1054
+ }
1055
+ return this._replaceRegexp(searchValue, replacement);
1056
+ }
1057
+ _replaceAllString(string, replacement) {
1058
+ const { original } = this;
1059
+ const stringLength = string.length;
1060
+ for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
1061
+ const previous = original.slice(index, index + stringLength);
1062
+ let _replacement = replacement;
1063
+ if (typeof replacement === "function") {
1064
+ _replacement = replacement(previous, index, original);
1065
+ }
1066
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
1067
+ }
1068
+ return this;
1069
+ }
1070
+ replaceAll(searchValue, replacement) {
1071
+ if (typeof searchValue === "string") {
1072
+ return this._replaceAllString(searchValue, replacement);
1073
+ }
1074
+ if (!searchValue.global) {
1075
+ throw new TypeError(
1076
+ "MagicString.prototype.replaceAll called with a non-global RegExp argument"
1077
+ );
1078
+ }
1079
+ return this._replaceRegexp(searchValue, replacement);
1080
+ }
1081
+ };
1082
+ var hasOwnProp = Object.prototype.hasOwnProperty;
1083
+ var Bundle = class _Bundle {
1084
+ constructor(options = {}) {
1085
+ this.intro = options.intro || "";
1086
+ this.separator = options.separator !== void 0 ? options.separator : "\n";
1087
+ this.sources = [];
1088
+ this.uniqueSources = [];
1089
+ this.uniqueSourceIndexByFilename = {};
1090
+ }
1091
+ addSource(source) {
1092
+ if (source instanceof MagicString) {
1093
+ return this.addSource({
1094
+ content: source,
1095
+ filename: source.filename,
1096
+ separator: this.separator
1097
+ });
1098
+ }
1099
+ if (!isObject(source) || !source.content) {
1100
+ throw new Error(
1101
+ "bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`"
1102
+ );
1103
+ }
1104
+ ["filename", "ignoreList", "indentExclusionRanges", "separator"].forEach((option) => {
1105
+ if (!hasOwnProp.call(source, option)) source[option] = source.content[option];
1106
+ });
1107
+ if (source.separator === void 0) {
1108
+ source.separator = this.separator;
1109
+ }
1110
+ if (source.filename) {
1111
+ if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
1112
+ this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
1113
+ this.uniqueSources.push({ filename: source.filename, content: source.content.original });
1114
+ } else {
1115
+ const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
1116
+ if (source.content.original !== uniqueSource.content) {
1117
+ throw new Error(`Illegal source: same filename (${source.filename}), different contents`);
1118
+ }
1119
+ }
1120
+ }
1121
+ this.sources.push(source);
1122
+ return this;
1123
+ }
1124
+ append(str, options) {
1125
+ this.addSource({
1126
+ content: new MagicString(str),
1127
+ separator: options && options.separator || ""
1128
+ });
1129
+ return this;
1130
+ }
1131
+ clone() {
1132
+ const bundle = new _Bundle({
1133
+ intro: this.intro,
1134
+ separator: this.separator
1135
+ });
1136
+ this.sources.forEach((source) => {
1137
+ bundle.addSource({
1138
+ filename: source.filename,
1139
+ content: source.content.clone(),
1140
+ separator: source.separator
1141
+ });
1142
+ });
1143
+ return bundle;
1144
+ }
1145
+ generateDecodedMap(options = {}) {
1146
+ const names = [];
1147
+ let x_google_ignoreList = void 0;
1148
+ this.sources.forEach((source) => {
1149
+ Object.keys(source.content.storedNames).forEach((name) => {
1150
+ if (!~names.indexOf(name)) names.push(name);
1151
+ });
1152
+ });
1153
+ const mappings = new Mappings(options.hires);
1154
+ if (this.intro) {
1155
+ mappings.advance(this.intro);
1156
+ }
1157
+ this.sources.forEach((source, i) => {
1158
+ if (i > 0) {
1159
+ mappings.advance(this.separator);
1160
+ }
1161
+ const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
1162
+ const magicString = source.content;
1163
+ const locate = getLocator(magicString.original);
1164
+ if (magicString.intro) {
1165
+ mappings.advance(magicString.intro);
1166
+ }
1167
+ magicString.firstChunk.eachNext((chunk) => {
1168
+ const loc = locate(chunk.start);
1169
+ if (chunk.intro.length) mappings.advance(chunk.intro);
1170
+ if (source.filename) {
1171
+ if (chunk.edited) {
1172
+ mappings.addEdit(
1173
+ sourceIndex,
1174
+ chunk.content,
1175
+ loc,
1176
+ chunk.storeName ? names.indexOf(chunk.original) : -1
1177
+ );
1178
+ } else {
1179
+ mappings.addUneditedChunk(
1180
+ sourceIndex,
1181
+ chunk,
1182
+ magicString.original,
1183
+ loc,
1184
+ magicString.sourcemapLocations
1185
+ );
1186
+ }
1187
+ } else {
1188
+ mappings.advance(chunk.content);
1189
+ }
1190
+ if (chunk.outro.length) mappings.advance(chunk.outro);
1191
+ });
1192
+ if (magicString.outro) {
1193
+ mappings.advance(magicString.outro);
1194
+ }
1195
+ if (source.ignoreList && sourceIndex !== -1) {
1196
+ if (x_google_ignoreList === void 0) {
1197
+ x_google_ignoreList = [];
1198
+ }
1199
+ x_google_ignoreList.push(sourceIndex);
1200
+ }
1201
+ });
1202
+ return {
1203
+ file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
1204
+ sources: this.uniqueSources.map((source) => {
1205
+ return options.file ? getRelativePath(options.file, source.filename) : source.filename;
1206
+ }),
1207
+ sourcesContent: this.uniqueSources.map((source) => {
1208
+ return options.includeContent ? source.content : null;
1209
+ }),
1210
+ names,
1211
+ mappings: mappings.raw,
1212
+ x_google_ignoreList
1213
+ };
1214
+ }
1215
+ generateMap(options) {
1216
+ return new SourceMap(this.generateDecodedMap(options));
1217
+ }
1218
+ getIndentString() {
1219
+ const indentStringCounts = {};
1220
+ this.sources.forEach((source) => {
1221
+ const indentStr = source.content._getRawIndentString();
1222
+ if (indentStr === null) return;
1223
+ if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;
1224
+ indentStringCounts[indentStr] += 1;
1225
+ });
1226
+ return Object.keys(indentStringCounts).sort((a, b) => {
1227
+ return indentStringCounts[a] - indentStringCounts[b];
1228
+ })[0] || " ";
1229
+ }
1230
+ indent(indentStr) {
1231
+ if (!arguments.length) {
1232
+ indentStr = this.getIndentString();
1233
+ }
1234
+ if (indentStr === "") return this;
1235
+ let trailingNewline = !this.intro || this.intro.slice(-1) === "\n";
1236
+ this.sources.forEach((source, i) => {
1237
+ const separator = source.separator !== void 0 ? source.separator : this.separator;
1238
+ const indentStart = trailingNewline || i > 0 && /\r?\n$/.test(separator);
1239
+ source.content.indent(indentStr, {
1240
+ exclude: source.indentExclusionRanges,
1241
+ indentStart
1242
+ //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
1243
+ });
1244
+ trailingNewline = source.content.lastChar() === "\n";
1245
+ });
1246
+ if (this.intro) {
1247
+ this.intro = indentStr + this.intro.replace(/^[^\n]/gm, (match, index) => {
1248
+ return index > 0 ? indentStr + match : match;
1249
+ });
1250
+ }
1251
+ return this;
1252
+ }
1253
+ prepend(str) {
1254
+ this.intro = str + this.intro;
1255
+ return this;
1256
+ }
1257
+ toString() {
1258
+ const body = this.sources.map((source, i) => {
1259
+ const separator = source.separator !== void 0 ? source.separator : this.separator;
1260
+ const str = (i > 0 ? separator : "") + source.content.toString();
1261
+ return str;
1262
+ }).join("");
1263
+ return this.intro + body;
1264
+ }
1265
+ isEmpty() {
1266
+ if (this.intro.length && this.intro.trim()) return false;
1267
+ if (this.sources.some((source) => !source.content.isEmpty())) return false;
1268
+ return true;
1269
+ }
1270
+ length() {
1271
+ return this.sources.reduce(
1272
+ (length, source) => length + source.content.length(),
1273
+ this.intro.length
1274
+ );
1275
+ }
1276
+ trimLines() {
1277
+ return this.trim("[\\r\\n]");
1278
+ }
1279
+ trim(charType) {
1280
+ return this.trimStart(charType).trimEnd(charType);
1281
+ }
1282
+ trimStart(charType) {
1283
+ const rx = new RegExp("^" + (charType || "\\s") + "+");
1284
+ this.intro = this.intro.replace(rx, "");
1285
+ if (!this.intro) {
1286
+ let source;
1287
+ let i = 0;
1288
+ do {
1289
+ source = this.sources[i++];
1290
+ if (!source) {
1291
+ break;
1292
+ }
1293
+ } while (!source.content.trimStartAborted(charType));
1294
+ }
1295
+ return this;
1296
+ }
1297
+ trimEnd(charType) {
1298
+ const rx = new RegExp((charType || "\\s") + "+$");
1299
+ let source;
1300
+ let i = this.sources.length - 1;
1301
+ do {
1302
+ source = this.sources[i--];
1303
+ if (!source) {
1304
+ this.intro = this.intro.replace(rx, "");
1305
+ break;
1306
+ }
1307
+ } while (!source.content.trimEndAborted(charType));
1308
+ return this;
1309
+ }
1310
+ };
1311
+ export {
1312
+ Bundle,
1313
+ SourceMap,
1314
+ MagicString as default
1315
+ };
1316
+ //# sourceMappingURL=magic-string.es-RGXYGAW3.js.map