tower-studio 0.2.42 → 0.2.43

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 (391) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/standalone/.next/build-manifest.json +3 -3
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +8 -0
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +3 -3
  14. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +27 -27
  15. package/.next/standalone/.next/server/app/_not-found/page.js +6 -6
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/api/adapters/test/route.js +3 -3
  19. package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js +1 -1
  22. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js +1 -1
  25. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js +1 -1
  28. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js +3 -3
  30. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/internal/assistant/route.js +2 -2
  32. package/.next/standalone/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js +1 -1
  34. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js +1 -1
  36. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js +1 -1
  38. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js +3 -2
  40. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/internal/hooks/session/route.js +1 -1
  42. package/.next/standalone/.next/server/app/api/internal/hooks/session/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js +2 -2
  44. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js +2 -2
  46. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js +1 -1
  48. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/buffer/route.js +1 -1
  50. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/buffer/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/input/route.js +1 -1
  52. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/input/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/paste-image/route/app-paths-manifest.json +3 -0
  54. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/paste-image/route/build-manifest.json +9 -0
  55. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/paste-image/route/server-reference-manifest.json +4 -0
  56. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/paste-image/route.js +8 -0
  57. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/paste-image/route.js.nft.json +1 -0
  58. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/paste-image/route_client-reference-manifest.js +3 -0
  59. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route.js +4 -3
  60. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +6 -5
  62. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route.js +4 -3
  64. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route.js.nft.json +1 -1
  65. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js +1 -1
  66. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
  67. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js +1 -1
  68. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js +3 -3
  70. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +2 -2
  72. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +64 -64
  73. package/.next/standalone/.next/server/app/missions/page.js +6 -6
  74. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  76. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +3 -3
  77. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +27 -27
  78. package/.next/standalone/.next/server/app/onboarding/page.js +6 -6
  79. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  81. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +3 -3
  82. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +27 -27
  83. package/.next/standalone/.next/server/app/page.js +6 -6
  84. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  86. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +3 -3
  87. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +44 -44
  88. package/.next/standalone/.next/server/app/settings/page.js +6 -6
  89. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  90. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  91. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +3 -3
  92. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +109 -109
  93. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js +6 -6
  94. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  96. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +3 -3
  97. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +88 -88
  98. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js +6 -6
  99. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  100. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  101. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +3 -3
  102. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +75 -75
  103. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js +6 -6
  104. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  106. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +3 -3
  107. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +75 -75
  108. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js +6 -6
  109. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +3 -3
  112. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +27 -27
  113. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js +7 -7
  114. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +3 -3
  117. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +67 -67
  118. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js +6 -6
  119. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  121. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +4 -4
  122. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +79 -79
  123. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +6 -6
  124. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  126. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +3 -3
  127. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +50 -50
  128. package/.next/standalone/.next/server/app/workspaces/page.js +6 -6
  129. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  130. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
  132. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_03qwlhl.js +1 -1
  133. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_09pca3o.js +1 -1
  134. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +1 -1
  135. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0h5yr8p.js +1 -1
  136. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0m8aavq.js +1 -1
  137. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0yp430z.js +1 -1
  138. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0yzw48x.js +1 -1
  139. package/.next/standalone/.next/server/chunks/0zjb_server_app_api_internal_terminal_[taskId]_paste-image_route_actions_0iegbi4.js +3 -0
  140. package/.next/standalone/.next/server/chunks/[externals]__0x_wqa7._.js +3 -0
  141. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-z_a1d._.js +1 -1
  142. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.p6em~._.js +3 -0
  143. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.zmhk-._.js +3 -0
  144. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0042hx5._.js +3 -0
  145. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0b3m.jm._.js → [root-of-the-server]__03ufxqq._.js} +3 -3
  146. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04--bs7._.js +3 -0
  147. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04m2l8a._.js +3 -0
  148. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04r193~._.js +3 -0
  149. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05abzth._.js +3 -0
  150. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0657y50._.js +3 -0
  151. package/.next/standalone/.next/server/chunks/[root-of-the-server]__075a0hk._.js +3 -0
  152. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08yqoti._.js +3 -0
  153. package/.next/standalone/.next/server/chunks/[root-of-the-server]__098.3z2._.js +3 -0
  154. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0obk~80._.js → [root-of-the-server]__0_d.s7s._.js} +3 -3
  155. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0askhfg._.js → [root-of-the-server]__0ajay8_._.js} +2 -2
  156. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b25v3p._.js +4 -0
  157. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0xswbi9._.js → [root-of-the-server]__0clptds._.js} +2 -2
  158. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ai09na._.js → [root-of-the-server]__0g.k9o~._.js} +2 -2
  159. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gn0ubd._.js +1 -1
  160. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gwztza._.js +1 -1
  161. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0h6bl6t._.js +3 -0
  162. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0iggiij._.js +3 -0
  163. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0i~3dwq._.js +3 -0
  164. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0j1px8f._.js +3 -0
  165. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0k-5ag7._.js +3 -0
  166. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l1-djp._.js +1 -1
  167. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-~q463._.js → [root-of-the-server]__0lvlooo._.js} +2 -2
  168. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0otyifi._.js +1 -1
  169. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q~uf3u._.js +3 -0
  170. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0t31ba_._.js +3 -0
  171. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0t_weyi._.js +3 -0
  172. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__06qz5fz._.js → [root-of-the-server]__0uptkzd._.js} +3 -3
  173. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wkjqrd._.js +3 -0
  174. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0x3kws1._.js +3 -0
  175. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0xot7fu._.js +1 -1
  176. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0~6py0f._.js → [root-of-the-server]__0y8w5di._.js} +3 -3
  177. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~g6-c~._.js +3 -0
  178. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10fv6tt._.js +3 -0
  179. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1189rd1._.js +4 -0
  180. package/.next/standalone/.next/server/chunks/{_06.mxka._.js → _0jmdgq~._.js} +1 -1
  181. package/.next/standalone/.next/server/chunks/{_0aflzks._.js → _0q10iet._.js} +1 -1
  182. package/.next/standalone/.next/server/chunks/_0qk_esg._.js +2 -2
  183. package/.next/standalone/.next/server/chunks/_0t31z6q._.js +1 -1
  184. package/.next/standalone/.next/server/chunks/{_0b~hjvi._.js → _12537g8._.js} +1 -1
  185. package/.next/standalone/.next/server/chunks/src_0fq3zjg._.js +3 -0
  186. package/.next/standalone/.next/server/chunks/src_0weytpz._.js +1 -1
  187. package/.next/standalone/.next/server/chunks/src_0wlyw0g._.js +3 -0
  188. package/.next/standalone/.next/server/chunks/src_0~ey84y._.js +3 -0
  189. package/.next/standalone/.next/server/chunks/src_actions_agent-actions_ts_10q9r5b._.js +2 -2
  190. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  191. package/.next/standalone/.next/server/chunks/ssr/0se9_next_11h0sx_._.js +1 -1
  192. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__00dh103._.js +3 -0
  193. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0mmypbn._.js → [root-of-the-server]__00ebsjb._.js} +1 -1
  194. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0c2mh1c._.js → [root-of-the-server]__01vm_46._.js} +4 -4
  195. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__025ol9g._.js +3 -0
  196. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__094t44p._.js → [root-of-the-server]__04ednzb._.js} +1 -1
  197. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04wbr9x._.js +1 -1
  198. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05xg05r._.js +1 -1
  199. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__065f3ii._.js +3 -0
  200. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0pmjob9._.js → [root-of-the-server]__06dfcgo._.js} +1 -1
  201. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__038u_kv._.js → [root-of-the-server]__07xkj1s._.js} +4 -4
  202. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08k-xb7._.js +3 -0
  203. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08tzbfh._.js +3 -0
  204. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0.infp2._.js → [root-of-the-server]__0_z5hke._.js} +1 -1
  205. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ce3fpq._.js → [root-of-the-server]__0ecd_1d._.js} +4 -4
  206. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__10s67lq._.js → [root-of-the-server]__0iln7n_._.js} +4 -4
  207. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09z_ddd._.js → [root-of-the-server]__0j_-qk5._.js} +1 -1
  208. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
  209. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0.u-t.1._.js → [root-of-the-server]__0k6oo0n._.js} +1 -1
  210. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0h589~0._.js → [root-of-the-server]__0lws68d._.js} +4 -4
  211. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0oq-j16._.js → [root-of-the-server]__0oamph.._.js} +4 -4
  212. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0pvaj~l._.js → [root-of-the-server]__0pnv7nd._.js} +1 -1
  213. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0whlq2_._.js → [root-of-the-server]__0stlq2_._.js} +2 -2
  214. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__03fujv7._.js → [root-of-the-server]__0tja~wz._.js} +1 -1
  215. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0391jsv._.js → [root-of-the-server]__0ug022w._.js} +1 -1
  216. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0l6bt9t._.js → [root-of-the-server]__0x6k.ee._.js} +1 -1
  217. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0dsaqeq._.js → [root-of-the-server]__0xr45lx._.js} +2 -2
  218. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__058rbx5._.js → [root-of-the-server]__0xwzk2.._.js} +4 -4
  219. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__12w35bx._.js → [root-of-the-server]__0yby8pl._.js} +4 -4
  220. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
  221. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0rckee~._.js → [root-of-the-server]__0zxc81t._.js} +1 -1
  222. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0dux7x.._.js → [root-of-the-server]__0zzqn5z._.js} +1 -1
  223. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0mq0f94._.js → [root-of-the-server]__10c.a3u._.js} +1 -1
  224. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0.2h0ux._.js → [root-of-the-server]__10n3vn6._.js} +1 -1
  225. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09t~p.u._.js → [root-of-the-server]__123rmyb._.js} +1 -1
  226. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__124zb~p._.js +30 -0
  227. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__02j1enz._.js → [root-of-the-server]__127w3bm._.js} +1 -1
  228. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0h-se8t._.js → [root-of-the-server]__12ko8p6._.js} +2 -2
  229. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0odeai5._.js → [root-of-the-server]__13ce7v2._.js} +1 -1
  230. package/.next/standalone/.next/server/chunks/ssr/_0-~9em3._.js +1 -1
  231. package/.next/standalone/.next/server/chunks/ssr/{_0f~l8kv._.js → _00l85fp._.js} +3 -3
  232. package/.next/standalone/.next/server/chunks/ssr/{_0c2gong._.js → _00odlgv._.js} +2 -2
  233. package/.next/standalone/.next/server/chunks/ssr/{_0whlnt7._.js → _0463zy~._.js} +2 -2
  234. package/.next/standalone/.next/server/chunks/ssr/{_0rq68d8._.js → _047dh-f._.js} +2 -2
  235. package/.next/standalone/.next/server/chunks/ssr/{_03lt1_x._.js → _05a2u03._.js} +4 -4
  236. package/.next/standalone/.next/server/chunks/ssr/{_0_5abui._.js → _05k76ur._.js} +2 -2
  237. package/.next/standalone/.next/server/chunks/ssr/{_0n4bq0m._.js → _060e1u.._.js} +1 -1
  238. package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
  239. package/.next/standalone/.next/server/chunks/ssr/{_0n5do.z._.js → _07lq-bp._.js} +1 -1
  240. package/.next/standalone/.next/server/chunks/ssr/{_0p6p_68._.js → _07q06~v._.js} +4 -4
  241. package/.next/standalone/.next/server/chunks/ssr/{_0mm~wxj._.js → _08-x_rp._.js} +1 -1
  242. package/.next/standalone/.next/server/chunks/ssr/_08bq4g8._.js +1 -1
  243. package/.next/standalone/.next/server/chunks/ssr/{_12ca88g._.js → _0_q41~z._.js} +4 -4
  244. package/.next/standalone/.next/server/chunks/ssr/{_0o2tntr._.js → _0b7smy6._.js} +2 -2
  245. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  246. package/.next/standalone/.next/server/chunks/ssr/{_0u7c6bz._.js → _0dxbp89._.js} +4 -4
  247. package/.next/standalone/.next/server/chunks/ssr/{_0axcfvf._.js → _0gkid_a._.js} +2 -2
  248. package/.next/standalone/.next/server/chunks/ssr/{_0tvm5af._.js → _0j5.ig_._.js} +1 -1
  249. package/.next/standalone/.next/server/chunks/ssr/{_0py1s-f._.js → _0nze-e6._.js} +1 -1
  250. package/.next/standalone/.next/server/chunks/ssr/{_0u.n7v8._.js → _0oeih09._.js} +2 -2
  251. package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
  252. package/.next/standalone/.next/server/chunks/ssr/{_0~oc5bl._.js → _0rrs.-d._.js} +2 -2
  253. package/.next/standalone/.next/server/chunks/ssr/{_0q2mf9q._.js → _0rtydyv._.js} +1 -1
  254. package/.next/standalone/.next/server/chunks/ssr/_0rxeqmo._.js +1 -1
  255. package/.next/standalone/.next/server/chunks/ssr/{_04bt0.3._.js → _0s.h4l2._.js} +1 -1
  256. package/.next/standalone/.next/server/chunks/ssr/{_09z2zmm._.js → _0s.ik0k._.js} +1 -1
  257. package/.next/standalone/.next/server/chunks/ssr/{_116-_2z._.js → _0syb503._.js} +2 -2
  258. package/.next/standalone/.next/server/chunks/ssr/{_0m.wslt._.js → _0uryq~z._.js} +2 -2
  259. package/.next/standalone/.next/server/chunks/ssr/_0wbcp88._.js +1 -1
  260. package/.next/standalone/.next/server/chunks/ssr/{_04~zqvy._.js → _0wqcz3w._.js} +4 -4
  261. package/.next/standalone/.next/server/chunks/ssr/{_0rrzd20._.js → _113957g._.js} +1 -1
  262. package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
  263. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  264. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
  265. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  266. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  267. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  268. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  269. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  270. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  271. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_notes_notes-page-client_tsx_10gyo3v._.js +1 -1
  272. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  273. package/.next/standalone/.next/server/chunks/ssr/src_components_ui_select_tsx_0d2ra01._.js +1 -1
  274. package/.next/standalone/.next/server/chunks/ssr/{src_lib_0_9avpk._.js → src_lib_0.~.oo-._.js} +1 -1
  275. package/.next/standalone/.next/server/chunks/ssr/{src_lib_02~3_5t._.js → src_lib_005uqbe._.js} +1 -1
  276. package/.next/standalone/.next/server/chunks/ssr/{src_lib_04d~c.c._.js → src_lib_00wjv6n._.js} +1 -1
  277. package/.next/standalone/.next/server/chunks/ssr/{src_lib_08wv1le._.js → src_lib_01sr8_t._.js} +1 -1
  278. package/.next/standalone/.next/server/chunks/ssr/src_lib_08jql1e._.js +3 -0
  279. package/.next/standalone/.next/server/chunks/ssr/src_lib_0b~j-9d._.js +3 -0
  280. package/.next/standalone/.next/server/chunks/ssr/src_lib_0eymyjf._.js +3 -0
  281. package/.next/standalone/.next/server/chunks/ssr/src_lib_0fkv9z3._.js +3 -0
  282. package/.next/standalone/.next/server/chunks/ssr/src_lib_0n-n0.a._.js +3 -0
  283. package/.next/standalone/.next/server/chunks/ssr/src_lib_0sgt~lv._.js +3 -0
  284. package/.next/standalone/.next/server/chunks/ssr/src_lib_0x-iyl1._.js +3 -0
  285. package/.next/standalone/.next/server/chunks/ssr/src_lib_0yjmty1._.js +3 -0
  286. package/.next/standalone/.next/server/chunks/ssr/src_lib_13aevv6._.js +3 -0
  287. package/.next/standalone/.next/server/functions-config-manifest.json +1 -0
  288. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  289. package/.next/standalone/.next/server/pages/500.html +1 -1
  290. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  291. package/.next/standalone/.next/server/server-reference-manifest.json +246 -246
  292. package/.next/standalone/.next/static/chunks/{17fug-zaik-v~.js → 0-vgfstmpuwnx.js} +1 -1
  293. package/.next/standalone/.next/static/chunks/0.lyp-cx3zt9..js +2 -0
  294. package/.next/standalone/.next/static/chunks/{0clewc5ifaruu.js → 00z.kuqsfrxq5.js} +2 -2
  295. package/.next/standalone/.next/static/chunks/01j9m895w64zn.js +1 -0
  296. package/.next/standalone/.next/static/chunks/01rbl6a8z.tuw.js +1 -0
  297. package/.next/standalone/.next/static/chunks/{0.wxa05y455w7.js → 04op7bjge~n4l.js} +1 -1
  298. package/.next/standalone/.next/static/chunks/{13.3woq55msp..js → 05v-c3ir3ik_1.js} +1 -1
  299. package/.next/standalone/.next/static/chunks/{0bdwzhoelky9-.js → 070fs6rmafi.i.js} +1 -1
  300. package/.next/standalone/.next/static/chunks/07i9j5yyg4vs3.js +1 -0
  301. package/.next/standalone/.next/static/chunks/{040j8d.w8mkyn.js → 08i9.47-_mxro.js} +1 -1
  302. package/.next/standalone/.next/static/chunks/{0ypd9eqm_pj-o.js → 0_yp-y9l0upp~.js} +1 -1
  303. package/.next/standalone/.next/static/chunks/0ddt-snh45031.js +1 -0
  304. package/.next/standalone/.next/static/chunks/0evfu1ozaw5ak.js +1 -0
  305. package/.next/standalone/.next/static/chunks/{0wcwdbtpm0~r6.js → 0gq65t6au55oa.js} +1 -1
  306. package/.next/standalone/.next/static/chunks/0gz71w_~yw2iu.js +1 -0
  307. package/.next/standalone/.next/static/chunks/{0dewfthzwmcwb.js → 0hk3lmsij2x1c.js} +1 -1
  308. package/.next/standalone/.next/static/chunks/0j1hqwmeaqnn2.js +1 -0
  309. package/.next/standalone/.next/static/chunks/{0_d04kox03m72.css → 0jrje~1gt6w85.css} +1 -1
  310. package/.next/standalone/.next/static/chunks/0prrt_bws8ml6.js +1 -0
  311. package/.next/standalone/.next/static/chunks/0qgqjy.9.-qpi.js +1 -0
  312. package/.next/standalone/.next/static/chunks/{0m~m1~si.ot17.js → 0rfq8fy71hj7c.js} +1 -1
  313. package/.next/standalone/.next/static/chunks/{02f8-ju2se8qw.js → 0rjt_ddd~6t8r.js} +1 -1
  314. package/.next/standalone/.next/static/chunks/{0.onaugl2w8ci.js → 0rnitheqdpd1..js} +1 -1
  315. package/.next/standalone/.next/static/chunks/{035a_v6g7ioyw.js → 0sr-m2t6vck14.js} +1 -1
  316. package/.next/standalone/.next/static/chunks/{0rozlwh3y46l0.js → 0ts___1ygewqp.js} +1 -1
  317. package/.next/standalone/.next/static/chunks/0vmy6tsqy.xf4.js +1 -0
  318. package/.next/standalone/.next/static/chunks/0wbq-_8jyxjxm.js +1 -0
  319. package/.next/standalone/.next/static/chunks/0xejm4ge9~cn..js +1 -0
  320. package/.next/standalone/.next/static/chunks/0~prx0ure_1i6.js +1 -0
  321. package/.next/standalone/.next/static/chunks/1107zshxaajt9.js +1 -0
  322. package/.next/standalone/.next/static/chunks/{17m4o~gdsvuo3.js → 11p.r-9wyh7_2.js} +1 -1
  323. package/.next/standalone/.next/static/chunks/11x3_612u8w~9.js +1 -0
  324. package/.next/standalone/.next/static/chunks/14mk_a0k99wbg.js +1 -0
  325. package/.next/standalone/package.json +9 -9
  326. package/dist/mcp-server.cjs +131 -74
  327. package/next.config.ts +4 -0
  328. package/package.json +9 -9
  329. package/skills/tower/SKILL.md +6 -0
  330. package/.next/standalone/.next/server/chunks/[externals]__0izylsq._.js +0 -3
  331. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.tbb~k._.js +0 -3
  332. package/.next/standalone/.next/server/chunks/[root-of-the-server]__032d9pl._.js +0 -3
  333. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04jduyo._.js +0 -3
  334. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05zlbau._.js +0 -4
  335. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05~g1fm._.js +0 -3
  336. package/.next/standalone/.next/server/chunks/[root-of-the-server]__075f7rs._.js +0 -4
  337. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08b~~wj._.js +0 -3
  338. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bo_6v~._.js +0 -3
  339. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c7z.~a._.js +0 -3
  340. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e~6fr~._.js +0 -3
  341. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fey.8j._.js +0 -3
  342. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fxmnch._.js +0 -4
  343. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gr~8aq._.js +0 -3
  344. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hd.0to._.js +0 -3
  345. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0j3l3l4._.js +0 -3
  346. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0r-6wmj._.js +0 -3
  347. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rpck4h._.js +0 -3
  348. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0skk0fd._.js +0 -3
  349. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0t_yyy8._.js +0 -3
  350. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0v2nkck._.js +0 -3
  351. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z20rmt._.js +0 -3
  352. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11l3gud._.js +0 -3
  353. package/.next/standalone/.next/server/chunks/[root-of-the-server]__126b53k._.js +0 -4
  354. package/.next/standalone/.next/server/chunks/src_02ruq-1._.js +0 -3
  355. package/.next/standalone/.next/server/chunks/src_07gek7k._.js +0 -3
  356. package/.next/standalone/.next/server/chunks/src_0mqkaid._.js +0 -3
  357. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.-z9ts._.js +0 -3
  358. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__045k323._.js +0 -3
  359. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__087pocz._.js +0 -3
  360. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gt5dbj._.js +0 -3
  361. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ni-_7_._.js +0 -30
  362. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0y~ooou._.js +0 -3
  363. package/.next/standalone/.next/server/chunks/ssr/src_lib_0a60u40._.js +0 -3
  364. package/.next/standalone/.next/server/chunks/ssr/src_lib_0fu5szn._.js +0 -3
  365. package/.next/standalone/.next/server/chunks/ssr/src_lib_0gve57o._.js +0 -3
  366. package/.next/standalone/.next/server/chunks/ssr/src_lib_0koe0p0._.js +0 -3
  367. package/.next/standalone/.next/server/chunks/ssr/src_lib_0qdh-v4._.js +0 -3
  368. package/.next/standalone/.next/server/chunks/ssr/src_lib_0ramp4w._.js +0 -3
  369. package/.next/standalone/.next/server/chunks/ssr/src_lib_0sn1z-s._.js +0 -3
  370. package/.next/standalone/.next/server/chunks/ssr/src_lib_0x6grav._.js +0 -3
  371. package/.next/standalone/.next/server/chunks/ssr/src_lib_110am8v._.js +0 -3
  372. package/.next/standalone/.next/static/chunks/0-efd~h5j2ufi.js +0 -1
  373. package/.next/standalone/.next/static/chunks/0.z171pzeg-.7.js +0 -1
  374. package/.next/standalone/.next/static/chunks/01zlxs4rl~h_o.js +0 -1
  375. package/.next/standalone/.next/static/chunks/0af7afat3acfx.js +0 -1
  376. package/.next/standalone/.next/static/chunks/0ais32-8.3wlj.js +0 -1
  377. package/.next/standalone/.next/static/chunks/0f43x~jzb70f4.js +0 -1
  378. package/.next/standalone/.next/static/chunks/0i-x__600fys6.js +0 -1
  379. package/.next/standalone/.next/static/chunks/0l25d0nc5ygyd.js +0 -1
  380. package/.next/standalone/.next/static/chunks/0lyq0-a32.15m.js +0 -1
  381. package/.next/standalone/.next/static/chunks/0t8lz62rmr801.js +0 -2
  382. package/.next/standalone/.next/static/chunks/0utrquxfg25b2.js +0 -1
  383. package/.next/standalone/.next/static/chunks/0wcdxs4sl-gjf.js +0 -1
  384. package/.next/standalone/.next/static/chunks/0x-ug4iz~~qr2.js +0 -1
  385. package/.next/standalone/.next/static/chunks/0xj6v_80hlyv0.js +0 -1
  386. package/.next/standalone/.next/static/chunks/0xl7h5fsfc7zk.js +0 -1
  387. package/.next/standalone/.next/static/chunks/115ae91fq~slq.js +0 -1
  388. package/.next/standalone/.next/static/chunks/13rq33eiffqaz.js +0 -1
  389. /package/.next/standalone/.next/static/{LCBoYZWhXzs8PjuBmxw7g → d-Uhp63kgWdPkhPt7Fzyb}/_buildManifest.js +0 -0
  390. /package/.next/standalone/.next/static/{LCBoYZWhXzs8PjuBmxw7g → d-Uhp63kgWdPkhPt7Fzyb}/_clientMiddlewareManifest.js +0 -0
  391. /package/.next/standalone/.next/static/{LCBoYZWhXzs8PjuBmxw7g → d-Uhp63kgWdPkhPt7Fzyb}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
1
  module.exports=[605171,t=>{"use strict";var e=t.i(750227),i=t.i(902157);t.i(660526);var s=t.i(427699),r=t.i(522734),n=t.i(687769),h=t.i(81111),o=t.i(899871),a=t.i(814747),l=t.i(449719),d=t.i(500874),u=t.i(406461),f=t.i(57328),c=t.i(666680),p=t.i(912714),m=Object.defineProperty,y="object"==typeof process&&process?process:{stdout:null,stderr:null},b=t=>!!t&&"object"==typeof t&&(t instanceof te||t instanceof h.default||E(t)||g(t)),E=t=>!!t&&"object"==typeof t&&t instanceof n.EventEmitter&&"function"==typeof t.pipe&&t.pipe!==h.default.Writable.prototype.pipe,g=t=>!!t&&"object"==typeof t&&t instanceof n.EventEmitter&&"function"==typeof t.write&&"function"==typeof t.end,w=Symbol("EOF"),R=Symbol("maybeEmitEnd"),v=Symbol("emittedEnd"),_=Symbol("emittingEnd"),S=Symbol("emittedError"),O=Symbol("closed"),T=Symbol("read"),k=Symbol("flush"),L=Symbol("flushChunk"),x=Symbol("encoding"),A=Symbol("decoder"),N=Symbol("flowing"),D=Symbol("paused"),I=Symbol("resume"),C=Symbol("buffer"),B=Symbol("pipes"),M=Symbol("bufferLength"),F=Symbol("bufferPush"),P=Symbol("bufferShift"),z=Symbol("objectMode"),U=Symbol("destroyed"),j=Symbol("error"),H=Symbol("emitData"),Z=Symbol("emitEnd"),G=Symbol("emitEnd2"),W=Symbol("async"),$=Symbol("abort"),V=Symbol("aborted"),Y=Symbol("signal"),q=Symbol("dataListeners"),K=Symbol("discarded"),X=t=>Promise.resolve().then(t),Q=t=>t(),J=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[I](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},tt=class extends J{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=t=>this.dest.emit("error",t),t.on("error",this.proxyErrors)}},te=class extends n.EventEmitter{[N]=!1;[D]=!1;[B]=[];[C]=[];[z];[x];[W];[A];[w]=!1;[v]=!1;[_]=!1;[O]=!1;[S]=null;[M]=0;[U]=!1;[Y];[V]=!1;[q]=0;[K]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw TypeError("Encoding and objectMode may not be used together");(t=>!!t.objectMode)(e)?(this[z]=!0,this[x]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[x]=e.encoding,this[z]=!1):(this[z]=!1,this[x]=null),this[W]=!!e.async,this[A]=this[x]?new o.StringDecoder(this[x]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[C]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[B]});let{signal:i}=e;i&&(this[Y]=i,i.aborted?this[$]():i.addEventListener("abort",()=>this[$]()))}get bufferLength(){return this[M]}get encoding(){return this[x]}set encoding(t){throw Error("Encoding must be set at instantiation time")}setEncoding(t){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[z]}set objectMode(t){throw Error("objectMode must be set at instantiation time")}get async(){return this[W]}set async(t){this[W]=this[W]||!!t}[$](){this[V]=!0,this.emit("abort",this[Y]?.reason),this.destroy(this[Y]?.reason)}get aborted(){return this[V]}set aborted(t){}write(t,e,i){if(this[V])return!1;if(this[w])throw Error("write after end");if(this[U])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(i=e,e="utf8"),e||(e="utf8");let s=this[W]?X:Q;if(!this[z]&&!Buffer.isBuffer(t)){let e;if(e=t,!Buffer.isBuffer(e)&&ArrayBuffer.isView(e))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else{let e;if((e=t)instanceof ArrayBuffer||e&&"object"==typeof e&&e.constructor&&"ArrayBuffer"===e.constructor.name&&e.byteLength>=0)t=Buffer.from(t);else if("string"!=typeof t)throw Error("Non-contiguous data written to non-objectMode stream")}}return this[z]?(this[N]&&0!==this[M]&&this[k](!0),this[N]?this.emit("data",t):this[F](t)):t.length&&("string"==typeof t&&(e!==this[x]||this[A]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[x]&&(t=this[A].write(t)),this[N]&&0!==this[M]&&this[k](!0),this[N]?this.emit("data",t):this[F](t)),0!==this[M]&&this.emit("readable"),i&&s(i),this[N]}read(t){if(this[U])return null;if(this[K]=!1,0===this[M]||0===t||t&&t>this[M])return this[R](),null;this[z]&&(t=null),this[C].length>1&&!this[z]&&(this[C]=[this[x]?this[C].join(""):Buffer.concat(this[C],this[M])]);let e=this[T](t||null,this[C][0]);return this[R](),e}[T](t,e){if(this[z])this[P]();else{let i=e;t===i.length||null===t?this[P]():("string"==typeof i?(this[C][0]=i.slice(t),e=i.slice(0,t)):(this[C][0]=i.subarray(t),e=i.subarray(0,t)),this[M]-=t)}return this.emit("data",e),this[C].length||this[w]||this.emit("drain"),e}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e="utf8"),void 0!==t&&this.write(t,e),i&&this.once("end",i),this[w]=!0,this.writable=!1,(this[N]||!this[D])&&this[R](),this}[I](){this[U]||(this[q]||this[B].length||(this[K]=!0),this[D]=!1,this[N]=!0,this.emit("resume"),this[C].length?this[k]():this[w]?this[R]():this.emit("drain"))}resume(){return this[I]()}pause(){this[N]=!1,this[D]=!0,this[K]=!1}get destroyed(){return this[U]}get flowing(){return this[N]}get paused(){return this[D]}[F](t){this[z]?this[M]+=1:this[M]+=t.length,this[C].push(t)}[P](){return this[z]?this[M]-=1:this[M]-=this[C][0].length,this[C].shift()}[k](t=!1){do;while(this[L](this[P]())&&this[C].length)t||this[C].length||this[w]||this.emit("drain")}[L](t){return this.emit("data",t),this[N]}pipe(t,e){if(this[U])return t;this[K]=!1;let i=this[v];return e=e||{},t===y.stdout||t===y.stderr?e.end=!1:e.end=!1!==e.end,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[B].push(e.proxyErrors?new tt(this,t,e):new J(this,t,e)),this[W]?X(()=>this[I]()):this[I]()),t}unpipe(t){let e=this[B].find(e=>e.dest===t);e&&(1===this[B].length?(this[N]&&0===this[q]&&(this[N]=!1),this[B]=[]):this[B].splice(this[B].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if("data"===t)this[K]=!1,this[q]++,this[B].length||this[N]||this[I]();else if("readable"===t&&0!==this[M])super.emit("readable");else("end"===t||"finish"===t||"prefinish"===t)&&this[v]?(super.emit(t),this.removeAllListeners(t)):"error"===t&&this[S]&&(this[W]?X(()=>e.call(this,this[S])):e.call(this,this[S]));return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return"data"===t&&(this[q]=this.listeners("data").length,0!==this[q]||this[K]||this[B].length||(this[N]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return("data"===t||void 0===t)&&(this[q]=0,this[K]||this[B].length||(this[N]=!1)),e}get emittedEnd(){return this[v]}[R](){this[_]||this[v]||this[U]||0!==this[C].length||!this[w]||(this[_]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[O]&&this.emit("close"),this[_]=!1)}emit(t,...e){let i=e[0];if("error"!==t&&"close"!==t&&t!==U&&this[U])return!1;if("data"===t)return(!!this[z]||!!i)&&(this[W]?(X(()=>this[H](i)),!0):this[H](i));if("end"===t)return this[Z]();if("close"===t){if(this[O]=!0,!this[v]&&!this[U])return!1;let t=super.emit("close");return this.removeAllListeners("close"),t}if("error"===t){this[S]=i,super.emit(j,i);let t=(!this[Y]||!!this.listeners("error").length)&&super.emit("error",i);return this[R](),t}if("resume"===t){let t=super.emit("resume");return this[R](),t}if("finish"===t||"prefinish"===t){let e=super.emit(t);return this.removeAllListeners(t),e}let s=super.emit(t,...e);return this[R](),s}[H](t){for(let e of this[B])!1===e.dest.write(t)&&this.pause();let e=!this[K]&&super.emit("data",t);return this[R](),e}[Z](){return!this[v]&&(this[v]=!0,this.readable=!1,this[W]?(X(()=>this[G]()),!0):this[G]())}[G](){if(this[A]){let t=this[A].end();if(t){for(let e of this[B])e.dest.write(t);this[K]||super.emit("data",t)}}for(let t of this[B])t.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[z]||(t.dataLength=0);let e=this.promise();return this.on("data",e=>{t.push(e),this[z]||(t.dataLength+=e.length)}),await e,t}async concat(){if(this[z])throw Error("cannot concat in objectMode");let t=await this.collect();return this[x]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(U,()=>e(Error("stream destroyed"))),this.on("error",t=>e(t)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[K]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(null!==i)return Promise.resolve({done:!1,value:i});if(this[w])return e();let s,r,n=t=>{this.off("data",h),this.off("end",o),this.off(U,a),e(),r(t)},h=t=>{this.off("error",n),this.off("end",o),this.off(U,a),this.pause(),s({value:t,done:!!this[w]})},o=()=>{this.off("error",n),this.off("data",h),this.off(U,a),e(),s({done:!0,value:void 0})},a=()=>n(Error("stream destroyed"));return new Promise((t,e)=>{r=e,s=t,this.once(U,a),this.once("error",n),this.once("end",o),this.once("data",h)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[K]=!1;let t=!1,e=()=>(this.pause(),this.off(j,e),this.off(U,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let i=this.read();return null===i?e():{done:!1,value:i}};return this.once("end",e),this.once(j,e),this.once(U,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){return this[U]||(this[U]=!0,this[K]=!0,this[C].length=0,this[M]=0,"function"!=typeof this.close||this[O]||this.close()),t?this.emit("error",t):this.emit(U),this}static get isStream(){return b}},ti=r.default.writev,ts=Symbol("_autoClose"),tr=Symbol("_close"),tn=Symbol("_ended"),th=Symbol("_fd"),to=Symbol("_finished"),ta=Symbol("_flags"),tl=Symbol("_flush"),td=Symbol("_handleChunk"),tu=Symbol("_makeBuf"),tf=Symbol("_mode"),tc=Symbol("_needDrain"),tp=Symbol("_onerror"),tm=Symbol("_onopen"),ty=Symbol("_onread"),tb=Symbol("_onwrite"),tE=Symbol("_open"),tg=Symbol("_path"),tw=Symbol("_pos"),tR=Symbol("_queue"),tv=Symbol("_read"),t_=Symbol("_readSize"),tS=Symbol("_reading"),tO=Symbol("_remain"),tT=Symbol("_size"),tk=Symbol("_write"),tL=Symbol("_writing"),tx=Symbol("_defaultFlag"),tA=Symbol("_errored"),tN=class extends te{[tA]=!1;[th];[tg];[t_];[tS]=!1;[tT];[tO];[ts];constructor(t,e){if(super(e=e||{}),this.readable=!0,this.writable=!1,"string"!=typeof t)throw TypeError("path must be a string");this[tA]=!1,this[th]="number"==typeof e.fd?e.fd:void 0,this[tg]=t,this[t_]=e.readSize||0x1000000,this[tS]=!1,this[tT]="number"==typeof e.size?e.size:1/0,this[tO]=this[tT],this[ts]="boolean"!=typeof e.autoClose||e.autoClose,"number"==typeof this[th]?this[tv]():this[tE]()}get fd(){return this[th]}get path(){return this[tg]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[tE](){r.default.open(this[tg],"r",(t,e)=>this[tm](t,e))}[tm](t,e){t?this[tp](t):(this[th]=e,this.emit("open",e),this[tv]())}[tu](){return Buffer.allocUnsafe(Math.min(this[t_],this[tO]))}[tv](){if(!this[tS]){this[tS]=!0;let t=this[tu]();if(0===t.length)return process.nextTick(()=>this[ty](null,0,t));r.default.read(this[th],t,0,t.length,null,(t,e,i)=>this[ty](t,e,i))}}[ty](t,e,i){this[tS]=!1,t?this[tp](t):this[td](e,i)&&this[tv]()}[tr](){if(this[ts]&&"number"==typeof this[th]){let t=this[th];this[th]=void 0,r.default.close(t,t=>t?this.emit("error",t):this.emit("close"))}}[tp](t){this[tS]=!0,this[tr](),this.emit("error",t)}[td](t,e){let i=!1;return this[tO]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(0===t||this[tO]<=0)&&(i=!1,this[tr](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return"number"==typeof this[th]&&this[tv](),!1;case"error":return!this[tA]&&(this[tA]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}},tD=class extends tN{[tE](){let t=!0;try{this[tm](null,r.default.openSync(this[tg],"r")),t=!1}finally{t&&this[tr]()}}[tv](){let t=!0;try{if(!this[tS]){for(this[tS]=!0;;){let t=this[tu](),e=0===t.length?0:r.default.readSync(this[th],t,0,t.length,null);if(!this[td](e,t))break}this[tS]=!1}t=!1}finally{t&&this[tr]()}}[tr](){if(this[ts]&&"number"==typeof this[th]){let t=this[th];this[th]=void 0,r.default.closeSync(t),this.emit("close")}}},tI=class extends s.default{readable=!1;writable=!0;[tA]=!1;[tL]=!1;[tn]=!1;[tR]=[];[tc]=!1;[tg];[tf];[ts];[th];[tx];[ta];[to]=!1;[tw];constructor(t,e){super(e=e||{}),this[tg]=t,this[th]="number"==typeof e.fd?e.fd:void 0,this[tf]=void 0===e.mode?438:e.mode,this[tw]="number"==typeof e.start?e.start:void 0,this[ts]="boolean"!=typeof e.autoClose||e.autoClose;let i=void 0!==this[tw]?"r+":"w";this[tx]=void 0===e.flags,this[ta]=void 0===e.flags?i:e.flags,void 0===this[th]&&this[tE]()}emit(t,...e){if("error"===t){if(this[tA])return!1;this[tA]=!0}return super.emit(t,...e)}get fd(){return this[th]}get path(){return this[tg]}[tp](t){this[tr](),this[tL]=!0,this.emit("error",t)}[tE](){r.default.open(this[tg],this[ta],this[tf],(t,e)=>this[tm](t,e))}[tm](t,e){this[tx]&&"r+"===this[ta]&&t&&"ENOENT"===t.code?(this[ta]="w",this[tE]()):t?this[tp](t):(this[th]=e,this.emit("open",e),this[tL]||this[tl]())}end(t,e){return t&&this.write(t,e),this[tn]=!0,this[tL]||this[tR].length||"number"!=typeof this[th]||this[tb](null,0),this}write(t,e){return"string"==typeof t&&(t=Buffer.from(t,e)),this[tn]?(this.emit("error",Error("write() after end()")),!1):void 0===this[th]||this[tL]||this[tR].length?(this[tR].push(t),this[tc]=!0,!1):(this[tL]=!0,this[tk](t),!0)}[tk](t){r.default.write(this[th],t,0,t.length,this[tw],(t,e)=>this[tb](t,e))}[tb](t,e){t?this[tp](t):(void 0!==this[tw]&&"number"==typeof e&&(this[tw]+=e),this[tR].length?this[tl]():(this[tL]=!1,this[tn]&&!this[to]?(this[to]=!0,this[tr](),this.emit("finish")):this[tc]&&(this[tc]=!1,this.emit("drain"))))}[tl](){if(0===this[tR].length)this[tn]&&this[tb](null,0);else if(1===this[tR].length)this[tk](this[tR].pop());else{let t=this[tR];this[tR]=[],ti(this[th],t,this[tw],(t,e)=>this[tb](t,e))}}[tr](){if(this[ts]&&"number"==typeof this[th]){let t=this[th];this[th]=void 0,r.default.close(t,t=>t?this.emit("error",t):this.emit("close"))}}},tC=class extends tI{[tE](){let t;if(this[tx]&&"r+"===this[ta])try{t=r.default.openSync(this[tg],this[ta],this[tf])}catch(t){if(t?.code==="ENOENT")return this[ta]="w",this[tE]();throw t}else t=r.default.openSync(this[tg],this[ta],this[tf]);this[tm](null,t)}[tr](){if(this[ts]&&"number"==typeof this[th]){let t=this[th];this[th]=void 0,r.default.closeSync(t),this.emit("close")}}[tk](t){let e=!0;try{this[tb](null,r.default.writeSync(this[th],t,0,t.length,this[tw])),e=!1}finally{if(e)try{this[tr]()}catch{}}}},tB=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),tM=t=>tB.get(t)||t,tF=(t={})=>{if(!t)return{};let e={};for(let[i,s]of Object.entries(t))e[tM(i)]=s;return void 0===e.chmod&&!1===e.noChmod&&(e.chmod=!0),delete e.noChmod,e},tP=(t,e,i,s,r)=>Object.assign((n=[],h,o)=>{Array.isArray(n)&&(h=n,n={}),"function"==typeof h&&(o=h,h=void 0),h=h?Array.from(h):[];let a=tF(n);if(r?.(a,h),a.sync&&a.file){if("function"==typeof o)throw TypeError("callback not supported for sync tar functions");return t(a,h)}if(a.sync||!a.file)if(!a.sync||a.file){if(!a.sync&&!a.file){if("function"==typeof o)throw TypeError("callback only supported with file option");return s(a,h)}}else{if("function"==typeof o)throw TypeError("callback not supported for sync tar functions");return i(a,h)}else{let t=e(a,h);return o?t.then(()=>o(),o):t}throw Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r}),tz=u.default.constants||{ZLIB_VERNUM:4736},tU=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},tz)),tj=d.Buffer.concat,tH=Object.getOwnPropertyDescriptor(d.Buffer,"concat"),tZ=t=>t,tG=tH?.writable===!0||tH?.set!==void 0?t=>{d.Buffer.concat=t?tZ:tj}:t=>{},tW=Symbol("_superWrite"),t$=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},tV=Symbol("flushFlag"),tY=class extends te{#t=!1;#e=!1;#i;#s;#r;#n;#h;get sawError(){return this.#t}get handle(){return this.#n}get flushFlag(){return this.#i}constructor(t,e){if(!t||"object"!=typeof t)throw TypeError("invalid options for ZlibBase constructor");if(super(t),this.#i=t.flush??0,this.#s=t.finishFlush??0,this.#r=t.fullFlushFlag??0,"function"!=typeof u[e])throw TypeError("Compression method not supported: "+e);try{this.#n=new u[e](t)}catch(t){throw new t$(t,this.constructor)}this.#h=t=>{this.#t||(this.#t=!0,this.close(),this.emit("error",t))},this.#n?.on("error",t=>this.#h(new t$(t))),this.once("end",()=>this.close)}close(){this.#n&&(this.#n.close(),this.#n=void 0,this.emit("close"))}reset(){if(!this.#t)return(0,l.default)(this.#n,"zlib binding closed"),this.#n.reset?.()}flush(t){this.ended||("number"!=typeof t&&(t=this.#r),this.write(Object.assign(d.Buffer.alloc(0),{[tV]:t})))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#s),this.#e=!0,super.end(i)}get ended(){return this.#e}[tW](t){return super.write(t)}write(t,e,i){let s,r;if("function"==typeof e&&(i=e,e="utf8"),"string"==typeof t&&(t=d.Buffer.from(t,e)),this.#t)return;(0,l.default)(this.#n,"zlib binding closed");let n=this.#n._handle,h=n.close;n.close=()=>{};let o=this.#n.close;this.#n.close=()=>{},tG(!0);try{let e="number"==typeof t[tV]?t[tV]:this.#i;s=this.#n._processChunk(t,e),tG(!1)}catch(t){tG(!1),this.#h(new t$(t,this.write))}finally{this.#n&&(this.#n._handle=n,n.close=h,this.#n.close=o,this.#n.removeAllListeners("error"))}if(this.#n&&this.#n.on("error",t=>this.#h(new t$(t,this.write))),s)if(Array.isArray(s)&&s.length>0){let t=s[0];r=this[tW](d.Buffer.from(t));for(let t=1;t<s.length;t++)r=this[tW](s[t])}else r=this[tW](d.Buffer.from(s));return i&&i(),r}},tq=class extends tY{#t;#e;constructor(t,e){(t=t||{}).flush=t.flush||tU.Z_NO_FLUSH,t.finishFlush=t.finishFlush||tU.Z_FINISH,t.fullFlushFlag=tU.Z_FULL_FLUSH,super(t,e),this.#t=t.level,this.#e=t.strategy}params(t,e){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#t!==t||this.#e!==e){this.flush(tU.Z_SYNC_FLUSH),(0,l.default)(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(t,e)=>{"function"==typeof t&&(e=t,t=this.flushFlag),this.flush(t),e?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#e=e)}}}},tK=class extends tq{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[tW](t){return this.#t&&(this.#t=!1,t[9]=255),super[tW](t)}},tX=class extends tq{constructor(t){super(t,"Unzip")}},tQ=class extends tY{constructor(t,e){(t=t||{}).flush=t.flush||tU.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||tU.BROTLI_OPERATION_FINISH,t.fullFlushFlag=tU.BROTLI_OPERATION_FLUSH,super(t,e)}},tJ=class extends tQ{constructor(t){super(t,"BrotliCompress")}},t0=class extends tQ{constructor(t){super(t,"BrotliDecompress")}},t1=class extends tY{constructor(t,e){(t=t||{}).flush=t.flush||tU.ZSTD_e_continue,t.finishFlush=t.finishFlush||tU.ZSTD_e_end,t.fullFlushFlag=tU.ZSTD_e_flush,super(t,e)}},t2=class extends t1{constructor(t){super(t,"ZstdCompress")}},t5=class extends t1{constructor(t){super(t,"ZstdDecompress")}},t4=t=>(255^t)&255,t8=t=>(255^t)+1&255,t3={},t6={code:()=>ei,isCode:()=>t9,isName:()=>et,name:()=>ee};for(var t7 in t6)m(t3,t7,{get:t6[t7],enumerable:!0});var t9=t=>ee.has(t),et=t=>ei.has(t),ee=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),ei=new Map(Array.from(ee).map(t=>[t[1],t[0]])),es=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#e(t)}decode(t,e,i,s){if(e||(e=0),!t||!(t.length>=e+512))throw Error("need 512 bytes for header");this.path=i?.path??en(t,e,100),this.mode=i?.mode??s?.mode??ea(t,e+100,8),this.uid=i?.uid??s?.uid??ea(t,e+108,8),this.gid=i?.gid??s?.gid??ea(t,e+116,8),this.size=i?.size??s?.size??ea(t,e+124,12),this.mtime=i?.mtime??s?.mtime??eh(t,e+136,12),this.cksum=ea(t,e+148,12),s&&this.#e(s,!0),i&&this.#e(i);let r=en(t,e+156,1);if(t9(r)&&(this.#t=r||"0"),"0"===this.#t&&"/"===this.path.slice(-1)&&(this.#t="5"),"5"===this.#t&&(this.size=0),this.linkpath=en(t,e+157,100),"ustar\x0000"===t.subarray(e+257,e+265).toString())if(this.uname=i?.uname??s?.uname??en(t,e+265,32),this.gname=i?.gname??s?.gname??en(t,e+297,32),this.devmaj=i?.devmaj??s?.devmaj??ea(t,e+329,8)??0,this.devmin=i?.devmin??s?.devmin??ea(t,e+337,8)??0,0!==t[e+475]){let i=en(t,e+345,155);this.path=i+"/"+this.path}else{let r=en(t,e+345,130);r&&(this.path=r+"/"+this.path),this.atime=i?.atime??s?.atime??eh(t,e+476,12),this.ctime=i?.ctime??s?.ctime??eh(t,e+488,12)}let n=256;for(let i=e;i<e+148;i++)n+=t[i];for(let i=e+156;i<e+512;i++)n+=t[i];this.cksumValid=n===this.cksum,void 0===this.cksum&&256===n&&(this.nullBlock=!0)}#e(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter(([t,i])=>!(null==i||"path"===t&&e||"linkpath"===t&&e||"global"===t))))}encode(t,e=0){if(t||(t=this.block=Buffer.alloc(512)),"Unsupported"===this.#t&&(this.#t="0"),!(t.length>=e+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=er(this.path||"",i),r=s[0],n=s[1];this.needPax=!!s[2],this.needPax=eb(t,e,100,r)||this.needPax,this.needPax=eu(t,e+100,8,this.mode)||this.needPax,this.needPax=eu(t,e+108,8,this.uid)||this.needPax,this.needPax=eu(t,e+116,8,this.gid)||this.needPax,this.needPax=eu(t,e+124,12,this.size)||this.needPax,this.needPax=em(t,e+136,12,this.mtime)||this.needPax,t[e+156]=Number(this.#t.codePointAt(0)),this.needPax=eb(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=eb(t,e+265,32,this.uname)||this.needPax,this.needPax=eb(t,e+297,32,this.gname)||this.needPax,this.needPax=eu(t,e+329,8,this.devmaj)||this.needPax,this.needPax=eu(t,e+337,8,this.devmin)||this.needPax,this.needPax=eb(t,e+345,i,n)||this.needPax,0!==t[e+475]?this.needPax=eb(t,e+345,155,n)||this.needPax:(this.needPax=eb(t,e+345,130,n)||this.needPax,this.needPax=em(t,e+476,12,this.atime)||this.needPax,this.needPax=em(t,e+488,12,this.ctime)||this.needPax);let h=256;for(let i=e;i<e+148;i++)h+=t[i];for(let i=e+156;i<e+512;i++)h+=t[i];return this.cksum=h,eu(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return"Unsupported"===this.#t?this.#t:ee.get(this.#t)}get typeKey(){return this.#t}set type(t){let e=String(ei.get(t));if(t9(e)||"Unsupported"===e)this.#t=e;else if(t9(t))this.#t=t;else throw TypeError("invalid entry type: "+t)}},er=(t,i)=>{let s=t,r="",n,h=e.posix.parse(t).root||".";if(100>Buffer.byteLength(s))n=[s,r,!1];else{r=e.posix.dirname(s),s=e.posix.basename(s);do 100>=Buffer.byteLength(s)&&Buffer.byteLength(r)<=i?n=[s,r,!1]:Buffer.byteLength(s)>100&&Buffer.byteLength(r)<=i?n=[s.slice(0,99),r,!0]:(s=e.posix.join(e.posix.basename(r),s),r=e.posix.dirname(r));while(r!==h&&void 0===n)n||(n=[t.slice(0,99),"",!0])}return n},en=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),eh=(t,e,i)=>eo(ea(t,e,i)),eo=t=>void 0===t?void 0:new Date(1e3*t),ea=(t,e,i)=>128&Number(t[e])?(t=>{let e=t[0],i=128===e?(t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);0!==r&&(i+=r*Math.pow(256,e-s-1))}return i})(t.subarray(1,t.length)):255===e?(t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var n,h=Number(t[r]);s?n=t4(h):0===h?n=h:(s=!0,n=t8(h)),0!==n&&(i-=n*Math.pow(256,e-r-1))}return i})(t):null;if(null===i)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i})(t.subarray(e,e+i)):el(t,e,i),el=(t,e,i)=>{let s;return isNaN(s=parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8))?void 0:s},ed={12:0x1ffffffff,8:2097151},eu=(t,e,i,s)=>void 0!==s&&(s>ed[i]||s<0?(((t,e)=>{if(Number.isSafeInteger(t))t<0?((t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=255&t;t=Math.floor(t/256),i?e[s-1]=t4(r):0===r?e[s-1]=0:(i=!0,e[s-1]=t8(r))}})(t,e):((t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=255&t,t=Math.floor(t/256)})(t,e);else throw Error("cannot encode number outside of javascript safe integer range")})(s,t.subarray(e,e+i)),!0):(ef(t,e,i,s),!1)),ef=(t,e,i,s)=>t.write(ec(s,i),e,i,"ascii"),ec=(t,e)=>ep(Math.floor(t).toString(8),e),ep=(t,e)=>(t.length===e-1?t:Array(e-t.length-1).join("0")+t+" ")+"\0",em=(t,e,i,s)=>void 0!==s&&eu(t,e,i,s.getTime()/1e3),ey=Array(156).join("\0"),eb=(t,e,i,s)=>void 0!==s&&(t.write(s+ey,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),eE=class t{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,e=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=e,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(""===t)return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let t=0;t<512;t++)r[t]=0;new es({path:("PaxHeader/"+(0,e.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(t,512,i,"utf8");for(let t=i+512;t<r.length;t++)r[t]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(void 0===this[t])return"";let e=this[t],i=" "+("dev"===t||"ino"===t||"nlink"===t?"SCHILY.":"")+t+"="+(e instanceof Date?e.getTime()/1e3:e)+`
2
2
  `,s=Buffer.byteLength(i),r=Math.floor(Math.log(s)/Math.log(10))+1;return s+r>=Math.pow(10,r)&&(r+=1),r+s+i}static parse(e,i,s=!1){return new t(eg(ew(e),i),s)}},eg=(t,e)=>e?Object.assign({},e,t):t,ew=t=>t.replace(/\n$/,"").split(`
3
- `).reduce(eR,Object.create(null)),eR=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;let s=(e=e.slice((i+" ").length)).split("="),r=s.shift();if(!r)return t;let n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),h=s.join("=");return t[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(1e3*Number(h)):/^[0-9]+$/.test(h)?+h:h,t},ev="win32"!==(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)?t=>t:t=>t&&t.replaceAll(/\\/g,"/"),e_=class extends te{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw Error("no path provided for tar.ReadEntry");this.path=ev(t.path),this.mode=t.mode,this.mode&&(this.mode=4095&this.mode),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?ev(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#t(e),i&&this.#t(i,!0)}write(t){let e=t.length;if(e>this.blockRemain)throw Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,s-e),!!this.ignore||(i>=e?super.write(t):super.write(t.subarray(0,i)))}#t(t,e=!1){t.path&&(t.path=ev(t.path)),t.linkpath&&(t.linkpath=ev(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([t,i])=>!(null==i||"path"===t&&e))))}},eS=(t,e,i,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=i instanceof Error&&i.code||e,s.tarCode=e,t.strict||!1===s.recoverable?i instanceof Error?t.emit("error",Object.assign(i,s)):t.emit("error",Object.assign(Error(`${e}: ${i}`),s)):(i instanceof Error&&(s=Object.assign(i,s),i=i.message),t.emit("warn",e,i,s))},eO=Buffer.from([31,139]),eT=Buffer.from([40,181,47,253]),ek=Math.max(eO.length,eT.length),eL=Symbol("state"),ex=Symbol("writeEntry"),eA=Symbol("readEntry"),eN=Symbol("nextEntry"),eD=Symbol("processEntry"),eI=Symbol("extendedHeader"),eC=Symbol("globalExtendedHeader"),eB=Symbol("meta"),eM=Symbol("emitMeta"),eF=Symbol("buffer"),eP=Symbol("queue"),ez=Symbol("ended"),eU=Symbol("emittedEnd"),ej=Symbol("emit"),eH=Symbol("unzip"),eZ=Symbol("consumeChunk"),eG=Symbol("consumeChunkSub"),eW=Symbol("consumeBody"),e$=Symbol("consumeMeta"),eV=Symbol("consumeHeader"),eY=Symbol("consuming"),eq=Symbol("bufferConcat"),eK=Symbol("maybeEnd"),eX=Symbol("writing"),eQ=Symbol("aborted"),eJ=Symbol("onDone"),e0=Symbol("sawValidEntry"),e1=Symbol("sawNullBlock"),e2=Symbol("sawEOF"),e5=Symbol("closeStream"),e4=()=>!0,e8=class extends s.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[eP]=[];[eF];[eA];[ex];[eL]="begin";[eB]="";[eI];[eC];[ez]=!1;[eH];[eQ]=!1;[e0];[e1]=!1;[e2]=!1;[eX]=!1;[eY]=!1;[eU]=!1;constructor(t={}){super(),this.file=t.file||"",this.on(eJ,()=>{("begin"===this[eL]||!1===this[e0])&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(eJ,t.ondone):this.on(eJ,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||1048576,this.filter="function"==typeof t.filter?t.filter:e4;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=t.gzip||t.zstd||void 0===t.brotli?!!e&&void 0:t.brotli;let i=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=t.gzip||t.brotli||void 0===t.zstd?!!i||void 0:t.zstd,this.on("end",()=>this[e5]()),"function"==typeof t.onwarn&&this.on("warn",t.onwarn),"function"==typeof t.onReadEntry&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){eS(this,t,e,i)}[eV](t,e){let i;void 0===this[e0]&&(this[e0]=!1);try{i=new es(t,e,this[eI],this[eC])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock)this[e1]?(this[e2]=!0,"begin"===this[eL]&&(this[eL]="header"),this[ej]("eof")):(this[e1]=!0,this[ej]("nullBlock"));else if(this[e1]=!1,i.cksumValid)if(i.path){let t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(/^(Symbolic)?Link$/.test(t)||/^(Global)?ExtendedHeader$/.test(t)||!i.linkpath){let t=this[ex]=new e_(i,this[eI],this[eC]);if(!this[e0])if(t.remain){let e=()=>{t.invalid||(this[e0]=!0)};t.on("end",e)}else this[e0]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[ej]("ignoredEntry",t),this[eL]="ignore",t.resume()):t.size>0&&(this[eB]="",t.on("data",t=>this[eB]+=t),this[eL]="meta"):(this[eI]=void 0,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[ej]("ignoredEntry",t),this[eL]=t.remain?"ignore":"header",t.resume()):(t.remain?this[eL]="body":(this[eL]="header",t.end()),this[eA]?this[eP].push(t):(this[eP].push(t),this[eN]())))}else this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}[e5](){queueMicrotask(()=>this.emit("close"))}[eD](t){let e=!0;if(t)if(Array.isArray(t)){let[e,...i]=t;this.emit(e,...i)}else this[eA]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",()=>this[eN]()),e=!1);else this[eA]=void 0,e=!1;return e}[eN](){do;while(this[eD](this[eP].shift()))if(0===this[eP].length){let t=this[eA];!t||t.flowing||t.size===t.remain?this[eX]||this.emit("drain"):t.once("drain",()=>this.emit("drain"))}}[eW](t,e){let i=this[ex];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=t.length&&0===e?t:t.subarray(e,e+s);return i.write(r),i.blockRemain||(this[eL]="header",this[ex]=void 0,i.end()),r.length}[e$](t,e){let i=this[ex],s=this[eW](t,e);return!this[ex]&&i&&this[eM](i),s}[ej](t,e,i){0!==this[eP].length||this[eA]?this[eP].push([t,e,i]):this.emit(t,e,i)}[eM](t){switch(this[ej]("meta",this[eB]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[eI]=eE.parse(this[eB],this[eI],!1);break;case"GlobalExtendedHeader":this[eC]=eE.parse(this[eB],this[eC],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[eI]??Object.create(null);this[eI]=t,t.path=this[eB].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[eI]||Object.create(null);this[eI]=t,t.linkpath=this[eB].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+t.type)}}abort(t){this[eQ]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this[eQ])return i?.(),!1;if((void 0===this[eH]||void 0===this.brotli&&!1===this[eH])&&t){if(this[eF]&&(t=Buffer.concat([this[eF],t]),this[eF]=void 0),t.length<ek)return this[eF]=t,i?.(),!0;for(let e=0;void 0===this[eH]&&e<eO.length;e++)t[e]!==eO[e]&&(this[eH]=!1);let e=!1;if(!1===this[eH]&&!1!==this.zstd){e=!0;for(let i=0;i<eT.length;i++)if(t[i]!==eT[i]){e=!1;break}}let s=void 0===this.brotli&&!e;if(!1===this[eH]&&s)if(t.length<512)if(!this[ez])return this[eF]=t,i?.(),!0;else this.brotli=!0;else try{new es(t.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(void 0===this[eH]||!1===this[eH]&&(this.brotli||e)){let s=this[ez];this[ez]=!1,this[eH]=void 0===this[eH]?new tX({}):e?new t5({}):new t0({}),this[eH].on("data",t=>this[eZ](t)),this[eH].on("error",t=>this.abort(t)),this[eH].on("end",()=>{this[ez]=!0,this[eZ]()}),this[eX]=!0;let r=!!this[eH][s?"end":"write"](t);return this[eX]=!1,i?.(),r}}this[eX]=!0,this[eH]?this[eH].write(t):this[eZ](t),this[eX]=!1;let s=!(this[eP].length>0)&&(!this[eA]||this[eA].flowing);return s||0!==this[eP].length||this[eA]?.once("drain",()=>this.emit("drain")),i?.(),s}[eq](t){t&&!this[eQ]&&(this[eF]=this[eF]?Buffer.concat([this[eF],t]):t)}[eK](){if(this[ez]&&!this[eU]&&!this[eQ]&&!this[eY]){this[eU]=!0;let t=this[ex];if(t&&t.blockRemain){let e=this[eF]?this[eF].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[eF]&&t.write(this[eF]),t.end()}this[ej](eJ)}}[eZ](t){if(this[eY]&&t)this[eq](t);else if(t||this[eF]){if(t){if(this[eY]=!0,this[eF]){this[eq](t);let e=this[eF];this[eF]=void 0,this[eG](e)}else this[eG](t);for(;this[eF]&&this[eF]?.length>=512&&!this[eQ]&&!this[e2];){let t=this[eF];this[eF]=void 0,this[eG](t)}this[eY]=!1}}else this[eK]();(!this[eF]||this[ez])&&this[eK]()}[eG](t){let e=0,i=t.length;for(;e+512<=i&&!this[eQ]&&!this[e2];)switch(this[eL]){case"begin":case"header":this[eV](t,e),e+=512;break;case"ignore":case"body":e+=this[eW](t,e);break;case"meta":e+=this[e$](t,e);break;default:throw Error("invalid state: "+this[eL])}e<i&&(this[eF]=this[eF]?Buffer.concat([t.subarray(e),this[eF]]):t.subarray(e))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e)),i&&this.once("finish",i),this[eQ]||(this[eH]?(t&&this[eH].write(t),this[eH].end()):(this[ez]=!0,(void 0===this.brotli||void 0===this.zstd)&&(t=t||Buffer.alloc(0)),t&&this.write(t),this[eK]())),this}},e3=t=>{let e=t.length-1,i=-1;for(;e>-1&&"/"===t.charAt(e);)i=e,e--;return -1===i?t:t.slice(0,i)},e6=(t,e)=>{let i=new Map(e.map(t=>[e3(t),!0])),s=t.filter,r=(t,e="")=>{let s=e||(0,a.parse)(t).root||".",n;if(t===s)n=!1;else{let e=i.get(t);n=void 0!==e?e:r((0,a.dirname)(t),s)}return i.set(t,n),n};t.filter=s?(t,e)=>s(t,e)&&r(e3(t)):t=>r(e3(t))},e7=tP(t=>{let e=new e8(t),s=t.file,r;try{r=i.default.openSync(s,"r");let n=i.default.fstatSync(r),h=t.maxReadSize||0x1000000;if(n.size<h){let t=Buffer.allocUnsafe(n.size),s=i.default.readSync(r,t,0,n.size,0);e.end(s===t.byteLength?t:t.subarray(0,s))}else{let t=0,s=Buffer.allocUnsafe(h);for(;t<n.size;){let n=i.default.readSync(r,s,0,h,t);if(0===n)break;t+=n,e.write(s.subarray(0,n))}e.end()}}finally{if("number"==typeof r)try{i.default.closeSync(r)}catch{}}},(t,e)=>{let s=new e8(t),r=t.maxReadSize||0x1000000,n=t.file;return new Promise((t,e)=>{s.on("error",e),s.on("end",t),i.default.stat(n,(t,i)=>{if(t)e(t);else{let t=new tN(n,{readSize:r,size:i.size});t.on("error",e),t.pipe(s)}})})},t=>new e8(t),t=>new e8(t),(t,e)=>{let i;e?.length&&e6(t,e),t.noResume||(i=t.onReadEntry,t.onReadEntry=i?t=>{i(t),t.resume()}:t=>t.resume())}),e9=(t,e,i)=>(t&=4095,i&&(t=(384|t)&-19),e&&(256&t&&(t|=64),32&t&&(t|=8),4&t&&(t|=1)),t),{isAbsolute:it,parse:ie}=e.win32,ii=t=>{let e="",i=ie(t);for(;it(t)||i.root;){let s="/"===t.charAt(0)&&"//?/"!==t.slice(0,4)?"/":i.root;t=t.slice(s.length),e+=s,i=ie(t)}return[e,t]},is=["|","<",">","?",":"],ir=is.map(t=>String.fromCodePoint(61440+Number(t.codePointAt(0)))),ih=new Map(is.map((t,e)=>[t,ir[e]])),io=new Map(ir.map((t,e)=>[t,is[e]])),ia=t=>is.reduce((t,e)=>t.split(e).join(ih.get(e)),t),il=(t,e)=>e?(t=ev(t).replace(/^\.(\/|$)/,""),e3(e)+"/"+t):ev(t),id=Symbol("process"),iu=Symbol("file"),ic=Symbol("directory"),ip=Symbol("symlink"),im=Symbol("hardlink"),iy=Symbol("header"),ib=Symbol("read"),iE=Symbol("lstat"),ig=Symbol("onlstat"),iw=Symbol("onread"),iR=Symbol("onreadlink"),iv=Symbol("openfile"),i_=Symbol("onopenfile"),iS=Symbol("close"),iO=Symbol("mode"),iT=Symbol("awaitDrain"),ik=Symbol("ondrain"),iL=Symbol("prefix"),ix=class extends te{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#t=!1;constructor(t,e={}){let i=tF(e);super(),this.path=ev(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||0x1000000,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=ev(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?ev(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[t,e]=ii(this.path);t&&"string"==typeof e&&(this.path=e,s=t)}this.win32=!!i.win32||"win32"===process.platform,this.win32&&(this.path=(t=>ir.reduce((t,e)=>t.split(e).join(io.get(e)),t))(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=ev(i.absolute||a.default.resolve(this.cwd,t)),""===this.path&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let r=this.statCache.get(this.absolute);r?this[ig](r):this[iE]()}warn(t,e,i={}){return eS(this,t,e,i)}emit(t,...e){return"error"===t&&(this.#t=!0),super.emit(t,...e)}[iE](){r.default.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[ig](e)})}[ig](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=iD(t),this.emit("stat",t),this[id]()}[id](){switch(this.type){case"File":return this[iu]();case"Directory":return this[ic]();case"SymbolicLink":return this[ip]();default:return this.end()}}[iO](t){return e9(t,"Directory"===this.type,this.portable)}[iL](t){return il(t,this.prefix)}[iy](){if(!this.stat)throw Error("cannot write header before stat");"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new es({path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,mode:this[iO](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:"Unsupported"===this.type?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new eE({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw Error("failed to encode header");super.write(t)}[ic](){if(!this.stat)throw Error("cannot create directory entry without stat");"/"!==this.path.slice(-1)&&(this.path+="/"),this.stat.size=0,this[iy](),this.end()}[ip](){r.default.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[iR](e)})}[iR](t){this.linkpath=ev(t),this[iy](),this.end()}[im](t){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=ev(a.default.relative(this.cwd,t)),this.stat.size=0,this[iy](),this.end()}[iu](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(e?.indexOf(this.cwd)===0)return this[im](e);this.linkCache.set(t,this.absolute)}if(this[iy](),0===this.stat.size)return this.end();this[iv]()}[iv](){r.default.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[i_](e)})}[i_](t){if(this.fd=t,this.#t)return this[iS]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[ib]()}[ib](){let{fd:t,buf:e,offset:i,length:s,pos:n}=this;if(void 0===t||void 0===e)throw Error("cannot read file without first opening");r.default.read(t,e,i,s,n,(t,e)=>{if(t)return this[iS](()=>this.emit("error",t));this[iw](e)})}[iS](t=()=>{}){void 0!==this.fd&&r.default.close(this.fd,t)}[iw](t){if(t<=0&&this.remain>0){let t=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[iS](()=>this.emit("error",t))}if(t>this.remain){let t=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[iS](()=>this.emit("error",t))}if(!this.buf)throw Error("should have created buffer prior to reading");if(t===this.remain)for(let e=t;e<this.length&&t<this.blockRemain;e++)this.buf[e+this.offset]=0,t++,this.remain++;let e=0===this.offset&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(e)?this[ik]():this[iT](()=>this[ik]())}[iT](t){this.once("drain",t)}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this.blockRemain<t.length){let t=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,i)}[ik](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[iS](t=>t?this.emit("error",t):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[ib]()}},iA=class extends ix{sync=!0;[iE](){this[ig](r.default.lstatSync(this.absolute))}[ip](){this[iR](r.default.readlinkSync(this.absolute))}[iv](){this[i_](r.default.openSync(this.absolute,"r"))}[ib](){let t=!0;try{let{fd:e,buf:i,offset:s,length:n,pos:h}=this;if(void 0===e||void 0===i)throw Error("fd and buf must be set in READ method");let o=r.default.readSync(e,i,s,n,h);this[iw](o),t=!1}finally{if(t)try{this[iS](()=>{})}catch{}}}[iT](t){t()}[iS](t=()=>{}){void 0!==this.fd&&r.default.closeSync(this.fd),t()}},iN=class extends te{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return eS(this,t,e,i)}constructor(t,e={}){let i=tF(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;let{type:s}=t;if("Unsupported"===s)throw Error("writing entry that should be ignored");this.type=s,"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=ev(t.path),this.mode=void 0!==t.mode?this[iO](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=void 0!==t.linkpath?ev(t.linkpath):void 0,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[t,e]=ii(this.path);t&&"string"==typeof e&&(this.path=e,r=t)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new es({path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new eE({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let n=this.header?.block;if(!n)throw Error("failed to encode header");super.write(n),t.pipe(this)}[iL](t){return il(t,this.prefix)}[iO](t){return e9(t,"Directory"===this.type,this.portable)}write(t,e,i){"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8"));let s=t.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}},iD=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported",iI=class t{tail;head;length=0;static create(e=[]){return new t(e)}constructor(t=[]){for(let e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let i=0,s=t.length;i<s;i++){var e;e=this,e.tail=new iC(t[i],e.tail,void 0,e),e.head||(e.head=e.tail),e.length++}return this.length}unshift(...t){for(var e,i=0,s=t.length;i<s;i++){e=this,e.head=new iC(t[i],void 0,e.head,e),e.tail||(e.tail=e.head),e.length++}return this.length}pop(){if(!this.tail)return;let t=this.tail.value,e=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,e.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,e=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,e.list=void 0,this.length--,t}forEach(t,e){e=e||this;for(let i=this.head,s=0;i;s++)t.call(e,i.value,s,this),i=i.next}forEachReverse(t,e){e=e||this;for(let i=this.tail,s=this.length-1;i;s--)t.call(e,i.value,s,this),i=i.prev}get(t){let e=0,i=this.head;for(;i&&e<t;e++)i=i.next;if(e===t&&i)return i.value}getReverse(t){let e=0,i=this.tail;for(;i&&e<t;e++)i=i.prev;if(e===t&&i)return i.value}map(e,i){i=i||this;let s=new t;for(let t=this.head;t;)s.push(e.call(i,t.value,this)),t=t.next;return s}mapReverse(e,i){i=i||this;var s=new t;for(let t=this.tail;t;)s.push(e.call(i,t.value,this)),t=t.prev;return s}reduce(t,e){let i,s=this.head;if(arguments.length>1)i=e;else if(this.head)s=this.head.next,i=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var r=0;s;r++)i=t(i,s.value,r),s=s.next;return i}reduceReverse(t,e){let i,s=this.tail;if(arguments.length>1)i=e;else if(this.tail)s=this.tail.prev,i=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let e=this.length-1;s;e--)i=t(i,s.value,e),s=s.prev;return i}toArray(){let t=Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){let t=Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new t;if(i<e||i<0)return s;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,n=0;for(n=0;r&&n<e;n++)r=r.next;for(;r&&n<i;n++,r=r.next)s.push(r.value);return s}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new t;if(i<e||i<0)return s;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.length,n=this.tail;for(;n&&r>i;r--)n=n.prev;for(;n&&r>e;r--,n=n.prev)s.push(n.value);return s}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let s=this.head;for(let e=0;s&&e<t;e++)s=s.next;let r=[];for(let t=0;s&&t<e;t++)r.push(s.value),s=this.removeNode(s);for(let t of(s?s!==this.tail&&(s=s.prev):s=this.tail,i))s=function(t,e,i){let s=e?e.next:t.head,r=new iC(i,e,s,t);return void 0===r.next&&(t.tail=r),void 0===r.prev&&(t.head=r),t.length++,r}(this,s,t);return r}reverse(){let t=this.head,e=this.tail;for(let e=t;e;e=e.prev){let t=e.prev;e.prev=e.next,e.next=t}return this.head=e,this.tail=t,this}},iC=class{list;next;prev;value;constructor(t,e,i,s){this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},iB=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(t,e){this.path=t||"./",this.absolute=e}},iM=Buffer.alloc(1024),iF=Symbol("onStat"),iP=Symbol("ended"),iz=Symbol("queue"),iU=Symbol("current"),ij=Symbol("process"),iH=Symbol("processing"),iZ=Symbol("processJob"),iG=Symbol("jobs"),iW=Symbol("jobDone"),i$=Symbol("addFSEntry"),iV=Symbol("addTarEntry"),iY=Symbol("stat"),iq=Symbol("readdir"),iK=Symbol("onreaddir"),iX=Symbol("pipe"),iQ=Symbol("entry"),iJ=Symbol("entryOpt"),i0=Symbol("writeEntryClass"),i1=Symbol("write"),i2=Symbol("ondrain"),i5=class extends te{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[i0];onWriteEntry;[iz];[iG]=0;[iH]=!1;[iP]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=ev(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[i0]=ix,"function"==typeof t.onwarn&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli||t.zstd){if(+!!t.gzip+ +!!t.brotli+ +!!t.zstd>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&("object"!=typeof t.gzip&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new tK(t.gzip)),t.brotli&&("object"!=typeof t.brotli&&(t.brotli={}),this.zip=new tJ(t.brotli)),t.zstd&&("object"!=typeof t.zstd&&(t.zstd={}),this.zip=new t2(t.zstd)),!this.zip)throw Error("impossible");let e=this.zip;e.on("data",t=>super.write(t)),e.on("end",()=>super.end()),e.on("drain",()=>this[i2]()),this.on("resume",()=>e.resume())}else this.on("drain",this[i2]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter="function"==typeof t.filter?t.filter:()=>!0,this[iz]=new iI,this[iG]=0,this.jobs=Number(t.jobs)||4,this[iH]=!1,this[iP]=!1}[i1](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&this.add(t),this[iP]=!0,this[ij](),i&&i(),this}write(t){if(this[iP])throw Error("write after end");return t instanceof e_?this[iV](t):this[i$](t),this.flowing}[iV](t){let e=ev(a.default.resolve(this.cwd,t.path));if(this.filter(t.path,t)){let i=new iB(t.path,e);i.entry=new iN(t,this[iJ](i)),i.entry.on("end",()=>this[iW](i)),this[iG]+=1,this[iz].push(i)}else t.resume();this[ij]()}[i$](t){let e=ev(a.default.resolve(this.cwd,t));this[iz].push(new iB(t,e)),this[ij]()}[iY](t){t.pending=!0,this[iG]+=1;let e=this.follow?"stat":"lstat";r.default[e](t.absolute,(e,i)=>{t.pending=!1,this[iG]-=1,e?this.emit("error",e):this[iF](t,i)})}[iF](t,e){this.statCache.set(t.absolute,e),t.stat=e,this.filter(t.path,e)?e.isFile()&&e.nlink>1&&t===this[iU]&&!this.linkCache.get(`${e.dev}:${e.ino}`)&&!this.sync&&this[iZ](t):t.ignore=!0,this[ij]()}[iq](t){t.pending=!0,this[iG]+=1,r.default.readdir(t.absolute,(e,i)=>{if(t.pending=!1,this[iG]-=1,e)return this.emit("error",e);this[iK](t,i)})}[iK](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[ij]()}[ij](){if(!this[iH]){this[iH]=!0;for(let t=this[iz].head;t&&this[iG]<this.jobs;t=t.next)if(this[iZ](t.value),t.value.ignore){let e=t.next;this[iz].removeNode(t),t.next=e}this[iH]=!1,this[iP]&&0===this[iz].length&&0===this[iG]&&(this.zip?this.zip.end(iM):(super.write(iM),super.end()))}}get[iU](){return this[iz]&&this[iz].head&&this[iz].head.value}[iW](t){this[iz].shift(),this[iG]-=1,this[ij]()}[iZ](t){if(!t.pending){if(t.entry){t!==this[iU]||t.piped||this[iX](t);return}if(!t.stat){let e=this.statCache.get(t.absolute);e?this[iF](t,e):this[iY](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let e=this.readdirCache.get(t.absolute);if(e?this[iK](t,e):this[iq](t),!t.readdir)return}if(t.entry=this[iQ](t),!t.entry){t.ignore=!0;return}t!==this[iU]||t.piped||this[iX](t)}}}[iJ](t){return{onwarn:(t,e,i)=>this.warn(t,e,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[iQ](t){this[iG]+=1;try{return new this[i0](t.path,this[iJ](t)).on("end",()=>this[iW](t)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[i2](){this[iU]&&this[iU].entry&&this[iU].entry.resume()}[iX](t){t.piped=!0,t.readdir&&t.readdir.forEach(e=>{let i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[i$](s+e)});let e=t.entry,i=this.zip;if(!e)throw Error("cannot pipe without source");i?e.on("data",t=>{i.write(t)||e.pause()}):e.on("data",t=>{super.write(t)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){eS(this,t,e,i)}},i4=class extends i5{sync=!0;constructor(t){super(t),this[i0]=iA}pause(){}resume(){}[iY](t){let e=this.follow?"statSync":"lstatSync";this[iF](t,r.default[e](t.absolute))}[iq](t){this[iK](t,r.default.readdirSync(t.absolute))}[iX](t){let e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach(e=>{let i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[i$](s+e)}),!e)throw Error("Cannot pipe without source");i?e.on("data",t=>{i.write(t)}):e.on("data",t=>{super[i1](t)})}},i8=(t,i)=>{i.forEach(i=>{"@"===i.charAt(0)?e7({file:e.default.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(i)}),t.end()},i3=async(t,i)=>{for(let s of i)"@"===s.charAt(0)?await e7({file:e.default.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>{t.add(e)}}):t.add(s);t.end()};tP((t,e)=>{let i=new i4(t),s=new tC(t.file,{mode:t.mode||438});i.pipe(s),i8(i,e)},(t,e)=>{let i=new i5(t),s=new tI(t.file,{mode:t.mode||438});i.pipe(s);let r=new Promise((t,e)=>{s.on("error",e),s.on("close",t),i.on("error",e)});return i3(i,e).catch(t=>i.emit("error",t)),r},(t,e)=>{let i=new i4(t);return i8(i,e),i},(t,e)=>{let i=new i5(t);return i3(i,e).catch(t=>i.emit("error",t)),i},(t,e)=>{if(!e?.length)throw TypeError("no paths specified to add to archive")});var i6="win32"===(process.env.__FAKE_PLATFORM__||process.platform),{O_CREAT:i7,O_NOFOLLOW:i9,O_TRUNC:st,O_WRONLY:se}=r.default.constants,si=Number(process.env.__FAKE_FS_O_FILENAME__)||r.default.constants.UV_FS_O_FILEMAP||0,ss=si|st|i7|se,sr=i6||"number"!=typeof i9?null:i9|st|i7|se,sn=null!==sr?()=>sr:i6&&si?t=>t<524288?ss:"w":()=>"w",sh=(t,e,s)=>{try{return i.default.lchownSync(t,e,s)}catch(t){if(t?.code!=="ENOENT")throw t}},so=(t,e,s,r)=>{i.default.lchown(t,e,s,t=>{r(t&&t?.code!=="ENOENT"?t:null)})},sa=(t,i,s,r,n)=>{i.isDirectory()?sl(e.default.resolve(t,i.name),s,r,h=>{if(h)return n(h);so(e.default.resolve(t,i.name),s,r,n)}):so(e.default.resolve(t,i.name),s,r,n)},sl=(t,e,s,r)=>{i.default.readdir(t,{withFileTypes:!0},(i,n)=>{if(i){if("ENOENT"===i.code)return r();if("ENOTDIR"!==i.code&&"ENOTSUP"!==i.code)return r(i)}if(i||!n.length)return so(t,e,s,r);let h=n.length,o=null,a=i=>{if(!o){if(i)return r(o=i);if(0==--h)return so(t,e,s,r)}};for(let i of n)sa(t,i,e,s,a)})},sd=(t,i,s,r)=>{i.isDirectory()&&su(e.default.resolve(t,i.name),s,r),sh(e.default.resolve(t,i.name),s,r)},su=(t,e,s)=>{let r;try{r=i.default.readdirSync(t,{withFileTypes:!0})}catch(i){if(i?.code==="ENOENT")return;if(i?.code==="ENOTDIR"||i?.code==="ENOTSUP")return sh(t,e,s);throw i}for(let i of r)sd(t,i,e,s);return sh(t,e,s)},sf=class extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}},sc=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}},sp=(t,s,r,n,h,o,a)=>{if(0===s.length)return a(null,o);let l=s.shift(),d=ev(e.default.resolve(t+"/"+l));i.default.mkdir(d,r,sm(d,s,r,n,h,o,a))},sm=(t,e,s,r,n,h,o)=>a=>{a?i.default.lstat(t,(l,d)=>{if(l)l.path=l.path&&ev(l.path),o(l);else if(d.isDirectory())sp(t,e,s,r,n,h,o);else if(r)i.default.unlink(t,a=>{if(a)return o(a);i.default.mkdir(t,s,sm(t,e,s,r,n,h,o))});else{if(d.isSymbolicLink())return o(new sc(t,t+"/"+e.join("/")));o(a)}}):(h=h||t,sp(t,e,s,r,n,h,o))},sy=Object.create(null),sb=new Set,sE="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform),sg=class{#t=new Map;#e=new Map;#i=new Set;reserve(t,i){let s=new Set((t=sE?["win32 parallelization disabled"]:t.map(t=>e3((0,e.join)((t=>{sb.has(t)?sb.delete(t):sy[t]=t.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),sb.add(t);let e=sy[t],i=sb.size-1e4;if(i>1e3){for(let t of sb)if(sb.delete(t),delete sy[t],--i<=0)break}return e})(t))))).map(t=>t.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return void 0!==s&&(i=(0,e.join)(s,i)),t.push(i||"/"),t},[])).reduce((t,e)=>t.concat(e)));for(let e of(this.#e.set(i,{dirs:s,paths:t}),t)){let t=this.#t.get(e);t?t.push(i):this.#t.set(e,[i])}for(let t of s){let e=this.#t.get(t);if(e){let t=e.at(-1);t instanceof Set?t.add(i):e.push(new Set([i]))}else this.#t.set(t,[new Set([i])])}return this.#r(i)}#s(t){let e=this.#e.get(t);if(!e)throw Error("function does not have any path reservations");return{paths:e.paths.map(t=>this.#t.get(t)),dirs:[...e.dirs].map(t=>this.#t.get(t))}}check(t){let{paths:e,dirs:i}=this.#s(t);return e.every(e=>e&&e[0]===t)&&i.every(e=>e&&e[0]instanceof Set&&e[0].has(t))}#r(t){return!this.#i.has(t)&&!!this.check(t)&&(this.#i.add(t),t(()=>this.#n(t)),!0)}#n(t){if(!this.#i.has(t))return!1;let e=this.#e.get(t);if(!e)throw Error("invalid reservation");let{paths:i,dirs:s}=e,r=new Set;for(let e of i){let i=this.#t.get(e);if(!i||i?.[0]!==t)continue;let s=i[1];if(!s){this.#t.delete(e);continue}if(i.shift(),"function"==typeof s)r.add(s);else for(let t of s)r.add(t)}for(let e of s){let i=this.#t.get(e),s=i?.[0];if(!(!i||!(s instanceof Set)))if(1===s.size&&1===i.length){this.#t.delete(e);continue}else if(1===s.size){i.shift();let t=i[0];"function"==typeof t&&r.add(t)}else s.delete(t)}return this.#i.delete(t),r.forEach(t=>this.#r(t)),!0}},sw=Symbol("onEntry"),sR=Symbol("checkFs"),sv=Symbol("checkFs2"),s_=Symbol("isReusable"),sS=Symbol("makeFs"),sO=Symbol("file"),sT=Symbol("directory"),sk=Symbol("link"),sL=Symbol("symlink"),sx=Symbol("hardlink"),sA=Symbol("ensureNoSymlink"),sN=Symbol("unsupported"),sD=Symbol("checkPath"),sI=Symbol("stripAbsolutePath"),sC=Symbol("mkdir"),sB=Symbol("onError"),sM=Symbol("pending"),sF=Symbol("pend"),sP=Symbol("unpend"),sz=Symbol("ended"),sU=Symbol("maybeClose"),sj=Symbol("skip"),sH=Symbol("doChown"),sZ=Symbol("uid"),sG=Symbol("gid"),sW=Symbol("checkedCwd"),s$="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform),sV=(t,e,i)=>void 0!==t&&t===t>>>0?t:void 0!==e&&e===e>>>0?e:i,sY=class extends e8{[sz]=!1;[sW]=!1;[sM]=0;reservations=new sg;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[sz]=!0,this[sU]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,"number"==typeof t.uid||"number"==typeof t.gid){if("number"!=typeof t.uid||"number"!=typeof t.gid)throw TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=void 0===t.preserveOwner&&"number"!=typeof t.uid?!!(process.getuid&&0===process.getuid()):!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:1024,this.forceChown=!0===t.forceChown,this.win32=!!t.win32||s$,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=ev(e.default.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?"number"==typeof t.processUmask?t.processUmask:process.umask():0,this.umask="number"==typeof t.umask?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",t=>this[sw](t))}warn(t,e,i={}){return("TAR_BAD_ARCHIVE"===t||"TAR_ABORT"===t)&&(i.recoverable=!1),super.warn(t,e,i)}[sU](){this[sz]&&0===this[sM]&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[sI](t,i){let s=t[i],{type:r}=t;if(!s||this.preservePaths)return!0;let[n,h]=ii(s),o=h.replaceAll(/\\/g,"/").split("/");if(o.includes("..")||s$&&/^[a-z]:\.\.$/i.test(o[0]??"")){if("path"===i||"Link"===r)return this.warn("TAR_ENTRY_ERROR",`${i} contains '..'`,{entry:t,[i]:s}),!1;let n=e.default.posix.dirname(t.path),h=e.default.posix.normalize(e.default.posix.join(n,o.join("/")));if(h.startsWith("../")||".."===h)return this.warn("TAR_ENTRY_ERROR",`${i} escapes extraction directory`,{entry:t,[i]:s}),!1}return n&&(t[i]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${i}`,{entry:t,[i]:s})),!0}[sD](t){let i=ev(t.path),s=i.split("/");if(this.strip){if(s.length<this.strip)return!1;if("Link"===t.type){let e=ev(String(t.linkpath)).split("/");if(!(e.length>=this.strip))return!1;t.linkpath=e.slice(this.strip).join("/")}s.splice(0,this.strip),t.path=s.join("/")}if(isFinite(this.maxDepth)&&s.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:i,depth:s.length,maxDepth:this.maxDepth}),!1;if(!this[sI](t,"path")||!this[sI](t,"linkpath"))return!1;if(t.absolute=e.default.isAbsolute(t.path)?ev(e.default.resolve(t.path)):ev(e.default.resolve(this.cwd,t.path)),!this.preservePaths&&"string"==typeof t.absolute&&0!==t.absolute.indexOf(this.cwd+"/")&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:ev(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&"Directory"!==t.type&&"GNUDumpDir"!==t.type)return!1;if(this.win32){let{root:i}=e.default.win32.parse(String(t.absolute));t.absolute=i+ia(String(t.absolute).slice(i.length));let{root:s}=e.default.win32.parse(t.path);t.path=s+ia(t.path.slice(s.length))}return!0}[sw](t){if(!this[sD](t))return t.resume();switch(f.default.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=448|t.mode);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[sR](t);default:return this[sN](t)}}[sB](t,e){"CwdError"===t.name?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[sP](),e.resume())}[sC](t,s,r){((t,s,r)=>{t=ev(t);let n=s.umask??18,h=448|s.mode,o=(h&n)!=0,a=s.uid,l=s.gid,d="number"==typeof a&&"number"==typeof l&&(a!==s.processUid||l!==s.processGid),u=s.preserve,f=s.unlink,c=ev(s.cwd),m=(e,s)=>{e?r(e):s&&d?sl(s,a,l,t=>m(t)):o?i.default.chmod(t,h,r):r()};if(t===c){var y;return y=t,i.default.stat(y,(t,e)=>{(t||!e.isDirectory())&&(t=new sf(y,t?.code||"ENOTDIR")),m(t)})}if(u)return p.default.mkdir(t,{mode:h,recursive:!0}).then(t=>m(null,t??void 0),m);let b=ev(e.default.relative(c,t)).split("/");sp(c,b,h,f,c,void 0,m)})(ev(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:s},r)}[sH](t){return this.forceChown||this.preserveOwner&&("number"==typeof t.uid&&t.uid!==this.processUid||"number"==typeof t.gid&&t.gid!==this.processGid)||"number"==typeof this.uid&&this.uid!==this.processUid||"number"==typeof this.gid&&this.gid!==this.processGid}[sZ](t){return sV(this.uid,t.uid,this.processUid)}[sG](t){return sV(this.gid,t.gid,this.processGid)}[sO](t,e){let s="number"==typeof t.mode?4095&t.mode:this.fmode,r=new tI(String(t.absolute),{flags:sn(t.size),mode:s,autoClose:!1});r.on("error",s=>{r.fd&&i.default.close(r.fd,()=>{}),r.write=()=>!0,this[sB](s,t),e()});let n=1,h=s=>{if(s){r.fd&&i.default.close(r.fd,()=>{}),this[sB](s,t),e();return}0==--n&&void 0!==r.fd&&i.default.close(r.fd,i=>{i?this[sB](i,t):this[sP](),e()})};r.on("finish",()=>{let e=String(t.absolute),s=r.fd;if("number"==typeof s&&t.mtime&&!this.noMtime){n++;let r=t.atime||new Date,o=t.mtime;i.default.futimes(s,r,o,t=>t?i.default.utimes(e,r,o,e=>h(e&&t)):h())}if("number"==typeof s&&this[sH](t)){n++;let r=this[sZ](t),o=this[sG](t);"number"==typeof r&&"number"==typeof o&&i.default.fchown(s,r,o,t=>t?i.default.chown(e,r,o,e=>h(e&&t)):h())}h()});let o=this.transform&&this.transform(t)||t;o!==t&&(o.on("error",i=>{this[sB](i,t),e()}),t.pipe(o)),o.pipe(r)}[sT](t,e){let s="number"==typeof t.mode?4095&t.mode:this.dmode;this[sC](String(t.absolute),s,s=>{if(s){this[sB](s,t),e();return}let r=1,n=()=>{0==--r&&(e(),this[sP](),t.resume())};t.mtime&&!this.noMtime&&(r++,i.default.utimes(String(t.absolute),t.atime||new Date,t.mtime,n)),this[sH](t)&&(r++,i.default.chown(String(t.absolute),Number(this[sZ](t)),Number(this[sG](t)),n)),n()})}[sN](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[sL](t,i){let s=ev(e.default.relative(this.cwd,e.default.resolve(e.default.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[sA](t,this.cwd,s,()=>this[sk](t,String(t.linkpath),"symlink",i),e=>{this[sB](e,t),i()})}[sx](t,i){let s=ev(e.default.resolve(this.cwd,String(t.linkpath))),r=ev(String(t.linkpath)).split("/");this[sA](t,this.cwd,r,()=>this[sk](t,s,"link",i),e=>{this[sB](e,t),i()})}[sA](t,s,r,n,h){let o=r.shift();if(this.preservePaths||void 0===o)return n();let a=e.default.resolve(s,o);i.default.lstat(a,(i,s)=>i?n():s?.isSymbolicLink()?h(new sc(a,e.default.resolve(a,r.join("/")))):void this[sA](t,a,r,n,h))}[sF](){this[sM]++}[sP](){this[sM]--,this[sU]()}[sj](t){this[sP](),t.resume()}[s_](t,e){return"File"===t.type&&!this.unlink&&e.isFile()&&e.nlink<=1&&!s$}[sR](t){this[sF]();let e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,e=>this[sv](t,e))}[sv](t,s){let r=t=>{s(t)},n=()=>{this[sC](this.cwd,this.dmode,e=>{if(e){this[sB](e,t),r();return}this[sW]=!0,h()})},h=()=>{if(t.absolute!==this.cwd){let i=ev(e.default.dirname(String(t.absolute)));if(i!==this.cwd)return this[sC](i,this.dmode,e=>{if(e){this[sB](e,t),r();return}o()})}o()},o=()=>{i.default.lstat(String(t.absolute),(e,s)=>{if(s&&(this.keep||this.newer&&s.mtime>(t.mtime??s.mtime))){this[sj](t),r();return}if(e||this[s_](t,s))return this[sS](null,t,r);if(s.isDirectory()){if("Directory"===t.type){let e=this.chmod&&t.mode&&(4095&s.mode)!==t.mode,n=e=>this[sS](e??null,t,r);return e?i.default.chmod(String(t.absolute),Number(t.mode),n):n()}if(t.absolute!==this.cwd)return i.default.rmdir(String(t.absolute),e=>this[sS](e??null,t,r))}if(t.absolute===this.cwd)return this[sS](null,t,r);((t,e)=>{if(!s$)return i.default.unlink(t,e);let s=t+".DELETE."+(0,c.randomBytes)(16).toString("hex");i.default.rename(t,s,t=>{if(t)return e(t);i.default.unlink(s,e)})})(String(t.absolute),e=>this[sS](e??null,t,r))})};this[sW]?h():n()}[sS](t,e,i){if(t){this[sB](t,e),i();return}switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[sO](e,i);case"Link":return this[sx](e,i);case"SymbolicLink":return this[sL](e,i);case"Directory":case"GNUDumpDir":return this[sT](e,i)}}[sk](t,e,s,r){i.default[s](e,String(t.absolute),e=>{e?this[sB](e,t):(this[sP](),t.resume()),r()})}},sq=t=>{try{return[null,t()]}catch(t){return[t,null]}},sK=class extends sY{sync=!0;[sS](t,e){return super[sS](t,e,()=>{})}[sR](t){if(!this[sW]){let e=this[sC](this.cwd,this.dmode);if(e)return this[sB](e,t);this[sW]=!0}if(t.absolute!==this.cwd){let i=ev(e.default.dirname(String(t.absolute)));if(i!==this.cwd){let e=this[sC](i,this.dmode);if(e)return this[sB](e,t)}}let[s,r]=sq(()=>i.default.lstatSync(String(t.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(t.mtime??r.mtime)))return this[sj](t);if(s||this[s_](t,r))return this[sS](null,t);if(r.isDirectory()){if("Directory"===t.type){let[e]=this.chmod&&t.mode&&(4095&r.mode)!==t.mode?sq(()=>{i.default.chmodSync(String(t.absolute),Number(t.mode))}):[];return this[sS](e,t)}let[e]=sq(()=>i.default.rmdirSync(String(t.absolute)));this[sS](e,t)}let[n]=t.absolute===this.cwd?[]:sq(()=>(t=>{if(!s$)return i.default.unlinkSync(t);let e=t+".DELETE."+(0,c.randomBytes)(16).toString("hex");i.default.renameSync(t,e),i.default.unlinkSync(e)})(String(t.absolute)));this[sS](n,t)}[sO](t,e){let s="number"==typeof t.mode?4095&t.mode:this.fmode,r=s=>{let r;try{i.default.closeSync(n)}catch(t){r=t}(s||r)&&this[sB](s||r,t),e()},n;try{n=i.default.openSync(String(t.absolute),sn(t.size),s)}catch(t){return r(t)}let h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",e=>this[sB](e,t)),t.pipe(h)),h.on("data",t=>{try{i.default.writeSync(n,t,0,t.length)}catch(t){r(t)}}),h.on("end",()=>{let e=null;if(t.mtime&&!this.noMtime){let s=t.atime||new Date,r=t.mtime;try{i.default.futimesSync(n,s,r)}catch(n){try{i.default.utimesSync(String(t.absolute),s,r)}catch{e=n}}}if(this[sH](t)){let s=this[sZ](t),r=this[sG](t);try{i.default.fchownSync(n,Number(s),Number(r))}catch(n){try{i.default.chownSync(String(t.absolute),Number(s),Number(r))}catch{e=e||n}}}r(e)})}[sT](t,e){let s="number"==typeof t.mode?4095&t.mode:this.dmode,r=this[sC](String(t.absolute),s);if(r){this[sB](r,t),e();return}if(t.mtime&&!this.noMtime)try{i.default.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[sH](t))try{i.default.chownSync(String(t.absolute),Number(this[sZ](t)),Number(this[sG](t)))}catch{}e(),t.resume()}[sC](t,s){try{return((t,s)=>{t=ev(t);let r=s.umask??18,n=448|s.mode,h=(n&r)!=0,o=s.uid,a=s.gid,l="number"==typeof o&&"number"==typeof a&&(o!==s.processUid||a!==s.processGid),d=s.preserve,u=s.unlink,f=ev(s.cwd),c=e=>{e&&l&&su(e,o,a),h&&i.default.chmodSync(t,n)};if(t===f)return(t=>{let e=!1,s;try{e=i.default.statSync(t).isDirectory()}catch(t){s=t?.code}finally{if(!e)throw new sf(t,s??"ENOTDIR")}})(f),c();if(d)return c(i.default.mkdirSync(t,{mode:n,recursive:!0})??void 0);let p=ev(e.default.relative(f,t)).split("/"),m;for(let t=p.shift(),s=f;t&&(s+="/"+t);t=p.shift()){s=ev(e.default.resolve(s));try{i.default.mkdirSync(s,n),m=m||s}catch{let t=i.default.lstatSync(s);if(t.isDirectory())continue;if(u){i.default.unlinkSync(s),i.default.mkdirSync(s,n),m=m||s;continue}if(t.isSymbolicLink())return new sc(s,s+"/"+p.join("/"))}}return c(m)})(ev(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:s})}catch(t){return t}}[sA](t,s,r,n,h){if(this.preservePaths||0===r.length)return n();let o=s;for(let t of r){o=e.default.resolve(o,t);let[a,l]=sq(()=>i.default.lstatSync(o));if(a)return n();if(l.isSymbolicLink())return h(new sc(o,e.default.resolve(s,r.join("/"))))}n()}[sk](t,e,s,r){let n=`${s}Sync`;try{i.default[n](e,String(t.absolute)),r(),t.resume()}catch(e){return this[sB](e,t)}}},sX=tP(t=>{let e=new sK(t),s=t.file,r=i.default.statSync(s);new tD(s,{readSize:t.maxReadSize||0x1000000,size:r.size}).pipe(e)},(t,e)=>{let s=new sY(t),r=t.maxReadSize||0x1000000,n=t.file;return new Promise((t,e)=>{s.on("error",e),s.on("close",t),i.default.stat(n,(t,i)=>{if(t)e(t);else{let t=new tN(n,{readSize:r,size:i.size});t.on("error",e),t.pipe(s)}})})},t=>new sK(t),t=>new sY(t),(t,e)=>{e?.length&&e6(t,e)}),sQ=(t,i)=>{i.forEach(i=>{"@"===i.charAt(0)?e7({file:e.default.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(i)}),t.end()},sJ=async(t,i)=>{for(let s of i)"@"===s.charAt(0)?await e7({file:e.default.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>t.add(e)}):t.add(s);t.end()},s0=tP((t,e)=>{let s=new i4(t),r=!0,n,h;try{var o,a,l,d,u;let f;try{n=i.default.openSync(t.file,"r+")}catch(e){if(e?.code==="ENOENT")n=i.default.openSync(t.file,"w+");else throw e}let c=i.default.fstatSync(n),p=Buffer.alloc(512);t:for(h=0;h<c.size;h+=512){for(let t=0,e=0;t<512;t+=e){if(e=i.default.readSync(n,p,t,p.length-t,h+t),0===h&&31===p[0]&&139===p[1])throw Error("cannot append to compressed archives");if(!e)break t}let e=new es(p);if(!e.cksumValid)break;let s=512*Math.ceil((e.size||0)/512);if(h+s+512>c.size)break;h+=s,t.mtimeCache&&e.mtime&&t.mtimeCache.set(String(e.path),e.mtime)}r=!1,o=t,a=s,l=h,d=n,u=e,f=new tC(o.file,{fd:d,start:l}),a.pipe(f),sQ(a,u)}finally{if(r)try{i.default.closeSync(n)}catch{}}},(t,e)=>{e=Array.from(e);let s=new i5(t);return new Promise((r,n)=>{s.on("error",n);let h="r+",o=(a,l)=>a&&"ENOENT"===a.code&&"r+"===h?(h="w+",i.default.open(t.file,h,o)):a||!l?n(a):void i.default.fstat(l,(h,o)=>{if(h)return i.default.close(l,()=>n(h));((e,s,r)=>{let n=(t,s)=>{t?i.default.close(e,e=>r(t)):r(null,s)},h=0;if(0===s)return n(null,0);let o=0,a=Buffer.alloc(512),l=(r,d)=>{if(r||void 0===d)return n(r);if((o+=d)<512&&d)return i.default.read(e,a,o,a.length-o,h+o,l);if(0===h&&31===a[0]&&139===a[1])return n(Error("cannot append to compressed archives"));if(o<512)return n(null,h);let u=new es(a);if(!u.cksumValid)return n(null,h);let f=512*Math.ceil((u.size??0)/512);if(h+f+512>s||(h+=f+512)>=s)return n(null,h);t.mtimeCache&&u.mtime&&t.mtimeCache.set(String(u.path),u.mtime),o=0,i.default.read(e,a,0,512,h,l)};i.default.read(e,a,0,512,h,l)})(l,o.size,(i,h)=>{if(i)return n(i);let o=new tI(t.file,{fd:l,start:h});s.pipe(o),o.on("error",n),o.on("close",r),sJ(s,e)})});i.default.open(t.file,h,o)})},()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(t,e)=>{if(!t.file)throw TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!e?.length)throw TypeError("no paths specified to add/replace")});tP(s0.syncFile,s0.asyncFile,s0.syncNoFile,s0.asyncNoFile,(t,e=[])=>{s0.validate?.(t,e),s1(t)});var s1=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,s)=>e(i,s)&&!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(e,i)=>!((t.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))};let s2=/^tower-(backup|auto)-\d{8}-\d{6}\.tar\.gz$/;async function s5(t){let s=(0,e.join)((0,e.dirname)(t),`_meta_tmp_${Date.now()}`);try{(0,i.mkdirSync)(s,{recursive:!0}),await sX({file:t,cwd:s,filter:t=>"metadata.json"===t});let r=(0,e.join)(s,"metadata.json");if(!(0,i.existsSync)(r))return null;return JSON.parse((0,i.readFileSync)(r,"utf-8"))}catch{return null}finally{(0,i.rmSync)(s,{recursive:!0,force:!0})}}(0,e.join)("storage","assets"),t.s(["readMetadataFromArchive",0,s5,"validateFilename",0,function(t){if(!s2.test(t))throw Error(`Invalid backup filename: ${t}`)}],605171)},119620,t=>t.a(async(e,i)=>{try{var s=t.i(855104),r=t.i(198840),n=t.i(750227),h=t.i(902157),o=t.i(192520),a=t.i(605171),l=t.i(22569),d=e([l]);async function u(e){let i=(0,r.requireLocalhost)(e);if(i)return i;try{let i=(await e.formData()).get("file");if(!i)return s.NextResponse.json({error:"No file provided"},{status:400});try{(0,a.validateFilename)(i.name)}catch{return s.NextResponse.json({error:"Invalid backup filename"},{status:400})}let r=await (0,l.getConfigValue)("system.backupDir","")||(0,o.getBackupsDir)();(0,h.mkdirSync)(r,{recursive:!0});let d=(0,n.join)(r,i.name);if((0,h.existsSync)(d))return s.NextResponse.json({error:"File already exists"},{status:409});let u=Buffer.from(await i.arrayBuffer());(0,h.writeFileSync)(d,u);let f=await (0,a.readMetadataFromArchive)(d);if(!f||!f.version){try{t.r(902157).unlinkSync(d)}catch{}return s.NextResponse.json({error:"Invalid backup archive"},{status:400})}return s.NextResponse.json({filename:i.name,metadata:f})}catch{return s.NextResponse.json({error:"Import failed"},{status:500})}}[l]=d.then?(await d)():d,t.s(["POST",0,u,"dynamic",0,"force-dynamic","runtime",0,"nodejs"]),i()}catch(t){i(t)}},!1),766434,t=>t.a(async(e,i)=>{try{var s=t.i(765876),r=t.i(675896),n=t.i(959160),h=t.i(97944),o=t.i(86757),a=t.i(204144),l=t.i(273436),d=t.i(743641),u=t.i(813766),f=t.i(840884),c=t.i(498814),p=t.i(780006),m=t.i(544432),y=t.i(772005),b=t.i(450223),E=t.i(193695);t.i(628400);var g=t.i(800071),w=t.i(119620),R=e([w]);[w]=R.then?(await R)():R;let _=new s.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/internal/backup/import/route",pathname:"/api/internal/backup/import",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/internal/backup/import/route.ts",nextConfigOutput:"standalone",userland:w}),{workAsyncStorage:S,workUnitAsyncStorage:O,serverHooks:T}=_;async function v(t,e,i){i.requestMeta&&(0,h.setRequestMeta)(t,i.requestMeta),_.isDev&&(0,h.addRequestMeta)(t,"devRequestTimingInternalsEnd",process.hrtime.bigint());let s="/api/internal/backup/import/route";s=s.replace(/\/index$/,"")||"/";let n=await _.prepare(t,e,{srcPage:s,multiZoneDraftMode:!1});if(!n)return e.statusCode=400,e.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve()),null;let{buildId:w,params:R,nextConfig:v,parsedUrl:S,isDraftMode:O,prerenderManifest:T,routerServerContext:k,isOnDemandRevalidate:L,revalidateOnlyGenerated:x,resolvedPathname:A,clientReferenceManifest:N,serverActionsManifest:D}=n,I=(0,l.normalizeAppPath)(s),C=!!(T.dynamicRoutes[I]||T.routes[A]),B=async()=>((null==k?void 0:k.render404)?await k.render404(t,e,S,!1):e.end("This page could not be found"),null);if(C&&!O){let t=!!T.routes[A],e=T.dynamicRoutes[I];if(e&&!1===e.fallback&&!t){if(v.adapterPath)return await B();throw new E.NoFallbackError}}let M=null;!C||_.isDev||O||(M=A,M="/index"===M?"/":M);let F=!0===_.isDev||!C,P=C&&!F;D&&N&&(0,a.setManifestsSingleton)({page:s,clientReferenceManifest:N,serverActionsManifest:D});let z=t.method||"GET",U=(0,o.getTracer)(),j=U.getActiveScopeSpan(),H=!!(null==k?void 0:k.isWrappedByNextServer),Z=!!(0,h.getRequestMeta)(t,"minimalMode"),G=(0,h.getRequestMeta)(t,"incrementalCache")||await _.getIncrementalCache(t,v,T,Z);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let W={params:R,previewProps:T.preview,renderOpts:{experimental:{authInterrupts:!!v.experimental.authInterrupts},cacheComponents:!!v.cacheComponents,supportsDynamicResponse:F,incrementalCache:G,cacheLifeProfiles:v.cacheLife,waitUntil:i.waitUntil,onClose:t=>{e.on("close",t)},onAfterTaskError:void 0,onInstrumentationRequestError:(e,i,s,r)=>_.onRequestError(t,e,s,r,k)},sharedContext:{buildId:w}},$=new d.NodeNextRequest(t),V=new d.NodeNextResponse(e),Y=u.NextRequestAdapter.fromNodeNextRequest($,(0,u.signalFromNodeResponse)(e));try{let n,h=async t=>_.handle(Y,W).finally(()=>{if(!t)return;t.setAttributes({"http.status_code":e.statusCode,"next.rsc":!1});let i=U.getRootSpanAttributes();if(!i)return;if(i.get("next.span_type")!==f.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${i.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=i.get("next.route");if(r){let e=`${z} ${r}`;t.setAttributes({"next.route":r,"http.route":r,"next.span_name":e}),t.updateName(e),n&&n!==t&&(n.setAttribute("http.route",r),n.updateName(e))}else t.updateName(`${z} ${s}`)}),a=async n=>{var o,a;let l=async({previousCacheEntry:r})=>{try{if(!Z&&L&&x&&!r)return e.statusCode=404,e.setHeader("x-nextjs-cache","REVALIDATED"),e.end("This page could not be found"),null;let s=await h(n);t.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&i.waitUntil&&(i.waitUntil(o),o=void 0);let a=W.renderOpts.collectedTags;if(!C)return await (0,p.sendResponse)($,V,s,W.renderOpts.pendingWaitUntil),null;{let t=await s.blob(),e=(0,m.toNodeOutgoingHttpHeaders)(s.headers);a&&(e[b.NEXT_CACHE_TAGS_HEADER]=a),!e["content-type"]&&t.type&&(e["content-type"]=t.type);let i=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=b.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,r=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=b.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await t.arrayBuffer()),headers:e},cacheControl:{revalidate:i,expire:r}}}}catch(e){throw(null==r?void 0:r.isStale)&&await _.onRequestError(t,e,{routerKind:"App Router",routePath:s,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:P,isOnDemandRevalidate:L})},!1,k),e}},d=await _.handleResponse({req:t,nextConfig:v,cacheKey:M,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:L,revalidateOnlyGenerated:x,responseGenerator:l,waitUntil:i.waitUntil,isMinimalMode:Z});if(!C)return null;if((null==d||null==(o=d.value)?void 0:o.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(a=d.value)?void 0:a.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});Z||e.setHeader("x-nextjs-cache",L?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),O&&e.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,m.fromNodeOutgoingHttpHeaders)(d.value.headers);return Z&&C||u.delete(b.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||e.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,y.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)($,V,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};H&&j?await a(j):(n=U.getActiveScopeSpan(),await U.withPropagatedContext(t.headers,()=>U.trace(f.BaseServerSpan.handleRequest,{spanName:`${z} ${s}`,kind:o.SpanKind.SERVER,attributes:{"http.method":z,"http.target":t.url}},a),void 0,!H))}catch(e){if(e instanceof E.NoFallbackError||await _.onRequestError(t,e,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:P,isOnDemandRevalidate:L})},!1,k),C)throw e;return await (0,p.sendResponse)($,V,new Response(null,{status:500})),null}}t.s(["handler",0,v,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:O})},"routeModule",0,_,"serverHooks",0,T,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,O]),i()}catch(t){i(t)}},!1)];
3
+ `).reduce(eR,Object.create(null)),eR=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;let s=(e=e.slice((i+" ").length)).split("="),r=s.shift();if(!r)return t;let n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),h=s.join("=");return t[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(1e3*Number(h)):/^[0-9]+$/.test(h)?+h:h,t},ev="win32"!==(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)?t=>t:t=>t&&t.replaceAll(/\\/g,"/"),e_=class extends te{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw Error("no path provided for tar.ReadEntry");this.path=ev(t.path),this.mode=t.mode,this.mode&&(this.mode=4095&this.mode),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?ev(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#t(e),i&&this.#t(i,!0)}write(t){let e=t.length;if(e>this.blockRemain)throw Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,s-e),!!this.ignore||(i>=e?super.write(t):super.write(t.subarray(0,i)))}#t(t,e=!1){t.path&&(t.path=ev(t.path)),t.linkpath&&(t.linkpath=ev(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([t,i])=>!(null==i||"path"===t&&e))))}},eS=(t,e,i,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=i instanceof Error&&i.code||e,s.tarCode=e,t.strict||!1===s.recoverable?i instanceof Error?t.emit("error",Object.assign(i,s)):t.emit("error",Object.assign(Error(`${e}: ${i}`),s)):(i instanceof Error&&(s=Object.assign(i,s),i=i.message),t.emit("warn",e,i,s))},eO=Buffer.from([31,139]),eT=Buffer.from([40,181,47,253]),ek=Math.max(eO.length,eT.length),eL=Symbol("state"),ex=Symbol("writeEntry"),eA=Symbol("readEntry"),eN=Symbol("nextEntry"),eD=Symbol("processEntry"),eI=Symbol("extendedHeader"),eC=Symbol("globalExtendedHeader"),eB=Symbol("meta"),eM=Symbol("emitMeta"),eF=Symbol("buffer"),eP=Symbol("queue"),ez=Symbol("ended"),eU=Symbol("emittedEnd"),ej=Symbol("emit"),eH=Symbol("unzip"),eZ=Symbol("consumeChunk"),eG=Symbol("consumeChunkSub"),eW=Symbol("consumeBody"),e$=Symbol("consumeMeta"),eV=Symbol("consumeHeader"),eY=Symbol("consuming"),eq=Symbol("bufferConcat"),eK=Symbol("maybeEnd"),eX=Symbol("writing"),eQ=Symbol("aborted"),eJ=Symbol("onDone"),e0=Symbol("sawValidEntry"),e1=Symbol("sawNullBlock"),e2=Symbol("sawEOF"),e5=Symbol("closeStream"),e4=()=>!0,e8=class extends s.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[eP]=[];[eF];[eA];[ex];[eL]="begin";[eB]="";[eI];[eC];[ez]=!1;[eH];[eQ]=!1;[e0];[e1]=!1;[e2]=!1;[eX]=!1;[eY]=!1;[eU]=!1;constructor(t={}){super(),this.file=t.file||"",this.on(eJ,()=>{("begin"===this[eL]||!1===this[e0])&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(eJ,t.ondone):this.on(eJ,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||1048576,this.filter="function"==typeof t.filter?t.filter:e4;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=t.gzip||t.zstd||void 0===t.brotli?!!e&&void 0:t.brotli;let i=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=t.gzip||t.brotli||void 0===t.zstd?!!i||void 0:t.zstd,this.on("end",()=>this[e5]()),"function"==typeof t.onwarn&&this.on("warn",t.onwarn),"function"==typeof t.onReadEntry&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){eS(this,t,e,i)}[eV](t,e){let i;void 0===this[e0]&&(this[e0]=!1);try{i=new es(t,e,this[eI],this[eC])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock)this[e1]?(this[e2]=!0,"begin"===this[eL]&&(this[eL]="header"),this[ej]("eof")):(this[e1]=!0,this[ej]("nullBlock"));else if(this[e1]=!1,i.cksumValid)if(i.path){let t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(/^(Symbolic)?Link$/.test(t)||/^(Global)?ExtendedHeader$/.test(t)||!i.linkpath){let t=this[ex]=new e_(i,this[eI],this[eC]);if(!this[e0])if(t.remain){let e=()=>{t.invalid||(this[e0]=!0)};t.on("end",e)}else this[e0]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[ej]("ignoredEntry",t),this[eL]="ignore",t.resume()):t.size>0&&(this[eB]="",t.on("data",t=>this[eB]+=t),this[eL]="meta"):(this[eI]=void 0,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[ej]("ignoredEntry",t),this[eL]=t.remain?"ignore":"header",t.resume()):(t.remain?this[eL]="body":(this[eL]="header",t.end()),this[eA]?this[eP].push(t):(this[eP].push(t),this[eN]())))}else this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}[e5](){queueMicrotask(()=>this.emit("close"))}[eD](t){let e=!0;if(t)if(Array.isArray(t)){let[e,...i]=t;this.emit(e,...i)}else this[eA]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",()=>this[eN]()),e=!1);else this[eA]=void 0,e=!1;return e}[eN](){do;while(this[eD](this[eP].shift()))if(0===this[eP].length){let t=this[eA];!t||t.flowing||t.size===t.remain?this[eX]||this.emit("drain"):t.once("drain",()=>this.emit("drain"))}}[eW](t,e){let i=this[ex];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=t.length&&0===e?t:t.subarray(e,e+s);return i.write(r),i.blockRemain||(this[eL]="header",this[ex]=void 0,i.end()),r.length}[e$](t,e){let i=this[ex],s=this[eW](t,e);return!this[ex]&&i&&this[eM](i),s}[ej](t,e,i){0!==this[eP].length||this[eA]?this[eP].push([t,e,i]):this.emit(t,e,i)}[eM](t){switch(this[ej]("meta",this[eB]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[eI]=eE.parse(this[eB],this[eI],!1);break;case"GlobalExtendedHeader":this[eC]=eE.parse(this[eB],this[eC],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[eI]??Object.create(null);this[eI]=t,t.path=this[eB].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[eI]||Object.create(null);this[eI]=t,t.linkpath=this[eB].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+t.type)}}abort(t){this[eQ]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this[eQ])return i?.(),!1;if((void 0===this[eH]||void 0===this.brotli&&!1===this[eH])&&t){if(this[eF]&&(t=Buffer.concat([this[eF],t]),this[eF]=void 0),t.length<ek)return this[eF]=t,i?.(),!0;for(let e=0;void 0===this[eH]&&e<eO.length;e++)t[e]!==eO[e]&&(this[eH]=!1);let e=!1;if(!1===this[eH]&&!1!==this.zstd){e=!0;for(let i=0;i<eT.length;i++)if(t[i]!==eT[i]){e=!1;break}}let s=void 0===this.brotli&&!e;if(!1===this[eH]&&s)if(t.length<512)if(!this[ez])return this[eF]=t,i?.(),!0;else this.brotli=!0;else try{new es(t.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(void 0===this[eH]||!1===this[eH]&&(this.brotli||e)){let s=this[ez];this[ez]=!1,this[eH]=void 0===this[eH]?new tX({}):e?new t5({}):new t0({}),this[eH].on("data",t=>this[eZ](t)),this[eH].on("error",t=>this.abort(t)),this[eH].on("end",()=>{this[ez]=!0,this[eZ]()}),this[eX]=!0;let r=!!this[eH][s?"end":"write"](t);return this[eX]=!1,i?.(),r}}this[eX]=!0,this[eH]?this[eH].write(t):this[eZ](t),this[eX]=!1;let s=!(this[eP].length>0)&&(!this[eA]||this[eA].flowing);return s||0!==this[eP].length||this[eA]?.once("drain",()=>this.emit("drain")),i?.(),s}[eq](t){t&&!this[eQ]&&(this[eF]=this[eF]?Buffer.concat([this[eF],t]):t)}[eK](){if(this[ez]&&!this[eU]&&!this[eQ]&&!this[eY]){this[eU]=!0;let t=this[ex];if(t&&t.blockRemain){let e=this[eF]?this[eF].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[eF]&&t.write(this[eF]),t.end()}this[ej](eJ)}}[eZ](t){if(this[eY]&&t)this[eq](t);else if(t||this[eF]){if(t){if(this[eY]=!0,this[eF]){this[eq](t);let e=this[eF];this[eF]=void 0,this[eG](e)}else this[eG](t);for(;this[eF]&&this[eF]?.length>=512&&!this[eQ]&&!this[e2];){let t=this[eF];this[eF]=void 0,this[eG](t)}this[eY]=!1}}else this[eK]();(!this[eF]||this[ez])&&this[eK]()}[eG](t){let e=0,i=t.length;for(;e+512<=i&&!this[eQ]&&!this[e2];)switch(this[eL]){case"begin":case"header":this[eV](t,e),e+=512;break;case"ignore":case"body":e+=this[eW](t,e);break;case"meta":e+=this[e$](t,e);break;default:throw Error("invalid state: "+this[eL])}e<i&&(this[eF]=this[eF]?Buffer.concat([t.subarray(e),this[eF]]):t.subarray(e))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e)),i&&this.once("finish",i),this[eQ]||(this[eH]?(t&&this[eH].write(t),this[eH].end()):(this[ez]=!0,(void 0===this.brotli||void 0===this.zstd)&&(t=t||Buffer.alloc(0)),t&&this.write(t),this[eK]())),this}},e3=t=>{let e=t.length-1,i=-1;for(;e>-1&&"/"===t.charAt(e);)i=e,e--;return -1===i?t:t.slice(0,i)},e6=(t,e)=>{let i=new Map(e.map(t=>[e3(t),!0])),s=t.filter,r=(t,e="")=>{let s=e||(0,a.parse)(t).root||".",n;if(t===s)n=!1;else{let e=i.get(t);n=void 0!==e?e:r((0,a.dirname)(t),s)}return i.set(t,n),n};t.filter=s?(t,e)=>s(t,e)&&r(e3(t)):t=>r(e3(t))},e7=tP(t=>{let e=new e8(t),s=t.file,r;try{r=i.default.openSync(s,"r");let n=i.default.fstatSync(r),h=t.maxReadSize||0x1000000;if(n.size<h){let t=Buffer.allocUnsafe(n.size),s=i.default.readSync(r,t,0,n.size,0);e.end(s===t.byteLength?t:t.subarray(0,s))}else{let t=0,s=Buffer.allocUnsafe(h);for(;t<n.size;){let n=i.default.readSync(r,s,0,h,t);if(0===n)break;t+=n,e.write(s.subarray(0,n))}e.end()}}finally{if("number"==typeof r)try{i.default.closeSync(r)}catch{}}},(t,e)=>{let s=new e8(t),r=t.maxReadSize||0x1000000,n=t.file;return new Promise((t,e)=>{s.on("error",e),s.on("end",t),i.default.stat(n,(t,i)=>{if(t)e(t);else{let t=new tN(n,{readSize:r,size:i.size});t.on("error",e),t.pipe(s)}})})},t=>new e8(t),t=>new e8(t),(t,e)=>{let i;e?.length&&e6(t,e),t.noResume||(i=t.onReadEntry,t.onReadEntry=i?t=>{i(t),t.resume()}:t=>t.resume())}),e9=(t,e,i)=>(t&=4095,i&&(t=(384|t)&-19),e&&(256&t&&(t|=64),32&t&&(t|=8),4&t&&(t|=1)),t),{isAbsolute:it,parse:ie}=e.win32,ii=t=>{let e="",i=ie(t);for(;it(t)||i.root;){let s="/"===t.charAt(0)&&"//?/"!==t.slice(0,4)?"/":i.root;t=t.slice(s.length),e+=s,i=ie(t)}return[e,t]},is=["|","<",">","?",":"],ir=is.map(t=>String.fromCodePoint(61440+Number(t.codePointAt(0)))),ih=new Map(is.map((t,e)=>[t,ir[e]])),io=new Map(ir.map((t,e)=>[t,is[e]])),ia=t=>is.reduce((t,e)=>t.split(e).join(ih.get(e)),t),il=(t,e)=>e?(t=ev(t).replace(/^\.(\/|$)/,""),e3(e)+"/"+t):ev(t),id=Symbol("process"),iu=Symbol("file"),ic=Symbol("directory"),ip=Symbol("symlink"),im=Symbol("hardlink"),iy=Symbol("header"),ib=Symbol("read"),iE=Symbol("lstat"),ig=Symbol("onlstat"),iw=Symbol("onread"),iR=Symbol("onreadlink"),iv=Symbol("openfile"),i_=Symbol("onopenfile"),iS=Symbol("close"),iO=Symbol("mode"),iT=Symbol("awaitDrain"),ik=Symbol("ondrain"),iL=Symbol("prefix"),ix=class extends te{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#t=!1;constructor(t,e={}){let i=tF(e);super(),this.path=ev(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||0x1000000,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=ev(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?ev(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[t,e]=ii(this.path);t&&"string"==typeof e&&(this.path=e,s=t)}this.win32=!!i.win32||"win32"===process.platform,this.win32&&(this.path=(t=>ir.reduce((t,e)=>t.split(e).join(io.get(e)),t))(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=ev(i.absolute||a.default.resolve(this.cwd,t)),""===this.path&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let r=this.statCache.get(this.absolute);r?this[ig](r):this[iE]()}warn(t,e,i={}){return eS(this,t,e,i)}emit(t,...e){return"error"===t&&(this.#t=!0),super.emit(t,...e)}[iE](){r.default.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[ig](e)})}[ig](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=iD(t),this.emit("stat",t),this[id]()}[id](){switch(this.type){case"File":return this[iu]();case"Directory":return this[ic]();case"SymbolicLink":return this[ip]();default:return this.end()}}[iO](t){return e9(t,"Directory"===this.type,this.portable)}[iL](t){return il(t,this.prefix)}[iy](){if(!this.stat)throw Error("cannot write header before stat");"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new es({path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,mode:this[iO](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:"Unsupported"===this.type?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new eE({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let t=this.header?.block;if(!t)throw Error("failed to encode header");super.write(t)}[ic](){if(!this.stat)throw Error("cannot create directory entry without stat");"/"!==this.path.slice(-1)&&(this.path+="/"),this.stat.size=0,this[iy](),this.end()}[ip](){r.default.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[iR](e)})}[iR](t){this.linkpath=ev(t),this[iy](),this.end()}[im](t){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=ev(a.default.relative(this.cwd,t)),this.stat.size=0,this[iy](),this.end()}[iu](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(e?.indexOf(this.cwd)===0)return this[im](e);this.linkCache.set(t,this.absolute)}if(this[iy](),0===this.stat.size)return this.end();this[iv]()}[iv](){r.default.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[i_](e)})}[i_](t){if(this.fd=t,this.#t)return this[iS]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[ib]()}[ib](){let{fd:t,buf:e,offset:i,length:s,pos:n}=this;if(void 0===t||void 0===e)throw Error("cannot read file without first opening");r.default.read(t,e,i,s,n,(t,e)=>{if(t)return this[iS](()=>this.emit("error",t));this[iw](e)})}[iS](t=()=>{}){void 0!==this.fd&&r.default.close(this.fd,t)}[iw](t){if(t<=0&&this.remain>0){let t=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[iS](()=>this.emit("error",t))}if(t>this.remain){let t=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[iS](()=>this.emit("error",t))}if(!this.buf)throw Error("should have created buffer prior to reading");if(t===this.remain)for(let e=t;e<this.length&&t<this.blockRemain;e++)this.buf[e+this.offset]=0,t++,this.remain++;let e=0===this.offset&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(e)?this[ik]():this[iT](()=>this[ik]())}[iT](t){this.once("drain",t)}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this.blockRemain<t.length){let t=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,i)}[ik](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[iS](t=>t?this.emit("error",t):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[ib]()}},iA=class extends ix{sync=!0;[iE](){this[ig](r.default.lstatSync(this.absolute))}[ip](){this[iR](r.default.readlinkSync(this.absolute))}[iv](){this[i_](r.default.openSync(this.absolute,"r"))}[ib](){let t=!0;try{let{fd:e,buf:i,offset:s,length:n,pos:h}=this;if(void 0===e||void 0===i)throw Error("fd and buf must be set in READ method");let o=r.default.readSync(e,i,s,n,h);this[iw](o),t=!1}finally{if(t)try{this[iS](()=>{})}catch{}}}[iT](t){t()}[iS](t=()=>{}){void 0!==this.fd&&r.default.closeSync(this.fd),t()}},iN=class extends te{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return eS(this,t,e,i)}constructor(t,e={}){let i=tF(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;let{type:s}=t;if("Unsupported"===s)throw Error("writing entry that should be ignored");this.type=s,"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=ev(t.path),this.mode=void 0!==t.mode?this[iO](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=void 0!==t.linkpath?ev(t.linkpath):void 0,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[t,e]=ii(this.path);t&&"string"==typeof e&&(this.path=e,r=t)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new es({path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new eE({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[iL](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[iL](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let n=this.header?.block;if(!n)throw Error("failed to encode header");super.write(n),t.pipe(this)}[iL](t){return il(t,this.prefix)}[iO](t){return e9(t,"Directory"===this.type,this.portable)}write(t,e,i){"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8"));let s=t.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}},iD=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported",iI=class t{tail;head;length=0;static create(e=[]){return new t(e)}constructor(t=[]){for(let e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let i=0,s=t.length;i<s;i++){var e;e=this,e.tail=new iC(t[i],e.tail,void 0,e),e.head||(e.head=e.tail),e.length++}return this.length}unshift(...t){for(var e,i=0,s=t.length;i<s;i++){e=this,e.head=new iC(t[i],void 0,e.head,e),e.tail||(e.tail=e.head),e.length++}return this.length}pop(){if(!this.tail)return;let t=this.tail.value,e=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,e.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,e=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,e.list=void 0,this.length--,t}forEach(t,e){e=e||this;for(let i=this.head,s=0;i;s++)t.call(e,i.value,s,this),i=i.next}forEachReverse(t,e){e=e||this;for(let i=this.tail,s=this.length-1;i;s--)t.call(e,i.value,s,this),i=i.prev}get(t){let e=0,i=this.head;for(;i&&e<t;e++)i=i.next;if(e===t&&i)return i.value}getReverse(t){let e=0,i=this.tail;for(;i&&e<t;e++)i=i.prev;if(e===t&&i)return i.value}map(e,i){i=i||this;let s=new t;for(let t=this.head;t;)s.push(e.call(i,t.value,this)),t=t.next;return s}mapReverse(e,i){i=i||this;var s=new t;for(let t=this.tail;t;)s.push(e.call(i,t.value,this)),t=t.prev;return s}reduce(t,e){let i,s=this.head;if(arguments.length>1)i=e;else if(this.head)s=this.head.next,i=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var r=0;s;r++)i=t(i,s.value,r),s=s.next;return i}reduceReverse(t,e){let i,s=this.tail;if(arguments.length>1)i=e;else if(this.tail)s=this.tail.prev,i=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let e=this.length-1;s;e--)i=t(i,s.value,e),s=s.prev;return i}toArray(){let t=Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){let t=Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new t;if(i<e||i<0)return s;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,n=0;for(n=0;r&&n<e;n++)r=r.next;for(;r&&n<i;n++,r=r.next)s.push(r.value);return s}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new t;if(i<e||i<0)return s;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.length,n=this.tail;for(;n&&r>i;r--)n=n.prev;for(;n&&r>e;r--,n=n.prev)s.push(n.value);return s}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let s=this.head;for(let e=0;s&&e<t;e++)s=s.next;let r=[];for(let t=0;s&&t<e;t++)r.push(s.value),s=this.removeNode(s);for(let t of(s?s!==this.tail&&(s=s.prev):s=this.tail,i))s=function(t,e,i){let s=e?e.next:t.head,r=new iC(i,e,s,t);return void 0===r.next&&(t.tail=r),void 0===r.prev&&(t.head=r),t.length++,r}(this,s,t);return r}reverse(){let t=this.head,e=this.tail;for(let e=t;e;e=e.prev){let t=e.prev;e.prev=e.next,e.next=t}return this.head=e,this.tail=t,this}},iC=class{list;next;prev;value;constructor(t,e,i,s){this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},iB=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(t,e){this.path=t||"./",this.absolute=e}},iM=Buffer.alloc(1024),iF=Symbol("onStat"),iP=Symbol("ended"),iz=Symbol("queue"),iU=Symbol("current"),ij=Symbol("process"),iH=Symbol("processing"),iZ=Symbol("processJob"),iG=Symbol("jobs"),iW=Symbol("jobDone"),i$=Symbol("addFSEntry"),iV=Symbol("addTarEntry"),iY=Symbol("stat"),iq=Symbol("readdir"),iK=Symbol("onreaddir"),iX=Symbol("pipe"),iQ=Symbol("entry"),iJ=Symbol("entryOpt"),i0=Symbol("writeEntryClass"),i1=Symbol("write"),i2=Symbol("ondrain"),i5=class extends te{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[i0];onWriteEntry;[iz];[iG]=0;[iH]=!1;[iP]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=ev(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[i0]=ix,"function"==typeof t.onwarn&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli||t.zstd){if(+!!t.gzip+ +!!t.brotli+ +!!t.zstd>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&("object"!=typeof t.gzip&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new tK(t.gzip)),t.brotli&&("object"!=typeof t.brotli&&(t.brotli={}),this.zip=new tJ(t.brotli)),t.zstd&&("object"!=typeof t.zstd&&(t.zstd={}),this.zip=new t2(t.zstd)),!this.zip)throw Error("impossible");let e=this.zip;e.on("data",t=>super.write(t)),e.on("end",()=>super.end()),e.on("drain",()=>this[i2]()),this.on("resume",()=>e.resume())}else this.on("drain",this[i2]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter="function"==typeof t.filter?t.filter:()=>!0,this[iz]=new iI,this[iG]=0,this.jobs=Number(t.jobs)||4,this[iH]=!1,this[iP]=!1}[i1](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&this.add(t),this[iP]=!0,this[ij](),i&&i(),this}write(t){if(this[iP])throw Error("write after end");return t instanceof e_?this[iV](t):this[i$](t),this.flowing}[iV](t){let e=ev(a.default.resolve(this.cwd,t.path));if(this.filter(t.path,t)){let i=new iB(t.path,e);i.entry=new iN(t,this[iJ](i)),i.entry.on("end",()=>this[iW](i)),this[iG]+=1,this[iz].push(i)}else t.resume();this[ij]()}[i$](t){let e=ev(a.default.resolve(this.cwd,t));this[iz].push(new iB(t,e)),this[ij]()}[iY](t){t.pending=!0,this[iG]+=1;let e=this.follow?"stat":"lstat";r.default[e](t.absolute,(e,i)=>{t.pending=!1,this[iG]-=1,e?this.emit("error",e):this[iF](t,i)})}[iF](t,e){this.statCache.set(t.absolute,e),t.stat=e,this.filter(t.path,e)?e.isFile()&&e.nlink>1&&t===this[iU]&&!this.linkCache.get(`${e.dev}:${e.ino}`)&&!this.sync&&this[iZ](t):t.ignore=!0,this[ij]()}[iq](t){t.pending=!0,this[iG]+=1,r.default.readdir(t.absolute,(e,i)=>{if(t.pending=!1,this[iG]-=1,e)return this.emit("error",e);this[iK](t,i)})}[iK](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[ij]()}[ij](){if(!this[iH]){this[iH]=!0;for(let t=this[iz].head;t&&this[iG]<this.jobs;t=t.next)if(this[iZ](t.value),t.value.ignore){let e=t.next;this[iz].removeNode(t),t.next=e}this[iH]=!1,this[iP]&&0===this[iz].length&&0===this[iG]&&(this.zip?this.zip.end(iM):(super.write(iM),super.end()))}}get[iU](){return this[iz]&&this[iz].head&&this[iz].head.value}[iW](t){this[iz].shift(),this[iG]-=1,this[ij]()}[iZ](t){if(!t.pending){if(t.entry){t!==this[iU]||t.piped||this[iX](t);return}if(!t.stat){let e=this.statCache.get(t.absolute);e?this[iF](t,e):this[iY](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let e=this.readdirCache.get(t.absolute);if(e?this[iK](t,e):this[iq](t),!t.readdir)return}if(t.entry=this[iQ](t),!t.entry){t.ignore=!0;return}t!==this[iU]||t.piped||this[iX](t)}}}[iJ](t){return{onwarn:(t,e,i)=>this.warn(t,e,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[iQ](t){this[iG]+=1;try{return new this[i0](t.path,this[iJ](t)).on("end",()=>this[iW](t)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[i2](){this[iU]&&this[iU].entry&&this[iU].entry.resume()}[iX](t){t.piped=!0,t.readdir&&t.readdir.forEach(e=>{let i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[i$](s+e)});let e=t.entry,i=this.zip;if(!e)throw Error("cannot pipe without source");i?e.on("data",t=>{i.write(t)||e.pause()}):e.on("data",t=>{super.write(t)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){eS(this,t,e,i)}},i4=class extends i5{sync=!0;constructor(t){super(t),this[i0]=iA}pause(){}resume(){}[iY](t){let e=this.follow?"statSync":"lstatSync";this[iF](t,r.default[e](t.absolute))}[iq](t){this[iK](t,r.default.readdirSync(t.absolute))}[iX](t){let e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach(e=>{let i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[i$](s+e)}),!e)throw Error("Cannot pipe without source");i?e.on("data",t=>{i.write(t)}):e.on("data",t=>{super[i1](t)})}},i8=(t,i)=>{i.forEach(i=>{"@"===i.charAt(0)?e7({file:e.default.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(i)}),t.end()},i3=async(t,i)=>{for(let s of i)"@"===s.charAt(0)?await e7({file:e.default.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>{t.add(e)}}):t.add(s);t.end()};tP((t,e)=>{let i=new i4(t),s=new tC(t.file,{mode:t.mode||438});i.pipe(s),i8(i,e)},(t,e)=>{let i=new i5(t),s=new tI(t.file,{mode:t.mode||438});i.pipe(s);let r=new Promise((t,e)=>{s.on("error",e),s.on("close",t),i.on("error",e)});return i3(i,e).catch(t=>i.emit("error",t)),r},(t,e)=>{let i=new i4(t);return i8(i,e),i},(t,e)=>{let i=new i5(t);return i3(i,e).catch(t=>i.emit("error",t)),i},(t,e)=>{if(!e?.length)throw TypeError("no paths specified to add to archive")});var i6="win32"===(process.env.__FAKE_PLATFORM__||process.platform),{O_CREAT:i7,O_NOFOLLOW:i9,O_TRUNC:st,O_WRONLY:se}=r.default.constants,si=Number(process.env.__FAKE_FS_O_FILENAME__)||r.default.constants.UV_FS_O_FILEMAP||0,ss=si|st|i7|se,sr=i6||"number"!=typeof i9?null:i9|st|i7|se,sn=null!==sr?()=>sr:i6&&si?t=>t<524288?ss:"w":()=>"w",sh=(t,e,s)=>{try{return i.default.lchownSync(t,e,s)}catch(t){if(t?.code!=="ENOENT")throw t}},so=(t,e,s,r)=>{i.default.lchown(t,e,s,t=>{r(t&&t?.code!=="ENOENT"?t:null)})},sa=(t,i,s,r,n)=>{i.isDirectory()?sl(e.default.resolve(t,i.name),s,r,h=>{if(h)return n(h);so(e.default.resolve(t,i.name),s,r,n)}):so(e.default.resolve(t,i.name),s,r,n)},sl=(t,e,s,r)=>{i.default.readdir(t,{withFileTypes:!0},(i,n)=>{if(i){if("ENOENT"===i.code)return r();if("ENOTDIR"!==i.code&&"ENOTSUP"!==i.code)return r(i)}if(i||!n.length)return so(t,e,s,r);let h=n.length,o=null,a=i=>{if(!o){if(i)return r(o=i);if(0==--h)return so(t,e,s,r)}};for(let i of n)sa(t,i,e,s,a)})},sd=(t,i,s,r)=>{i.isDirectory()&&su(e.default.resolve(t,i.name),s,r),sh(e.default.resolve(t,i.name),s,r)},su=(t,e,s)=>{let r;try{r=i.default.readdirSync(t,{withFileTypes:!0})}catch(i){if(i?.code==="ENOENT")return;if(i?.code==="ENOTDIR"||i?.code==="ENOTSUP")return sh(t,e,s);throw i}for(let i of r)sd(t,i,e,s);return sh(t,e,s)},sf=class extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}},sc=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}},sp=(t,s,r,n,h,o,a)=>{if(0===s.length)return a(null,o);let l=s.shift(),d=ev(e.default.resolve(t+"/"+l));i.default.mkdir(d,r,sm(d,s,r,n,h,o,a))},sm=(t,e,s,r,n,h,o)=>a=>{a?i.default.lstat(t,(l,d)=>{if(l)l.path=l.path&&ev(l.path),o(l);else if(d.isDirectory())sp(t,e,s,r,n,h,o);else if(r)i.default.unlink(t,a=>{if(a)return o(a);i.default.mkdir(t,s,sm(t,e,s,r,n,h,o))});else{if(d.isSymbolicLink())return o(new sc(t,t+"/"+e.join("/")));o(a)}}):(h=h||t,sp(t,e,s,r,n,h,o))},sy=Object.create(null),sb=new Set,sE="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform),sg=class{#t=new Map;#e=new Map;#i=new Set;reserve(t,i){let s=new Set((t=sE?["win32 parallelization disabled"]:t.map(t=>e3((0,e.join)((t=>{sb.has(t)?sb.delete(t):sy[t]=t.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),sb.add(t);let e=sy[t],i=sb.size-1e4;if(i>1e3){for(let t of sb)if(sb.delete(t),delete sy[t],--i<=0)break}return e})(t))))).map(t=>t.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return void 0!==s&&(i=(0,e.join)(s,i)),t.push(i||"/"),t},[])).reduce((t,e)=>t.concat(e)));for(let e of(this.#e.set(i,{dirs:s,paths:t}),t)){let t=this.#t.get(e);t?t.push(i):this.#t.set(e,[i])}for(let t of s){let e=this.#t.get(t);if(e){let t=e.at(-1);t instanceof Set?t.add(i):e.push(new Set([i]))}else this.#t.set(t,[new Set([i])])}return this.#r(i)}#s(t){let e=this.#e.get(t);if(!e)throw Error("function does not have any path reservations");return{paths:e.paths.map(t=>this.#t.get(t)),dirs:[...e.dirs].map(t=>this.#t.get(t))}}check(t){let{paths:e,dirs:i}=this.#s(t);return e.every(e=>e&&e[0]===t)&&i.every(e=>e&&e[0]instanceof Set&&e[0].has(t))}#r(t){return!this.#i.has(t)&&!!this.check(t)&&(this.#i.add(t),t(()=>this.#n(t)),!0)}#n(t){if(!this.#i.has(t))return!1;let e=this.#e.get(t);if(!e)throw Error("invalid reservation");let{paths:i,dirs:s}=e,r=new Set;for(let e of i){let i=this.#t.get(e);if(!i||i?.[0]!==t)continue;let s=i[1];if(!s){this.#t.delete(e);continue}if(i.shift(),"function"==typeof s)r.add(s);else for(let t of s)r.add(t)}for(let e of s){let i=this.#t.get(e),s=i?.[0];if(!(!i||!(s instanceof Set)))if(1===s.size&&1===i.length){this.#t.delete(e);continue}else if(1===s.size){i.shift();let t=i[0];"function"==typeof t&&r.add(t)}else s.delete(t)}return this.#i.delete(t),r.forEach(t=>this.#r(t)),!0}},sw=Symbol("onEntry"),sR=Symbol("checkFs"),sv=Symbol("checkFs2"),s_=Symbol("isReusable"),sS=Symbol("makeFs"),sO=Symbol("file"),sT=Symbol("directory"),sk=Symbol("link"),sL=Symbol("symlink"),sx=Symbol("hardlink"),sA=Symbol("ensureNoSymlink"),sN=Symbol("unsupported"),sD=Symbol("checkPath"),sI=Symbol("stripAbsolutePath"),sC=Symbol("mkdir"),sB=Symbol("onError"),sM=Symbol("pending"),sF=Symbol("pend"),sP=Symbol("unpend"),sz=Symbol("ended"),sU=Symbol("maybeClose"),sj=Symbol("skip"),sH=Symbol("doChown"),sZ=Symbol("uid"),sG=Symbol("gid"),sW=Symbol("checkedCwd"),s$="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform),sV=(t,e,i)=>void 0!==t&&t===t>>>0?t:void 0!==e&&e===e>>>0?e:i,sY=class extends e8{[sz]=!1;[sW]=!1;[sM]=0;reservations=new sg;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[sz]=!0,this[sU]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,"number"==typeof t.uid||"number"==typeof t.gid){if("number"!=typeof t.uid||"number"!=typeof t.gid)throw TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=void 0===t.preserveOwner&&"number"!=typeof t.uid?!!(process.getuid&&0===process.getuid()):!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:1024,this.forceChown=!0===t.forceChown,this.win32=!!t.win32||s$,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=ev(e.default.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?"number"==typeof t.processUmask?t.processUmask:process.umask():0,this.umask="number"==typeof t.umask?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",t=>this[sw](t))}warn(t,e,i={}){return("TAR_BAD_ARCHIVE"===t||"TAR_ABORT"===t)&&(i.recoverable=!1),super.warn(t,e,i)}[sU](){this[sz]&&0===this[sM]&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[sI](t,i){let s=t[i],{type:r}=t;if(!s||this.preservePaths)return!0;let[n,h]=ii(s),o=h.replaceAll(/\\/g,"/").split("/");if(o.includes("..")||s$&&/^[a-z]:\.\.$/i.test(o[0]??"")){if("path"===i||"Link"===r)return this.warn("TAR_ENTRY_ERROR",`${i} contains '..'`,{entry:t,[i]:s}),!1;let n=e.default.posix.dirname(t.path),h=e.default.posix.normalize(e.default.posix.join(n,o.join("/")));if(h.startsWith("../")||".."===h)return this.warn("TAR_ENTRY_ERROR",`${i} escapes extraction directory`,{entry:t,[i]:s}),!1}return n&&(t[i]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${i}`,{entry:t,[i]:s})),!0}[sD](t){let i=ev(t.path),s=i.split("/");if(this.strip){if(s.length<this.strip)return!1;if("Link"===t.type){let e=ev(String(t.linkpath)).split("/");if(!(e.length>=this.strip))return!1;t.linkpath=e.slice(this.strip).join("/")}s.splice(0,this.strip),t.path=s.join("/")}if(isFinite(this.maxDepth)&&s.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:i,depth:s.length,maxDepth:this.maxDepth}),!1;if(!this[sI](t,"path")||!this[sI](t,"linkpath"))return!1;if(t.absolute=e.default.isAbsolute(t.path)?ev(e.default.resolve(t.path)):ev(e.default.resolve(this.cwd,t.path)),!this.preservePaths&&"string"==typeof t.absolute&&0!==t.absolute.indexOf(this.cwd+"/")&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:ev(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&"Directory"!==t.type&&"GNUDumpDir"!==t.type)return!1;if(this.win32){let{root:i}=e.default.win32.parse(String(t.absolute));t.absolute=i+ia(String(t.absolute).slice(i.length));let{root:s}=e.default.win32.parse(t.path);t.path=s+ia(t.path.slice(s.length))}return!0}[sw](t){if(!this[sD](t))return t.resume();switch(f.default.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=448|t.mode);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[sR](t);default:return this[sN](t)}}[sB](t,e){"CwdError"===t.name?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[sP](),e.resume())}[sC](t,s,r){((t,s,r)=>{t=ev(t);let n=s.umask??18,h=448|s.mode,o=(h&n)!=0,a=s.uid,l=s.gid,d="number"==typeof a&&"number"==typeof l&&(a!==s.processUid||l!==s.processGid),u=s.preserve,f=s.unlink,c=ev(s.cwd),m=(e,s)=>{e?r(e):s&&d?sl(s,a,l,t=>m(t)):o?i.default.chmod(t,h,r):r()};if(t===c){var y;return y=t,i.default.stat(y,(t,e)=>{(t||!e.isDirectory())&&(t=new sf(y,t?.code||"ENOTDIR")),m(t)})}if(u)return p.default.mkdir(t,{mode:h,recursive:!0}).then(t=>m(null,t??void 0),m);let b=ev(e.default.relative(c,t)).split("/");sp(c,b,h,f,c,void 0,m)})(ev(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:s},r)}[sH](t){return this.forceChown||this.preserveOwner&&("number"==typeof t.uid&&t.uid!==this.processUid||"number"==typeof t.gid&&t.gid!==this.processGid)||"number"==typeof this.uid&&this.uid!==this.processUid||"number"==typeof this.gid&&this.gid!==this.processGid}[sZ](t){return sV(this.uid,t.uid,this.processUid)}[sG](t){return sV(this.gid,t.gid,this.processGid)}[sO](t,e){let s="number"==typeof t.mode?4095&t.mode:this.fmode,r=new tI(String(t.absolute),{flags:sn(t.size),mode:s,autoClose:!1});r.on("error",s=>{r.fd&&i.default.close(r.fd,()=>{}),r.write=()=>!0,this[sB](s,t),e()});let n=1,h=s=>{if(s){r.fd&&i.default.close(r.fd,()=>{}),this[sB](s,t),e();return}0==--n&&void 0!==r.fd&&i.default.close(r.fd,i=>{i?this[sB](i,t):this[sP](),e()})};r.on("finish",()=>{let e=String(t.absolute),s=r.fd;if("number"==typeof s&&t.mtime&&!this.noMtime){n++;let r=t.atime||new Date,o=t.mtime;i.default.futimes(s,r,o,t=>t?i.default.utimes(e,r,o,e=>h(e&&t)):h())}if("number"==typeof s&&this[sH](t)){n++;let r=this[sZ](t),o=this[sG](t);"number"==typeof r&&"number"==typeof o&&i.default.fchown(s,r,o,t=>t?i.default.chown(e,r,o,e=>h(e&&t)):h())}h()});let o=this.transform&&this.transform(t)||t;o!==t&&(o.on("error",i=>{this[sB](i,t),e()}),t.pipe(o)),o.pipe(r)}[sT](t,e){let s="number"==typeof t.mode?4095&t.mode:this.dmode;this[sC](String(t.absolute),s,s=>{if(s){this[sB](s,t),e();return}let r=1,n=()=>{0==--r&&(e(),this[sP](),t.resume())};t.mtime&&!this.noMtime&&(r++,i.default.utimes(String(t.absolute),t.atime||new Date,t.mtime,n)),this[sH](t)&&(r++,i.default.chown(String(t.absolute),Number(this[sZ](t)),Number(this[sG](t)),n)),n()})}[sN](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[sL](t,i){let s=ev(e.default.relative(this.cwd,e.default.resolve(e.default.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[sA](t,this.cwd,s,()=>this[sk](t,String(t.linkpath),"symlink",i),e=>{this[sB](e,t),i()})}[sx](t,i){let s=ev(e.default.resolve(this.cwd,String(t.linkpath))),r=ev(String(t.linkpath)).split("/");this[sA](t,this.cwd,r,()=>this[sk](t,s,"link",i),e=>{this[sB](e,t),i()})}[sA](t,s,r,n,h){let o=r.shift();if(this.preservePaths||void 0===o)return n();let a=e.default.resolve(s,o);i.default.lstat(a,(i,s)=>i?n():s?.isSymbolicLink()?h(new sc(a,e.default.resolve(a,r.join("/")))):void this[sA](t,a,r,n,h))}[sF](){this[sM]++}[sP](){this[sM]--,this[sU]()}[sj](t){this[sP](),t.resume()}[s_](t,e){return"File"===t.type&&!this.unlink&&e.isFile()&&e.nlink<=1&&!s$}[sR](t){this[sF]();let e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,e=>this[sv](t,e))}[sv](t,s){let r=t=>{s(t)},n=()=>{this[sC](this.cwd,this.dmode,e=>{if(e){this[sB](e,t),r();return}this[sW]=!0,h()})},h=()=>{if(t.absolute!==this.cwd){let i=ev(e.default.dirname(String(t.absolute)));if(i!==this.cwd)return this[sC](i,this.dmode,e=>{if(e){this[sB](e,t),r();return}o()})}o()},o=()=>{i.default.lstat(String(t.absolute),(e,s)=>{if(s&&(this.keep||this.newer&&s.mtime>(t.mtime??s.mtime))){this[sj](t),r();return}if(e||this[s_](t,s))return this[sS](null,t,r);if(s.isDirectory()){if("Directory"===t.type){let e=this.chmod&&t.mode&&(4095&s.mode)!==t.mode,n=e=>this[sS](e??null,t,r);return e?i.default.chmod(String(t.absolute),Number(t.mode),n):n()}if(t.absolute!==this.cwd)return i.default.rmdir(String(t.absolute),e=>this[sS](e??null,t,r))}if(t.absolute===this.cwd)return this[sS](null,t,r);((t,e)=>{if(!s$)return i.default.unlink(t,e);let s=t+".DELETE."+(0,c.randomBytes)(16).toString("hex");i.default.rename(t,s,t=>{if(t)return e(t);i.default.unlink(s,e)})})(String(t.absolute),e=>this[sS](e??null,t,r))})};this[sW]?h():n()}[sS](t,e,i){if(t){this[sB](t,e),i();return}switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[sO](e,i);case"Link":return this[sx](e,i);case"SymbolicLink":return this[sL](e,i);case"Directory":case"GNUDumpDir":return this[sT](e,i)}}[sk](t,e,s,r){i.default[s](e,String(t.absolute),e=>{e?this[sB](e,t):(this[sP](),t.resume()),r()})}},sq=t=>{try{return[null,t()]}catch(t){return[t,null]}},sK=class extends sY{sync=!0;[sS](t,e){return super[sS](t,e,()=>{})}[sR](t){if(!this[sW]){let e=this[sC](this.cwd,this.dmode);if(e)return this[sB](e,t);this[sW]=!0}if(t.absolute!==this.cwd){let i=ev(e.default.dirname(String(t.absolute)));if(i!==this.cwd){let e=this[sC](i,this.dmode);if(e)return this[sB](e,t)}}let[s,r]=sq(()=>i.default.lstatSync(String(t.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(t.mtime??r.mtime)))return this[sj](t);if(s||this[s_](t,r))return this[sS](null,t);if(r.isDirectory()){if("Directory"===t.type){let[e]=this.chmod&&t.mode&&(4095&r.mode)!==t.mode?sq(()=>{i.default.chmodSync(String(t.absolute),Number(t.mode))}):[];return this[sS](e,t)}let[e]=sq(()=>i.default.rmdirSync(String(t.absolute)));this[sS](e,t)}let[n]=t.absolute===this.cwd?[]:sq(()=>(t=>{if(!s$)return i.default.unlinkSync(t);let e=t+".DELETE."+(0,c.randomBytes)(16).toString("hex");i.default.renameSync(t,e),i.default.unlinkSync(e)})(String(t.absolute)));this[sS](n,t)}[sO](t,e){let s="number"==typeof t.mode?4095&t.mode:this.fmode,r=s=>{let r;try{i.default.closeSync(n)}catch(t){r=t}(s||r)&&this[sB](s||r,t),e()},n;try{n=i.default.openSync(String(t.absolute),sn(t.size),s)}catch(t){return r(t)}let h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",e=>this[sB](e,t)),t.pipe(h)),h.on("data",t=>{try{i.default.writeSync(n,t,0,t.length)}catch(t){r(t)}}),h.on("end",()=>{let e=null;if(t.mtime&&!this.noMtime){let s=t.atime||new Date,r=t.mtime;try{i.default.futimesSync(n,s,r)}catch(n){try{i.default.utimesSync(String(t.absolute),s,r)}catch{e=n}}}if(this[sH](t)){let s=this[sZ](t),r=this[sG](t);try{i.default.fchownSync(n,Number(s),Number(r))}catch(n){try{i.default.chownSync(String(t.absolute),Number(s),Number(r))}catch{e=e||n}}}r(e)})}[sT](t,e){let s="number"==typeof t.mode?4095&t.mode:this.dmode,r=this[sC](String(t.absolute),s);if(r){this[sB](r,t),e();return}if(t.mtime&&!this.noMtime)try{i.default.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[sH](t))try{i.default.chownSync(String(t.absolute),Number(this[sZ](t)),Number(this[sG](t)))}catch{}e(),t.resume()}[sC](t,s){try{return((t,s)=>{t=ev(t);let r=s.umask??18,n=448|s.mode,h=(n&r)!=0,o=s.uid,a=s.gid,l="number"==typeof o&&"number"==typeof a&&(o!==s.processUid||a!==s.processGid),d=s.preserve,u=s.unlink,f=ev(s.cwd),c=e=>{e&&l&&su(e,o,a),h&&i.default.chmodSync(t,n)};if(t===f)return(t=>{let e=!1,s;try{e=i.default.statSync(t).isDirectory()}catch(t){s=t?.code}finally{if(!e)throw new sf(t,s??"ENOTDIR")}})(f),c();if(d)return c(i.default.mkdirSync(t,{mode:n,recursive:!0})??void 0);let p=ev(e.default.relative(f,t)).split("/"),m;for(let t=p.shift(),s=f;t&&(s+="/"+t);t=p.shift()){s=ev(e.default.resolve(s));try{i.default.mkdirSync(s,n),m=m||s}catch{let t=i.default.lstatSync(s);if(t.isDirectory())continue;if(u){i.default.unlinkSync(s),i.default.mkdirSync(s,n),m=m||s;continue}if(t.isSymbolicLink())return new sc(s,s+"/"+p.join("/"))}}return c(m)})(ev(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:s})}catch(t){return t}}[sA](t,s,r,n,h){if(this.preservePaths||0===r.length)return n();let o=s;for(let t of r){o=e.default.resolve(o,t);let[a,l]=sq(()=>i.default.lstatSync(o));if(a)return n();if(l.isSymbolicLink())return h(new sc(o,e.default.resolve(s,r.join("/"))))}n()}[sk](t,e,s,r){let n=`${s}Sync`;try{i.default[n](e,String(t.absolute)),r(),t.resume()}catch(e){return this[sB](e,t)}}},sX=tP(t=>{let e=new sK(t),s=t.file,r=i.default.statSync(s);new tD(s,{readSize:t.maxReadSize||0x1000000,size:r.size}).pipe(e)},(t,e)=>{let s=new sY(t),r=t.maxReadSize||0x1000000,n=t.file;return new Promise((t,e)=>{s.on("error",e),s.on("close",t),i.default.stat(n,(t,i)=>{if(t)e(t);else{let t=new tN(n,{readSize:r,size:i.size});t.on("error",e),t.pipe(s)}})})},t=>new sK(t),t=>new sY(t),(t,e)=>{e?.length&&e6(t,e)}),sQ=(t,i)=>{i.forEach(i=>{"@"===i.charAt(0)?e7({file:e.default.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(i)}),t.end()},sJ=async(t,i)=>{for(let s of i)"@"===s.charAt(0)?await e7({file:e.default.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>t.add(e)}):t.add(s);t.end()},s0=tP((t,e)=>{let s=new i4(t),r=!0,n,h;try{var o,a,l,d,u;let f;try{n=i.default.openSync(t.file,"r+")}catch(e){if(e?.code==="ENOENT")n=i.default.openSync(t.file,"w+");else throw e}let c=i.default.fstatSync(n),p=Buffer.alloc(512);t:for(h=0;h<c.size;h+=512){for(let t=0,e=0;t<512;t+=e){if(e=i.default.readSync(n,p,t,p.length-t,h+t),0===h&&31===p[0]&&139===p[1])throw Error("cannot append to compressed archives");if(!e)break t}let e=new es(p);if(!e.cksumValid)break;let s=512*Math.ceil((e.size||0)/512);if(h+s+512>c.size)break;h+=s,t.mtimeCache&&e.mtime&&t.mtimeCache.set(String(e.path),e.mtime)}r=!1,o=t,a=s,l=h,d=n,u=e,f=new tC(o.file,{fd:d,start:l}),a.pipe(f),sQ(a,u)}finally{if(r)try{i.default.closeSync(n)}catch{}}},(t,e)=>{e=Array.from(e);let s=new i5(t);return new Promise((r,n)=>{s.on("error",n);let h="r+",o=(a,l)=>a&&"ENOENT"===a.code&&"r+"===h?(h="w+",i.default.open(t.file,h,o)):a||!l?n(a):void i.default.fstat(l,(h,o)=>{if(h)return i.default.close(l,()=>n(h));((e,s,r)=>{let n=(t,s)=>{t?i.default.close(e,e=>r(t)):r(null,s)},h=0;if(0===s)return n(null,0);let o=0,a=Buffer.alloc(512),l=(r,d)=>{if(r||void 0===d)return n(r);if((o+=d)<512&&d)return i.default.read(e,a,o,a.length-o,h+o,l);if(0===h&&31===a[0]&&139===a[1])return n(Error("cannot append to compressed archives"));if(o<512)return n(null,h);let u=new es(a);if(!u.cksumValid)return n(null,h);let f=512*Math.ceil((u.size??0)/512);if(h+f+512>s||(h+=f+512)>=s)return n(null,h);t.mtimeCache&&u.mtime&&t.mtimeCache.set(String(u.path),u.mtime),o=0,i.default.read(e,a,0,512,h,l)};i.default.read(e,a,0,512,h,l)})(l,o.size,(i,h)=>{if(i)return n(i);let o=new tI(t.file,{fd:l,start:h});s.pipe(o),o.on("error",n),o.on("close",r),sJ(s,e)})});i.default.open(t.file,h,o)})},()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(t,e)=>{if(!t.file)throw TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!e?.length)throw TypeError("no paths specified to add/replace")});tP(s0.syncFile,s0.asyncFile,s0.syncNoFile,s0.asyncNoFile,(t,e=[])=>{s0.validate?.(t,e),s1(t)});var s1=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,s)=>e(i,s)&&!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(e,i)=>!((t.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))};let s2=/^tower-(backup|auto)-\d{8}-\d{6}\.tar\.gz$/;async function s5(t){let s=(0,e.join)((0,e.dirname)(t),`_meta_tmp_${Date.now()}`);try{(0,i.mkdirSync)(s,{recursive:!0}),await sX({file:t,cwd:s,filter:t=>"metadata.json"===t});let r=(0,e.join)(s,"metadata.json");if(!(0,i.existsSync)(r))return null;return JSON.parse((0,i.readFileSync)(r,"utf-8"))}catch{return null}finally{(0,i.rmSync)(s,{recursive:!0,force:!0})}}(0,e.join)("storage","assets"),t.s(["readMetadataFromArchive",0,s5,"validateFilename",0,function(t){if(!s2.test(t))throw Error(`Invalid backup filename: ${t}`)}],605171)},119620,t=>t.a(async(e,i)=>{try{var s=t.i(855104),r=t.i(198840),n=t.i(750227),h=t.i(902157),o=t.i(192520),a=t.i(605171),l=t.i(22569),d=e([l]);async function u(e){let i=(0,r.requireLocalhost)(e);if(i)return i;try{let i=(await e.formData()).get("file");if(!i)return s.NextResponse.json({error:"No file provided"},{status:400});try{(0,a.validateFilename)(i.name)}catch{return s.NextResponse.json({error:"Invalid backup filename"},{status:400})}let r=await (0,l.getConfigValue)("system.backupDir","")||(0,o.getBackupsDir)();(0,h.mkdirSync)(r,{recursive:!0});let d=(0,n.join)(r,i.name);if((0,h.existsSync)(d))return s.NextResponse.json({error:"File already exists"},{status:409});let u=Buffer.from(await i.arrayBuffer());(0,h.writeFileSync)(d,u);let f=await (0,a.readMetadataFromArchive)(d);if(!f||!f.version){try{t.r(902157).unlinkSync(d)}catch{}return s.NextResponse.json({error:"Invalid backup archive"},{status:400})}return s.NextResponse.json({filename:i.name,metadata:f})}catch{return s.NextResponse.json({error:"Import failed"},{status:500})}}[l]=d.then?(await d)():d,t.s(["POST",0,u,"dynamic",0,"force-dynamic","runtime",0,"nodejs"]),i()}catch(t){i(t)}},!1),766434,t=>t.a(async(e,i)=>{try{var s=t.i(765876),r=t.i(675896),n=t.i(959160),h=t.i(97944),o=t.i(86757),a=t.i(204144),l=t.i(273436),d=t.i(743641),u=t.i(813766),f=t.i(840884),c=t.i(498814),p=t.i(780006),m=t.i(544432),y=t.i(772005),b=t.i(114430),E=t.i(193695);t.i(628400);var g=t.i(800071),w=t.i(119620),R=e([w]);[w]=R.then?(await R)():R;let _=new s.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/internal/backup/import/route",pathname:"/api/internal/backup/import",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/internal/backup/import/route.ts",nextConfigOutput:"standalone",userland:w}),{workAsyncStorage:S,workUnitAsyncStorage:O,serverHooks:T}=_;async function v(t,e,i){i.requestMeta&&(0,h.setRequestMeta)(t,i.requestMeta),_.isDev&&(0,h.addRequestMeta)(t,"devRequestTimingInternalsEnd",process.hrtime.bigint());let s="/api/internal/backup/import/route";s=s.replace(/\/index$/,"")||"/";let n=await _.prepare(t,e,{srcPage:s,multiZoneDraftMode:!1});if(!n)return e.statusCode=400,e.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve()),null;let{buildId:w,params:R,nextConfig:v,parsedUrl:S,isDraftMode:O,prerenderManifest:T,routerServerContext:k,isOnDemandRevalidate:L,revalidateOnlyGenerated:x,resolvedPathname:A,clientReferenceManifest:N,serverActionsManifest:D}=n,I=(0,l.normalizeAppPath)(s),C=!!(T.dynamicRoutes[I]||T.routes[A]),B=async()=>((null==k?void 0:k.render404)?await k.render404(t,e,S,!1):e.end("This page could not be found"),null);if(C&&!O){let t=!!T.routes[A],e=T.dynamicRoutes[I];if(e&&!1===e.fallback&&!t){if(v.adapterPath)return await B();throw new E.NoFallbackError}}let M=null;!C||_.isDev||O||(M=A,M="/index"===M?"/":M);let F=!0===_.isDev||!C,P=C&&!F;D&&N&&(0,a.setManifestsSingleton)({page:s,clientReferenceManifest:N,serverActionsManifest:D});let z=t.method||"GET",U=(0,o.getTracer)(),j=U.getActiveScopeSpan(),H=!!(null==k?void 0:k.isWrappedByNextServer),Z=!!(0,h.getRequestMeta)(t,"minimalMode"),G=(0,h.getRequestMeta)(t,"incrementalCache")||await _.getIncrementalCache(t,v,T,Z);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let W={params:R,previewProps:T.preview,renderOpts:{experimental:{authInterrupts:!!v.experimental.authInterrupts},cacheComponents:!!v.cacheComponents,supportsDynamicResponse:F,incrementalCache:G,cacheLifeProfiles:v.cacheLife,waitUntil:i.waitUntil,onClose:t=>{e.on("close",t)},onAfterTaskError:void 0,onInstrumentationRequestError:(e,i,s,r)=>_.onRequestError(t,e,s,r,k)},sharedContext:{buildId:w}},$=new d.NodeNextRequest(t),V=new d.NodeNextResponse(e),Y=u.NextRequestAdapter.fromNodeNextRequest($,(0,u.signalFromNodeResponse)(e));try{let n,h=async t=>_.handle(Y,W).finally(()=>{if(!t)return;t.setAttributes({"http.status_code":e.statusCode,"next.rsc":!1});let i=U.getRootSpanAttributes();if(!i)return;if(i.get("next.span_type")!==f.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${i.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=i.get("next.route");if(r){let e=`${z} ${r}`;t.setAttributes({"next.route":r,"http.route":r,"next.span_name":e}),t.updateName(e),n&&n!==t&&(n.setAttribute("http.route",r),n.updateName(e))}else t.updateName(`${z} ${s}`)}),a=async n=>{var o,a;let l=async({previousCacheEntry:r})=>{try{if(!Z&&L&&x&&!r)return e.statusCode=404,e.setHeader("x-nextjs-cache","REVALIDATED"),e.end("This page could not be found"),null;let s=await h(n);t.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&i.waitUntil&&(i.waitUntil(o),o=void 0);let a=W.renderOpts.collectedTags;if(!C)return await (0,p.sendResponse)($,V,s,W.renderOpts.pendingWaitUntil),null;{let t=await s.blob(),e=(0,m.toNodeOutgoingHttpHeaders)(s.headers);a&&(e[b.NEXT_CACHE_TAGS_HEADER]=a),!e["content-type"]&&t.type&&(e["content-type"]=t.type);let i=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=b.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,r=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=b.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await t.arrayBuffer()),headers:e},cacheControl:{revalidate:i,expire:r}}}}catch(e){throw(null==r?void 0:r.isStale)&&await _.onRequestError(t,e,{routerKind:"App Router",routePath:s,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:P,isOnDemandRevalidate:L})},!1,k),e}},d=await _.handleResponse({req:t,nextConfig:v,cacheKey:M,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:L,revalidateOnlyGenerated:x,responseGenerator:l,waitUntil:i.waitUntil,isMinimalMode:Z});if(!C)return null;if((null==d||null==(o=d.value)?void 0:o.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(a=d.value)?void 0:a.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});Z||e.setHeader("x-nextjs-cache",L?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),O&&e.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,m.fromNodeOutgoingHttpHeaders)(d.value.headers);return Z&&C||u.delete(b.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||e.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,y.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)($,V,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};H&&j?await a(j):(n=U.getActiveScopeSpan(),await U.withPropagatedContext(t.headers,()=>U.trace(f.BaseServerSpan.handleRequest,{spanName:`${z} ${s}`,kind:o.SpanKind.SERVER,attributes:{"http.method":z,"http.target":t.url}},a),void 0,!H))}catch(e){if(e instanceof E.NoFallbackError||await _.onRequestError(t,e,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:P,isOnDemandRevalidate:L})},!1,k),C)throw e;return await (0,p.sendResponse)($,V,new Response(null,{status:500})),null}}t.s(["handler",0,v,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:O})},"routeModule",0,_,"serverHooks",0,T,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,O]),i()}catch(t){i(t)}},!1)];
4
4
 
5
5
  //# sourceMappingURL=_0t31z6q._.js.map
@@ -4,4 +4,4 @@ module.exports=[10005,e=>{"use strict";let t=new(e.i(472129)).ClaudeCliAdapter;a
4
4
  ${e.slice(-5e3)}
5
5
  \`\`\``,l=await r(n,t);return l&&l.replace(/^[#*\->"'\s]+/,"").trim()||null}e.s(["aiQuery",0,r,"generateSummaryFromLog",0,n])},283373,e=>{"use strict";var t=e.i(233405),r=e.i(522734),n=e.i(843793),l=e.i(10005);function a(e,r){return(0,t.execFileSync)("git",e,{cwd:r,timeout:1e4,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}function i(e,t){if(t)return t;for(let t of["main","master","develop"])try{return a(["merge-base","HEAD",t],e)}catch{}return null}function u(e){if(!e)return null;let t=e.split("\n").filter(Boolean);if(0===t.length)return null;let r=t[0].replace(/^[a-f0-9]+\s+/,"");return 1===t.length?r:`${t.length} commits: ${r}`}async function s(e,t,o,c,m,f=null){try{let t;console.error(`[captureExecutionSummary] Starting: exec=${e.slice(0,8)} exit=${o} buffer=${c.length}chars worktree=${m} fork=${f?.slice(0,8)??"none"}`);let s=null,p=null,d=null;if(m&&(0,r.existsSync)(m))try{if(a(["rev-parse","--git-dir"],m),s=function(e,t){try{let r=i(e,t);if(!r)return null;return a(["log","--oneline",`${r}..HEAD`],e)||null}catch{return null}}(m,f),(p=function(e,t){try{let r=i(e,t);if(!r)return null;let n=a(["diff","--stat",`${r}..HEAD`],e);if(!n)return null;return function(e){let t=e.split("\n"),r=t[t.length-1];if(!r)return null;let n=r.match(/(\d+)\s+files?\s+changed/),l=r.match(/(\d+)\s+insertions?\(\+\)/),a=r.match(/(\d+)\s+deletions?\(-\)/);return n||l||a?{commits:0,filesChanged:n?parseInt(n[1],10):0,insertions:l?parseInt(l[1],10):0,deletions:a?parseInt(a[1],10):0}:null}(n)}catch{return null}}(m,f))&&s){let e=s.split("\n").filter(Boolean).length;p={...p,commits:e}}d=u(s)}catch{}let g=(t=c.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/\x1b[^[\]()][^\x1b]*/g,"").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"").replace(/\n{3,}/g,"\n\n").trim()).length<=10240?t:t.slice(t.length-10240);await n.db.taskExecution.update({where:{id:e},data:{summary:d??(s?u(s):null),gitLog:s??null,gitStats:p?JSON.stringify(p):null,exitCode:o,terminalLog:g||null}}),g&&m&&(console.error("[captureExecutionSummary] Starting background AI summary..."),(0,l.generateSummaryFromLog)(g,m).then(async t=>{t&&(console.error(`[captureExecutionSummary] AI summary ready: ${t.slice(0,80)}`),await n.db.taskExecution.update({where:{id:e},data:{summary:t}}))}).catch(e=>{console.error("[captureExecutionSummary] Background AI summary failed:",e)}))}catch(e){console.error("[captureExecutionSummary] Failed to capture summary:",e)}}e.s(["captureExecutionSummary",0,s])},145135,e=>{e.v(t=>Promise.all(["server/chunks/[externals]__0lhlhz4._.js","server/chunks/07-d_@anthropic-ai_claude-agent-sdk_sdk_mjs_0.721uk._.js"].map(t=>e.l(t))).then(()=>t(217040)))}];
6
6
 
7
- //# sourceMappingURL=_0b~hjvi._.js.map
7
+ //# sourceMappingURL=_12537g8._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[215624,e=>{"use strict";var t=e.i(921675),a=e.i(843793),n=e.i(195158),r=e.i(50377),i=e.i(86708);let s=["onboarding.completed","onboarding.lastStep","onboarding.username"];async function o(){let e=await a.db.systemConfig.findMany({where:{key:{in:[...s]}}}),t={};for(let a of e)try{t[a.key]=JSON.parse(a.value)}catch{t[a.key]=null}let n=!0===t["onboarding.completed"],r=t["onboarding.lastStep"],i=t["onboarding.username"];return{isFirstRun:!n,isCompleted:n,lastStep:"number"==typeof r?r:0,username:"string"==typeof i&&i.length>0?i:null}}async function l(e){await a.db.systemConfig.upsert({where:{key:"onboarding.lastStep"},create:{key:"onboarding.lastStep",value:JSON.stringify(e)},update:{value:JSON.stringify(e)}}),(0,n.revalidatePath)("/","layout")}async function u(e,t=4){if(await a.db.systemConfig.upsert({where:{key:"onboarding.completed"},create:{key:"onboarding.completed",value:"true"},update:{value:"true"}}),await a.db.systemConfig.upsert({where:{key:"onboarding.lastStep"},create:{key:"onboarding.lastStep",value:String(t)},update:{value:String(t)}}),void 0!==e){let t=e.trim().slice(0,64).replace(/[\r\n]/g," ");t.length>0&&await a.db.systemConfig.upsert({where:{key:"onboarding.username"},create:{key:"onboarding.username",value:JSON.stringify(t)},update:{value:JSON.stringify(t)}})}(0,n.revalidatePath)("/","layout")}async function d(e,t){await a.db.systemConfig.upsert({where:{key:"onboarding.extensions.requested"},create:{key:"onboarding.extensions.requested",value:JSON.stringify(e)},update:{value:JSON.stringify(e)}}),await a.db.systemConfig.upsert({where:{key:"onboarding.extensions.completed"},create:{key:"onboarding.extensions.completed",value:JSON.stringify(t)},update:{value:JSON.stringify(t)}}),(0,n.revalidatePath)("/","layout")}async function c(t){try{r.logger.create("task-completion").info("Task completion event dispatched",{taskId:t.taskId,taskTitle:t.taskTitle,status:t.status,executionId:t.executionId});let{broadcastNotification:a}=await e.A(590621);a({...t,type:"completion"})}catch{}}(0,i.ensureServerEntryExports)([o,l,u,d,c]),(0,t.registerServerReference)(o,"00120f8f663c6ecb5e907be3722be478161731fb06",null),(0,t.registerServerReference)(l,"40f1fe7136b3744a64a73f740180f891458c0c6401",null),(0,t.registerServerReference)(u,"60055c035170d24b736f46a94e3432ed3060e75fb0",null),(0,t.registerServerReference)(d,"60bac43b8930ce1461a961a4aa62d3122b8ee95c7b",null),(0,t.registerServerReference)(c,"4027ca05fa72e0ebd510c561a1c9b99820fffdc216",null),e.s(["dispatchTaskCompletionEvent",0,c])},590621,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0~ju4-d._.js","server/chunks/src_lib_0i2.v2d._.js"].map(t=>e.l(t))).then(()=>t(513200)))}];
2
+
3
+ //# sourceMappingURL=src_0fq3zjg._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[397998,e=>{"use strict";async function r(){{let{pruneOrphanedWorktrees:r,cleanupStaleExecutions:s,ensureTowerLabel:t,ensureDefaultWorkspace:o}=await e.A(257948);await r(),await s(),await t(),await o();let{startWsServer:a}=await e.A(484221);await a();let{ensureTowerDir:i}=await e.A(204549);i(),(async()=>{try{let{providerRegistry:r}=await e.A(128761),{installAllForProvider:s}=await e.A(518092),t=parseInt(process.env.PORT||"3000",10),o=`http://localhost:${t}`;for(let e of r.getAll()){let r=e.cli?.adapter;if(r)try{if(await r.repairHookPaths?.().catch(()=>{}),!await r.isAvailable()||await r.isMcpInstalled("tower",{scope:"user"}).catch(()=>!1))continue;let t=await s(e.name,o);t.ok?console.error(`[init-tower] Auto-installed Tower MCP for ${e.name} (user scope)`):console.error(`[init-tower] Auto-install for ${e.name} reported issues:`,{mcp:t.mcp?.ok,hooks:t.hooks?.ok,skill:t.skill?.ok})}catch(r){console.error(`[init-tower] Auto-install failed for ${e.name}:`,r)}}}catch(e){console.error("[init-tower] Provider auto-install setup failed:",e)}})()}}e.s(["register",0,r])},257948,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__11l3gud._.js"].map(r=>e.l(r))).then(()=>r(271856)))},484221,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0t_yyy8._.js","server/chunks/src_lib_12xey8u._.js"].map(r=>e.l(r))).then(()=>r(336114)))},204549,e=>{e.v(r=>Promise.all(["server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js","server/chunks/[root-of-the-server]__0b3m.jm._.js"].map(r=>e.l(r))).then(()=>r(301105)))},128761,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0-~q463._.js","server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js"].map(r=>e.l(r))).then(()=>r(136902)))},518092,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0z20rmt._.js","server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js"].map(r=>e.l(r))).then(()=>r(760138)))}];
1
+ module.exports=[397998,e=>{"use strict";async function r(){{let{pruneOrphanedWorktrees:r,cleanupStaleExecutions:s,ensureTowerLabel:t,ensureDefaultWorkspace:o}=await e.A(257948);await r(),await s(),await t(),await o();let{startWsServer:a}=await e.A(484221);await a();let{ensureTowerDir:i}=await e.A(204549);i(),(async()=>{try{let{providerRegistry:r}=await e.A(128761),{installAllForProvider:s}=await e.A(518092),t=parseInt(process.env.PORT||"3000",10),o=`http://localhost:${t}`;for(let e of r.getAll()){let r=e.cli?.adapter;if(r)try{if(await r.repairHookPaths?.().catch(()=>{}),!await r.isAvailable()||await r.isMcpInstalled("tower",{scope:"user"}).catch(()=>!1))continue;let t=await s(e.name,o);t.ok?console.error(`[init-tower] Auto-installed Tower MCP for ${e.name} (user scope)`):console.error(`[init-tower] Auto-install for ${e.name} reported issues:`,{mcp:t.mcp?.ok,hooks:t.hooks?.ok,skill:t.skill?.ok})}catch(r){console.error(`[init-tower] Auto-install failed for ${e.name}:`,r)}}}catch(e){console.error("[init-tower] Provider auto-install setup failed:",e)}})()}}e.s(["register",0,r])},257948,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0657y50._.js"].map(r=>e.l(r))).then(()=>r(271856)))},484221,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0.p6em~._.js","server/chunks/src_lib_12xey8u._.js"].map(r=>e.l(r))).then(()=>r(336114)))},204549,e=>{e.v(r=>Promise.all(["server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js","server/chunks/[root-of-the-server]__03ufxqq._.js"].map(r=>e.l(r))).then(()=>r(301105)))},128761,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0lvlooo._.js","server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js"].map(r=>e.l(r))).then(()=>r(136902)))},518092,e=>{e.v(r=>Promise.all(["server/chunks/[root-of-the-server]__0j1px8f._.js","server/chunks/src_lib_ai_providers_index_ts_0.y.3vp._.js"].map(r=>e.l(r))).then(()=>r(760138)))}];
2
2
 
3
3
  //# sourceMappingURL=src_0weytpz._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[215624,e=>{"use strict";var t=e.i(921675),a=e.i(843793),n=e.i(195158),r=e.i(50377),i=e.i(86708);let s=["onboarding.completed","onboarding.lastStep","onboarding.username"];async function o(){let e=await a.db.systemConfig.findMany({where:{key:{in:[...s]}}}),t={};for(let a of e)try{t[a.key]=JSON.parse(a.value)}catch{t[a.key]=null}let n=!0===t["onboarding.completed"],r=t["onboarding.lastStep"],i=t["onboarding.username"];return{isFirstRun:!n,isCompleted:n,lastStep:"number"==typeof r?r:0,username:"string"==typeof i&&i.length>0?i:null}}async function l(e){await a.db.systemConfig.upsert({where:{key:"onboarding.lastStep"},create:{key:"onboarding.lastStep",value:JSON.stringify(e)},update:{value:JSON.stringify(e)}}),(0,n.revalidatePath)("/","layout")}async function u(e,t=4){if(await a.db.systemConfig.upsert({where:{key:"onboarding.completed"},create:{key:"onboarding.completed",value:"true"},update:{value:"true"}}),await a.db.systemConfig.upsert({where:{key:"onboarding.lastStep"},create:{key:"onboarding.lastStep",value:String(t)},update:{value:String(t)}}),void 0!==e){let t=e.trim().slice(0,64).replace(/[\r\n]/g," ");t.length>0&&await a.db.systemConfig.upsert({where:{key:"onboarding.username"},create:{key:"onboarding.username",value:JSON.stringify(t)},update:{value:JSON.stringify(t)}})}(0,n.revalidatePath)("/","layout")}async function d(e,t){await a.db.systemConfig.upsert({where:{key:"onboarding.extensions.requested"},create:{key:"onboarding.extensions.requested",value:JSON.stringify(e)},update:{value:JSON.stringify(e)}}),await a.db.systemConfig.upsert({where:{key:"onboarding.extensions.completed"},create:{key:"onboarding.extensions.completed",value:JSON.stringify(t)},update:{value:JSON.stringify(t)}}),(0,n.revalidatePath)("/","layout")}async function c(t){try{r.logger.create("task-completion").info("Task completion event dispatched",{taskId:t.taskId,taskTitle:t.taskTitle,status:t.status,executionId:t.executionId});let{broadcastNotification:a}=await e.A(590621);a({...t,type:"completion"})}catch{}}(0,i.ensureServerEntryExports)([o,l,u,d,c]),(0,t.registerServerReference)(o,"00120f8f663c6ecb5e907be3722be478161731fb06",null),(0,t.registerServerReference)(l,"40f1fe7136b3744a64a73f740180f891458c0c6401",null),(0,t.registerServerReference)(u,"60055c035170d24b736f46a94e3432ed3060e75fb0",null),(0,t.registerServerReference)(d,"60bac43b8930ce1461a961a4aa62d3122b8ee95c7b",null),(0,t.registerServerReference)(c,"4027ca05fa72e0ebd510c561a1c9b99820fffdc216",null),e.s(["dispatchTaskCompletionEvent",0,c])},590621,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0~ju4-d._.js","server/chunks/src_lib_0i2.v2d._.js"].map(t=>e.l(t))).then(()=>t(513200)))}];
2
+
3
+ //# sourceMappingURL=src_0wlyw0g._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[215624,e=>{"use strict";var t=e.i(921675),a=e.i(843793),n=e.i(195158),r=e.i(50377),i=e.i(86708);let s=["onboarding.completed","onboarding.lastStep","onboarding.username"];async function o(){let e=await a.db.systemConfig.findMany({where:{key:{in:[...s]}}}),t={};for(let a of e)try{t[a.key]=JSON.parse(a.value)}catch{t[a.key]=null}let n=!0===t["onboarding.completed"],r=t["onboarding.lastStep"],i=t["onboarding.username"];return{isFirstRun:!n,isCompleted:n,lastStep:"number"==typeof r?r:0,username:"string"==typeof i&&i.length>0?i:null}}async function l(e){await a.db.systemConfig.upsert({where:{key:"onboarding.lastStep"},create:{key:"onboarding.lastStep",value:JSON.stringify(e)},update:{value:JSON.stringify(e)}}),(0,n.revalidatePath)("/","layout")}async function u(e,t=4){if(await a.db.systemConfig.upsert({where:{key:"onboarding.completed"},create:{key:"onboarding.completed",value:"true"},update:{value:"true"}}),await a.db.systemConfig.upsert({where:{key:"onboarding.lastStep"},create:{key:"onboarding.lastStep",value:String(t)},update:{value:String(t)}}),void 0!==e){let t=e.trim().slice(0,64).replace(/[\r\n]/g," ");t.length>0&&await a.db.systemConfig.upsert({where:{key:"onboarding.username"},create:{key:"onboarding.username",value:JSON.stringify(t)},update:{value:JSON.stringify(t)}})}(0,n.revalidatePath)("/","layout")}async function d(e,t){await a.db.systemConfig.upsert({where:{key:"onboarding.extensions.requested"},create:{key:"onboarding.extensions.requested",value:JSON.stringify(e)},update:{value:JSON.stringify(e)}}),await a.db.systemConfig.upsert({where:{key:"onboarding.extensions.completed"},create:{key:"onboarding.extensions.completed",value:JSON.stringify(t)},update:{value:JSON.stringify(t)}}),(0,n.revalidatePath)("/","layout")}async function c(t){try{r.logger.create("task-completion").info("Task completion event dispatched",{taskId:t.taskId,taskTitle:t.taskTitle,status:t.status,executionId:t.executionId});let{broadcastNotification:a}=await e.A(590621);a({...t,type:"completion"})}catch{}}(0,i.ensureServerEntryExports)([o,l,u,d,c]),(0,t.registerServerReference)(o,"00120f8f663c6ecb5e907be3722be478161731fb06",null),(0,t.registerServerReference)(l,"40f1fe7136b3744a64a73f740180f891458c0c6401",null),(0,t.registerServerReference)(u,"60055c035170d24b736f46a94e3432ed3060e75fb0",null),(0,t.registerServerReference)(d,"60bac43b8930ce1461a961a4aa62d3122b8ee95c7b",null),(0,t.registerServerReference)(c,"4027ca05fa72e0ebd510c561a1c9b99820fffdc216",null),e.s(["dispatchTaskCompletionEvent",0,c])},590621,e=>{e.v(t=>Promise.all(["server/chunks/[root-of-the-server]__0~ju4-d._.js","server/chunks/src_lib_0i2.v2d._.js"].map(t=>e.l(t))).then(()=>t(513200)))}];
2
+
3
+ //# sourceMappingURL=src_0~ey84y._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[756264,e=>{"use strict";var t=e.i(921675),a=e.i(843793),r=e.i(195158),i=e.i(248434),n=e.i(83721),s=e.i(50377),d=e.i(572173),o=e.i(89428),c=e.i(924868),l=e.i(446786),u=e.i(814747),w=e.i(86708);let f=s.logger.create("agent-actions"),h=(0,u.join)((0,l.tmpdir)(),"tower-signals");async function p(e,t){try{await (0,c.mkdir)(h,{recursive:!0,mode:448}),await (0,c.writeFile)((0,u.join)(h,`exit-${e}`),String(t),{mode:384})}catch{}}async function k(e,t){let i=await a.db.taskMessage.create({data:{role:"USER",content:t,taskId:e}});return(0,r.revalidatePath)("/workspaces"),{userMessage:i}}async function b(e){return a.db.taskMessage.findMany({where:{taskId:e},orderBy:{createdAt:"asc"}})}async function E(e,t="CLAUDE_CODE",i,n){let s=await a.db.taskExecution.create({data:{taskId:e,agent:t,status:"RUNNING",startedAt:new Date,worktreePath:i??null,worktreeBranch:n??null}});return await a.db.task.update({where:{id:e},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces"),s}async function P(e,t="FAILED"){let i=await a.db.taskExecution.update({where:{id:e},data:{status:t,endedAt:new Date}});return(0,r.revalidatePath)("/workspaces"),i}async function m(t){let{destroySession:i,getSession:n}=await e.A(217260),s=n(t),d=s?.getBuffer()??"",o=await a.db.taskExecution.findFirst({where:{taskId:t,status:"RUNNING"},orderBy:{createdAt:"desc"}}),c=await a.db.task.findUnique({where:{id:t},include:{project:{select:{localPath:!0}}}});if(i(t),o){await a.db.taskExecution.update({where:{id:o.id},data:{status:"COMPLETED",endedAt:new Date}}),await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}});let r=o.worktreePath||c?.project?.localPath||null,{captureExecutionSummary:i}=await e.A(507603);await i(o.id,t,0,d,r,o.forkCommit)}(0,r.revalidatePath)("/workspaces")}async function g(e){return a.db.taskExecution.findMany({where:{taskId:e},orderBy:{createdAt:"desc"},include:{insightNote:{select:{id:!0,title:!0,content:!0}}}})}async function I(t,i){let s=await a.db.task.findUnique({where:{id:t},include:{project:!0}});if(!s)throw Error("Task not found");if(!s.project?.localPath)throw Error("Project has no local path configured");await a.db.taskExecution.updateMany({where:{taskId:t,status:"RUNNING",NOT:{sessionId:i}},data:{status:"FAILED",endedAt:new Date}});let c=await a.db.taskExecution.findFirst({where:{taskId:t,sessionId:i},orderBy:{createdAt:"desc"}});if(!c)throw Error("Previous execution not found");let l=c.worktreePath??s.project.localPath,w=s.subPath?(0,u.join)(l,s.subPath):l,h=await (0,d.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:k}=await (0,o.resolveCliAdapter)("terminal"),b=k.buildEnvOverrides({taskId:t,taskTitle:s.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`,callbackUrl:c.callbackUrl??void 0}),E=await a.db.taskExecution.update({where:{id:c.id},data:{status:"RUNNING",endedAt:null}});await a.db.task.update({where:{id:t},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces");let P=await (0,d.readConfigValue)("onboarding.username",""),m=k.buildSpawnArgs({taskId:t,prompt:"",cwd:w,resumeSessionId:i,extraArgs:[...P?["--append-system-prompt",`The user's name is ${P}.`]:[]],envOverrides:b}),g=/no conversation found with session id|unknown session|session .* not found/i;return(0,n.createSession)(t,m.command,m.args,w,()=>{},async r=>{await p(t,r);let n=await a.db.taskExecution.findUnique({where:{id:E.id}});if(n?.status!=="RUNNING")return;let{getSession:d}=await e.A(217260),o=d(t),l=o?.getBuffer()??"";if(0!==r&&g.test(l)){f.info("Session resume failed — retrying with fresh execution",{taskId:t,previousSessionId:i}),await a.db.taskExecution.update({where:{id:E.id},data:{status:"FAILED",endedAt:new Date}}).catch(()=>{});try{await N(t,s.title)}catch(e){f.error("Fresh execution retry also failed",e,{taskId:t})}return}await a.db.taskExecution.update({where:{id:E.id},data:{status:0===r?"COMPLETED":"FAILED",endedAt:new Date}}).catch(()=>{});let u=c.worktreePath||s.project.localPath,{captureExecutionSummary:w}=await e.A(507603);await w(E.id,t,r,l,u,E.forkCommit);let{dispatchTaskCompletionEvent:h}=await e.A(136565);await h({taskId:t,taskTitle:s.title,status:0===r?"COMPLETED":"FAILED",executionId:E.id,workspaceId:s.project.workspaceId}),0===r&&await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}}).catch(()=>{})},m.env,void 0,1e3*h),{executionId:E.id,worktreePath:c.worktreePath??l??null}}async function A(t){let i=await a.db.task.findUnique({where:{id:t},include:{project:!0}});if(!i)throw Error("Task not found");if(!i.project?.localPath)throw Error("Project has no local path configured");let s=await a.db.taskExecution.findFirst({where:{taskId:t},orderBy:{createdAt:"desc"}}),{destroySession:c}=await e.A(217260);c(t),await a.db.taskExecution.updateMany({where:{taskId:t,status:"RUNNING"},data:{status:"FAILED",endedAt:new Date}});let l=s?.worktreePath??i.project.localPath,w=i.subPath?(0,u.join)(l,i.subPath):l,f=await (0,d.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:h,provider:k}=await (0,o.resolveCliAdapter)("terminal"),b=h.buildEnvOverrides({taskId:t,taskTitle:i.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`}),E=await a.db.taskExecution.create({data:{taskId:t,agent:k.agentFieldValue,status:"RUNNING",startedAt:new Date,worktreePath:s?.worktreePath??null,worktreeBranch:s?.worktreeBranch??null}});await a.db.task.update({where:{id:t},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces");let P=await (0,d.readConfigValue)("onboarding.username",""),m=h.buildSpawnArgs({taskId:t,prompt:"",cwd:w,continueLatest:!0,extraArgs:[...P?["--append-system-prompt",`The user's name is ${P}.`]:[]],envOverrides:b});return(0,n.createSession)(t,m.command,m.args,w,()=>{},async r=>{await p(t,r);let n=await a.db.taskExecution.findUnique({where:{id:E.id}});if(n?.status!=="RUNNING")return;let{getSession:d}=await e.A(217260),o=d(t),c=o?.getBuffer()??"";await a.db.taskExecution.update({where:{id:E.id},data:{status:0===r?"COMPLETED":"FAILED",endedAt:new Date}}).catch(()=>{});let l=s?.worktreePath||i.project.localPath,{captureExecutionSummary:u}=await e.A(507603);await u(E.id,t,r,c,l,s?.forkCommit??null);let{dispatchTaskCompletionEvent:w}=await e.A(136565);await w({taskId:t,taskTitle:i.title,status:0===r?"COMPLETED":"FAILED",executionId:E.id,workspaceId:i.project.workspaceId}),0===r&&await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}}).catch(()=>{})},m.env,void 0,1e3*f),{executionId:E.id,worktreePath:s?.worktreePath??l??null}}async function v(t){let{getSession:r}=await e.A(217260),i=r(t);if(i&&!i.killed){let e=await a.db.taskExecution.findFirst({where:{taskId:t,status:"RUNNING"},orderBy:{createdAt:"desc"}});return{mode:"already_running",executionId:e?.id??null,worktreePath:e?.worktreePath??null}}if(await a.db.taskExecution.count({where:{taskId:t}})>0){let e=await A(t);return{mode:"continued",executionId:e.executionId,worktreePath:e.worktreePath}}let n=await N(t,"");return{mode:"started",executionId:n.executionId,worktreePath:n.worktreePath}}async function N(t,s,w,h,k){let b,E,P=await a.db.task.findUnique({where:{id:t},include:{project:!0}});if(!P)throw Error("Task not found");if(!P.project?.localPath)throw Error("Project has no local path configured");let m=await (0,d.readConfigValue)("system.maxConcurrentExecutions",20);if(await a.db.taskExecution.count({where:{status:"RUNNING"}})>=m)throw Error(`已达并发上限(${m}),请等待其他任务完成后再启动`);let g=await (0,d.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:I,provider:A,model:v}=await (0,o.resolveCliAdapter)("terminal");await a.db.taskExecution.updateMany({where:{taskId:t,status:"RUNNING"},data:{status:"FAILED",endedAt:new Date}}),"IN_PROGRESS"!==P.status&&(await a.db.task.update({where:{id:t},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces"));let N="";if(!k){let e=await a.db.taskMessage.findMany({where:{taskId:t},orderBy:{createdAt:"desc"},take:10});N=[`Task: ${P.title}`,P.description?`Description: ${P.description}`:"",e.length>0?`Recent conversation:
2
- ${e.reverse().map(e=>`${e.role}: ${e.content}`).join("\n")}`:"",s.trim()?`User message: ${s}`:""].filter(Boolean).join("\n\n")}let x=w??P.promptId;if(x){let e=await a.db.agentPrompt.findUnique({where:{id:x}});e?.content&&(E=await (0,c.mkdtemp)((0,u.join)((0,l.tmpdir)(),"tower-pty-")),b=(0,u.join)(E,"instructions.md"),await (0,c.writeFile)(b,e.content,"utf-8"))}let y=null,R=null;if(P.baseBranch&&P.project.localPath){let{worktreePath:e,worktreeBranch:a}=await (0,i.createWorktree)(P.project.localPath,t,P.baseBranch);y=e,R=a}let j=y??P.project.localPath,S=P.subPath?(0,u.join)(j,P.subPath):j,D=await a.db.taskExecution.create({data:{taskId:t,agent:A.agentFieldValue,status:"RUNNING",startedAt:new Date,worktreePath:y??null,worktreeBranch:R??null,callbackUrl:h??null}}),U=null;if(P.project.localPath)try{let t,{execFileSync:r}=await e.A(144264);(t=y&&P.baseBranch?r("git",["merge-base",P.baseBranch,"HEAD"],{cwd:y,encoding:"utf-8",timeout:5e3}).trim():r("git",["rev-parse","HEAD"],{cwd:P.project.localPath,encoding:"utf-8",timeout:5e3}).trim())&&(U=t,await a.db.taskExecution.update({where:{id:D.id},data:{forkCommit:t}}))}catch{}let T="";if(b){let{readFile:t}=await e.A(260815);T+=await t(b,"utf-8")}let O=await (0,d.readConfigValue)("onboarding.username","");O&&(T+=(T?"\n":"")+`The user's name is ${O}.`);let C=I.buildSpawnArgs({taskId:t,prompt:N,cwd:S,extraArgs:[...T?["--append-system-prompt",T]:[],...v?["--model",v]:[]],envOverrides:I.buildEnvOverrides({taskId:t,taskTitle:P.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`,callbackUrl:h??void 0})});return(0,n.createSession)(t,C.command,C.args,S,()=>{},async r=>{await p(t,r);let i=await a.db.taskExecution.findUnique({where:{id:D.id}});if(i?.status!=="RUNNING")return;let{getSession:n}=await e.A(217260),s=n(t),d=s?.getBuffer()??"";await a.db.taskExecution.update({where:{id:D.id},data:{status:0===r?"COMPLETED":"FAILED",endedAt:new Date}}).catch(e=>{f.error("Failed to update execution status",e)});let o=y||P.project.localPath,{captureExecutionSummary:l}=await e.A(507603);await l(D.id,t,r,d,o,U);let{dispatchTaskCompletionEvent:u}=await e.A(136565);await u({taskId:t,taskTitle:P.title,status:0===r?"COMPLETED":"FAILED",executionId:D.id,workspaceId:P.project.workspaceId}),0===r&&await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}}).catch(e=>{f.error("Failed to update task status",e)}),E&&await (0,c.rm)(E,{recursive:!0,force:!0}).catch(()=>{})},C.env,void 0,1e3*g),{executionId:D.id,worktreePath:y??j??null}}async function x(e,t,a,r,i){try{let n=await N(e,t,a,r,i);return{ok:!0,...n}}catch(t){return f.error("startPtyExecution failed",{taskId:e,error:t instanceof Error?t.stack??t.message:String(t)}),{ok:!1,error:t instanceof Error&&t.message?t.message:String(t)}}}async function y(){return(await a.db.taskExecution.findMany({where:{status:"RUNNING"},orderBy:{startedAt:"asc"},include:{task:{include:{project:{include:{workspace:!0}}}}}})).map(e=>({executionId:e.id,taskId:e.taskId,taskTitle:e.task.title,projectId:e.task.project.id,projectName:e.task.project.name,projectAlias:e.task.project.alias,projectLocalPath:e.task.project.localPath,workspaceId:e.task.project.workspace.id,workspaceName:e.task.project.workspace.name,worktreePath:e.worktreePath,subPath:e.task.subPath??null,startedAt:e.startedAt?.toISOString()??null}))}(0,w.ensureServerEntryExports)([k,b,E,P,m,g,I,A,v,N,x,y]),(0,t.registerServerReference)(k,"607a2e74aaa37598f4a570d3b8f0833b579f486aff",null),(0,t.registerServerReference)(b,"405ed509c48d2f2428f2720da99f0137f31594035e",null),(0,t.registerServerReference)(E,"781853b577c952ba5702f009fefb44d3e9e55ef4bb",null),(0,t.registerServerReference)(P,"604e1b6a84c5d6c348e43b9ed60631d01a49f5d79c",null),(0,t.registerServerReference)(m,"40440496d342c8b9a8abc5babc36d91186e2d060ef",null),(0,t.registerServerReference)(g,"4059ebe87310fd6051a72d03ec63d9c6b59e067c77",null),(0,t.registerServerReference)(I,"60daaf44fc82c289f40d6d430c9f39ac67379ca846",null),(0,t.registerServerReference)(A,"40b3259dcce14539c8949fbff3152fe01393aa9e78",null),(0,t.registerServerReference)(v,"40feaba80bcebe3a1a0422f1aaac65b1925b17dfae",null),(0,t.registerServerReference)(N,"7c751fb9f9f48f3e80d07435dfea390a702e217dd3",null),(0,t.registerServerReference)(x,"7c861f495fd28ff313b1aa5a0c701fc1903aceeefb",null),(0,t.registerServerReference)(y,"00a96d03b963f76ad435fe60e431d978706117935f",null),e.s(["continueOrStartTaskExecution",0,v,"startPtyExecution",0,N,"stopPtyExecution",0,m])}];
1
+ module.exports=[756264,e=>{"use strict";var t=e.i(921675),a=e.i(843793),r=e.i(195158),i=e.i(248434),n=e.i(83721),s=e.i(50377),d=e.i(572173),o=e.i(89428),c=e.i(924868),l=e.i(446786),u=e.i(814747),w=e.i(86708);let h=s.logger.create("agent-actions"),f=(0,u.join)((0,l.tmpdir)(),"tower-signals");async function p(e,t){try{await (0,c.mkdir)(f,{recursive:!0,mode:448}),await (0,c.writeFile)((0,u.join)(f,`exit-${e}`),String(t),{mode:384})}catch{}}async function k(e,t){let i=await a.db.taskMessage.create({data:{role:"USER",content:t,taskId:e}});return(0,r.revalidatePath)("/workspaces"),{userMessage:i}}async function b(e){return a.db.taskMessage.findMany({where:{taskId:e},orderBy:{createdAt:"asc"}})}async function E(e,t="CLAUDE_CODE",i,n){let s=await a.db.taskExecution.create({data:{taskId:e,agent:t,status:"RUNNING",startedAt:new Date,worktreePath:i??null,worktreeBranch:n??null}});return await a.db.task.update({where:{id:e},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces"),s}async function P(e,t="FAILED"){let i=await a.db.taskExecution.update({where:{id:e},data:{status:t,endedAt:new Date}});return(0,r.revalidatePath)("/workspaces"),i}async function m(t){let{destroySession:i,getSession:n}=await e.A(217260),s=n(t),d=s?.getBuffer()??"",o=await a.db.taskExecution.findFirst({where:{taskId:t,status:"RUNNING"},orderBy:{createdAt:"desc"}}),c=await a.db.task.findUnique({where:{id:t},include:{project:{select:{localPath:!0}}}});if(i(t),o){await a.db.taskExecution.update({where:{id:o.id},data:{status:"COMPLETED",endedAt:new Date}}),await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}});let r=o.worktreePath||c?.project?.localPath||null,{captureExecutionSummary:i}=await e.A(507603);await i(o.id,t,0,d,r,o.forkCommit)}(0,r.revalidatePath)("/workspaces")}async function g(e){return a.db.taskExecution.findMany({where:{taskId:e},orderBy:{createdAt:"desc"},include:{insightNote:{select:{id:!0,title:!0,content:!0}}}})}async function I(t,i){let s=await a.db.task.findUnique({where:{id:t},include:{project:!0}});if(!s)throw Error("Task not found");if(!s.project?.localPath)throw Error("Project has no local path configured");await a.db.taskExecution.updateMany({where:{taskId:t,status:"RUNNING",NOT:{sessionId:i}},data:{status:"FAILED",endedAt:new Date}});let c=await a.db.taskExecution.findFirst({where:{taskId:t,sessionId:i},orderBy:{createdAt:"desc"}});if(!c)throw Error("Previous execution not found");let l=c.worktreePath??s.project.localPath,w=s.subPath?(0,u.join)(l,s.subPath):l,f=await (0,d.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:k}=await (0,o.resolveCliAdapter)("terminal"),b=k.buildEnvOverrides({taskId:t,taskTitle:s.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`,callbackUrl:c.callbackUrl??void 0}),E=await a.db.taskExecution.update({where:{id:c.id},data:{status:"RUNNING",endedAt:null}});await a.db.task.update({where:{id:t},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces");let P=await (0,d.readConfigValue)("onboarding.username",""),m=k.buildSpawnArgs({taskId:t,prompt:"",cwd:w,resumeSessionId:i,extraArgs:[...P?["--append-system-prompt",`The user's name is ${P}.`]:[]],envOverrides:b}),g=/no conversation found with session id|unknown session|session .* not found/i;return(0,n.createSession)(t,m.command,m.args,w,()=>{},async r=>{await p(t,r);let n=await a.db.taskExecution.findUnique({where:{id:E.id}});if(n?.status!=="RUNNING")return;let{getSession:d}=await e.A(217260),o=d(t),l=o?.getBuffer()??"";if(0!==r&&g.test(l)){h.info("Session resume failed — retrying with fresh execution",{taskId:t,previousSessionId:i}),await a.db.taskExecution.update({where:{id:E.id},data:{status:"FAILED",endedAt:new Date}}).catch(()=>{});try{await N(t,s.title)}catch(e){h.error("Fresh execution retry also failed",e,{taskId:t})}return}await a.db.taskExecution.update({where:{id:E.id},data:{status:0===r?"COMPLETED":"FAILED",endedAt:new Date}}).catch(()=>{});let u=c.worktreePath||s.project.localPath,{captureExecutionSummary:w}=await e.A(507603);await w(E.id,t,r,l,u,E.forkCommit);let{dispatchTaskCompletionEvent:f}=await e.A(136565);await f({taskId:t,taskTitle:s.title,status:0===r?"COMPLETED":"FAILED",executionId:E.id,workspaceId:s.project.workspaceId}),0===r&&await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}}).catch(()=>{})},m.env,void 0,1e3*f),{executionId:E.id,worktreePath:c.worktreePath??l??null}}async function A(t){let i=await a.db.task.findUnique({where:{id:t},include:{project:!0}});if(!i)throw Error("Task not found");if(!i.project?.localPath)throw Error("Project has no local path configured");let s=await a.db.taskExecution.findFirst({where:{taskId:t},orderBy:{createdAt:"desc"}}),{destroySession:c}=await e.A(217260);c(t),await a.db.taskExecution.updateMany({where:{taskId:t,status:"RUNNING"},data:{status:"FAILED",endedAt:new Date}});let l=s?.worktreePath??i.project.localPath,w=i.subPath?(0,u.join)(l,i.subPath):l,h=await (0,d.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:f,provider:k}=await (0,o.resolveCliAdapter)("terminal"),b=f.buildEnvOverrides({taskId:t,taskTitle:i.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`}),E=await a.db.taskExecution.create({data:{taskId:t,agent:k.agentFieldValue,status:"RUNNING",startedAt:new Date,worktreePath:s?.worktreePath??null,worktreeBranch:s?.worktreeBranch??null}});await a.db.task.update({where:{id:t},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces");let P=await (0,d.readConfigValue)("onboarding.username",""),m=f.buildSpawnArgs({taskId:t,prompt:"",cwd:w,continueLatest:!0,extraArgs:[...P?["--append-system-prompt",`The user's name is ${P}.`]:[]],envOverrides:b});return(0,n.createSession)(t,m.command,m.args,w,()=>{},async r=>{await p(t,r);let n=await a.db.taskExecution.findUnique({where:{id:E.id}});if(n?.status!=="RUNNING")return;let{getSession:d}=await e.A(217260),o=d(t),c=o?.getBuffer()??"";await a.db.taskExecution.update({where:{id:E.id},data:{status:0===r?"COMPLETED":"FAILED",endedAt:new Date}}).catch(()=>{});let l=s?.worktreePath||i.project.localPath,{captureExecutionSummary:u}=await e.A(507603);await u(E.id,t,r,c,l,s?.forkCommit??null);let{dispatchTaskCompletionEvent:w}=await e.A(136565);await w({taskId:t,taskTitle:i.title,status:0===r?"COMPLETED":"FAILED",executionId:E.id,workspaceId:i.project.workspaceId}),0===r&&await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}}).catch(()=>{})},m.env,void 0,1e3*h),{executionId:E.id,worktreePath:s?.worktreePath??l??null}}async function v(t){let{getSession:r}=await e.A(217260),i=r(t);if(i&&!i.killed){let e=await a.db.taskExecution.findFirst({where:{taskId:t,status:"RUNNING"},orderBy:{createdAt:"desc"}});return{mode:"already_running",executionId:e?.id??null,worktreePath:e?.worktreePath??null}}if(await a.db.taskExecution.count({where:{taskId:t}})>0){let e=await A(t);return{mode:"continued",executionId:e.executionId,worktreePath:e.worktreePath}}let n=await N(t,"");return{mode:"started",executionId:n.executionId,worktreePath:n.worktreePath}}async function N(t,s,w,f,k){let b,E,P=await a.db.task.findUnique({where:{id:t},include:{project:!0}});if(!P)throw Error("Task not found");if(!P.project?.localPath)throw Error("Project has no local path configured");let m=await (0,d.readConfigValue)("system.maxConcurrentExecutions",20);if(await a.db.taskExecution.count({where:{status:"RUNNING"}})>=m)throw Error(`已达并发上限(${m}),请等待其他任务完成后再启动`);let g=await (0,d.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:I,provider:A,model:v}=await (0,o.resolveCliAdapter)("terminal");await a.db.taskExecution.updateMany({where:{taskId:t,status:"RUNNING"},data:{status:"FAILED",endedAt:new Date}}),"IN_PROGRESS"!==P.status&&(await a.db.task.update({where:{id:t},data:{status:"IN_PROGRESS"}}),(0,r.revalidatePath)("/workspaces"));let N="";if(!k){let e=await a.db.taskMessage.findMany({where:{taskId:t},orderBy:{createdAt:"desc"},take:10});N=[`Task: ${P.title}`,P.description?`Description: ${P.description}`:"",e.length>0?`Recent conversation:
2
+ ${e.reverse().map(e=>`${e.role}: ${e.content}`).join("\n")}`:"",s.trim()?`User message: ${s}`:""].filter(Boolean).join("\n\n")}let x=w??P.promptId;if(x){let e=await a.db.agentPrompt.findUnique({where:{id:x}});e?.content&&(E=await (0,c.mkdtemp)((0,u.join)((0,l.tmpdir)(),"tower-pty-")),b=(0,u.join)(E,"instructions.md"),await (0,c.writeFile)(b,e.content,"utf-8"))}let y=null,R=null;if(P.baseBranch&&P.project.localPath){let{worktreePath:e,worktreeBranch:a}=await (0,i.createWorktree)(P.project.localPath,t,P.baseBranch);y=e,R=a}let j=y??P.project.localPath,S=P.subPath?(0,u.join)(j,P.subPath):j,D=await a.db.taskExecution.create({data:{taskId:t,agent:A.agentFieldValue,status:"RUNNING",startedAt:new Date,worktreePath:y??null,worktreeBranch:R??null,callbackUrl:f??null}}),U=null;if(P.project.localPath)try{let t,{execFileSync:r}=await e.A(144264);(t=y&&P.baseBranch?r("git",["merge-base",P.baseBranch,"HEAD"],{cwd:y,encoding:"utf-8",timeout:5e3}).trim():r("git",["rev-parse","HEAD"],{cwd:P.project.localPath,encoding:"utf-8",timeout:5e3}).trim())&&(U=t,await a.db.taskExecution.update({where:{id:D.id},data:{forkCommit:t}}))}catch{}let T="";if(b){let{readFile:t}=await e.A(260815);T+=await t(b,"utf-8")}let O=await (0,d.readConfigValue)("onboarding.username","");O&&(T+=(T?"\n":"")+`The user's name is ${O}.`);let C=I.buildSpawnArgs({taskId:t,prompt:N,cwd:S,extraArgs:[...T?["--append-system-prompt",T]:[],...v?["--model",v]:[]],envOverrides:I.buildEnvOverrides({taskId:t,taskTitle:P.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`,callbackUrl:f??void 0})});return(0,n.createSession)(t,C.command,C.args,S,()=>{},async r=>{await p(t,r);let i=await a.db.taskExecution.findUnique({where:{id:D.id}});if(i?.status!=="RUNNING")return;let{getSession:n}=await e.A(217260),s=n(t),d=s?.getBuffer()??"";await a.db.taskExecution.update({where:{id:D.id},data:{status:0===r?"COMPLETED":"FAILED",endedAt:new Date}}).catch(e=>{h.error("Failed to update execution status",e)});let o=y||P.project.localPath,{captureExecutionSummary:l}=await e.A(507603);await l(D.id,t,r,d,o,U);let{dispatchTaskCompletionEvent:u}=await e.A(136565);await u({taskId:t,taskTitle:P.title,status:0===r?"COMPLETED":"FAILED",executionId:D.id,workspaceId:P.project.workspaceId}),0===r&&await a.db.task.update({where:{id:t},data:{status:"IN_REVIEW"}}).catch(e=>{h.error("Failed to update task status",e)}),E&&await (0,c.rm)(E,{recursive:!0,force:!0}).catch(()=>{})},C.env,void 0,1e3*g),{executionId:D.id,worktreePath:y??j??null}}async function x(e,t,a,r,i){try{let n=await N(e,t,a,r,i);return{ok:!0,...n}}catch(t){return h.error("startPtyExecution failed",{taskId:e,error:t instanceof Error?t.stack??t.message:String(t)}),{ok:!1,error:t instanceof Error&&t.message?t.message:String(t)}}}async function y(){return(await a.db.taskExecution.findMany({where:{status:"RUNNING"},orderBy:{startedAt:"asc"},include:{task:{include:{project:{include:{workspace:!0}}}}}})).map(e=>({executionId:e.id,taskId:e.taskId,taskTitle:e.task.title,projectId:e.task.project.id,projectName:e.task.project.name,projectAlias:e.task.project.alias,projectLocalPath:e.task.project.localPath,workspaceId:e.task.project.workspace.id,workspaceName:e.task.project.workspace.name,worktreePath:e.worktreePath,subPath:e.task.subPath??null,startedAt:e.startedAt?.toISOString()??null}))}(0,w.ensureServerEntryExports)([k,b,E,P,m,g,I,A,v,N,x,y]),(0,t.registerServerReference)(k,"603f00de09a600f7d202a25277719712c2ed283aaf",null),(0,t.registerServerReference)(b,"407dd468ac5dbcb334f8a335abaff8acc79403f899",null),(0,t.registerServerReference)(E,"7890193fab5d3eb669ce2b4b704f5b0061973ebd9c",null),(0,t.registerServerReference)(P,"60034fbbd81247db48df931753fa269220fbea04dc",null),(0,t.registerServerReference)(m,"40637f6866f1cba755071a07147fb5965bb2e9b5a6",null),(0,t.registerServerReference)(g,"404d52059c47f9bd69cc1dc54c9a5b0b5329a4a5ce",null),(0,t.registerServerReference)(I,"60b2ad02a90fcd96621307c3f0b52c7dfe56e5f656",null),(0,t.registerServerReference)(A,"40c46a99d6959ba8c380e4f6ac7ccff4b78db03943",null),(0,t.registerServerReference)(v,"407b113b35e24312a4e2cf7bcb7210ae6d8cace6a6",null),(0,t.registerServerReference)(N,"7cebd0f04a21654b0a6c325835a800d3073dbf4f85",null),(0,t.registerServerReference)(x,"7c0868c06b7af021524a56df961ada6682a134b71d",null),(0,t.registerServerReference)(y,"00607be623cf335ac16f02ffbbbdf655bd98fe0111",null),e.s(["continueOrStartTaskExecution",0,v,"startPtyExecution",0,N,"stopPtyExecution",0,m])}];
3
3
 
4
4
  //# sourceMappingURL=src_actions_agent-actions_ts_10q9r5b._.js.map