sliccy 5.59.1 → 5.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/dist/ui/assets/__vite-browser-external-DZX1xHt-.js +1 -0
  2. package/dist/ui/assets/account-store-BddNCTSm.js +98 -0
  3. package/dist/ui/assets/account-store-dvAfa3y8.js +38 -0
  4. package/dist/ui/assets/adobe-C0iTCwW2.js +1 -0
  5. package/dist/ui/assets/adobe-DC5UT0ZJ.js +2 -0
  6. package/dist/ui/assets/adobe-oauth-state-Csa5ciQS.js +1 -0
  7. package/dist/ui/assets/{adobe-oauth-state-BeQ7T3Vk.js → adobe-oauth-state-Vbbfo7gR.js} +1 -1
  8. package/dist/ui/assets/agent-message-to-chat-QyCEPmi8.js +7 -0
  9. package/dist/ui/assets/{anthropic-messages-BP_xL8Mh.js → anthropic-messages-CIsUSIzG.js} +3 -3
  10. package/dist/ui/assets/{anthropic-messages-BwBPoNP0.js → anthropic-messages-_fPAePlR.js} +3 -3
  11. package/dist/ui/assets/{apps-Bs4OZdLX.js → apps-ztx90XZQ.js} +1 -1
  12. package/dist/ui/assets/attachments-CByeG2Ru.js +1 -0
  13. package/dist/ui/assets/{azure-openai-hnPmyx7n.js → azure-openai-BKnOwPkT.js} +1 -1
  14. package/dist/ui/assets/{azure-openai-EZeNxE7d.js → azure-openai-Y9U14npX.js} +1 -1
  15. package/dist/ui/assets/{azure-openai-responses-BXDkTtSH.js → azure-openai-responses-DhzbC_tL.js} +1 -1
  16. package/dist/ui/assets/{azure-openai-responses-De9pJjBR.js → azure-openai-responses-bHfWNMbx.js} +1 -1
  17. package/dist/ui/assets/base64-DpPqYZJF.js +1 -0
  18. package/dist/ui/assets/bedrock-camp-BEi8MYUS.js +1 -0
  19. package/dist/ui/assets/bedrock-camp-CvxD6hHk.js +1 -0
  20. package/dist/ui/assets/bridge-launch-params-jegYRGJ6.js +1 -0
  21. package/dist/ui/assets/{browser-2wdq8OwU.js → browser-COVn7LPD.js} +6 -6
  22. package/dist/ui/assets/{cdp-Bwq6NLAx.js → cdp-7evcrxxP.js} +1 -1
  23. package/dist/ui/assets/cerebras-D_u7JsxU.js +1 -0
  24. package/dist/ui/assets/cerebras-ZAPHCT6L.js +1 -0
  25. package/dist/ui/assets/client-CpLUc-P8.js +4 -0
  26. package/dist/ui/assets/clipboard-Bd1Wp2vH.js +1 -0
  27. package/dist/ui/assets/compat-DyT25qXb.js +2 -0
  28. package/dist/ui/assets/{completionchunk-B2eUYPOo.js → completionchunk-D8ek1SQ-.js} +1 -1
  29. package/dist/ui/assets/{composer-speech-CgPswGW1.js → composer-speech-BWsih2Nz.js} +1 -1
  30. package/dist/ui/assets/{connect-surface-Ccit9qN8.js → connect-surface-YVJhSwyb.js} +1 -1
  31. package/dist/ui/assets/{context-compaction-LYFtS2_f.js → context-compaction-dcYYajWb.js} +6 -6
  32. package/dist/ui/assets/cost-command-Cpg2Em0Q.js +1613 -0
  33. package/dist/ui/assets/db-DjAqlQ2I.js +1 -0
  34. package/dist/ui/assets/db-ysOO0kLr.js +1 -0
  35. package/dist/ui/assets/dictation-priming-DGpw1lUV.js +1 -0
  36. package/dist/ui/assets/dip-BumXS1a9.js +233 -0
  37. package/dist/ui/assets/discovery-preference-DCtfbqw1.js +1 -0
  38. package/dist/ui/assets/dist-0FRaZO2z.js +12 -0
  39. package/dist/ui/assets/{dist-DH3_TPic.js → dist-BhEJb2Dl.js} +1 -1
  40. package/dist/ui/assets/{dist-DD6YY4Ks2.js → dist-Bj10RLrf.js} +1 -1
  41. package/dist/ui/assets/{dist-BHXb30bf.js → dist-Bq5i9FMJ.js} +4 -4
  42. package/dist/ui/assets/dist-CJ6ilPeJ.js +18 -0
  43. package/dist/ui/assets/{dist-D58cmC11.js → dist-Cc2eS9kS.js} +1 -1
  44. package/dist/ui/assets/{dist-CC_gNVTb.js → dist-DB-MlM2G.js} +1 -1
  45. package/dist/ui/assets/{dist-Bw2SRiP7.js → dist-DuLHpm2f.js} +1 -1
  46. package/dist/ui/assets/dist-DvjiIrEx.js +23 -0
  47. package/dist/ui/assets/{dist-D1pcMg_U.js → dist-d2CXjMIs.js} +3 -3
  48. package/dist/ui/assets/electron-overlay-route-CjT6k9Df.js +1 -0
  49. package/dist/ui/assets/ensure-speech-assets-D2Pclall.js +1 -0
  50. package/dist/ui/assets/es-CP2z28j0.js +53 -0
  51. package/dist/ui/assets/esp8266-CkAPDkuz.js +1 -0
  52. package/dist/ui/assets/esptool-operations-C0DUkD34.js +13 -0
  53. package/dist/ui/assets/esptool-operations-iCYPdIRA.js +12 -0
  54. package/dist/ui/assets/extension-bridge-transport-DHBo-K6K.js +1 -0
  55. package/dist/ui/assets/{follower-navigate-watcher-CRVUcrQz.js → follower-navigate-watcher-Cn5RjYxg.js} +1 -1
  56. package/dist/ui/assets/{fs-C4sVSIbi.js → fs-BVM9dzPP.js} +1 -1
  57. package/dist/ui/assets/fs-CMpdIYZs.js +2 -0
  58. package/dist/ui/assets/git-config-Lj0BT7Oc.js +7 -0
  59. package/dist/ui/assets/github-CmX1lUH3.js +2 -0
  60. package/dist/ui/assets/github-copilot-C9loxoyp.js +1 -0
  61. package/dist/ui/assets/github-copilot-JdvDIR67.js +2 -0
  62. package/dist/ui/assets/github-ndbvNRbv.js +1 -0
  63. package/dist/ui/assets/global-db-DvmmimLY.js +1 -0
  64. package/dist/ui/assets/{google-generative-ai-C58ldv83.js → google-generative-ai-CyS9qbzb.js} +1 -1
  65. package/dist/ui/assets/{google-generative-ai-Eq6eGS5h.js → google-generative-ai-DkRyuoBH.js} +1 -1
  66. package/dist/ui/assets/{google-shared-DQbld86Z.js → google-shared-CCJkdw81.js} +2 -2
  67. package/dist/ui/assets/{google-shared-DwCjfFnw.js → google-shared-p5XdfI6c.js} +3 -3
  68. package/dist/ui/assets/{google-vertex-C18Xl3dV.js → google-vertex-Cp9ldPyE.js} +1 -1
  69. package/dist/ui/assets/{google-vertex-CkkAgSFr.js → google-vertex-D7VRnbrL.js} +1 -1
  70. package/dist/ui/assets/{handoff-link-CLvhqfpd.js → handoff-link-CfgH86mb.js} +1 -1
  71. package/dist/ui/assets/hear-D7srqY_7.js +1 -0
  72. package/dist/ui/assets/hear-acxY6mf0.js +1 -0
  73. package/dist/ui/assets/hid-device-registry-DboUgvzI.js +1 -0
  74. package/dist/ui/assets/hid-picker-Bhoh8hxy.js +1 -0
  75. package/dist/ui/assets/installer-D7LGGQGy.js +3 -0
  76. package/dist/ui/assets/{js-realm-worker-CeYHBMC5.js → js-realm-worker-B4uCLm52.js} +3 -3
  77. package/dist/ui/assets/{json-parse-B51EftGA.js → json-parse-CpLf0aqK.js} +1 -1
  78. package/dist/ui/assets/{json-parse-C7d6hyOc.js → json-parse-rb7sUwcH.js} +1 -1
  79. package/dist/ui/assets/kernel-worker-DMnEeTNU.js +8759 -0
  80. package/dist/ui/assets/{kokoro-C-DxSDte.js → kokoro-CGDCwNNA.js} +2 -2
  81. package/dist/ui/assets/{kokoro-BFFlHn4y.js → kokoro-D3TYeL2z.js} +2 -2
  82. package/dist/ui/assets/{kokoro-engine-DENIKgTV.js → kokoro-engine-DLKTuHMR.js} +2 -2
  83. package/dist/ui/assets/legacy-api-aliases-BQSsmFIS.js +1 -0
  84. package/dist/ui/assets/legacy-api-aliases-DWJHPSiz.js +1 -0
  85. package/dist/ui/assets/{legacy-styles-kYboUbpI.js → legacy-styles-DcRu2WCJ.js} +1 -1
  86. package/dist/ui/assets/lick-manager-Ct3WOtut.js +2 -0
  87. package/dist/ui/assets/lick-ws-bridge-C_bJMGw6.js +1 -0
  88. package/dist/ui/assets/{lick-ws-bridge-DpPrSP8R.js → lick-ws-bridge-SPFIXhG2.js} +1 -1
  89. package/dist/ui/assets/llm-session-id-ZObKEXzb.js +1 -0
  90. package/dist/ui/assets/local-llm-B5vPCdpH.js +2 -0
  91. package/dist/ui/assets/{local-llm-wgOnNpVi.js → local-llm-DS8tu43V.js} +1 -1
  92. package/dist/ui/assets/magick-wasm-B-rybRPb.js +43 -0
  93. package/dist/ui/assets/main-D8Y-cnmF.js +22 -0
  94. package/dist/ui/assets/{main-cherry-d-KDlb8k.js → main-cherry-CGm5knH6.js} +1 -1
  95. package/dist/ui/assets/{mime-types-BqLkKWa7.js → mime-types-D7IV6i7k.js} +1 -1
  96. package/dist/ui/assets/mistral-conversations-CLDzxp2F.js +8 -0
  97. package/dist/ui/assets/mistral-conversations-DbKikZnf.js +7 -0
  98. package/dist/ui/assets/{models-ByRUWfA-.js → models-CzSI8IsT.js} +1 -1
  99. package/dist/ui/assets/{mount-C0YbhdMr.js → mount-C4XESP9i.js} +1 -1
  100. package/dist/ui/assets/mount-Hr9QXuwp.js +2 -0
  101. package/dist/ui/assets/{mount-bridge-client-0Afn2H9Y.js → mount-bridge-client-BVLVI9yX.js} +1 -1
  102. package/dist/ui/assets/mount-recovery-BHHDw9yC.js +2 -0
  103. package/dist/ui/assets/mount-table-store-CTrzlrNn.js +1 -0
  104. package/dist/ui/assets/navigation-watcher-BoJS9hdc.js +1 -0
  105. package/dist/ui/assets/new-session-u-78FCPG.js +2 -0
  106. package/dist/ui/assets/oauth-bootstrap-DHKASsxn.js +2 -0
  107. package/dist/ui/assets/{oauth-service-w5HZt7Xx.js → oauth-service-CmM0tZSO.js} +1 -1
  108. package/dist/ui/assets/oauth-service-DSuwOpMz.js +1 -0
  109. package/dist/ui/assets/{openai-BeH6aC_-.js → openai-BxFF4GUL.js} +2 -2
  110. package/dist/ui/assets/{openai-BvKpRLAG.js → openai-CmTnPr9N.js} +2 -2
  111. package/dist/ui/assets/openai-codex-Djc_-qM9.js +1 -0
  112. package/dist/ui/assets/openai-codex-gi-RyKX_.js +1 -0
  113. package/dist/ui/assets/{openai-codex-responses-BDYh8ojD.js → openai-codex-responses-B_k2rCqO.js} +1 -1
  114. package/dist/ui/assets/{openai-codex-responses-C7QnNmC0.js → openai-codex-responses-RviMslSH.js} +1 -1
  115. package/dist/ui/assets/{openai-completions-t-glszMQ.js → openai-completions-CGLtJfv2.js} +1 -1
  116. package/dist/ui/assets/{openai-completions-BnAjXzgN.js → openai-completions-COYKlBqA.js} +1 -1
  117. package/dist/ui/assets/{openai-responses-o9_kr7GP.js → openai-responses-C4mUX6jK.js} +1 -1
  118. package/dist/ui/assets/{openai-responses-BofM6cmY.js → openai-responses-D02gU0ey.js} +1 -1
  119. package/dist/ui/assets/{openai-responses-shared-79gch22X.js → openai-responses-shared-CCTyKL6A.js} +2 -2
  120. package/dist/ui/assets/{openai-responses-shared-DKPwc9Eh.js → openai-responses-shared-bVKJbQt9.js} +2 -2
  121. package/dist/ui/assets/{openrouter-images-PT0FZmkM.js → openrouter-images-BrQDTa3_.js} +1 -1
  122. package/dist/ui/assets/{openrouter-images-D0dgD5eX.js → openrouter-images-DtvjLeGK.js} +1 -1
  123. package/dist/ui/assets/otel-C1NYdIbe.js +3 -0
  124. package/dist/ui/assets/otel-joHgpnL_.js +3 -0
  125. package/dist/ui/assets/page-follower-tray-DFeLlotx.js +5 -0
  126. package/dist/ui/assets/panel-rpc-handlers-CTZqBsvr.js +2 -0
  127. package/dist/ui/assets/{pdfjs-BdCnB7P8.js → pdfjs-B1saeD0h.js} +5 -5
  128. package/dist/ui/assets/{port-bridge-client-Btb0CfZS.js → port-bridge-client-CdvMlimf.js} +1 -1
  129. package/dist/ui/assets/{port-bridge-client-BtsJUDjt.js → port-bridge-client-CsrXhMWo.js} +1 -1
  130. package/dist/ui/assets/preload-helper-Czpn1I53.js +1 -0
  131. package/dist/ui/assets/process-manager-B5dz0PkO.js +1 -0
  132. package/dist/ui/assets/provider-DeZ3vGbS.js +2 -0
  133. package/dist/ui/assets/provider-POdkeNpc.js +1 -0
  134. package/dist/ui/assets/provider-settings-3FoUN196.js +1 -0
  135. package/dist/ui/assets/provider-settings-BraIAAA7.js +2 -0
  136. package/dist/ui/assets/provider-store-access-B_pR-9Xx.js +2 -0
  137. package/dist/ui/assets/provider-store-access-BkJ_SWbe.js +1 -0
  138. package/dist/ui/assets/providers-B26DtTJa.js +1 -0
  139. package/dist/ui/assets/providers-CvODsjGm.js +2 -0
  140. package/dist/ui/assets/proxied-fetch-DETjVL-j.js +2 -0
  141. package/dist/ui/assets/proxied-fetch-sbHa3Tte.js +1 -0
  142. package/dist/ui/assets/{py-realm-worker-C5_FcpVv.js → py-realm-worker-VuYxvTG9.js} +2 -2
  143. package/dist/ui/assets/{pyodide-CVuZVKDU.js → pyodide-BahZNzwn.js} +2 -2
  144. package/dist/ui/assets/{quick-llm-8fakxnYS.js → quick-llm-DzhE1JW0.js} +1 -1
  145. package/dist/ui/assets/{readline-D4m_9EmN.js → readline-0OE_8qoR.js} +1 -1
  146. package/dist/ui/assets/remote-cdp-transport-DOoXIxy3.js +1 -0
  147. package/dist/ui/assets/{remote-terminal-view-BOSJ_t1v.js → remote-terminal-view-C7x7cM1d.js} +2 -2
  148. package/dist/ui/assets/runtime-mode-M-qJL9jF.js +1 -0
  149. package/dist/ui/assets/safe-buffer-C0pSmFaz.js +12 -0
  150. package/dist/ui/assets/script-catalog-BYXhqRAc.js +2 -0
  151. package/dist/ui/assets/{secret-env-CGjJCzwN.js → secret-env-1E2r2H5F.js} +1 -1
  152. package/dist/ui/assets/{secret-topology-_rfIhUjY.js → secret-topology-D2k1IxFk.js} +1 -1
  153. package/dist/ui/assets/{secrets-bridge-client-a5aLwwny.js → secrets-bridge-client-CONYX8PU.js} +1 -1
  154. package/dist/ui/assets/serial-picker-CUd91lje.js +1 -0
  155. package/dist/ui/assets/session-freezer-CUzeQ9yz.js +21 -0
  156. package/dist/ui/assets/{setup-sprinkle-exec-P2hO-taT.js → setup-sprinkle-exec-DD6jqggr.js} +1 -1
  157. package/dist/ui/assets/setup-sudo-cXyK0NGW.js +2 -0
  158. package/dist/ui/assets/{shared-Cq5Q0noX.js → shared-Dwjvg8S5.js} +1 -1
  159. package/dist/ui/assets/shared-X5SFnyK-.js +4 -0
  160. package/dist/ui/assets/skills-otSlGBFl.js +6 -0
  161. package/dist/ui/assets/{slicc-editor-DKckizoI.js → slicc-editor-BoIEeofq.js} +2 -2
  162. package/dist/ui/assets/{speak-DG2fJcBd.js → speak-WMi1eHMn.js} +3 -3
  163. package/dist/ui/assets/{speak-CcZ3Uni4.js → speak-YEgNUk4w.js} +1 -1
  164. package/dist/ui/assets/{sprinkle-bridge-C0ycYX8f.js → sprinkle-bridge-CmJpELpy.js} +1 -1
  165. package/dist/ui/assets/sprinkle-manager-DXrwoVHS.js +1 -0
  166. package/dist/ui/assets/{sprinkle-renderer-Bk_e6Kbr.js → sprinkle-renderer-B0y9_9py.js} +2 -2
  167. package/dist/ui/assets/{wc-shell-ChAQky0u.js → src-6TqoULh8.js} +94 -211
  168. package/dist/ui/assets/src-CS5gSDhT.js +1 -0
  169. package/dist/ui/assets/src-Dk1QVJRd.js +1 -0
  170. package/dist/ui/assets/store-BfzctFJC.js +1 -0
  171. package/dist/ui/assets/{sudo-CBMei9fD.js → sudo-LN3PJp6v.js} +1 -1
  172. package/dist/ui/assets/telemetry-C8rZr13D.js +3 -0
  173. package/dist/ui/assets/timestamp-preference-DgrTvVNx.js +2 -0
  174. package/dist/ui/assets/transcript-limits-D0M7bLr9.js +1 -0
  175. package/dist/ui/assets/{transform-messages-ZX8cvJiJ.js → transform-messages-CVIV-EgO.js} +1 -1
  176. package/dist/ui/assets/transform-messages-fFaW-DLG.js +1 -0
  177. package/dist/ui/assets/transformers-env-8w05vuhN.js +1 -0
  178. package/dist/ui/assets/{transformers-env-w-btTDFl.js → transformers-env-sL29_hFb.js} +1 -1
  179. package/dist/ui/assets/{transformers.web-C6PlPLR-.js → transformers.web-CrioJkWG.js} +4 -4
  180. package/dist/ui/assets/{transformers.web-DkJGoARp.js → transformers.web-D6viRW2X.js} +5 -5
  181. package/dist/ui/assets/tray-follower-status-CyJIKXH4.js +1 -0
  182. package/dist/ui/assets/tray-join-url-BIvzbiFR.js +1 -0
  183. package/dist/ui/assets/tray-leader-DcLymd_E.js +1 -0
  184. package/dist/ui/assets/tray-leave-runtime-lJcLlwtm.js +1 -0
  185. package/dist/ui/assets/tray-runtime-config-DJIIJaBR.js +1 -0
  186. package/dist/ui/assets/tray-runtime-config-DlPGhxQs.js +1 -0
  187. package/dist/ui/assets/tray-sync-protocol-CVdiCvfU.js +1 -0
  188. package/dist/ui/assets/upgrade-detection-DIIyklC5.js +1 -0
  189. package/dist/ui/assets/usb-device-registry-BOGfZXgp.js +1 -0
  190. package/dist/ui/assets/{usb-operations-D-YdmmuG.js → usb-operations-BQbhk96u.js} +1 -1
  191. package/dist/ui/assets/usb-picker-Cl6Cwuv9.js +1 -0
  192. package/dist/ui/assets/voice-reply-DHV6R4En.js +1 -0
  193. package/dist/ui/assets/wc-attach-DU0svqb7.js +13 -0
  194. package/dist/ui/assets/wc-extension-oy0LEz26.js +2 -0
  195. package/dist/ui/assets/{wc-float-label-CNeJqRLg.js → wc-float-label-DeQPr3pd.js} +1 -1
  196. package/dist/ui/assets/wc-follower-DcQtc8YB.js +17 -0
  197. package/dist/ui/assets/wc-live-D7BaYtR7.js +8 -0
  198. package/dist/ui/assets/wc-nav-BqxVwvjV.js +2 -0
  199. package/dist/ui/assets/wc-onboarding-D9lPUOm-.js +2 -0
  200. package/dist/ui/assets/{wc-permissions-CAEOwurQ.js → wc-permissions-DW60QZxV.js} +3 -3
  201. package/dist/ui/assets/wc-permissions-providers-DMTDytlu.js +2 -0
  202. package/dist/ui/assets/wc-placeholder-C0wfdFBG.js +4 -0
  203. package/dist/ui/assets/wc-scoop-color-CByZNEJo.js +1 -0
  204. package/dist/ui/assets/wc-settings-qEE2zwaO.js +51 -0
  205. package/dist/ui/assets/wc-shell-BHZzK20y.js +117 -0
  206. package/dist/ui/assets/wc-sprinkles-DlE9uQTj.js +2 -0
  207. package/dist/ui/assets/wc-tray-BdFq9TlZ.js +2 -0
  208. package/dist/ui/assets/{whisper-engine-DBy-Rgc0.js → whisper-engine-C0mT2z02.js} +1 -1
  209. package/dist/ui/assets/whisper-session-DvjyTCj0.js +2 -0
  210. package/dist/ui/assets/xai-grok-Bx0idvJc.js +1 -0
  211. package/dist/ui/assets/xai-grok-CemZ8tZD.js +1 -0
  212. package/dist/ui/assets/xterm-DX7Hb5S-.js +47 -0
  213. package/dist/ui/assets/xterm-U4TA8lIC.js +35 -0
  214. package/dist/ui/index.html +24 -15
  215. package/dist/ui/packages/webapp/index.html +24 -15
  216. package/package.json +2 -2
  217. package/dist/ui/assets/__vite-browser-external-s4_sx6bN.js +0 -1
  218. package/dist/ui/assets/account-store-B2gG-qc_.js +0 -38
  219. package/dist/ui/assets/account-store-HRvOCmO4.js +0 -103
  220. package/dist/ui/assets/adobe-CHBAf7Hs.js +0 -1
  221. package/dist/ui/assets/adobe-CJZTrRE1.js +0 -2
  222. package/dist/ui/assets/adobe-oauth-state-C9eB9J5F.js +0 -1
  223. package/dist/ui/assets/agent-message-to-chat-ColCoNOH.js +0 -7
  224. package/dist/ui/assets/bedrock-camp-CZFsedRI.js +0 -1
  225. package/dist/ui/assets/bedrock-camp-Czep_VHL.js +0 -1
  226. package/dist/ui/assets/cdp-bridge-CUqQUcaF.js +0 -1
  227. package/dist/ui/assets/cerebras-C2wowhxn.js +0 -1
  228. package/dist/ui/assets/cerebras-CPDv_lSy.js +0 -1
  229. package/dist/ui/assets/clipboard-B_tsQU_u.js +0 -1
  230. package/dist/ui/assets/compat-FrhC6T45.js +0 -2
  231. package/dist/ui/assets/dip-DjQjKj4G.js +0 -1
  232. package/dist/ui/assets/discovery-preference-ChE43Rww.js +0 -1
  233. package/dist/ui/assets/dist-0c-Ms6jt.js +0 -23
  234. package/dist/ui/assets/dist-C30gQBcj2.js +0 -12
  235. package/dist/ui/assets/dist-CF1SACsY.js +0 -18
  236. package/dist/ui/assets/ensure-speech-assets-DOfhoSLd.js +0 -1
  237. package/dist/ui/assets/es-kEo2Tmh4.js +0 -53
  238. package/dist/ui/assets/esp8266-DhxGJGHR.js +0 -1
  239. package/dist/ui/assets/esp8266-dt3vHImh.js +0 -1
  240. package/dist/ui/assets/esptool-operations-BBtDOaij.js +0 -12
  241. package/dist/ui/assets/esptool-operations-wGO-l9-a.js +0 -13
  242. package/dist/ui/assets/extension-bridge-transport-Bi9JIuzJ.js +0 -1
  243. package/dist/ui/assets/fs-BuwyzyMW.js +0 -2
  244. package/dist/ui/assets/github-Bypbpxj_.js +0 -1
  245. package/dist/ui/assets/github-C85Bo5sl.js +0 -2
  246. package/dist/ui/assets/github-copilot-Bl3DpxDS.js +0 -2
  247. package/dist/ui/assets/github-copilot-BzF1rbqF.js +0 -1
  248. package/dist/ui/assets/hear-C7y434Fx.js +0 -1
  249. package/dist/ui/assets/hear-tL55Pr9X.js +0 -1
  250. package/dist/ui/assets/hid-device-registry-6w-g8ZpF.js +0 -1
  251. package/dist/ui/assets/hid-picker-Cp7Sp5N-.js +0 -1
  252. package/dist/ui/assets/kernel-worker-BwALz4mK.js +0 -10443
  253. package/dist/ui/assets/lick-ws-bridge-Cu9jmlYC.js +0 -1
  254. package/dist/ui/assets/main-CGnZl3f-.js +0 -24
  255. package/dist/ui/assets/mistral-conversations-DKqvekSA.js +0 -7
  256. package/dist/ui/assets/mistral-conversations-szVW8BsU.js +0 -8
  257. package/dist/ui/assets/mount-D5pPoQkC.js +0 -2
  258. package/dist/ui/assets/mount-id-nJcx05eu.js +0 -1
  259. package/dist/ui/assets/mount-table-store-s20mtVA3.js +0 -1
  260. package/dist/ui/assets/navigation-watcher-DTSw-td6.js +0 -1
  261. package/dist/ui/assets/new-session-Bs6AOhFK.js +0 -2
  262. package/dist/ui/assets/oauth-bootstrap-CE5ZvKUd.js +0 -2
  263. package/dist/ui/assets/oauth-service-Cf0jA8F5.js +0 -1
  264. package/dist/ui/assets/openai-codex-8wcYifFj.js +0 -1
  265. package/dist/ui/assets/openai-codex-xmVYehg_.js +0 -1
  266. package/dist/ui/assets/otel-BvlmHUjk.js +0 -3
  267. package/dist/ui/assets/otel-CCT7TRJr.js +0 -3
  268. package/dist/ui/assets/page-follower-tray-CowMs-O6.js +0 -5
  269. package/dist/ui/assets/panel-rpc-handlers-D7f3wT75.js +0 -2
  270. package/dist/ui/assets/preload-helper-CZgWQFsJ.js +0 -1
  271. package/dist/ui/assets/provider-DgMyEny4.js +0 -2
  272. package/dist/ui/assets/provider-m3ooafCg.js +0 -1
  273. package/dist/ui/assets/provider-settings-DJevRg9o.js +0 -1
  274. package/dist/ui/assets/provider-store-access-QXzphIMd.js +0 -1
  275. package/dist/ui/assets/provider-store-access-ZxL11bFB.js +0 -1
  276. package/dist/ui/assets/providers-B3oFOoQS.js +0 -1
  277. package/dist/ui/assets/providers-BW6jnLVy.js +0 -2
  278. package/dist/ui/assets/proxied-fetch-CQqrhHlW.js +0 -1
  279. package/dist/ui/assets/proxied-fetch-D3wsof0i.js +0 -2
  280. package/dist/ui/assets/remote-cdp-transport-DspFAFy_.js +0 -1
  281. package/dist/ui/assets/serial-picker-bJGym01W.js +0 -1
  282. package/dist/ui/assets/session-freezer-jxkdAA5Q.js +0 -1
  283. package/dist/ui/assets/sprinkle-manager-Bvx4CxCm.js +0 -1
  284. package/dist/ui/assets/src-BQoW5KdD.js +0 -1
  285. package/dist/ui/assets/src-BvERX0WZ.js +0 -1
  286. package/dist/ui/assets/store-B7DeyKtl.js +0 -1
  287. package/dist/ui/assets/transform-messages-DwI5R8if.js +0 -1
  288. package/dist/ui/assets/transformers-env-BwX2ts-q.js +0 -1
  289. package/dist/ui/assets/tray-leader-DKj3IyXq.js +0 -1
  290. package/dist/ui/assets/tray-leave-runtime-CPrd1hfA.js +0 -1
  291. package/dist/ui/assets/upgrade-detection-B_nKAXxR.js +0 -1
  292. package/dist/ui/assets/usb-device-registry-k6vTKonT.js +0 -1
  293. package/dist/ui/assets/usb-picker-DJjZemi7.js +0 -1
  294. package/dist/ui/assets/voice-reply-D08ppelD.js +0 -1
  295. package/dist/ui/assets/wc-attach-BD0vIfkn.js +0 -13
  296. package/dist/ui/assets/wc-extension-B6ny75yf.js +0 -2
  297. package/dist/ui/assets/wc-follower-DBHiqt6g.js +0 -17
  298. package/dist/ui/assets/wc-live-CuefElQr.js +0 -258
  299. package/dist/ui/assets/wc-nav-CQU9lWdP.js +0 -2
  300. package/dist/ui/assets/wc-onboarding-DaQiGWxH.js +0 -2
  301. package/dist/ui/assets/wc-permissions-providers-CbkqRh4J.js +0 -2
  302. package/dist/ui/assets/wc-placeholder-DCIY4YK0.js +0 -4
  303. package/dist/ui/assets/wc-settings-BDh89SFJ.js +0 -51
  304. package/dist/ui/assets/wc-sprinkles-CxI-YvJH.js +0 -2
  305. package/dist/ui/assets/wc-tray-DL8LCTDP.js +0 -2
  306. package/dist/ui/assets/whisper-session-C8cizjJD.js +0 -2
  307. package/dist/ui/assets/xai-grok-BnqGjgBw.js +0 -1
  308. package/dist/ui/assets/xai-grok-yL8zMte6.js +0 -1
  309. package/dist/ui/assets/xterm-DMlKjmUi.js +0 -36
  310. package/dist/ui/assets/xterm-Dwh1I9AE.js +0 -48
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"./rolldown-runtime-aKtaBQYM.js";t((e=>{(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(o(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(e,r){var i=1,a=e.length,o,s=``,c,l,u,d,f,p,m,h;for(c=0;c<a;c++)if(typeof e[c]==`string`)s+=e[c];else if(typeof e[c]==`object`){if(u=e[c],u.keys)for(o=r[i],l=0;l<u.keys.length;l++){if(o==null)throw Error(n(`[sprintf] Cannot access property "%s" of undefined value "%s"`,u.keys[l],u.keys[l-1]));o=o[u.keys[l]]}else o=u.param_no?r[u.param_no]:r[i++];if(t.not_type.test(u.type)&&t.not_primitive.test(u.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(u.type)&&typeof o!=`number`&&isNaN(o))throw TypeError(n(`[sprintf] expecting number but found %T`,o));switch(t.number.test(u.type)&&(m=o>=0),u.type){case`b`:o=parseInt(o,10).toString(2);break;case`c`:o=String.fromCharCode(parseInt(o,10));break;case`d`:case`i`:o=parseInt(o,10);break;case`j`:o=JSON.stringify(o,null,u.width?parseInt(u.width):0);break;case`e`:o=u.precision?parseFloat(o).toExponential(u.precision):parseFloat(o).toExponential();break;case`f`:o=u.precision?parseFloat(o).toFixed(u.precision):parseFloat(o);break;case`g`:o=u.precision?String(Number(o.toPrecision(u.precision))):parseFloat(o);break;case`o`:o=(parseInt(o,10)>>>0).toString(8);break;case`s`:o=String(o),o=u.precision?o.substring(0,u.precision):o;break;case`t`:o=String(!!o),o=u.precision?o.substring(0,u.precision):o;break;case`T`:o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=u.precision?o.substring(0,u.precision):o;break;case`u`:o=parseInt(o,10)>>>0;break;case`v`:o=o.valueOf(),o=u.precision?o.substring(0,u.precision):o;break;case`x`:o=(parseInt(o,10)>>>0).toString(16);break;case`X`:o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(u.type)?s+=o:(t.number.test(u.type)&&(!m||u.sign)?(h=m?`+`:`-`,o=o.toString().replace(t.sign,``)):h=``,f=u.pad_char?u.pad_char===`0`?`0`:u.pad_char.charAt(1):` `,p=u.width-(h+o).length,d=u.width&&p>0?f.repeat(p):``,s+=u.align?h+o+d:f===`0`?h+d+o:d+h+o)}return s}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var n=e,r,i=[],o=0;n;){if((r=t.text.exec(n))!==null)i.push(r[0]);else if((r=t.modulo.exec(n))!==null)i.push(`%`);else if((r=t.placeholder.exec(n))!==null){if(r[2]){o|=1;var s=[],c=r[2],l=[];if((l=t.key.exec(c))!==null)for(s.push(l[1]);(c=c.substring(l[0].length))!==``;)if((l=t.key_access.exec(c))!==null)s.push(l[1]);else if((l=t.index_access.exec(c))!==null)s.push(l[1]);else throw SyntaxError(`[sprintf] failed to parse named argument key`);else throw SyntaxError(`[sprintf] failed to parse named argument key`);r[2]=s}else o|=2;if(o===3)throw Error(`[sprintf] mixing positional and named placeholders is not (yet) supported`);i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}else throw SyntaxError(`[sprintf] unexpected placeholder`);n=n.substring(r[0].length)}return a[e]=i}e!==void 0&&(e.sprintf=n,e.vsprintf=r),typeof window<`u`&&(window.sprintf=n,window.vsprintf=r,typeof define==`function`&&define.amd&&define(function(){return{sprintf:n,vsprintf:r}}))})()}))();var n=(e,t,n)=>{let a=e instanceof RegExp?r(e,n):e,o=t instanceof RegExp?r(t,n):t,s=a!==null&&o!=null&&i(a,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+a.length,s[1]),post:n.slice(s[1]+o.length)}},r=(e,t)=>{let n=t.match(e);return n?n[0]:null},i=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},a=`\0SLASH`+Math.random()+`\0`,o=`\0OPEN`+Math.random()+`\0`,s=`\0CLOSE`+Math.random()+`\0`,c=`\0COMMA`+Math.random()+`\0`,l=`\0PERIOD`+Math.random()+`\0`,u=new RegExp(a,`g`),d=new RegExp(o,`g`),f=new RegExp(s,`g`),p=new RegExp(c,`g`),m=new RegExp(l,`g`),h=/\\\\/g,ee=/\\{/g,te=/\\}/g,ne=/\\,/g,re=/\\\./g,ie=1e5;function ae(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function oe(e){return e.replace(h,a).replace(ee,o).replace(te,s).replace(ne,c).replace(re,l)}function se(e){return e.replace(u,`\\`).replace(d,`{`).replace(f,`}`).replace(p,`,`).replace(m,`.`)}function ce(e){if(!e)return[``];let t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);let{pre:i,body:a,post:o}=r,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;let c=ce(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function le(e,t={}){if(!e)return[];let{max:n=ie}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),me(oe(e),n,!0).map(se)}function ue(e){return`{`+e+`}`}function de(e){return/^-?0\d/.test(e)}function fe(e,t){return e<=t}function pe(e,t){return e>=t}function me(e,t,r){let i=[],a=n(`{`,`}`,e);if(!a)return[e];let o=a.pre,c=a.post.length?me(a.post,t,!1):[``];if(/\$$/.test(a.pre))for(let e=0;e<c.length&&e<t;e++){let t=o+`{`+a.body+`}`+c[e];i.push(t)}else{let n=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),u=n||l,d=a.body.indexOf(`,`)>=0;if(!u&&!d)return a.post.match(/,(?!,).*\}/)?(e=a.pre+`{`+a.body+s+a.post,me(e,t,!0)):[e];let f;if(u)f=a.body.split(/\.\./);else if(f=ce(a.body),f.length===1&&f[0]!==void 0&&(f=me(f[0],t,!1).map(ue),f.length===1))return c.map(e=>a.pre+f[0]+e);let p;if(u&&f[0]!==void 0&&f[1]!==void 0){let e=ae(f[0]),t=ae(f[1]),n=Math.max(f[0].length,f[1].length),r=f.length===3&&f[2]!==void 0?Math.abs(ae(f[2])):1,i=fe;t<e&&(r*=-1,i=pe);let a=f.some(de);p=[];for(let o=e;i(o,t);o+=r){let e;if(l)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}p.push(e)}}else{p=[];for(let e=0;e<f.length;e++)p.push.apply(p,me(f[e],t,!1))}for(let e=0;e<p.length;e++)for(let n=0;n<c.length&&i.length<t;n++){let t=o+p[e]+c[n];(!r||u||t)&&i.push(t)}}return i}var he=1024*64,ge=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>he)throw TypeError(`pattern is too long`)},_e={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},ve=e=>e.replace(/[[\]\\-]/g,`\\$&`),ye=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),be=e=>e.join(``),xe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(_e))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(ve(d)+`-`+ve(t)):t===d&&r.push(ve(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(ve(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(ve(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[ye(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+be(r)+`]`,p=`[`+(l?``:`^`)+be(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},Se=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),Ce,we=new Set([`!`,`?`,`+`,`*`,`@`]),Te=e=>we.has(e),Ee=e=>Te(e.type),De=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),Oe=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),ke=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ae=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),je=`(?!(?:^|/)\\.\\.?(?:$|/))`,Me=`(?!\\.)`,Ne=new Set([`[`,`.`]),Pe=new Set([`..`,`.`]),Fe=new Set(`().*{}+?[]^$\\!`),Ie=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Le=`[^/]`,Re=`[^/]*?`,ze=`[^/]+?`,Be=0,Ve=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Be;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof Ce&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof Ce&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new Ce(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&Te(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new Ce(n,t);u=Ce.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new Ce(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&Te(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new Ce(n,d);d.push(o),u=Ce.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new Ce(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,Oe)}#m(e,t=De){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=ke){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new Ce(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ae.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ae.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new Ce(null,void 0,t);return Ce.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!Ee(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?Ce.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Pe.has(this.#r[0]))){let n=Ne,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?je:o?Me:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,Se(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,Se(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?Me:``)+ze;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?Me:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,Se(i),this.#t=!!this.#t,this.#n]}#x(){if(Ee(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(Fe.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?ze:Re,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=xe(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=Le,t=!0;continue}i+=Ie(c)}return[i,Se(e),!!t,a]}};Ce=Ve;var He=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),Ue=(e,t,n={})=>(ge(t),!n.nocomment&&t.charAt(0)===`#`?!1:new bt(t,n).match(e)),We=/^\*+([^+@!?\*\[\(]*)$/,Ge=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ke=e=>t=>t.endsWith(e),qe=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Je=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ye=/^\*+\.\*+$/,Xe=e=>!e.startsWith(`.`)&&e.includes(`.`),Ze=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Qe=/^\.\*+$/,$e=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),et=/^\*+$/,tt=e=>e.length!==0&&!e.startsWith(`.`),nt=e=>e.length!==0&&e!==`.`&&e!==`..`,rt=/^\?+([^+@!?\*\[\(]*)?$/,it=([e,t=``])=>{let n=ct([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},at=([e,t=``])=>{let n=lt([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},ot=([e,t=``])=>{let n=lt([e]);return t?e=>n(e)&&e.endsWith(t):n},st=([e,t=``])=>{let n=ct([e]);return t?e=>n(e)&&e.endsWith(t):n},ct=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},lt=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ut=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,dt={win32:{sep:`\\`},posix:{sep:`/`}};Ue.sep=ut===`win32`?dt.win32.sep:dt.posix.sep;var ft=Symbol(`globstar **`);Ue.GLOBSTAR=ft;var pt=`[^/]*?`,mt=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,ht=`(?:(?!(?:\\/|^)\\.).)*?`;Ue.filter=(e,t={})=>n=>Ue(n,e,t);var gt=(e,t={})=>Object.assign({},e,t);Ue.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return Ue;let t=Ue;return Object.assign((n,r,i={})=>t(n,r,gt(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,gt(e,n))}static defaults(n){return t.defaults(gt(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,gt(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,gt(e,r))}},unescape:(n,r={})=>t.unescape(n,gt(e,r)),escape:(n,r={})=>t.escape(n,gt(e,r)),filter:(n,r={})=>t.filter(n,gt(e,r)),defaults:n=>t.defaults(gt(e,n)),makeRe:(n,r={})=>t.makeRe(n,gt(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,gt(e,r)),match:(n,r,i={})=>t.match(n,r,gt(e,i)),sep:t.sep,GLOBSTAR:ft})};var _t=(e,t={})=>(ge(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:le(e,{max:t.braceExpandMax}));Ue.braceExpand=_t,Ue.makeRe=(e,t={})=>new bt(e,t).makeRe(),Ue.match=(e,t,n={})=>{let r=new bt(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var vt=/[?*]|[+@!]\(.*?\)|\[|\]/,yt=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),bt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){ge(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ut,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!vt.test(e[2]))&&!vt.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(ft)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(ft,i),o=t.lastIndexOf(ft),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===ft?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,ee=e.length-u;for(let e of d)e[1]=ee-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===ft)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return _t(this.pattern,this.options)}parse(e){ge(e);let t=this.options;if(e===`**`)return ft;if(e===``)return``;let n,r=null;(n=e.match(et))?r=t.dot?nt:tt:(n=e.match(We))?r=(t.nocase?t.dot?Je:qe:t.dot?Ke:Ge)(n[1]):(n=e.match(rt))?r=(t.nocase?t.dot?at:it:t.dot?ot:st)(n):(n=e.match(Ye))?r=t.dot?Ze:Xe:(n=e.match(Qe))&&(r=$e);let i=Ve.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?pt:t.dot?mt:ht,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?yt(e):e===ft?ft:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==ft||a===ft||(a===void 0?i!==void 0&&i!==ft?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==ft&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=ft))});let i=t.filter(e=>e!==ft);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Ue.defaults(e).Minimatch}};Ue.AST=Ve,Ue.Minimatch=bt,Ue.escape=He,Ue.unescape=Se;var xt={};function St(){throw Error(`gunzipSync is not available in the browser`)}function Ct(){throw Error(`gzipSync is not available in the browser`)}var wt=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends wt{};function Tt(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Et(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Dt(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Ot(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function kt(e,t){return Dt(e,t,``)}function At(e,t){return Ot(e,t,``)}function jt(e,t){return t.slice(0,Mt(e,t))}function Mt(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Nt(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function Pt(e){let t=e.match(/^\s*/);return t?t[0]:``}var Ft=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,It=RegExp(`[${Ft}]+|\\s+|[^${Ft}]`,`ug`);new class extends wt{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(It)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Lt(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&Lt(n,i,r,null),e}};function Lt(e,t,n,r){if(t&&n){let i=Pt(t.value),a=Nt(t.value),o=Pt(n.value),s=Nt(n.value);if(e){let r=Tt(i,o);e.value=Ot(e.value,o,r),t.value=kt(t.value,r),n.value=kt(n.value,r)}if(r){let e=Et(a,s);r.value=Dt(r.value,s,e),t.value=At(t.value,e),n.value=At(n.value,e)}}else if(n){if(e){let e=Pt(n.value);n.value=n.value.substring(e.length)}if(r){let e=Pt(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Pt(r.value),i=Pt(t.value),a=Nt(t.value),o=Tt(n,i);t.value=kt(t.value,o);let s=Et(kt(n,o),a);t.value=At(t.value,s),r.value=Dt(r.value,n,s),e.value=Ot(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=Pt(r.value),n=jt(Nt(t.value),e);t.value=At(t.value,n)}else if(e){let n=jt(Nt(e.value),Pt(t.value));t.value=kt(t.value,n)}}new class extends wt{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Ft}]+|[^\\S\\n\\r]+|[^${Ft}]`,`ug`);return e.match(t)||[]}},new class extends wt{constructor(){super(...arguments),this.tokenize=Rt}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1
+ import{r as e,t}from"./rolldown-runtime-aKtaBQYM.js";t((e=>{(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(o(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(e,r){var i=1,a=e.length,o,s=``,c,l,u,d,f,p,m,h;for(c=0;c<a;c++)if(typeof e[c]==`string`)s+=e[c];else if(typeof e[c]==`object`){if(u=e[c],u.keys)for(o=r[i],l=0;l<u.keys.length;l++){if(o==null)throw Error(n(`[sprintf] Cannot access property "%s" of undefined value "%s"`,u.keys[l],u.keys[l-1]));o=o[u.keys[l]]}else o=u.param_no?r[u.param_no]:r[i++];if(t.not_type.test(u.type)&&t.not_primitive.test(u.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(u.type)&&typeof o!=`number`&&isNaN(o))throw TypeError(n(`[sprintf] expecting number but found %T`,o));switch(t.number.test(u.type)&&(m=o>=0),u.type){case`b`:o=parseInt(o,10).toString(2);break;case`c`:o=String.fromCharCode(parseInt(o,10));break;case`d`:case`i`:o=parseInt(o,10);break;case`j`:o=JSON.stringify(o,null,u.width?parseInt(u.width):0);break;case`e`:o=u.precision?parseFloat(o).toExponential(u.precision):parseFloat(o).toExponential();break;case`f`:o=u.precision?parseFloat(o).toFixed(u.precision):parseFloat(o);break;case`g`:o=u.precision?String(Number(o.toPrecision(u.precision))):parseFloat(o);break;case`o`:o=(parseInt(o,10)>>>0).toString(8);break;case`s`:o=String(o),o=u.precision?o.substring(0,u.precision):o;break;case`t`:o=String(!!o),o=u.precision?o.substring(0,u.precision):o;break;case`T`:o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=u.precision?o.substring(0,u.precision):o;break;case`u`:o=parseInt(o,10)>>>0;break;case`v`:o=o.valueOf(),o=u.precision?o.substring(0,u.precision):o;break;case`x`:o=(parseInt(o,10)>>>0).toString(16);break;case`X`:o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(u.type)?s+=o:(t.number.test(u.type)&&(!m||u.sign)?(h=m?`+`:`-`,o=o.toString().replace(t.sign,``)):h=``,f=u.pad_char?u.pad_char===`0`?`0`:u.pad_char.charAt(1):` `,p=u.width-(h+o).length,d=u.width&&p>0?f.repeat(p):``,s+=u.align?h+o+d:f===`0`?h+d+o:d+h+o)}return s}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var n=e,r,i=[],o=0;n;){if((r=t.text.exec(n))!==null)i.push(r[0]);else if((r=t.modulo.exec(n))!==null)i.push(`%`);else if((r=t.placeholder.exec(n))!==null){if(r[2]){o|=1;var s=[],c=r[2],l=[];if((l=t.key.exec(c))!==null)for(s.push(l[1]);(c=c.substring(l[0].length))!==``;)if((l=t.key_access.exec(c))!==null)s.push(l[1]);else if((l=t.index_access.exec(c))!==null)s.push(l[1]);else throw SyntaxError(`[sprintf] failed to parse named argument key`);else throw SyntaxError(`[sprintf] failed to parse named argument key`);r[2]=s}else o|=2;if(o===3)throw Error(`[sprintf] mixing positional and named placeholders is not (yet) supported`);i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}else throw SyntaxError(`[sprintf] unexpected placeholder`);n=n.substring(r[0].length)}return a[e]=i}e!==void 0&&(e.sprintf=n,e.vsprintf=r),typeof window<`u`&&(window.sprintf=n,window.vsprintf=r,typeof define==`function`&&define.amd&&define(function(){return{sprintf:n,vsprintf:r}}))})()}))();var n=(e,t,n)=>{let a=e instanceof RegExp?r(e,n):e,o=t instanceof RegExp?r(t,n):t,s=a!==null&&o!=null&&i(a,o,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+a.length,s[1]),post:n.slice(s[1]+o.length)}},r=(e,t)=>{let n=t.match(e);return n?n[0]:null},i=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},a=`\0SLASH`+Math.random()+`\0`,o=`\0OPEN`+Math.random()+`\0`,s=`\0CLOSE`+Math.random()+`\0`,c=`\0COMMA`+Math.random()+`\0`,l=`\0PERIOD`+Math.random()+`\0`,u=new RegExp(a,`g`),d=new RegExp(o,`g`),f=new RegExp(s,`g`),p=new RegExp(c,`g`),m=new RegExp(l,`g`),h=/\\\\/g,ee=/\\{/g,te=/\\}/g,ne=/\\,/g,re=/\\\./g,ie=1e5;function ae(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function oe(e){return e.replace(h,a).replace(ee,o).replace(te,s).replace(ne,c).replace(re,l)}function se(e){return e.replace(u,`\\`).replace(d,`{`).replace(f,`}`).replace(p,`,`).replace(m,`.`)}function ce(e){if(!e)return[``];let t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);let{pre:i,body:a,post:o}=r,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;let c=ce(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function le(e,t={}){if(!e)return[];let{max:n=ie}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),me(oe(e),n,!0).map(se)}function ue(e){return`{`+e+`}`}function de(e){return/^-?0\d/.test(e)}function fe(e,t){return e<=t}function pe(e,t){return e>=t}function me(e,t,r){let i=[],a=n(`{`,`}`,e);if(!a)return[e];let o=a.pre,c=a.post.length?me(a.post,t,!1):[``];if(/\$$/.test(a.pre))for(let e=0;e<c.length&&e<t;e++){let t=o+`{`+a.body+`}`+c[e];i.push(t)}else{let n=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),u=n||l,d=a.body.indexOf(`,`)>=0;if(!u&&!d)return a.post.match(/,(?!,).*\}/)?(e=a.pre+`{`+a.body+s+a.post,me(e,t,!0)):[e];let f;if(u)f=a.body.split(/\.\./);else if(f=ce(a.body),f.length===1&&f[0]!==void 0&&(f=me(f[0],t,!1).map(ue),f.length===1))return c.map(e=>a.pre+f[0]+e);let p;if(u&&f[0]!==void 0&&f[1]!==void 0){let e=ae(f[0]),t=ae(f[1]),n=Math.max(f[0].length,f[1].length),r=f.length===3&&f[2]!==void 0?Math.abs(ae(f[2])):1,i=fe;t<e&&(r*=-1,i=pe);let a=f.some(de);p=[];for(let o=e;i(o,t);o+=r){let e;if(l)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}p.push(e)}}else{p=[];for(let e=0;e<f.length;e++)p.push.apply(p,me(f[e],t,!1))}for(let e=0;e<p.length;e++)for(let n=0;n<c.length&&i.length<t;n++){let t=o+p[e]+c[n];(!r||u||t)&&i.push(t)}}return i}var he=1024*64,ge=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>he)throw TypeError(`pattern is too long`)},_e={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},ve=e=>e.replace(/[[\]\\-]/g,`\\$&`),ye=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),be=e=>e.join(``),xe=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(_e))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(ve(d)+`-`+ve(t)):t===d&&r.push(ve(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(ve(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(ve(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[ye(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+be(r)+`]`,p=`[`+(l?``:`^`)+be(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},Se=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),Ce,we=new Set([`!`,`?`,`+`,`*`,`@`]),Te=e=>we.has(e),Ee=e=>Te(e.type),De=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),Oe=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),ke=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ae=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),je=`(?!(?:^|/)\\.\\.?(?:$|/))`,Me=`(?!\\.)`,Ne=new Set([`[`,`.`]),Pe=new Set([`..`,`.`]),Fe=new Set(`().*{}+?[]^$\\!`),Ie=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Le=`[^/]`,Re=`[^/]*?`,ze=`[^/]+?`,Be=0,Ve=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Be;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof Ce&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof Ce&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new Ce(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&Te(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new Ce(n,t);u=Ce.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new Ce(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&Te(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new Ce(n,d);d.push(o),u=Ce.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new Ce(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,Oe)}#m(e,t=De){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=ke){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new Ce(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ae.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ae.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new Ce(null,void 0,t);return Ce.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!Ee(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?Ce.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Pe.has(this.#r[0]))){let n=Ne,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?je:o?Me:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,Se(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,Se(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?Me:``)+ze;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?Me:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,Se(i),this.#t=!!this.#t,this.#n]}#x(){if(Ee(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(Fe.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?ze:Re,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=xe(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=Le,t=!0;continue}i+=Ie(c)}return[i,Se(e),!!t,a]}};Ce=Ve;var He=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),Ue=(e,t,n={})=>(ge(t),!n.nocomment&&t.charAt(0)===`#`?!1:new bt(t,n).match(e)),We=/^\*+([^+@!?\*\[\(]*)$/,Ge=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ke=e=>t=>t.endsWith(e),qe=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Je=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ye=/^\*+\.\*+$/,Xe=e=>!e.startsWith(`.`)&&e.includes(`.`),Ze=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Qe=/^\.\*+$/,$e=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),et=/^\*+$/,tt=e=>e.length!==0&&!e.startsWith(`.`),nt=e=>e.length!==0&&e!==`.`&&e!==`..`,rt=/^\?+([^+@!?\*\[\(]*)?$/,it=([e,t=``])=>{let n=ct([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},at=([e,t=``])=>{let n=lt([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},ot=([e,t=``])=>{let n=lt([e]);return t?e=>n(e)&&e.endsWith(t):n},st=([e,t=``])=>{let n=ct([e]);return t?e=>n(e)&&e.endsWith(t):n},ct=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},lt=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ut=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,dt={win32:{sep:`\\`},posix:{sep:`/`}};Ue.sep=ut===`win32`?dt.win32.sep:dt.posix.sep;var ft=Symbol(`globstar **`);Ue.GLOBSTAR=ft;var pt=`[^/]*?`,mt=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,ht=`(?:(?!(?:\\/|^)\\.).)*?`;Ue.filter=(e,t={})=>n=>Ue(n,e,t);var gt=(e,t={})=>Object.assign({},e,t);Ue.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return Ue;let t=Ue;return Object.assign((n,r,i={})=>t(n,r,gt(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,gt(e,n))}static defaults(n){return t.defaults(gt(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,gt(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,gt(e,r))}},unescape:(n,r={})=>t.unescape(n,gt(e,r)),escape:(n,r={})=>t.escape(n,gt(e,r)),filter:(n,r={})=>t.filter(n,gt(e,r)),defaults:n=>t.defaults(gt(e,n)),makeRe:(n,r={})=>t.makeRe(n,gt(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,gt(e,r)),match:(n,r,i={})=>t.match(n,r,gt(e,i)),sep:t.sep,GLOBSTAR:ft})};var _t=(e,t={})=>(ge(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:le(e,{max:t.braceExpandMax}));Ue.braceExpand=_t,Ue.makeRe=(e,t={})=>new bt(e,t).makeRe(),Ue.match=(e,t,n={})=>{let r=new bt(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var vt=/[?*]|[+@!]\(.*?\)|\[|\]/,yt=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),bt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){ge(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ut,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!vt.test(e[2]))&&!vt.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(ft)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(ft,i),o=t.lastIndexOf(ft),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===ft?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,ee=e.length-u;for(let e of d)e[1]=ee-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===ft)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return _t(this.pattern,this.options)}parse(e){ge(e);let t=this.options;if(e===`**`)return ft;if(e===``)return``;let n,r=null;(n=e.match(et))?r=t.dot?nt:tt:(n=e.match(We))?r=(t.nocase?t.dot?Je:qe:t.dot?Ke:Ge)(n[1]):(n=e.match(rt))?r=(t.nocase?t.dot?at:it:t.dot?ot:st)(n):(n=e.match(Ye))?r=t.dot?Ze:Xe:(n=e.match(Qe))&&(r=$e);let i=Ve.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?pt:t.dot?mt:ht,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?yt(e):e===ft?ft:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==ft||a===ft||(a===void 0?i!==void 0&&i!==ft?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==ft&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=ft))});let i=t.filter(e=>e!==ft);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return Ue.defaults(e).Minimatch}};Ue.AST=Ve,Ue.Minimatch=bt,Ue.escape=He,Ue.unescape=Se;var xt={};function St(){throw Error(`gunzipSync is not available in the browser`)}function Ct(){throw Error(`gzipSync is not available in the browser`)}var wt=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends wt{};function Tt(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Et(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Dt(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Ot(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function kt(e,t){return Dt(e,t,``)}function At(e,t){return Ot(e,t,``)}function jt(e,t){return t.slice(0,Mt(e,t))}function Mt(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Nt(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function Pt(e){let t=e.match(/^\s*/);return t?t[0]:``}var Ft=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,It=RegExp(`[${Ft}]+|\\s+|[^${Ft}]`,`ug`);new class extends wt{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(It)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Lt(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&Lt(n,i,r,null),e}};function Lt(e,t,n,r){if(t&&n){let i=Pt(t.value),a=Nt(t.value),o=Pt(n.value),s=Nt(n.value);if(e){let r=Tt(i,o);e.value=Ot(e.value,o,r),t.value=kt(t.value,r),n.value=kt(n.value,r)}if(r){let e=Et(a,s);r.value=Dt(r.value,s,e),t.value=At(t.value,e),n.value=At(n.value,e)}}else if(n){if(e){let e=Pt(n.value);n.value=n.value.substring(e.length)}if(r){let e=Pt(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Pt(r.value),i=Pt(t.value),a=Nt(t.value),o=Tt(n,i);t.value=kt(t.value,o);let s=Et(kt(n,o),a);t.value=At(t.value,s),r.value=Dt(r.value,n,s),e.value=Ot(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=Pt(r.value),n=jt(Nt(t.value),e);t.value=At(t.value,n)}else if(e){let n=jt(Nt(e.value),Pt(t.value));t.value=kt(t.value,n)}}new class extends wt{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Ft}]+|[^\\S\\n\\r]+|[^${Ft}]`,`ug`);return e.match(t)||[]}},new class extends wt{constructor(){super(...arguments),this.tokenize=Rt}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
2
2
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
3
3
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
4
4
  `)&&(e=e.slice(0,-1)),t.endsWith(`
@@ -119,7 +119,7 @@ ${t.holdSpace}`,Ha(t.patternSpace,n?.maxStringLength??0,`pattern space`);break;c
119
119
  `),r=n===-1?t.patternSpace:t.patternSpace.slice(0,n);t.pendingFileWrites.push({filename:e.filename,content:`${r}
120
120
  `});break}case`execute`:t.errorMessage=`sed: e command (shell execution) is not supported in sandboxed environment`,t.quit=!0;break;case`transliterate`:t.patternSpace=Wa(t.patternSpace,e);break;case`lineNumber`:t.lineNumberOutput.push(String(t.lineNumber));break;case`branch`:break;case`branchOnSubst`:break;case`branchOnNoSubst`:break;case`group`:break}}function Wa(e,t){let n=``;for(let r of e){let e=t.source.indexOf(r);e===-1?n+=r:n+=t.dest[e]}return n}function Ga(e,t,n,r){let i=new Map;for(let t=0;t<e.length;t++){let n=e[t];n.type===`label`&&i.set(n.name,t)}let a=r?.maxIterations??Ka,o=0,s=0;for(;s<e.length;){if(o++,o>a)throw new b(`sed: command execution exceeded maximum iterations (${a})`,`iterations`);if(t.deleted||t.quit||t.quitSilent||t.restartCycle)break;let c=e[s];if(c.type===`next`){if(za(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit(`sed:cmd:next`),t.nCommandOutput.push(t.patternSpace),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length)t.linesConsumedInCycle++,t.patternSpace=n.lines[n.currentLineIndex+t.linesConsumedInCycle],t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1,t.substitutionMade=!1;else{t.quit=!0,t.deleted=!0;break}s++;continue}if(c.type===`nextAppend`){if(za(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit(`sed:cmd:nextAppend`),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length){t.linesConsumedInCycle++;let e=n.lines[n.currentLineIndex+t.linesConsumedInCycle];t.patternSpace+=`
121
121
  ${e}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;break}s++;continue}if(c.type===`branch`){let e=c;if(za(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)){if(t.coverage?.hit(`sed:cmd:branch`),e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`branchOnSubst`){let e=c;if(za(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:branchOnSubst`),t.substitutionMade)){if(t.substitutionMade=!1,e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`branchOnNoSubst`){let e=c;if(za(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:branchOnNoSubst`),!t.substitutionMade)){if(e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`group`){let e=c;if(za(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:group`),Ga(e.commands,t,n,r),t.branchRequest)){let e=i.get(t.branchRequest);if(e!==void 0){t.branchRequest=void 0,s=e;continue}break}s++;continue}Ua(c,t,r),s++}return t.linesConsumedInCycle}var Ka;function qa(e,t){for(let n of e)n.type===`label`?t.add(n.name):n.type===`group`&&qa(n.commands,t)}function Ja(e,t){for(let n of e){if((n.type===`branch`||n.type===`branchOnSubst`||n.type===`branchOnNoSubst`)&&n.label&&!t.has(n.label))return n.label;if(n.type===`group`){let e=Ja(n.commands,t);if(e)return e}}}_({},{flagsForFuzzing:()=>Xa,sedCommand:()=>Ya});var Ya,Xa;function Za(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function Qa(...e){return Object.assign(Object.create(null),...e)}var $a=g(()=>{});function eo(e,t,n){switch(n){case`+`:return e+t;case`-`:return e-t;case`*`:return e*t;case`/`:return t===0?0:e/t;case`%`:return t===0?0:e%t;case`^`:case`**`:return e**t;default:return 0}}function to(e,t){let n=0,r=``,i=0;for(;i<e.length;)if(e[i]===`%`&&i+1<e.length){let a=i+1,o=``,s=``,c=``,l,u=a;for(;a<e.length&&/\d/.test(e[a]);)a++;a>u&&e[a]===`$`?(l=parseInt(e.substring(u,a),10)-1,a++):a=u;let d=()=>{if(a<e.length){if(a+1<e.length&&(e[a]===`h`&&e[a+1]===`h`||e[a]===`l`&&e[a+1]===`l`)){a+=2;return}/[lzjh]/.test(e[a])&&a++}};for(;a<e.length&&/[-+ #0]/.test(e[a]);)o+=e[a++];if(e[a]===`*`){let e=t[n++],r=e===void 0?0:Math.floor(Number(e));r<0?(o+=`-`,s=String(Math.min(-r,no))):s=String(Math.min(r,no)),a++}else for(;a<e.length&&/\d/.test(e[a]);)s+=e[a++];if(s&&parseInt(s,10)>no&&(s=String(no)),e[a]===`.`){if(a++,e[a]===`*`){let e=t[n++];c=String(Math.min(e===void 0?0:Math.floor(Number(e)),no)),a++}else for(;a<e.length&&/\d/.test(e[a]);)c+=e[a++];c&&parseInt(c,10)>no&&(c=String(no))}d();let f=e[a],p=t[l===void 0?n:l];switch(f){case`s`:{let e=p===void 0?``:String(p);if(c&&(e=e.substring(0,parseInt(c,10))),s){let t=parseInt(s,10);e=o.includes(`-`)?e.padEnd(t):e.padStart(t)}r+=e,l===void 0&&n++;break}case`d`:case`i`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=e<0,i=Math.abs(e).toString();if(c){let e=parseInt(c,10);i=i.padStart(e,`0`)}let a=``;t?a=`-`:o.includes(`+`)?a=`+`:o.includes(` `)&&(a=` `);let u=a+i;if(s){let e=parseInt(s,10);u=o.includes(`-`)?u.padEnd(e):o.includes(`0`)&&!c?a+i.padStart(e-a.length,`0`):u.padStart(e)}r+=u,l===void 0&&n++;break}case`f`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e.toFixed(t);if(s){let e=parseInt(s,10);i=o.includes(`-`)?i.padEnd(e):i.padStart(e)}r+=i,l===void 0&&n++;break}case`e`:case`E`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e.toExponential(t);if(f===`E`&&(i=i.toUpperCase()),s){let e=parseInt(s,10);i=o.includes(`-`)?i.padEnd(e):i.padStart(e)}r+=i,l===void 0&&n++;break}case`g`:case`G`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e===0?0:Math.floor(Math.log10(Math.abs(e))),a;if(e===0?a=`0`:i<-4||i>=t?(a=e.toExponential(t-1),f===`G`&&(a=a.toUpperCase())):a=e.toPrecision(t),a.includes(`.`)&&(a=a.replace(/\.?0+$/,``).replace(/\.?0+e/,`e`)),a.includes(`e`)&&(a=a.replace(/\.?0+e/,`e`)),s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):a.padStart(e)}r+=a,l===void 0&&n++;break}case`x`:case`X`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=Math.abs(e).toString(16);if(f===`X`&&(t=t.toUpperCase()),c){let e=parseInt(c,10);t=t.padStart(e,`0`)}let i=e<0?`-`:``,a=i+t;if(s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):o.includes(`0`)&&!c?i+t.padStart(e-i.length,`0`):a.padStart(e)}r+=a,l===void 0&&n++;break}case`o`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=Math.abs(e).toString(8);if(c){let e=parseInt(c,10);t=t.padStart(e,`0`)}let i=e<0?`-`:``,a=i+t;if(s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):o.includes(`0`)&&!c?i+t.padStart(e-i.length,`0`):a.padStart(e)}r+=a,l===void 0&&n++;break}case`c`:typeof p==`number`?r+=String.fromCharCode(p):r+=String(p??``).charAt(0)||``,l===void 0&&n++;break;case`%`:r+=`%`;break;default:r+=e.substring(i,a+1)}i=a+1}else if(e[i]===`\\`&&i+1<e.length){let t=e[i+1];switch(t){case`n`:r+=`
122
- `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;default:r+=t}i+=2}else r+=e[i++];return r}var no,ro;function io(e){return typeof e==`number`?e!==0:!(e===``||e===`0`)}function I(e){if(typeof e==`number`)return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function L(e){return typeof e==`string`?e:String(e)}function ao(e){if(typeof e==`number`)return!0;let t=String(e).trim();return t===``?!1:!Number.isNaN(Number(t))}function oo(e,t){try{return M(e).test(t)}catch{return!1}}function so(e,t){return t===``?[]:e.FS===` `?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function co(e,t){return t===0?e.line:t<0||t>e.fields.length?``:e.fields[t-1]??``}function lo(e,t,n){if(t===0)e.line=L(n),e.fields=so(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push(``);e.fields[t-1]=L(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function uo(e,t){e.line=t,e.fields=so(e,t),e.NF=e.fields.length}function fo(e,t){if(e.FS=t,t===` `)e.fieldSep=new $i(/\s+/);else try{e.fieldSep=M(t)}catch{e.fieldSep=M(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}}function po(e,t){switch(t){case`FS`:return e.FS;case`OFS`:return e.OFS;case`ORS`:return e.ORS;case`OFMT`:return e.OFMT;case`NR`:return e.NR;case`NF`:return e.NF;case`FNR`:return e.FNR;case`FILENAME`:return e.FILENAME;case`RSTART`:return e.RSTART;case`RLENGTH`:return e.RLENGTH;case`SUBSEP`:return e.SUBSEP;case`ARGC`:return e.ARGC}return e.vars[t]??``}function mo(e,t,n){switch(t){case`FS`:fo(e,L(n));return;case`OFS`:e.OFS=L(n);return;case`ORS`:e.ORS=L(n);return;case`OFMT`:e.OFMT=L(n);return;case`NR`:e.NR=Math.floor(I(n));return;case`NF`:{let t=Math.floor(I(n));if(t<e.NF)e.fields=e.fields.slice(0,t),e.line=e.fields.join(e.OFS);else if(t>e.NF){for(;e.fields.length<t;)e.fields.push(``);e.line=e.fields.join(e.OFS)}e.NF=t;return}case`FNR`:e.FNR=Math.floor(I(n));return;case`FILENAME`:e.FILENAME=L(n);return;case`RSTART`:e.RSTART=Math.floor(I(n));return;case`RLENGTH`:e.RLENGTH=Math.floor(I(n));return;case`SUBSEP`:e.SUBSEP=L(n);return}e.vars[t]=n}function ho(e,t){let n=t,r=new Set,i=e.arrayAliases.get(n);for(;i!==void 0&&!r.has(n);)r.add(n),n=i,i=e.arrayAliases.get(n);return n}function go(e,t,n){if(t===`ARGV`)return e.ARGV[n]??``;if(t===`ENVIRON`)return e.ENVIRON[n]??``;let r=ho(e,t);return e.arrays[r]?.[n]??``}function _o(e,t,n,r){let i=ho(e,t);e.arrays[i]||(e.arrays[i]=Object.create(null)),e.arrays[i][n]=r}function vo(e,t,n){if(t===`ARGV`)return e.ARGV[n]!==void 0;if(t===`ENVIRON`)return e.ENVIRON[n]!==void 0;let r=ho(e,t);return e.arrays[r]?.[n]!==void 0}function yo(e,t,n){let r=ho(e,t);e.arrays[r]&&delete e.arrays[r][n]}function bo(e,t){let n=ho(e,t);delete e.arrays[n]}function xo(e,t){Da(e.requireDefenseContext,`awk`,t)}function R(e,t,n){return Oa(e.requireDefenseContext,`awk`,t,n)}async function z(e,t){switch(xo(e,`expression evaluation`),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case`number`:return t.value;case`string`:return t.value;case`regex`:return+!!oo(t.pattern,e.line);case`field`:return So(e,t);case`variable`:return po(e,t.name);case`array_access`:return Co(e,t);case`binary`:return wo(e,t);case`unary`:return Do(e,t);case`ternary`:return io(await R(e,`ternary condition evaluation`,()=>z(e,t.condition)))?await R(e,`ternary consequent evaluation`,()=>z(e,t.consequent)):await R(e,`ternary alternate evaluation`,()=>z(e,t.alternate));case`call`:return Oo(e,t.name,t.args);case`assignment`:return Ao(e,t);case`pre_increment`:return Mo(e,t.operand);case`pre_decrement`:return No(e,t.operand);case`post_increment`:return Po(e,t.operand);case`post_decrement`:return Fo(e,t.operand);case`in`:return Io(e,t.key,t.array);case`getline`:return Lo(e,t.variable,t.file,t.command);case`tuple`:return Bo(e,t.elements);default:return``}}async function So(e,t){return xo(e,`field reference evaluation`),co(e,Math.floor(I(await R(e,`field index evaluation`,()=>z(e,t.index)))))}async function Co(e,t){xo(e,`array access evaluation`);let n=L(await R(e,`array key evaluation`,()=>z(e,t.key)));return go(e,t.array,n)}async function wo(e,t){xo(e,`binary expression evaluation`);let n=t.operator;if(n===`||`)return io(await R(e,`logical-or left evaluation`,()=>z(e,t.left)))||io(await R(e,`logical-or right evaluation`,()=>z(e,t.right)))?1:0;if(n===`&&`)return io(await R(e,`logical-and left evaluation`,()=>z(e,t.left)))&&io(await R(e,`logical-and right evaluation`,()=>z(e,t.right)))?1:0;if(n===`~`){let n=await R(e,`regex left evaluation`,()=>z(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:L(await R(e,`regex right evaluation`,()=>z(e,t.right)));try{return+!!M(r).test(L(n))}catch{return 0}}if(n===`!~`){let n=await R(e,`negated-regex left evaluation`,()=>z(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:L(await R(e,`negated-regex right evaluation`,()=>z(e,t.right)));try{return+!M(r).test(L(n))}catch{return 1}}let r=await R(e,`binary left evaluation`,()=>z(e,t.left)),i=await R(e,`binary right evaluation`,()=>z(e,t.right));if(n===` `){let t=L(r)+L(i);if(e.maxOutputSize>0&&t.length>e.maxOutputSize)throw new b(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,`string_length`,e.output);return t}return To(n)?Eo(r,i,n):eo(I(r),I(i),n)}function To(e){return[`<`,`<=`,`>`,`>=`,`==`,`!=`].includes(e)}function Eo(e,t,n){let r=ao(e),i=ao(t);if(r&&i){let r=I(e),i=I(t);switch(n){case`<`:return+(r<i);case`<=`:return+(r<=i);case`>`:return+(r>i);case`>=`:return+(r>=i);case`==`:return+(r===i);case`!=`:return r===i?0:1}}let a=L(e),o=L(t);switch(n){case`<`:return+(a<o);case`<=`:return+(a<=o);case`>`:return+(a>o);case`>=`:return+(a>=o);case`==`:return+(a===o);case`!=`:return a===o?0:1}return 0}async function Do(e,t){xo(e,`unary expression evaluation`);let n=await R(e,`unary operand evaluation`,()=>z(e,t.operand));switch(t.operator){case`!`:return+!io(n);case`-`:return-I(n);case`+`:return+I(n);default:return n}}async function Oo(e,t,n){xo(e,`function call evaluation`);let r=ro.get(t);if(r)return r(n,e,{evalExpr:t=>z(e,t)});let i=e.functions.get(t);return i?ko(e,i,n):``}async function ko(e,t,n){if(xo(e,`user function call`),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new b(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,`recursion`,e.output);let r=Object.create(null);for(let n of t.params)r[n]=e.vars[n];let i=[];for(let r=0;r<t.params.length;r++){let a=t.params[r];if(r<n.length){let t=n[r];t.type===`variable`&&(e.arrayAliases.set(a,t.name),i.push(a));let o=await R(e,`user function argument evaluation`,()=>z(e,t));e.vars[a]=o}else e.vars[a]=``}e.hasReturn=!1,e.returnValue=void 0;let a=Vo;a&&await R(e,`user function body execution`,()=>a(e,t.body.statements));let o=e.returnValue??``;for(let n of t.params)r[n]===void 0?delete e.vars[n]:e.vars[n]=r[n];for(let t of i)e.arrayAliases.delete(t);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function Ao(e,t){xo(e,`assignment evaluation`);let n=await R(e,`assignment value evaluation`,()=>z(e,t.value)),r=t.target,i=t.operator,a;if(i===`=`)a=n;else{let t;if(r.type===`field`)t=co(e,Math.floor(I(await R(e,`assignment field index`,()=>z(e,r.index)))));else if(r.type===`variable`)t=po(e,r.name);else{let n=L(await R(e,`assignment array key`,()=>z(e,r.key)));t=go(e,r.array,n)}let o=I(t),s=I(n);switch(i){case`+=`:a=o+s;break;case`-=`:a=o-s;break;case`*=`:a=o*s;break;case`/=`:a=s===0?0:o/s;break;case`%=`:a=s===0?0:o%s;break;case`^=`:a=o**s;break;default:a=n}}if(r.type===`field`)lo(e,Math.floor(I(await R(e,`assignment target field index`,()=>z(e,r.index)))),a);else if(r.type===`variable`)mo(e,r.name,a);else{let t=L(await R(e,`assignment target array key`,()=>z(e,r.key)));_o(e,r.array,t,a)}return a}async function jo(e,t,n,r){xo(e,`inc/dec evaluation`);let i;if(t.type===`field`){let r=Math.floor(I(await R(e,`inc/dec field index`,()=>z(e,t.index))));i=I(co(e,r)),lo(e,r,i+n)}else if(t.type===`variable`)i=I(po(e,t.name)),mo(e,t.name,i+n);else{let r=L(await R(e,`inc/dec array key`,()=>z(e,t.key)));i=I(go(e,t.array,r)),_o(e,t.array,r,i+n)}return r?i+n:i}async function Mo(e,t){return jo(e,t,1,!0)}async function No(e,t){return jo(e,t,-1,!0)}async function Po(e,t){return jo(e,t,1,!1)}async function Fo(e,t){return jo(e,t,-1,!1)}async function Io(e,t,n){xo(e,`in-expression evaluation`);let r;if(t.type===`tuple`){e.coverage?.hit(`awk:expr:tuple`);let n=[];for(let r of t.elements)n.push(L(await R(e,`tuple key element evaluation`,()=>z(e,r))));r=n.join(e.SUBSEP)}else r=L(await R(e,`in-expression key evaluation`,()=>z(e,t)));return+!!vo(e,n,r)}async function Lo(e,t,n,r){if(xo(e,`getline evaluation`),r)return Ro(e,t,r);if(n)return zo(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let i=e.lineIndex+1;if(i>=e.lines.length)return 0;let a=e.lines[i];return t?mo(e,t,a):uo(e,a),e.NR++,e.lineIndex=i,1}async function Ro(e,t,n){let r=e.exec;if(!r)return-1;xo(e,`getline command source`);let i=L(await R(e,`getline command expression`,()=>z(e,n))),a=`__cmd_${i}`,o=`__cmdi_${i}`,s,c;if(e.vars[a]===void 0)try{s=Qn((await R(e,`getline command exec`,()=>r(i))).stdout).split(`
122
+ `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;default:r+=t}i+=2}else r+=e[i++];return r}var no,ro;function io(e){return typeof e==`number`?e!==0:!(e===``||e===`0`)}function I(e){if(typeof e==`number`)return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function L(e){return typeof e==`string`?e:String(e)}function ao(e){if(typeof e==`number`)return!0;let t=String(e).trim();return t!==``&&!Number.isNaN(Number(t))}function oo(e,t){try{return M(e).test(t)}catch{return!1}}function so(e,t){return t===``?[]:e.FS===` `?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function co(e,t){return t===0?e.line:t<0||t>e.fields.length?``:e.fields[t-1]??``}function lo(e,t,n){if(t===0)e.line=L(n),e.fields=so(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push(``);e.fields[t-1]=L(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function uo(e,t){e.line=t,e.fields=so(e,t),e.NF=e.fields.length}function fo(e,t){if(e.FS=t,t===` `)e.fieldSep=new $i(/\s+/);else try{e.fieldSep=M(t)}catch{e.fieldSep=M(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}}function po(e,t){switch(t){case`FS`:return e.FS;case`OFS`:return e.OFS;case`ORS`:return e.ORS;case`OFMT`:return e.OFMT;case`NR`:return e.NR;case`NF`:return e.NF;case`FNR`:return e.FNR;case`FILENAME`:return e.FILENAME;case`RSTART`:return e.RSTART;case`RLENGTH`:return e.RLENGTH;case`SUBSEP`:return e.SUBSEP;case`ARGC`:return e.ARGC}return e.vars[t]??``}function mo(e,t,n){switch(t){case`FS`:fo(e,L(n));return;case`OFS`:e.OFS=L(n);return;case`ORS`:e.ORS=L(n);return;case`OFMT`:e.OFMT=L(n);return;case`NR`:e.NR=Math.floor(I(n));return;case`NF`:{let t=Math.floor(I(n));if(t<e.NF)e.fields=e.fields.slice(0,t),e.line=e.fields.join(e.OFS);else if(t>e.NF){for(;e.fields.length<t;)e.fields.push(``);e.line=e.fields.join(e.OFS)}e.NF=t;return}case`FNR`:e.FNR=Math.floor(I(n));return;case`FILENAME`:e.FILENAME=L(n);return;case`RSTART`:e.RSTART=Math.floor(I(n));return;case`RLENGTH`:e.RLENGTH=Math.floor(I(n));return;case`SUBSEP`:e.SUBSEP=L(n);return}e.vars[t]=n}function ho(e,t){let n=t,r=new Set,i=e.arrayAliases.get(n);for(;i!==void 0&&!r.has(n);)r.add(n),n=i,i=e.arrayAliases.get(n);return n}function go(e,t,n){if(t===`ARGV`)return e.ARGV[n]??``;if(t===`ENVIRON`)return e.ENVIRON[n]??``;let r=ho(e,t);return e.arrays[r]?.[n]??``}function _o(e,t,n,r){let i=ho(e,t);e.arrays[i]||(e.arrays[i]=Object.create(null)),e.arrays[i][n]=r}function vo(e,t,n){if(t===`ARGV`)return e.ARGV[n]!==void 0;if(t===`ENVIRON`)return e.ENVIRON[n]!==void 0;let r=ho(e,t);return e.arrays[r]?.[n]!==void 0}function yo(e,t,n){let r=ho(e,t);e.arrays[r]&&delete e.arrays[r][n]}function bo(e,t){let n=ho(e,t);delete e.arrays[n]}function xo(e,t){Da(e.requireDefenseContext,`awk`,t)}function R(e,t,n){return Oa(e.requireDefenseContext,`awk`,t,n)}async function z(e,t){switch(xo(e,`expression evaluation`),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case`number`:return t.value;case`string`:return t.value;case`regex`:return+!!oo(t.pattern,e.line);case`field`:return So(e,t);case`variable`:return po(e,t.name);case`array_access`:return Co(e,t);case`binary`:return wo(e,t);case`unary`:return Do(e,t);case`ternary`:return io(await R(e,`ternary condition evaluation`,()=>z(e,t.condition)))?await R(e,`ternary consequent evaluation`,()=>z(e,t.consequent)):await R(e,`ternary alternate evaluation`,()=>z(e,t.alternate));case`call`:return Oo(e,t.name,t.args);case`assignment`:return Ao(e,t);case`pre_increment`:return Mo(e,t.operand);case`pre_decrement`:return No(e,t.operand);case`post_increment`:return Po(e,t.operand);case`post_decrement`:return Fo(e,t.operand);case`in`:return Io(e,t.key,t.array);case`getline`:return Lo(e,t.variable,t.file,t.command);case`tuple`:return Bo(e,t.elements);default:return``}}async function So(e,t){return xo(e,`field reference evaluation`),co(e,Math.floor(I(await R(e,`field index evaluation`,()=>z(e,t.index)))))}async function Co(e,t){xo(e,`array access evaluation`);let n=L(await R(e,`array key evaluation`,()=>z(e,t.key)));return go(e,t.array,n)}async function wo(e,t){xo(e,`binary expression evaluation`);let n=t.operator;if(n===`||`)return io(await R(e,`logical-or left evaluation`,()=>z(e,t.left)))||io(await R(e,`logical-or right evaluation`,()=>z(e,t.right)))?1:0;if(n===`&&`)return io(await R(e,`logical-and left evaluation`,()=>z(e,t.left)))&&io(await R(e,`logical-and right evaluation`,()=>z(e,t.right)))?1:0;if(n===`~`){let n=await R(e,`regex left evaluation`,()=>z(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:L(await R(e,`regex right evaluation`,()=>z(e,t.right)));try{return+!!M(r).test(L(n))}catch{return 0}}if(n===`!~`){let n=await R(e,`negated-regex left evaluation`,()=>z(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:L(await R(e,`negated-regex right evaluation`,()=>z(e,t.right)));try{return+!M(r).test(L(n))}catch{return 1}}let r=await R(e,`binary left evaluation`,()=>z(e,t.left)),i=await R(e,`binary right evaluation`,()=>z(e,t.right));if(n===` `){let t=L(r)+L(i);if(e.maxOutputSize>0&&t.length>e.maxOutputSize)throw new b(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,`string_length`,e.output);return t}return To(n)?Eo(r,i,n):eo(I(r),I(i),n)}function To(e){return[`<`,`<=`,`>`,`>=`,`==`,`!=`].includes(e)}function Eo(e,t,n){let r=ao(e),i=ao(t);if(r&&i){let r=I(e),i=I(t);switch(n){case`<`:return+(r<i);case`<=`:return+(r<=i);case`>`:return+(r>i);case`>=`:return+(r>=i);case`==`:return+(r===i);case`!=`:return r===i?0:1}}let a=L(e),o=L(t);switch(n){case`<`:return+(a<o);case`<=`:return+(a<=o);case`>`:return+(a>o);case`>=`:return+(a>=o);case`==`:return+(a===o);case`!=`:return a===o?0:1}return 0}async function Do(e,t){xo(e,`unary expression evaluation`);let n=await R(e,`unary operand evaluation`,()=>z(e,t.operand));switch(t.operator){case`!`:return+!io(n);case`-`:return-I(n);case`+`:return+I(n);default:return n}}async function Oo(e,t,n){xo(e,`function call evaluation`);let r=ro.get(t);if(r)return r(n,e,{evalExpr:t=>z(e,t)});let i=e.functions.get(t);return i?ko(e,i,n):``}async function ko(e,t,n){if(xo(e,`user function call`),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new b(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,`recursion`,e.output);let r=Object.create(null);for(let n of t.params)r[n]=e.vars[n];let i=[];for(let r=0;r<t.params.length;r++){let a=t.params[r];if(r<n.length){let t=n[r];t.type===`variable`&&(e.arrayAliases.set(a,t.name),i.push(a));let o=await R(e,`user function argument evaluation`,()=>z(e,t));e.vars[a]=o}else e.vars[a]=``}e.hasReturn=!1,e.returnValue=void 0;let a=Vo;a&&await R(e,`user function body execution`,()=>a(e,t.body.statements));let o=e.returnValue??``;for(let n of t.params)r[n]===void 0?delete e.vars[n]:e.vars[n]=r[n];for(let t of i)e.arrayAliases.delete(t);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function Ao(e,t){xo(e,`assignment evaluation`);let n=await R(e,`assignment value evaluation`,()=>z(e,t.value)),r=t.target,i=t.operator,a;if(i===`=`)a=n;else{let t;if(r.type===`field`)t=co(e,Math.floor(I(await R(e,`assignment field index`,()=>z(e,r.index)))));else if(r.type===`variable`)t=po(e,r.name);else{let n=L(await R(e,`assignment array key`,()=>z(e,r.key)));t=go(e,r.array,n)}let o=I(t),s=I(n);switch(i){case`+=`:a=o+s;break;case`-=`:a=o-s;break;case`*=`:a=o*s;break;case`/=`:a=s===0?0:o/s;break;case`%=`:a=s===0?0:o%s;break;case`^=`:a=o**s;break;default:a=n}}if(r.type===`field`)lo(e,Math.floor(I(await R(e,`assignment target field index`,()=>z(e,r.index)))),a);else if(r.type===`variable`)mo(e,r.name,a);else{let t=L(await R(e,`assignment target array key`,()=>z(e,r.key)));_o(e,r.array,t,a)}return a}async function jo(e,t,n,r){xo(e,`inc/dec evaluation`);let i;if(t.type===`field`){let r=Math.floor(I(await R(e,`inc/dec field index`,()=>z(e,t.index))));i=I(co(e,r)),lo(e,r,i+n)}else if(t.type===`variable`)i=I(po(e,t.name)),mo(e,t.name,i+n);else{let r=L(await R(e,`inc/dec array key`,()=>z(e,t.key)));i=I(go(e,t.array,r)),_o(e,t.array,r,i+n)}return r?i+n:i}async function Mo(e,t){return jo(e,t,1,!0)}async function No(e,t){return jo(e,t,-1,!0)}async function Po(e,t){return jo(e,t,1,!1)}async function Fo(e,t){return jo(e,t,-1,!1)}async function Io(e,t,n){xo(e,`in-expression evaluation`);let r;if(t.type===`tuple`){e.coverage?.hit(`awk:expr:tuple`);let n=[];for(let r of t.elements)n.push(L(await R(e,`tuple key element evaluation`,()=>z(e,r))));r=n.join(e.SUBSEP)}else r=L(await R(e,`in-expression key evaluation`,()=>z(e,t)));return+!!vo(e,n,r)}async function Lo(e,t,n,r){if(xo(e,`getline evaluation`),r)return Ro(e,t,r);if(n)return zo(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let i=e.lineIndex+1;if(i>=e.lines.length)return 0;let a=e.lines[i];return t?mo(e,t,a):uo(e,a),e.NR++,e.lineIndex=i,1}async function Ro(e,t,n){let r=e.exec;if(!r)return-1;xo(e,`getline command source`);let i=L(await R(e,`getline command expression`,()=>z(e,n))),a=`__cmd_${i}`,o=`__cmdi_${i}`,s,c;if(e.vars[a]===void 0)try{s=Qn((await R(e,`getline command exec`,()=>r(i))).stdout).split(`
123
123
  `),s.length>0&&s[s.length-1]===``&&s.pop(),e.vars[a]=JSON.stringify(s),e.vars[o]=-1,c=-1}catch(e){if(e instanceof v)throw e;return-1}else s=JSON.parse(e.vars[a]),c=e.vars[o];let l=c+1;if(l>=s.length)return 0;let u=s[l];return e.vars[o]=l,t?mo(e,t,u):uo(e,u),1}async function zo(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;xo(e,`getline file source`);let i=L(await R(e,`getline filename evaluation`,()=>z(e,n)));if(i===`/dev/null`)return 0;let a=r.resolvePath(e.cwd,i),o=`__fc_${a}`,s=`__fi_${a}`,c,l;if(e.vars[o]===void 0)try{c=(await R(e,`getline file read`,()=>r.readFile(a))).split(`
124
124
  `),c.length>0&&c[c.length-1]===``&&c.pop(),e.vars[o]=JSON.stringify(c),e.vars[s]=-1,l=-1}catch(e){if(e instanceof v)throw e;return-1}else c=JSON.parse(e.vars[o]),l=e.vars[s];let u=l+1;if(u>=c.length)return 0;let d=c[u];return e.vars[s]=u,t?mo(e,t,d):uo(e,d),1}async function Bo(e,t){if(xo(e,`tuple evaluation`),t.length===0)return``;for(let n=0;n<t.length-1;n++)await R(e,`tuple intermediate element`,()=>z(e,t[n]));return R(e,`tuple final element`,()=>z(e,t[t.length-1]))}var Vo;function Ho(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new b(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,`string_length`,e.output)}function Uo(e,t){Da(e.requireDefenseContext,`awk`,t)}function B(e,t,n){return Oa(e.requireDefenseContext,`awk`,t,n)}async function Wo(e,t){Uo(e,`block execution`);for(let n of t)if(await B(e,`statement execution`,()=>Ko(e,n)),Go(e))break}function Go(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Ko(e,t){switch(Uo(e,`single statement execution`),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case`block`:await B(e,`nested block statement`,()=>Wo(e,t.statements));break;case`expr_stmt`:await B(e,`expression statement`,()=>z(e,t.expression));break;case`print`:await B(e,`print statement`,()=>qo(e,t.args,t.output));break;case`printf`:await B(e,`printf statement`,()=>Jo(e,t.format,t.args,t.output));break;case`if`:await B(e,`if statement`,()=>Xo(e,t));break;case`while`:await B(e,`while statement`,()=>Zo(e,t));break;case`do_while`:await B(e,`do-while statement`,()=>Qo(e,t));break;case`for`:await B(e,`for statement`,()=>$o(e,t));break;case`for_in`:await B(e,`for-in statement`,()=>es(e,t));break;case`break`:e.loopBreak=!0;break;case`continue`:e.loopContinue=!0;break;case`next`:e.shouldNext=!0;break;case`nextfile`:e.shouldNextFile=!0;break;case`exit`:e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(I(await B(e,`exit code expression`,()=>z(e,n)))):0}break;case`return`:e.hasReturn=!0;{let n=t.value;e.returnValue=n?await B(e,`return expression`,()=>z(e,n)):``}break;case`delete`:await B(e,`delete statement`,()=>ts(e,t.target));break}}async function qo(e,t,n){Uo(e,`print execution`);let r=[];for(let n of t){let t=await B(e,`print argument evaluation`,()=>z(e,n));typeof t==`number`?Number.isInteger(t)&&Math.abs(t)<2**53-1?r.push(String(t)):r.push(to(e.OFMT,[t])):r.push(L(t))}let i=r.join(e.OFS)+e.ORS;n?await B(e,`print redirection write`,()=>Yo(e,n.redirect,n.file,i)):(e.output+=i,Ho(e))}async function Jo(e,t,n,r){Uo(e,`printf execution`);let i=L(await B(e,`printf format evaluation`,()=>z(e,t))),a=[];for(let t of n)a.push(await B(e,`printf argument evaluation`,()=>z(e,t)));let o=to(i,a);r?await B(e,`printf redirection write`,()=>Yo(e,r.redirect,r.file,o)):(e.output+=o,Ho(e))}async function Yo(e,t,n,r){Uo(e,`file write execution`);let i=e.fs;if(!i||!e.cwd){e.output+=r,Ho(e);return}let a=L(await B(e,`redirection filename evaluation`,()=>z(e,n))),o=i.resolvePath(e.cwd,a);t===`>`?e.openedFiles.has(o)?await B(e,`redirection append write`,()=>i.appendFile(o,r)):(await B(e,`redirection overwrite write`,()=>i.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await B(e,`redirection append mode write`,()=>i.appendFile(o,r)))}async function Xo(e,t){if(Uo(e,`if execution`),io(await B(e,`if condition evaluation`,()=>z(e,t.condition))))await B(e,`if consequent execution`,()=>Ko(e,t.consequent));else if(t.alternate){let n=t.alternate;await B(e,`if alternate execution`,()=>Ko(e,n))}}async function Zo(e,t){Uo(e,`while execution`);let n=0;for(;io(await B(e,`while condition evaluation`,()=>z(e,t.condition)));){if(n++,n>e.maxIterations)throw new b(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await B(e,`while body execution`,()=>Ko(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Qo(e,t){Uo(e,`do-while execution`);let n=0;do{if(n++,n>e.maxIterations)throw new b(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await B(e,`do-while body execution`,()=>Ko(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(io(await B(e,`do-while condition evaluation`,()=>z(e,t.condition))))}async function $o(e,t){Uo(e,`for execution`);let n=t.init,r=t.condition,i=t.update;n&&await B(e,`for init evaluation`,()=>z(e,n));let a=0;for(;!r||io(await B(e,`for condition evaluation`,()=>z(e,r)));){if(a++,a>e.maxIterations)throw new b(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await B(e,`for body execution`,()=>Ko(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;i&&await B(e,`for update evaluation`,()=>z(e,i))}}async function es(e,t){Uo(e,`for-in execution`);let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await B(e,`for-in body execution`,()=>Ko(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function ts(e,t){if(Uo(e,`delete execution`),t.type===`array_access`){let n=L(await B(e,`delete key evaluation`,()=>z(e,t.key)));yo(e,t.array,n)}else t.type===`variable`&&bo(e,t.name)}function ns(e,t){let n=t?e.parseTernary():rs(e);if(e.match(V.ASSIGN,V.PLUS_ASSIGN,V.MINUS_ASSIGN,V.STAR_ASSIGN,V.SLASH_ASSIGN,V.PERCENT_ASSIGN,V.CARET_ASSIGN)){let r=e.advance(),i=ns(e,t);if(n.type!==`variable`&&n.type!==`field`&&n.type!==`array_access`)throw Error(`Invalid assignment target`);return{type:`assignment`,operator:new Map([[`=`,`=`],[`+=`,`+=`],[`-=`,`-=`],[`*=`,`*=`],[`/=`,`/=`],[`%=`,`%=`],[`^=`,`^=`]]).get(r.value)??`=`,target:n,value:i}}return n}function rs(e){let t=is(e);for(;e.check(V.OR);){e.advance();let n=is(e);t={type:`binary`,operator:`||`,left:t,right:n}}return t}function is(e){let t=as(e);for(;e.check(V.AND);){e.advance();let n=as(e);t={type:`binary`,operator:`&&`,left:t,right:n}}return t}function as(e){let t=os(e);return e.check(V.IN)?(e.advance(),{type:`in`,key:t,array:String(e.expect(V.IDENT).value)}):t}function os(e){let t=ss(e);for(;ls(e)&&!us(e);){let n=ss(e);t={type:`binary`,operator:` `,left:t,right:n}}return t}function ss(e){let t=cs(e);for(;e.match(V.MATCH,V.NOT_MATCH);){let n=e.advance().type===V.MATCH?`~`:`!~`,r=cs(e);t={type:`binary`,operator:n,left:t,right:r}}return t}function cs(e){let t=e.parseAddSub();for(;e.match(V.LT,V.LE,V.GE,V.EQ,V.NE);){let n=e.advance(),r=e.parseAddSub();t={type:`binary`,operator:new Map([[`<`,`<`],[`<=`,`<=`],[`>=`,`>=`],[`==`,`==`],[`!=`,`!=`]]).get(n.value)??`==`,left:t,right:r}}return t}function ls(e){return e.match(V.NUMBER,V.STRING,V.IDENT,V.DOLLAR,V.LPAREN,V.NOT,V.MINUS,V.PLUS,V.INCREMENT,V.DECREMENT)}function us(e){return e.match(V.AND,V.OR,V.QUESTION,V.ASSIGN,V.PLUS_ASSIGN,V.MINUS_ASSIGN,V.STAR_ASSIGN,V.SLASH_ASSIGN,V.PERCENT_ASSIGN,V.CARET_ASSIGN,V.COMMA,V.SEMICOLON,V.NEWLINE,V.RBRACE,V.RPAREN,V.RBRACKET,V.COLON,V.PIPE,V.APPEND,V.GT,V.IN)}var V;_({},{awkCommand2:()=>ds,flagsForFuzzing:()=>fs});var ds,fs;_({},{flagsForFuzzing:()=>ms,sortCommand:()=>ps});var ps,ms;_({},{flagsForFuzzing:()=>gs,uniqCommand:()=>hs});var hs,gs;_({},{commCommand:()=>_s,flagsForFuzzing:()=>vs});var _s,vs;_({},{cutCommand:()=>ys,flagsForFuzzing:()=>bs});var ys,bs;_({},{flagsForFuzzing:()=>Ss,pasteCommand:()=>xs});var xs,Ss;_({},{flagsForFuzzing:()=>ws,trCommand:()=>Cs});var Cs,ws;_({},{flagsForFuzzing:()=>Es,rev:()=>Ts});var Ts,Es;_({},{flagsForFuzzing:()=>Os,nl:()=>Ds});var Ds,Os;_({},{flagsForFuzzing:()=>As,fold:()=>ks});var ks,As;_({},{expand:()=>js,flagsForFuzzing:()=>Ms});var js,Ms;_({},{flagsForFuzzing:()=>Ps,unexpand:()=>Ns});var Ns,Ps;_({},{flagsForFuzzing:()=>Is,strings:()=>Fs});var Fs,Is;_({},{flagsForFuzzing:()=>Rs,split:()=>Ls});var Ls,Rs;_({},{column:()=>zs,flagsForFuzzing:()=>Bs});var zs,Bs;_({},{flagsForFuzzing:()=>Hs,join:()=>Vs});var Vs,Hs;_({},{flagsForFuzzing:()=>Ws,teeCommand:()=>Us});var Us,Ws;function Gs(e,t){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1],i=t.name;if(e.ignoreCase){if(!i.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:na(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let n=e.pattern,r=t.relativePath,i=n.split(`/`);for(let t=0;t<i.length-1;t++){let n=i[t];if(n&&n!==`.`&&n!==`..`&&!n.includes(`*`)&&!n.includes(`?`)&&!n.includes(`[`)){let t=`/${n}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let a=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let t=a[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:na(r,n,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let n=e.ignoreCase?`i`:``;return{matches:M(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return e.fileType===`f`?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType===`d`?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case`empty`:return{matches:t.isEmpty,pruned:!1,printed:!1};case`mtime`:{let n=(Date.now()-t.mtime)/(1e3*60*60*24),r;return r=e.comparison===`more`?n>e.days:e.comparison===`less`?n<e.days:Math.floor(n)===e.days,{matches:r,pruned:!1,printed:!1}}case`newer`:{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case`size`:{let n=e.value;switch(e.unit){case`c`:n=e.value;break;case`k`:n=e.value*1024;break;case`M`:n=e.value*1024*1024;break;case`G`:n=e.value*1024*1024*1024;break;case`b`:n=e.value*512;break}let r;return r=e.comparison===`more`?t.size>n:e.comparison===`less`?t.size<n:e.unit===`b`?Math.ceil(t.size/512)===e.value:t.size===n,{matches:r,pruned:!1,printed:!1}}case`perm`:{let n=t.mode&511,r=e.mode&511,i;return i=e.matchType===`exact`?n===r:e.matchType===`all`?(n&r)===r:(n&r)!==0,{matches:i,pruned:!1,printed:!1}}case`prune`:return{matches:!0,pruned:!0,printed:!1};case`print`:return{matches:!0,pruned:!1,printed:!0};case`not`:{let n=Gs(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case`and`:{let n=Gs(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=Gs(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case`or`:{let n=Gs(e.left,t);if(n.matches)return n;let r=Gs(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function Ks(e){if(!e)return!1;switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!1;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!0;case`not`:return Ks(e.expr);case`and`:case`or`:return Ks(e.left)||Ks(e.right)}}function qs(e){if(!e)return!1;switch(e.type){case`empty`:return!0;case`not`:return qs(e.expr);case`and`:case`or`:return qs(e.left)||qs(e.right);default:return!1}}function Js(e){if(!e)return!0;switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!0;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!1;case`not`:return Js(e.expr);case`and`:case`or`:return Js(e.left)&&Js(e.right)}}function Ys(e,t,n,r,i){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:na(t,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let t=e.pattern,r=t.split(`/`);for(let t=0;t<r.length-1;t++){let i=r[t];if(i&&i!==`.`&&i!==`..`&&!i.includes(`*`)&&!i.includes(`?`)&&!i.includes(`[`)){let t=`/${i}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let i=t.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let t=i[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:na(n,t,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let t=e.ignoreCase?`i`:``;return{matches:M(e.pattern,t).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return e.fileType===`f`?{matches:r,pruned:!1,printed:!1}:e.fileType===`d`?{matches:i,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case`prune`:return{matches:!0,pruned:!0,printed:!1};case`print`:return{matches:!0,pruned:!1,printed:!0};case`not`:{let a=Ys(e.expr,t,n,r,i);return{matches:!a.matches,pruned:a.pruned,printed:!1}}case`and`:{let a=Ys(e.left,t,n,r,i);if(!a.matches)return{matches:!1,pruned:a.pruned,printed:!1};let o=Ys(e.right,t,n,r,i);return{matches:o.matches,pruned:a.pruned||o.pruned,printed:a.printed||o.printed}}case`or`:{let a=Ys(e.left,t,n,r,i);if(a.matches)return a;let o=Ys(e.right,t,n,r,i);return{matches:o.matches,pruned:a.pruned||o.pruned,printed:o.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function Xs(e){if(!e)return!1;switch(e.type){case`prune`:return!0;case`not`:return Xs(e.expr);case`and`:case`or`:return Xs(e.left)||Xs(e.right);default:return!1}}function Zs(e){switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!0;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!1;case`not`:return Zs(e.expr);case`and`:case`or`:return Zs(e.left)&&Zs(e.right)}}function Qs(e,t){switch(e.type){case`or`:if(Zs(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(Gs(e.left,n).pruned)return{shouldPrune:!0}}return Qs(e.right,t);case`and`:if(Zs(e.left)&&Zs(e.right))return{shouldPrune:Gs(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned};if(Zs(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return Gs(e.left,n).matches?Qs(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1};case`not`:return{shouldPrune:!1};default:return{shouldPrune:!1}}}_({},{findCommand:()=>$s,flagsForFuzzing:()=>ec});var $s,ec;_({},{basenameCommand:()=>tc,flagsForFuzzing:()=>nc});var tc,nc;_({},{dirnameCommand:()=>rc,flagsForFuzzing:()=>ic});var rc,ic;_({},{flagsForFuzzing:()=>sc,treeCommand:()=>oc});async function ac(e,t,n,r,i){let a={output:``,stderr:``,dirCount:0,fileCount:0};if(n.maxDepth!==null&&i>=n.maxDepth)return a;try{let o=[];if(e.fs.readdirWithFileTypes)o=(await e.fs.readdirWithFileTypes(t)).map(e=>({name:e.name,isDirectory:e.isDirectory}));else{let n=await e.fs.readdir(t);for(let r=0;r<n.length;r+=100){let i=n.slice(r,r+100),a=await Promise.all(i.map(async n=>{let r=t===`/`?`/${n}`:`${t}/${n}`;try{return{name:n,isDirectory:(await e.fs.stat(r)).isDirectory}}catch{return null}}));o.push(...a.filter(e=>e!==null))}}let s=o.filter(e=>!(!n.showHidden&&e.name.startsWith(`.`)||n.directoriesOnly&&!e.isDirectory));s.sort((e,t)=>e.name.localeCompare(t.name));for(let o=0;o<s.length;o++){let c=s[o],l=t===`/`?`/${c.name}`:`${t}/${c.name}`,u=o===s.length-1,d=u?"`-- ":`|-- `,f=r+(u?` `:`| `);if(c.isDirectory){a.dirCount++;let t=n.fullPath?l:c.name;a.output+=`${r+d+t}
125
125
  `;let o=await ac(e,l,n,f,i+1);a.output+=o.output,a.dirCount+=o.dirCount,a.fileCount+=o.fileCount}else{a.fileCount++;let e=n.fullPath?l:c.name;a.output+=`${r+d+e}
@@ -197,22 +197,22 @@ ${o.repeat(a)}}`}return String(e)}var Cl,wl;_({},{base64Command:()=>Tl,flagsForF
197
197
  `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}function rd(e){if(e.includes(`#`)){let[t,n]=e.split(`#`),r=Number.parseInt(t,10);if(r<2||r>64)return NaN;if(r<=36){let e=Number.parseInt(n,r);return e>2**53-1?2**53-1:e}let i=0;for(let e of n){let t;if(/[0-9]/.test(e))t=e.charCodeAt(0)-48;else if(/[a-z]/.test(e))t=e.charCodeAt(0)-97+10;else if(/[A-Z]/.test(e))t=e.charCodeAt(0)-65+36;else if(e===`@`)t=62;else if(e===`_`)t=63;else return NaN;if(t>=r)return NaN;if(i=i*r+t,i>2**53-1)return 2**53-1}return i}if(e.startsWith(`0x`)||e.startsWith(`0X`)){let t=Number.parseInt(e.slice(2),16);return t>2**53-1?2**53-1:t}if(e.startsWith(`0`)&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return NaN;let t=Number.parseInt(e,8);return t>2**53-1?2**53-1:t}let t=Number.parseInt(e,10);return t>2**53-1?2**53-1:t}function id(e,t,n,r){if(n.slice(r,r+3)!==`$((`)return null;let i=r+3,a=1,o=i;for(;i<n.length-1&&a>0;)n[i]===`(`&&n[i+1]===`(`?(a++,i+=2):n[i]===`)`&&n[i+1]===`)`?(a--,a>0&&(i+=2)):i++;let{expr:s}=e(t,n.slice(o,i),0);return i+=2,{expr:{type:`ArithNested`,expression:s},pos:i}}function ad(e,t){if(e.slice(t,t+2)!==`$'`)return null;let n=t+2,r=``;for(;n<e.length&&e[n]!==`'`;)if(e[n]===`\\`&&n+1<e.length){let t=e[n+1];switch(t){case`n`:r+=`
198
198
  `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;case`'`:r+=`'`;break;default:r+=t}n+=2}else r+=e[n],n++;e[n]===`'`&&n++;let i=Number.parseInt(r,10);return{expr:{type:`ArithNumber`,value:Number.isNaN(i)?0:i},pos:n}}function od(e,t){if(e.slice(t,t+2)!==`$"`)return null;let n=t+2,r=``;for(;n<e.length&&e[n]!==`"`;)e[n]===`\\`&&n+1<e.length?(r+=e[n+1],n+=2):(r+=e[n],n++);e[n]===`"`&&n++;let i=Number.parseInt(r,10);return{expr:{type:`ArithNumber`,value:Number.isNaN(i)?0:i},pos:n}}var sd,cd=g(()=>{sd=[`=`,`+=`,`-=`,`*=`,`/=`,`%=`,`<<=`,`>>=`,`&=`,`|=`,`^=`]});function ld(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){for(n++;n<e.length&&e[n]!==`"`;)e[n]===`\\`&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);n<e.length&&n++}else t+=e[n],n++;return t}function ud(e,t){let n=ld(t),{expr:r,pos:i}=pd(e,n,0),a=G(n,i);if(a<n.length){let e=t.slice(a).trim();if(e)return{type:`ArithmeticExpression`,originalText:t,expression:{type:`ArithSyntaxError`,errorToken:e,message:`${e}: syntax error: invalid arithmetic operator (error token is "${e}")`}}}return{type:`ArithmeticExpression`,expression:r,originalText:t}}function dd(e,t){return{expr:{type:`ArithSyntaxError`,errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function fd(e,t){return G(e,t)>=e.length}function pd(e,t,n){return md(e,t,n)}function md(e,t,n){let{expr:r,pos:i}=hd(e,t,n);for(i=G(t,i);t[i]===`,`;){if(i++,fd(t,i))return dd(`,`,i);let{expr:n,pos:a}=hd(e,t,i);r={type:`ArithBinary`,operator:`,`,left:r,right:n},i=G(t,a)}return{expr:r,pos:i}}function hd(e,t,n){let{expr:r,pos:i}=gd(e,t,n);if(i=G(t,i),t[i]===`?`){i++;let{expr:n,pos:a}=pd(e,t,i);if(i=G(t,a),t[i]===`:`){i++;let{expr:a,pos:o}=pd(e,t,i);return{expr:{type:`ArithTernary`,condition:r,consequent:n,alternate:a},pos:o}}}return{expr:r,pos:i}}function gd(e,t,n){let{expr:r,pos:i}=_d(e,t,n);for(;i=G(t,i),t.slice(i,i+2)===`||`;){if(i+=2,fd(t,i))return dd(`||`,i);let{expr:n,pos:a}=_d(e,t,i);r={type:`ArithBinary`,operator:`||`,left:r,right:n},i=a}return{expr:r,pos:i}}function _d(e,t,n){let{expr:r,pos:i}=vd(e,t,n);for(;i=G(t,i),t.slice(i,i+2)===`&&`;){if(i+=2,fd(t,i))return dd(`&&`,i);let{expr:n,pos:a}=vd(e,t,i);r={type:`ArithBinary`,operator:`&&`,left:r,right:n},i=a}return{expr:r,pos:i}}function vd(e,t,n){let{expr:r,pos:i}=yd(e,t,n);for(;i=G(t,i),t[i]===`|`&&t[i+1]!==`|`;){if(i++,fd(t,i))return dd(`|`,i);let{expr:n,pos:a}=yd(e,t,i);r={type:`ArithBinary`,operator:`|`,left:r,right:n},i=a}return{expr:r,pos:i}}function yd(e,t,n){let{expr:r,pos:i}=bd(e,t,n);for(;i=G(t,i),t[i]===`^`;){if(i++,fd(t,i))return dd(`^`,i);let{expr:n,pos:a}=bd(e,t,i);r={type:`ArithBinary`,operator:`^`,left:r,right:n},i=a}return{expr:r,pos:i}}function bd(e,t,n){let{expr:r,pos:i}=xd(e,t,n);for(;i=G(t,i),t[i]===`&`&&t[i+1]!==`&`;){if(i++,fd(t,i))return dd(`&`,i);let{expr:n,pos:a}=xd(e,t,i);r={type:`ArithBinary`,operator:`&`,left:r,right:n},i=a}return{expr:r,pos:i}}function xd(e,t,n){let{expr:r,pos:i}=Sd(e,t,n);for(;i=G(t,i),t.slice(i,i+2)===`==`||t.slice(i,i+2)===`!=`;){let n=t.slice(i,i+2);if(i+=2,fd(t,i))return dd(n,i);let{expr:a,pos:o}=Sd(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function Sd(e,t,n){let{expr:r,pos:i}=Cd(e,t,n);for(;;)if(i=G(t,i),t.slice(i,i+2)===`<=`||t.slice(i,i+2)===`>=`){let n=t.slice(i,i+2);if(i+=2,fd(t,i))return dd(n,i);let{expr:a,pos:o}=Cd(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else if(t[i]===`<`||t[i]===`>`){let n=t[i];if(i++,fd(t,i))return dd(n,i);let{expr:a,pos:o}=Cd(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else break;return{expr:r,pos:i}}function Cd(e,t,n){let{expr:r,pos:i}=wd(e,t,n);for(;i=G(t,i),t.slice(i,i+2)===`<<`||t.slice(i,i+2)===`>>`;){let n=t.slice(i,i+2);if(i+=2,fd(t,i))return dd(n,i);let{expr:a,pos:o}=wd(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function wd(e,t,n){let{expr:r,pos:i}=Td(e,t,n);for(;i=G(t,i),(t[i]===`+`||t[i]===`-`)&&t[i+1]!==t[i];){let n=t[i];if(i++,fd(t,i))return dd(n,i);let{expr:a,pos:o}=Td(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function Td(e,t,n){let{expr:r,pos:i}=Ed(e,t,n);for(;;)if(i=G(t,i),t[i]===`*`&&t[i+1]!==`*`){if(i++,fd(t,i))return dd(`*`,i);let{expr:n,pos:a}=Ed(e,t,i);r={type:`ArithBinary`,operator:`*`,left:r,right:n},i=a}else if(t[i]===`/`||t[i]===`%`){let n=t[i];if(i++,fd(t,i))return dd(n,i);let{expr:a,pos:o}=Ed(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else break;return{expr:r,pos:i}}function Ed(e,t,n){let{expr:r,pos:i}=Dd(e,t,n),a=G(t,i);if(t.slice(a,a+2)===`**`){if(a+=2,fd(t,a))return dd(`**`,a);let{expr:n,pos:i}=Ed(e,t,a);return{expr:{type:`ArithBinary`,operator:`**`,left:r,right:n},pos:i}}return{expr:r,pos:i}}function Dd(e,t,n){let r=G(t,n);if(t.slice(r,r+2)===`++`||t.slice(r,r+2)===`--`){let n=t.slice(r,r+2);r+=2;let{expr:i,pos:a}=Dd(e,t,r);return{expr:{type:`ArithUnary`,operator:n,operand:i,prefix:!0},pos:a}}if(t[r]===`+`||t[r]===`-`||t[r]===`!`||t[r]===`~`){let n=t[r];r++;let{expr:i,pos:a}=Dd(e,t,r);return{expr:{type:`ArithUnary`,operator:n,operand:i,prefix:!0},pos:a}}return kd(e,t,r)}function Od(e,t){let n=e[t];return n===`$`||n==="`"}function kd(e,t,n){let{expr:r,pos:i}=Ad(e,t,n,!1),a=[r];for(;Od(t,i);){let{expr:n,pos:r}=Ad(e,t,i,!0);a.push(n),i=r}a.length>1&&(r={type:`ArithConcat`,parts:a});let o;if(t[i]===`[`&&r.type===`ArithConcat`){i++;let{expr:n,pos:r}=pd(e,t,i);o=n,i=r,t[i]===`]`&&i++}if(o&&r.type===`ArithConcat`&&(r={type:`ArithDynamicElement`,nameExpr:r,subscript:o},o=void 0),i=G(t,i),r.type===`ArithConcat`||r.type===`ArithVariable`||r.type===`ArithDynamicElement`){for(let n of sd)if(t.slice(i,i+n.length)===n&&t.slice(i,i+n.length+1)!==`==`){i+=n.length;let{expr:a,pos:o}=hd(e,t,i);return r.type===`ArithDynamicElement`?{expr:{type:`ArithDynamicAssignment`,operator:n,target:r.nameExpr,subscript:r.subscript,value:a},pos:o}:r.type===`ArithConcat`?{expr:{type:`ArithDynamicAssignment`,operator:n,target:r,value:a},pos:o}:{expr:{type:`ArithAssignment`,operator:n,variable:r.name,value:a},pos:o}}}if(t.slice(i,i+2)===`++`||t.slice(i,i+2)===`--`){let e=t.slice(i,i+2);return i+=2,{expr:{type:`ArithUnary`,operator:e,operand:r,prefix:!1},pos:i}}return{expr:r,pos:i}}function Ad(e,t,n,r=!1){let i=G(t,n),a=id(pd,e,t,i);if(a)return a;let o=ad(t,i);if(o)return o;let s=od(t,i);if(s)return s;if(t.slice(i,i+2)===`$(`&&t[i+2]!==`(`){i+=2;let e=1,n=i;for(;i<t.length&&e>0;)t[i]===`(`?e++:t[i]===`)`&&e--,e>0&&i++;let r=t.slice(n,i);return i++,{expr:{type:`ArithCommandSubst`,command:r},pos:i}}if(t[i]==="`"){i++;let e=i;for(;i<t.length&&t[i]!=="`";)i++;let n=t.slice(e,i);return t[i]==="`"&&i++,{expr:{type:`ArithCommandSubst`,command:n},pos:i}}if(t[i]===`(`){i++;let{expr:n,pos:r}=pd(e,t,i);return i=G(t,r),t[i]===`)`&&i++,{expr:{type:`ArithGroup`,expression:n},pos:i}}if(t[i]===`'`){i++;let e=``;for(;i<t.length&&t[i]!==`'`;)e+=t[i],i++;t[i]===`'`&&i++;let n=Number.parseInt(e,10);return{expr:{type:`ArithSingleQuote`,content:e,value:Number.isNaN(n)?0:n},pos:i}}if(t[i]===`"`){i++;let n=``;for(;i<t.length&&t[i]!==`"`;)t[i]===`\\`&&i+1<t.length?(n+=t[i+1],i+=2):(n+=t[i],i++);t[i]===`"`&&i++;let r=n.trim();if(!r)return{expr:{type:`ArithNumber`,value:0},pos:i};let{expr:a}=pd(e,r,0);return{expr:a,pos:i}}if(/[0-9]/.test(t[i])){let e=``,n=!1,r=!1;for(;i<t.length;){let a=t[i];if(n)if(/[0-9a-zA-Z@_]/.test(a))e+=a,i++;else break;else if(a===`#`)n=!0,e+=a,i++;else if(e===`0`&&(a===`x`||a===`X`)&&i+1<t.length&&/[0-9a-fA-F]/.test(t[i+1]))r=!0,e+=a,i++;else if(r&&/[0-9a-fA-F]/.test(a))e+=a,i++;else if(!r&&/[0-9]/.test(a))e+=a,i++;else break}if(i<t.length&&/[a-zA-Z_]/.test(t[i])){let n=e;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)n+=t[i],i++;return{expr:{type:`ArithSyntaxError`,errorToken:n,message:`${n}: value too great for base (error token is "${n}")`},pos:i}}if(t[i]===`.`&&/[0-9]/.test(t[i+1]))throw new sr(`${e}.${t[i+1]}...: syntax error: invalid arithmetic operator`);if(t[i]===`[`){let n=t.slice(i).trim();return{expr:{type:`ArithNumberSubscript`,number:e,errorToken:n},pos:t.length}}return{expr:{type:`ArithNumber`,value:rd(e)},pos:i}}if(t[i]===`$`&&t[i+1]===`{`){let e=i+2,n=1,r=e;for(;r<t.length&&n>0;)t[r]===`{`?n++:t[r]===`}`&&n--,n>0&&r++;let a=t.slice(e,r),o=r+1;if(t[o]===`#`){let e=o+1;for(;e<t.length&&/[0-9a-zA-Z@_]/.test(t[e]);)e++;return{expr:{type:`ArithDynamicBase`,baseExpr:a,value:t.slice(o+1,e)},pos:e}}if(/[0-9]/.test(t[o])||t[o]===`x`||t[o]===`X`){let e=o;if(t[o]===`x`||t[o]===`X`)for(e++;e<t.length&&/[0-9a-fA-F]/.test(t[e]);)e++;else for(;e<t.length&&/[0-9]/.test(t[e]);)e++;return{expr:{type:`ArithDynamicNumber`,prefix:a,suffix:t.slice(o,e)},pos:e}}return i=o,{expr:{type:`ArithBracedExpansion`,content:a},pos:i}}if(t[i]===`$`&&i+1<t.length&&/[0-9]/.test(t[i+1])){i++;let e=``;for(;i<t.length&&/[0-9]/.test(t[i]);)e+=t[i],i++;return{expr:{type:`ArithVariable`,name:e,hasDollarPrefix:!0},pos:i}}if(t[i]===`$`&&i+1<t.length&&/[*@#?\-!$]/.test(t[i+1])){let e=t[i+1];return i+=2,{expr:{type:`ArithSpecialVar`,name:e},pos:i}}let c=!1;if(t[i]===`$`&&i+1<t.length&&/[a-zA-Z_]/.test(t[i+1])&&(c=!0,i++),i<t.length&&/[a-zA-Z_]/.test(t[i])){let n=``;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)n+=t[i],i++;if(t[i]===`[`&&!r){i++;let a;if(t[i]===`'`||t[i]===`"`){let e=t[i];for(i++,a=``;i<t.length&&t[i]!==e;)a+=t[i],i++;t[i]===e&&i++,i=G(t,i),t[i]===`]`&&i++}let o;if(a===void 0){let{expr:n,pos:r}=pd(e,t,i);o=n,i=r,t[i]===`]`&&i++}if(i=G(t,i),t[i]===`[`&&o)return{expr:{type:`ArithDoubleSubscript`,array:n,index:o},pos:i};if(!r){for(let r of sd)if(t.slice(i,i+r.length)===r&&t.slice(i,i+r.length+1)!==`==`){i+=r.length;let{expr:s,pos:c}=hd(e,t,i);return{expr:{type:`ArithAssignment`,operator:r,variable:n,subscript:o,stringKey:a,value:s},pos:c}}}return{expr:{type:`ArithArrayElement`,array:n,index:o,stringKey:a},pos:i}}if(i=G(t,i),!r){for(let r of sd)if(t.slice(i,i+r.length)===r&&t.slice(i,i+r.length+1)!==`==`){i+=r.length;let{expr:a,pos:o}=hd(e,t,i);return{expr:{type:`ArithAssignment`,operator:r,variable:n,value:a},pos:o}}}return{expr:{type:`ArithVariable`,name:n,hasDollarPrefix:c},pos:i}}if(t[i]===`#`){let e=i+1;for(;e<t.length&&t[e]!==`
199
199
  `;)e++;let n=t.slice(i,e).trim()||`#`;return{expr:{type:`ArithSyntaxError`,errorToken:n,message:`${n}: syntax error: invalid arithmetic operator (error token is "${n}")`},pos:t.length}}return{expr:{type:`ArithNumber`,value:0},pos:i}}var jd=g(()=>{x(),cd()});function Md(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)==192){if(n+1<e.length&&(e[n+1]&192)==128&&r>=194){let i=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(i),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)==224){if(n+2<e.length&&(e[n+1]&192)==128&&(e[n+2]&192)==128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let i=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(i>=55296&&i<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(i),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)==240&&r<=244){if(n+3<e.length&&(e[n+1]&192)==128&&(e[n+2]&192)==128&&(e[n+3]&192)==128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let i=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(i>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(i),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function Nd(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function Pd(e,t,n,r,i){let a=1,o=n+1;for(;o<t.length&&a>0;)t[o]===r?a++:t[o]===i&&a--,a>0&&o++;return a===0?o:-1}function Fd(e,t,n){let r=n,i=1;for(;r<t.length&&i>0;){let e=t[r];if(e===`\\`&&r+1<t.length){r+=2;continue}if(e===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){r=e+1;continue}}if(e===`"`){for(r++;r<t.length&&t[r]!==`"`;)t[r]===`\\`&&r+1<t.length?r+=2:r++;r<t.length&&r++;continue}e===`{`?i++:e===`}`&&i--,i>0&&r++}return r}function Id(e,t,n){let r=n,i=!1;for(;r<t.length;){let e=t[r];if(e===`/`&&i||e===`}`)break;if(e===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){r=e+1,i=!0;continue}}if(e===`"`){for(r++;r<t.length&&t[r]!==`"`;)t[r]===`\\`&&r+1<t.length?r+=2:r++;r<t.length&&r++,i=!0;continue}e===`\\`?(r+=2,i=!0):(r++,i=!0)}return r}function Ld(e,t,n){let r=n,i=``;for(;r<t.length;){let e=t[r];if(e===`*`||e===`?`)i+=e,r++;else if(e===`[`){let n=Rd(t,r);n===-1?(i+=e,r++):(i+=t.slice(r,n+1),r=n+1)}else break}return{pattern:i,endIndex:r}}function Rd(e,t){let n=t+1;for(n<e.length&&e[n]===`^`&&n++,n<e.length&&e[n]===`]`&&n++;n<e.length;){let t=e[n];if(t===`\\`&&n+1<e.length){let t=e[n+1];if(t===`"`||t===`'`)return-1;n+=2;continue}if(t===`]`)return n;if(t===`"`||t===`$`||t==="`")return-1;if(t===`'`){let t=e.indexOf(`'`,n+1);if(t!==-1){n=t+1;continue}}if(t===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){n=t+2;continue}}if(t===`[`&&n+1<e.length&&(e[n+1]===`.`||e[n+1]===`=`)){let t=`${e[n+1]}]`,r=e.indexOf(t,n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function zd(e,t,n){let r=``,i=n;for(;i<t.length&&t[i]!==`'`;){let e=t[i];if(e===`\\`&&i+1<t.length)switch(t[i+1]){case`n`:r+=`
200
- `,i+=2;break;case`t`:r+=` `,i+=2;break;case`r`:r+=`\r`,i+=2;break;case`\\`:r+=`\\`,i+=2;break;case`'`:r+=`'`,i+=2;break;case`"`:r+=`"`,i+=2;break;case`a`:r+=`\x07`,i+=2;break;case`b`:r+=`\b`,i+=2;break;case`e`:case`E`:r+=`\x1B`,i+=2;break;case`f`:r+=`\f`,i+=2;break;case`v`:r+=`\v`,i+=2;break;case`x`:{let e=[],n=i;for(;n+1<t.length&&t[n]===`\\`&&t[n+1]===`x`;){let r=t.slice(n+2,n+4),i=parseInt(r,16);if(!Number.isNaN(i)&&r.length>0)e.push(i),n+=2+r.length;else break}e.length>0?(r+=Md(e),i=n):(r+=`\\x`,i+=2);break}case`u`:{let e=t.slice(i+2,i+6),n=parseInt(e,16);Number.isNaN(n)?(r+=`\\u`,i+=2):(r+=String.fromCharCode(n),i+=6);break}case`c`:if(i+2<t.length){let e=t[i+2].charCodeAt(0)&31;r+=String.fromCharCode(e),i+=3}else r+=`\\c`,i+=2;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let e=``,n=i+1;for(;n<t.length&&n<i+4&&/[0-7]/.test(t[n]);)e+=t[n],n++;let a=parseInt(e,8);r+=String.fromCharCode(a),i=n;break}default:r+=e,i++}else r+=e,i++}return i<t.length&&t[i]===`'`&&i++,{part:U.literal(r),endIndex:i}}function Bd(e,t){let n=t.trim();return n===``?{type:`ArithmeticExpression`,expression:{type:`ArithNumber`,value:0}}:ud(e,n)}function Vd(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`{`?(r++,n+=a):a===`}`?(r--,n+=a):a===`,`&&r===0?(t.push(n),n=``):n+=a}return t.push(n),t}function Hd(e,t,n,r){let i=Pd(e,t,n,`{`,`}`);if(i===-1)return null;let a=t.slice(n+1,i),o=a.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:`BraceExpansion`,items:[{type:`Range`,start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:i+1};let s=a.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return s?{part:{type:`BraceExpansion`,items:[{type:`Range`,start:s[1],end:s[2],step:s[3]?Number.parseInt(s[3],10):void 0}]},endIndex:i+1}:a.includes(`,`)&&r?{part:{type:`BraceExpansion`,items:Vd(a).map(t=>({type:`Word`,word:U.word(r(e,t,!1,!1,!1))}))},endIndex:i+1}:a.includes(`,`)?{part:{type:`BraceExpansion`,items:Vd(a).map(e=>({type:`Word`,word:U.word([U.literal(e)])}))},endIndex:i+1}:null}function Ud(e,t){let n=``;for(let r of t.parts)switch(r.type){case`Literal`:n+=r.value;break;case`SingleQuoted`:n+=`'${r.value}'`;break;case`Escaped`:n+=r.value;break;case`DoubleQuoted`:n+=`"`;for(let e of r.parts)e.type===`Literal`||e.type===`Escaped`?n+=e.value:e.type===`ParameterExpansion`&&(n+=`\${${e.parameter}}`);n+=`"`;break;case`ParameterExpansion`:n+=`\${${r.parameter}}`;break;case`Glob`:n+=r.pattern;break;case`TildeExpansion`:n+=`~`,r.user&&(n+=r.user);break;case`BraceExpansion`:{n+=`{`;let t=[];for(let n of r.items)if(n.type===`Range`){let e=n.startStr??String(n.start),r=n.endStr??String(n.end);n.step===void 0?t.push(`${e}..${r}`):t.push(`${e}..${r}..${n.step}`)}else t.push(Ud(e,n.word));t.length===1&&r.items[0].type===`Range`?n+=t[0]:n+=t.join(`,`),n+=`}`;break}default:n+=r.type}return n}function Wd(e,t){return{[W.LESS]:`<`,[W.GREAT]:`>`,[W.DGREAT]:`>>`,[W.LESSAND]:`<&`,[W.GREATAND]:`>&`,[W.LESSGREAT]:`<>`,[W.CLOBBER]:`>|`,[W.TLESS]:`<<<`,[W.AND_GREAT]:`&>`,[W.AND_DGREAT]:`&>>`,[W.DLESS]:`<`,[W.DLESSDASH]:`<`}[t]||`>`}var Gd=g(()=>{ku(),jd(),qu()});function Kd(e){let t=e.current(),n=t.type;if(n===W.NUMBER){let n=e.peek(1);return t.end===n.start?$u.has(n.type):!1}if(n===W.FD_VARIABLE){let t=e.peek(1);return ed.has(t.type)}return Qu.has(n)}function qd(e){let t=null,n;e.check(W.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(W.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),i=Wd(e,r.type);if(r.type===W.DLESS||r.type===W.DLESSDASH)return Jd(e,i,t,r.type===W.DLESSDASH);e.isWord()||e.error(`Expected redirection target`);let a=e.parseWord();return U.redirection(i,a,t,n)}function Jd(e,t,n,r){e.isWord()||e.error(`Expected here-document delimiter`);let i=e.advance(),a=i.value,o=i.quoted||!1;(a.startsWith(`'`)&&a.endsWith(`'`)||a.startsWith(`"`)&&a.endsWith(`"`))&&(a=a.slice(1,-1));let s=U.redirection(r?`<<-`:`<<`,U.hereDoc(a,U.word([]),r,o),n);return e.addPendingHeredoc(s,a,r,o),s}function Yd(e){let t=e.current().line,n=[],r=null,i=[],a=[];for(;e.check(W.ASSIGNMENT_WORD)||Kd(e);)e.checkIterationLimit(),e.check(W.ASSIGNMENT_WORD)?n.push(Xd(e)):a.push(qd(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(W.DBRACK_START)||e.check(W.DPAREN_START))){let t=e.advance();r=U.word([U.literal(t.value)])}for(;(!e.isStatementEnd()||e.check(W.RBRACE))&&!e.check(W.PIPE,W.PIPE_AMP);)if(e.checkIterationLimit(),Kd(e))a.push(qd(e));else if(e.check(W.RBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(W.LBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(W.DBRACK_END)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.isWord())i.push(e.parseWord());else if(e.check(W.ASSIGNMENT_WORD)){let t=e.advance(),n=t.value,r=n.endsWith(`=`),a=n.endsWith(`=(`);if((r||a)&&(a||e.check(W.LPAREN))){let t=a?n.slice(0,-2):n.slice(0,-1);a||e.expect(W.LPAREN);let r=Zd(e);e.expect(W.RPAREN);let o=`${t}=(${r.map(t=>Ud(e,t)).join(` `)})`;i.push(e.parseWordFromString(o,!1,!1))}else i.push(e.parseWordFromString(n,t.quoted,t.singleQuoted))}else if(e.check(W.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=U.simpleCommand(r,i,n,a);return o.line=t,o}function Xd(e){let t=e.expect(W.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let i=r[0],a,o=i.length;if(n[o]===`[`){let t=0,r=o+1;for(;o<n.length;o++)if(n[o]===`[`)t++;else if(n[o]===`]`&&(t--,t===0))break;t!==0&&e.error(`Invalid assignment: ${n}`),a=n.slice(r,o),o++}let s=n[o]===`+`;s&&o++,n[o]!==`=`&&e.error(`Invalid assignment: ${n}`),o++;let c=n.slice(o);if(c===`(`){let t=Zd(e);e.expect(W.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return U.assignment(n,null,s,t)}if(c===``&&e.check(W.LPAREN)){let n=e.current();if(t.end===n.start){e.advance();let t=Zd(e);e.expect(W.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return U.assignment(n,null,s,t)}}let l=c?e.parseWordFromString(c,t.quoted,t.singleQuoted,!0):null,u=a===void 0?i:`${i}[${a}]`;return U.assignment(u,l,s,null)}function Zd(e){let t=[];for(e.skipNewlines();!e.check(W.RPAREN,W.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):Qd.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var Qd,$d=g(()=>{ku(),qu(),nd(),Gd(),Qd=new Set([W.AMP,W.PIPE,W.PIPE_AMP,W.SEMICOLON,W.AND_AND,W.OR_OR,W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND])});function ef(e,t){e.expect(W.IF);let n=[],r=e.parseCompoundList();e.expect(W.THEN);let i=e.parseCompoundList();if(i.length===0){let t=e.check(W.FI)?`fi`:e.check(W.ELSE)?`else`:e.check(W.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}for(n.push({condition:r,body:i});e.check(W.ELIF);){e.advance();let t=e.parseCompoundList();e.expect(W.THEN);let r=e.parseCompoundList();if(r.length===0){let t=e.check(W.FI)?`fi`:e.check(W.ELSE)?`else`:e.check(W.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}n.push({condition:t,body:r})}let a=null;e.check(W.ELSE)&&(e.advance(),a=e.parseCompoundList(),a.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(W.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.ifNode(n,a,o)}function tf(e,t){let n=e.expect(W.FOR);if(e.check(W.DPAREN_START))return nf(e,t,n.line);e.isWord()||e.error(`Expected variable name in for loop`);let r=e.advance().value,i=null;if(e.skipNewlines(),e.check(W.IN))for(e.advance(),i=[];!e.check(W.SEMICOLON,W.NEWLINE,W.DO,W.EOF)&&e.isWord();)i.push(e.parseWord());e.check(W.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(W.DO);let a=e.parseCompoundList();e.expect(W.DONE);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.forNode(r,i,a,o)}function nf(e,t,n){e.expect(W.DPAREN_START);let r=null,i=null,a=null,o=[``,``,``],s=0,c=0;for(;!e.check(W.DPAREN_END,W.EOF);){let t=e.advance();if(t.type===W.SEMICOLON&&c===0){if(s++,s>2)break}else t.value===`(`&&c++,t.value===`)`&&c--,o[s]+=t.value}e.expect(W.DPAREN_END),o[0].trim()&&(r=ud(e,o[0].trim())),o[1].trim()&&(i=ud(e,o[1].trim())),o[2].trim()&&(a=ud(e,o[2].trim())),e.skipNewlines(),e.check(W.SEMICOLON)&&e.advance(),e.skipNewlines();let l;e.check(W.LBRACE)?(e.advance(),l=e.parseCompoundList(),e.expect(W.RBRACE)):(e.expect(W.DO),l=e.parseCompoundList(),e.expect(W.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:`CStyleFor`,init:r,condition:i,update:a,body:l,redirections:u,line:n}}function rf(e,t){e.expect(W.WHILE);let n=e.parseCompoundList();e.expect(W.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(W.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.whileNode(n,r,i)}function af(e,t){e.expect(W.UNTIL);let n=e.parseCompoundList();e.expect(W.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(W.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.untilNode(n,r,i)}function of(e,t){e.expect(W.CASE),e.isWord()||e.error(`Expected word after 'case'`);let n=e.parseWord();e.skipNewlines(),e.expect(W.IN),e.skipNewlines();let r=[];for(;!e.check(W.ESAC,W.EOF);){e.checkIterationLimit();let t=e.getPos(),n=sf(e);if(n&&r.push(n),e.skipNewlines(),e.getPos()===t&&!n)break}e.expect(W.ESAC);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.caseNode(n,r,i)}function sf(e){e.check(W.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(W.PIPE));)e.advance();if(t.length===0)return null;e.expect(W.RPAREN),e.skipNewlines();let n=[];for(;!e.check(W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND,W.ESAC,W.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===W.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(W.LPAREN)&&e.peek(1).type===W.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let t=e.getPos(),r=e.parseStatement();if(r&&n.push(r),e.skipSeparators(!1),e.getPos()===t&&!r)break}let r=`;;`;return e.check(W.DSEMI)?(e.advance(),r=`;;`):e.check(W.SEMI_AND)?(e.advance(),r=`;&`):e.check(W.SEMI_SEMI_AND)&&(e.advance(),r=`;;&`),U.caseItem(t,n,r)}function cf(e,t){e.expect(W.LPAREN);let n=e.parseCompoundList();e.expect(W.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.subshell(n,r)}function lf(e,t){e.expect(W.LBRACE);let n=e.parseCompoundList();e.expect(W.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.group(n,r)}var uf=g(()=>{ku(),jd(),qu()});function df(e){return e.isWord()||e.check(W.LBRACE)||e.check(W.RBRACE)||e.check(W.ASSIGNMENT_WORD)}function ff(e){if(e.check(W.BANG)&&e.peek(1).type===W.LPAREN){e.advance(),e.advance();let t=1,n=`!(`;for(;t>0&&!e.check(W.EOF);)if(e.check(W.LPAREN))t++,n+=`(`,e.advance();else if(e.check(W.RPAREN))t--,t>0&&(n+=`)`),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(W.PIPE))n+=`|`,e.advance();else break;return n+=`)`,e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function pf(e){return e.skipNewlines(),mf(e)}function mf(e){let t=hf(e);for(e.skipNewlines();e.check(W.OR_OR);){e.advance(),e.skipNewlines();let n=hf(e);t={type:`CondOr`,left:t,right:n},e.skipNewlines()}return t}function hf(e){let t=gf(e);for(e.skipNewlines();e.check(W.AND_AND);){e.advance(),e.skipNewlines();let n=gf(e);t={type:`CondAnd`,left:t,right:n},e.skipNewlines()}return t}function gf(e){return e.skipNewlines(),e.check(W.BANG)?(e.advance(),e.skipNewlines(),{type:`CondNot`,operand:gf(e)}):_f(e)}function _f(e){if(e.check(W.LPAREN)){e.advance();let t=pf(e);return e.expect(W.RPAREN),{type:`CondGroup`,expression:t}}if(df(e)){let t=e.current(),n=t.value;if(yf.includes(n)&&!t.quoted){if(e.advance(),e.check(W.DBRACK_END)&&e.error(`Expected operand after ${n}`),df(e))return{type:`CondUnary`,operator:n,operand:e.parseWordNoBraceExpansion()};let t=e.current();e.error(`unexpected argument \`${t.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&bf.includes(e.current().value)){let t=e.advance().value,n;return n=t===`=~`?vf(e):t===`==`||t===`!=`?ff(e):e.parseWordNoBraceExpansion(),{type:`CondBinary`,operator:t,left:r,right:n}}return e.check(W.LESS)?(e.advance(),{type:`CondBinary`,operator:`<`,left:r,right:e.parseWordNoBraceExpansion()}):e.check(W.GREAT)?(e.advance(),{type:`CondBinary`,operator:`>`,left:r,right:e.parseWordNoBraceExpansion()}):e.isWord()&&e.current().value===`=`?(e.advance(),{type:`CondBinary`,operator:`==`,left:r,right:ff(e)}):{type:`CondWord`,word:r}}e.error(`Expected conditional expression`)}function vf(e){let t=[],n=0,r=-1,i=e.getInput(),a=()=>e.check(W.DBRACK_END)||e.check(W.AND_AND)||e.check(W.OR_OR)||e.check(W.NEWLINE)||e.check(W.EOF);for(;!a();){let a=e.current(),o=r>=0&&a.start>r;if(n===0&&o)break;if(n>0&&o){let e=i.slice(r,a.start);t.push({type:`Literal`,value:e})}if(e.isWord()||e.check(W.ASSIGNMENT_WORD)){let n=e.parseWordForRegex();t.push(...n.parts),r=e.peek(-1).end}else if(e.check(W.LPAREN)){let i=e.advance();t.push({type:`Literal`,value:`(`}),n++,r=i.end}else if(e.check(W.DPAREN_START)){let i=e.advance();t.push({type:`Literal`,value:`((`}),n+=2,r=i.end}else if(e.check(W.DPAREN_END))if(n>=2){let i=e.advance();t.push({type:`Literal`,value:`))`}),n-=2,r=i.end}else{if(n===1)break;break}else if(e.check(W.RPAREN))if(n>0){let i=e.advance();t.push({type:`Literal`,value:`)`}),n--,r=i.end}else break;else if(e.check(W.PIPE)){let n=e.advance();t.push({type:`Literal`,value:`|`}),r=n.end}else if(e.check(W.SEMICOLON))if(n>0){let n=e.advance();t.push({type:`Literal`,value:`;`}),r=n.end}else break;else if(n>0&&e.check(W.LESS)){let n=e.advance();t.push({type:`Literal`,value:`<`}),r=n.end}else if(n>0&&e.check(W.GREAT)){let n=e.advance();t.push({type:`Literal`,value:`>`}),r=n.end}else if(n>0&&e.check(W.DGREAT)){let n=e.advance();t.push({type:`Literal`,value:`>>`}),r=n.end}else if(n>0&&e.check(W.DLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<`}),r=n.end}else if(n>0&&e.check(W.LESSAND)){let n=e.advance();t.push({type:`Literal`,value:`<&`}),r=n.end}else if(n>0&&e.check(W.GREATAND)){let n=e.advance();t.push({type:`Literal`,value:`>&`}),r=n.end}else if(n>0&&e.check(W.LESSGREAT)){let n=e.advance();t.push({type:`Literal`,value:`<>`}),r=n.end}else if(n>0&&e.check(W.CLOBBER)){let n=e.advance();t.push({type:`Literal`,value:`>|`}),r=n.end}else if(n>0&&e.check(W.TLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<<`}),r=n.end}else if(n>0&&e.check(W.AMP)){let n=e.advance();t.push({type:`Literal`,value:`&`}),r=n.end}else if(n>0&&e.check(W.LBRACE)){let n=e.advance();t.push({type:`Literal`,value:`{`}),r=n.end}else if(n>0&&e.check(W.RBRACE)){let n=e.advance();t.push({type:`Literal`,value:`}`}),r=n.end}else break}return t.length===0&&e.error(`Expected regex pattern after =~`),{type:`Word`,parts:t}}var yf,bf,xf=g(()=>{qu(),yf=`-a.-b.-c.-d.-e.-f.-g.-h.-k.-p.-r.-s.-t.-u.-w.-x.-G.-L.-N.-O.-S.-z.-n.-o.-v.-R`.split(`.`),bf=[`==`,`!=`,`=~`,`<`,`>`,`-eq`,`-ne`,`-lt`,`-le`,`-gt`,`-ge`,`-nt`,`-ot`,`-ef`]});function Sf(e){return e.length>0?e:[U.literal(``)]}function Cf(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(`@*+?!`.includes(t)&&r+1<e.length&&e[r+1]===`(`){r++,n++,r++;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function wf(e,t,n){let r=n+1,i=t[r];if(`@*#?$!-0123456789`.includes(i))return{part:U.parameterExpansion(i),endIndex:r+1};let a=``;for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)a+=t[r],r++;return{part:U.parameterExpansion(a),endIndex:r}}function Tf(e,t,n,r=!1){let i=n+2,a=!1;t[i]===`!`&&(a=!0,i++);let o=!1;t[i]===`#`&&!/[}:#%/^,]/.test(t[i+1]||`}`)&&(o=!0,i++);let s=``,c=t[i];if(/[@*#?$!-]/.test(c)&&!/[a-zA-Z0-9_]/.test(t[i+1]||``))s=c,i++;else for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)s+=t[i],i++;if(t[i]===`[`){let r=Pd(e,t,i,`[`,`]`);if(s+=t.slice(i,r+1),i=r+1,t[i]===`[`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;let a=t.slice(n+2,r);return{part:U.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}}if(s===``&&!a&&!o&&t[i]!==`}`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;if(e>0)throw new td(`unexpected EOF while looking for matching '}'`,0,0);let a=t.slice(n+2,r);return{part:U.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}let l=null;if(a){let n=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n)if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let a=Ef(e,t,i,s,r);a.operation?(l={type:`Indirection`,innerOp:a.operation},i=a.endIndex):(l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``)}else l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``;else if(t[i]===`*`||t[i]===`@`&&!/[QPaAEKkuUL]/.test(t[i+1]||``)){let e=t[i];i++,l={type:`VarNamePrefix`,prefix:s,star:e===`*`},s=``}else if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let n=Ef(e,t,i,s,r);n.operation?(l={type:`Indirection`,innerOp:n.operation},i=n.endIndex):l={type:`Indirection`}}else l={type:`Indirection`}}else if(o)if(t[i]===`:`)for(l={type:`LengthSliceError`};i<t.length&&t[i]!==`}`;)i++;else t[i]!==`}`&&/[-+=?]/.test(t[i])||t[i]===`/`?e.error(`\${#${s}${t.slice(i,t.indexOf(`}`,i))}}: bad substitution`):l={type:`Length`};if(!l&&i<t.length&&t[i]!==`}`){let n=Ef(e,t,i,s,r);l=n.operation,i=n.endIndex}if(i<t.length&&t[i]!==`}`){let r=t[i];if(!/[:\-+=?#%/^,@[]/.test(r)){let r=i;for(;r<t.length&&t[r]!==`}`;)r++;let a=t.slice(n,r+1);e.error(`\${${a.slice(2,-1)}}: bad substitution`)}}for(;i<t.length&&t[i]!==`}`;)i++;if(i>=t.length)throw new td(`unexpected EOF while looking for matching '}'`,0,0);return{part:U.parameterExpansion(s,l),endIndex:i+1}}function Ef(e,t,n,r,i=!1){let a=n,o=t[a],s=t[a+1]||``;if(o===`:`){let n=s;if(`-=?+`.includes(n)){a+=2;let r=Fd(e,t,a),o=Af(e,t.slice(a,r),!1,!1,!0,!1,i,!1,!1,!0),s=U.word(Sf(o));if(n===`-`)return{operation:{type:`DefaultValue`,word:s,checkEmpty:!0},endIndex:r};if(n===`=`)return{operation:{type:`AssignDefault`,word:s,checkEmpty:!0},endIndex:r};if(n===`?`)return{operation:{type:`ErrorIfUnset`,word:s,checkEmpty:!0},endIndex:r};if(n===`+`)return{operation:{type:`UseAlternative`,word:s,checkEmpty:!0},endIndex:r}}a++;let r=Fd(e,t,a),o=t.slice(a,r),c=-1,l=0,u=0;for(let e=0;e<o.length;e++){let t=o[e];if(t===`(`||t===`[`)l++;else if(t===`)`||t===`]`)l--;else if(t===`?`&&l===0)u++;else if(t===`:`&&l===0)if(u>0)u--;else{c=e;break}}let d=c>=0?o.slice(0,c):o,f=c>=0?o.slice(c+1):null;return{operation:{type:`Substring`,offset:Bd(e,d),length:f===null?null:Bd(e,f)},endIndex:r}}if(`-=?+`.includes(o)){a++;let n=Fd(e,t,a),r=t.slice(a,n),s=Af(e,r,!1,!1,!0,!1,i,!1,!1,!0),c=U.word(Sf(s));if(o===`-`)return{operation:{type:`DefaultValue`,word:c,checkEmpty:!1},endIndex:n};if(o===`=`)return{operation:{type:`AssignDefault`,word:c,checkEmpty:!1},endIndex:n};if(o===`?`)return{operation:{type:`ErrorIfUnset`,word:r?c:null,checkEmpty:!1},endIndex:n};if(o===`+`)return{operation:{type:`UseAlternative`,word:c,checkEmpty:!1},endIndex:n}}if(o===`#`||o===`%`){let n=s===o,r=o===`#`?`prefix`:`suffix`;a+=n?2:1;let i=Fd(e,t,a),c=Af(e,t.slice(a,i),!1,!1,!1);return{operation:{type:`PatternRemoval`,pattern:U.word(Sf(c)),side:r,greedy:n},endIndex:i}}if(o===`/`){let n=s===`/`;a+=n?2:1;let r=null;t[a]===`#`?(r=`start`,a++):t[a]===`%`&&(r=`end`,a++);let i;i=r!==null&&(t[a]===`/`||t[a]===`}`)?a:Id(e,t,a);let o=Af(e,t.slice(a,i),!1,!1,!1),c=U.word(Sf(o)),l=null,u=i;if(t[i]===`/`){let n=i+1,r=Fd(e,t,n),a=Af(e,t.slice(n,r),!1,!1,!1);l=U.word(Sf(a)),u=r}return{operation:{type:`PatternReplacement`,pattern:c,replacement:l,all:n,anchor:r},endIndex:u}}if(o===`^`||o===`,`){let n=s===o,r=o===`^`?`upper`:`lower`;a+=n?2:1;let i=Fd(e,t,a),c=t.slice(a,i);return{operation:{type:`CaseModification`,direction:r,all:n,pattern:c?U.word([U.literal(c)]):null},endIndex:i}}return o===`@`&&/[QPaAEKkuUL]/.test(s)?{operation:{type:`Transform`,operator:s},endIndex:a+2}:{operation:null,endIndex:a}}function Df(e,t,n,r=!1){let i=n+1;if(i>=t.length)return{part:U.literal(`$`),endIndex:i};let a=t[i];if(a===`(`&&t[i+1]===`(`)return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(a===`[`){let n=1,r=i+1;for(;r<t.length&&n>0;)t[r]===`[`?n++:t[r]===`]`&&n--,n>0&&r++;if(n===0){let n=ud(e,t.slice(i+1,r));return{part:U.arithmeticExpansion(n),endIndex:r+1}}}return a===`(`?e.parseCommandSubstitution(t,n):a===`{`?Tf(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(a)?wf(e,t,n):{part:U.literal(`$`),endIndex:i}}function Of(e,t){let n=[],r=0,i=``,a=()=>{i&&=(n.push(U.literal(i)),``)};for(;r<t.length;){let o=t[r];if(o===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`"`||e===`\\`){i+=e,r+=2;continue}i+=o,r++;continue}if(o===`$`){a();let{part:i,endIndex:o}=Df(e,t,r,!0);i&&n.push(i),r=o;continue}if(o==="`"){a();let{part:i,endIndex:o}=e.parseBacktickSubstitution(t,r,!0);n.push(i),r=o;continue}i+=o,r++}return a(),n}function kf(e,t,n){let r=[],i=n,a=``,o=()=>{a&&=(r.push(U.literal(a)),``)};for(;i<t.length&&t[i]!==`"`;){let n=t[i];if(n===`\\`&&i+1<t.length){let e=t[i+1];if(`"\\$\`
200
+ `,i+=2;break;case`t`:r+=` `,i+=2;break;case`r`:r+=`\r`,i+=2;break;case`\\`:r+=`\\`,i+=2;break;case`'`:r+=`'`,i+=2;break;case`"`:r+=`"`,i+=2;break;case`a`:r+=`\x07`,i+=2;break;case`b`:r+=`\b`,i+=2;break;case`e`:case`E`:r+=`\x1B`,i+=2;break;case`f`:r+=`\f`,i+=2;break;case`v`:r+=`\v`,i+=2;break;case`x`:{let e=[],n=i;for(;n+1<t.length&&t[n]===`\\`&&t[n+1]===`x`;){let r=t.slice(n+2,n+4),i=parseInt(r,16);if(!Number.isNaN(i)&&r.length>0)e.push(i),n+=2+r.length;else break}e.length>0?(r+=Md(e),i=n):(r+=`\\x`,i+=2);break}case`u`:{let e=t.slice(i+2,i+6),n=parseInt(e,16);Number.isNaN(n)?(r+=`\\u`,i+=2):(r+=String.fromCharCode(n),i+=6);break}case`c`:if(i+2<t.length){let e=t[i+2].charCodeAt(0)&31;r+=String.fromCharCode(e),i+=3}else r+=`\\c`,i+=2;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let e=``,n=i+1;for(;n<t.length&&n<i+4&&/[0-7]/.test(t[n]);)e+=t[n],n++;let a=parseInt(e,8);r+=String.fromCharCode(a),i=n;break}default:r+=e,i++}else r+=e,i++}return i<t.length&&t[i]===`'`&&i++,{part:U.literal(r),endIndex:i}}function Bd(e,t){let n=t.trim();return n===``?{type:`ArithmeticExpression`,expression:{type:`ArithNumber`,value:0}}:ud(e,n)}function Vd(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`{`?(r++,n+=a):a===`}`?(r--,n+=a):a===`,`&&r===0?(t.push(n),n=``):n+=a}return t.push(n),t}function Hd(e,t,n,r){let i=Pd(e,t,n,`{`,`}`);if(i===-1)return null;let a=t.slice(n+1,i),o=a.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:`BraceExpansion`,items:[{type:`Range`,start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:i+1};let s=a.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return s?{part:{type:`BraceExpansion`,items:[{type:`Range`,start:s[1],end:s[2],step:s[3]?Number.parseInt(s[3],10):void 0}]},endIndex:i+1}:a.includes(`,`)&&r?{part:{type:`BraceExpansion`,items:Vd(a).map(t=>({type:`Word`,word:U.word(r(e,t,!1,!1,!1))}))},endIndex:i+1}:a.includes(`,`)?{part:{type:`BraceExpansion`,items:Vd(a).map(e=>({type:`Word`,word:U.word([U.literal(e)])}))},endIndex:i+1}:null}function Ud(e,t){let n=``;for(let r of t.parts)switch(r.type){case`Literal`:n+=r.value;break;case`SingleQuoted`:n+=`'${r.value}'`;break;case`Escaped`:n+=r.value;break;case`DoubleQuoted`:n+=`"`;for(let e of r.parts)e.type===`Literal`||e.type===`Escaped`?n+=e.value:e.type===`ParameterExpansion`&&(n+=`\${${e.parameter}}`);n+=`"`;break;case`ParameterExpansion`:n+=`\${${r.parameter}}`;break;case`Glob`:n+=r.pattern;break;case`TildeExpansion`:n+=`~`,r.user&&(n+=r.user);break;case`BraceExpansion`:{n+=`{`;let t=[];for(let n of r.items)if(n.type===`Range`){let e=n.startStr??String(n.start),r=n.endStr??String(n.end);n.step===void 0?t.push(`${e}..${r}`):t.push(`${e}..${r}..${n.step}`)}else t.push(Ud(e,n.word));t.length===1&&r.items[0].type===`Range`?n+=t[0]:n+=t.join(`,`),n+=`}`;break}default:n+=r.type}return n}function Wd(e,t){return{[W.LESS]:`<`,[W.GREAT]:`>`,[W.DGREAT]:`>>`,[W.LESSAND]:`<&`,[W.GREATAND]:`>&`,[W.LESSGREAT]:`<>`,[W.CLOBBER]:`>|`,[W.TLESS]:`<<<`,[W.AND_GREAT]:`&>`,[W.AND_DGREAT]:`&>>`,[W.DLESS]:`<`,[W.DLESSDASH]:`<`}[t]||`>`}var Gd=g(()=>{ku(),jd(),qu()});function Kd(e){let t=e.current(),n=t.type;if(n===W.NUMBER){let n=e.peek(1);return t.end===n.start&&$u.has(n.type)}if(n===W.FD_VARIABLE){let t=e.peek(1);return ed.has(t.type)}return Qu.has(n)}function qd(e){let t=null,n;e.check(W.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(W.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),i=Wd(e,r.type);if(r.type===W.DLESS||r.type===W.DLESSDASH)return Jd(e,i,t,r.type===W.DLESSDASH);e.isWord()||e.error(`Expected redirection target`);let a=e.parseWord();return U.redirection(i,a,t,n)}function Jd(e,t,n,r){e.isWord()||e.error(`Expected here-document delimiter`);let i=e.advance(),a=i.value,o=i.quoted||!1;(a.startsWith(`'`)&&a.endsWith(`'`)||a.startsWith(`"`)&&a.endsWith(`"`))&&(a=a.slice(1,-1));let s=U.redirection(r?`<<-`:`<<`,U.hereDoc(a,U.word([]),r,o),n);return e.addPendingHeredoc(s,a,r,o),s}function Yd(e){let t=e.current().line,n=[],r=null,i=[],a=[];for(;e.check(W.ASSIGNMENT_WORD)||Kd(e);)e.checkIterationLimit(),e.check(W.ASSIGNMENT_WORD)?n.push(Xd(e)):a.push(qd(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(W.DBRACK_START)||e.check(W.DPAREN_START))){let t=e.advance();r=U.word([U.literal(t.value)])}for(;(!e.isStatementEnd()||e.check(W.RBRACE))&&!e.check(W.PIPE,W.PIPE_AMP);)if(e.checkIterationLimit(),Kd(e))a.push(qd(e));else if(e.check(W.RBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(W.LBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(W.DBRACK_END)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.isWord())i.push(e.parseWord());else if(e.check(W.ASSIGNMENT_WORD)){let t=e.advance(),n=t.value,r=n.endsWith(`=`),a=n.endsWith(`=(`);if((r||a)&&(a||e.check(W.LPAREN))){let t=a?n.slice(0,-2):n.slice(0,-1);a||e.expect(W.LPAREN);let r=Zd(e);e.expect(W.RPAREN);let o=`${t}=(${r.map(t=>Ud(e,t)).join(` `)})`;i.push(e.parseWordFromString(o,!1,!1))}else i.push(e.parseWordFromString(n,t.quoted,t.singleQuoted))}else if(e.check(W.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=U.simpleCommand(r,i,n,a);return o.line=t,o}function Xd(e){let t=e.expect(W.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let i=r[0],a,o=i.length;if(n[o]===`[`){let t=0,r=o+1;for(;o<n.length;o++)if(n[o]===`[`)t++;else if(n[o]===`]`&&(t--,t===0))break;t!==0&&e.error(`Invalid assignment: ${n}`),a=n.slice(r,o),o++}let s=n[o]===`+`;s&&o++,n[o]!==`=`&&e.error(`Invalid assignment: ${n}`),o++;let c=n.slice(o);if(c===`(`){let t=Zd(e);e.expect(W.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return U.assignment(n,null,s,t)}if(c===``&&e.check(W.LPAREN)){let n=e.current();if(t.end===n.start){e.advance();let t=Zd(e);e.expect(W.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return U.assignment(n,null,s,t)}}let l=c?e.parseWordFromString(c,t.quoted,t.singleQuoted,!0):null,u=a===void 0?i:`${i}[${a}]`;return U.assignment(u,l,s,null)}function Zd(e){let t=[];for(e.skipNewlines();!e.check(W.RPAREN,W.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):Qd.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var Qd,$d=g(()=>{ku(),qu(),nd(),Gd(),Qd=new Set([W.AMP,W.PIPE,W.PIPE_AMP,W.SEMICOLON,W.AND_AND,W.OR_OR,W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND])});function ef(e,t){e.expect(W.IF);let n=[],r=e.parseCompoundList();e.expect(W.THEN);let i=e.parseCompoundList();if(i.length===0){let t=e.check(W.FI)?`fi`:e.check(W.ELSE)?`else`:e.check(W.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}for(n.push({condition:r,body:i});e.check(W.ELIF);){e.advance();let t=e.parseCompoundList();e.expect(W.THEN);let r=e.parseCompoundList();if(r.length===0){let t=e.check(W.FI)?`fi`:e.check(W.ELSE)?`else`:e.check(W.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}n.push({condition:t,body:r})}let a=null;e.check(W.ELSE)&&(e.advance(),a=e.parseCompoundList(),a.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(W.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.ifNode(n,a,o)}function tf(e,t){let n=e.expect(W.FOR);if(e.check(W.DPAREN_START))return nf(e,t,n.line);e.isWord()||e.error(`Expected variable name in for loop`);let r=e.advance().value,i=null;if(e.skipNewlines(),e.check(W.IN))for(e.advance(),i=[];!e.check(W.SEMICOLON,W.NEWLINE,W.DO,W.EOF)&&e.isWord();)i.push(e.parseWord());e.check(W.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(W.DO);let a=e.parseCompoundList();e.expect(W.DONE);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.forNode(r,i,a,o)}function nf(e,t,n){e.expect(W.DPAREN_START);let r=null,i=null,a=null,o=[``,``,``],s=0,c=0;for(;!e.check(W.DPAREN_END,W.EOF);){let t=e.advance();if(t.type===W.SEMICOLON&&c===0){if(s++,s>2)break}else t.value===`(`&&c++,t.value===`)`&&c--,o[s]+=t.value}e.expect(W.DPAREN_END),o[0].trim()&&(r=ud(e,o[0].trim())),o[1].trim()&&(i=ud(e,o[1].trim())),o[2].trim()&&(a=ud(e,o[2].trim())),e.skipNewlines(),e.check(W.SEMICOLON)&&e.advance(),e.skipNewlines();let l;e.check(W.LBRACE)?(e.advance(),l=e.parseCompoundList(),e.expect(W.RBRACE)):(e.expect(W.DO),l=e.parseCompoundList(),e.expect(W.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:`CStyleFor`,init:r,condition:i,update:a,body:l,redirections:u,line:n}}function rf(e,t){e.expect(W.WHILE);let n=e.parseCompoundList();e.expect(W.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(W.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.whileNode(n,r,i)}function af(e,t){e.expect(W.UNTIL);let n=e.parseCompoundList();e.expect(W.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(W.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.untilNode(n,r,i)}function of(e,t){e.expect(W.CASE),e.isWord()||e.error(`Expected word after 'case'`);let n=e.parseWord();e.skipNewlines(),e.expect(W.IN),e.skipNewlines();let r=[];for(;!e.check(W.ESAC,W.EOF);){e.checkIterationLimit();let t=e.getPos(),n=sf(e);if(n&&r.push(n),e.skipNewlines(),e.getPos()===t&&!n)break}e.expect(W.ESAC);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.caseNode(n,r,i)}function sf(e){e.check(W.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(W.PIPE));)e.advance();if(t.length===0)return null;e.expect(W.RPAREN),e.skipNewlines();let n=[];for(;!e.check(W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND,W.ESAC,W.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===W.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(W.LPAREN)&&e.peek(1).type===W.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let t=e.getPos(),r=e.parseStatement();if(r&&n.push(r),e.skipSeparators(!1),e.getPos()===t&&!r)break}let r=`;;`;return e.check(W.DSEMI)?(e.advance(),r=`;;`):e.check(W.SEMI_AND)?(e.advance(),r=`;&`):e.check(W.SEMI_SEMI_AND)&&(e.advance(),r=`;;&`),U.caseItem(t,n,r)}function cf(e,t){e.expect(W.LPAREN);let n=e.parseCompoundList();e.expect(W.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.subshell(n,r)}function lf(e,t){e.expect(W.LBRACE);let n=e.parseCompoundList();e.expect(W.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return U.group(n,r)}var uf=g(()=>{ku(),jd(),qu()});function df(e){return e.isWord()||e.check(W.LBRACE)||e.check(W.RBRACE)||e.check(W.ASSIGNMENT_WORD)}function ff(e){if(e.check(W.BANG)&&e.peek(1).type===W.LPAREN){e.advance(),e.advance();let t=1,n=`!(`;for(;t>0&&!e.check(W.EOF);)if(e.check(W.LPAREN))t++,n+=`(`,e.advance();else if(e.check(W.RPAREN))t--,t>0&&(n+=`)`),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(W.PIPE))n+=`|`,e.advance();else break;return n+=`)`,e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function pf(e){return e.skipNewlines(),mf(e)}function mf(e){let t=hf(e);for(e.skipNewlines();e.check(W.OR_OR);){e.advance(),e.skipNewlines();let n=hf(e);t={type:`CondOr`,left:t,right:n},e.skipNewlines()}return t}function hf(e){let t=gf(e);for(e.skipNewlines();e.check(W.AND_AND);){e.advance(),e.skipNewlines();let n=gf(e);t={type:`CondAnd`,left:t,right:n},e.skipNewlines()}return t}function gf(e){return e.skipNewlines(),e.check(W.BANG)?(e.advance(),e.skipNewlines(),{type:`CondNot`,operand:gf(e)}):_f(e)}function _f(e){if(e.check(W.LPAREN)){e.advance();let t=pf(e);return e.expect(W.RPAREN),{type:`CondGroup`,expression:t}}if(df(e)){let t=e.current(),n=t.value;if(yf.includes(n)&&!t.quoted){if(e.advance(),e.check(W.DBRACK_END)&&e.error(`Expected operand after ${n}`),df(e))return{type:`CondUnary`,operator:n,operand:e.parseWordNoBraceExpansion()};let t=e.current();e.error(`unexpected argument \`${t.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&bf.includes(e.current().value)){let t=e.advance().value,n;return n=t===`=~`?vf(e):t===`==`||t===`!=`?ff(e):e.parseWordNoBraceExpansion(),{type:`CondBinary`,operator:t,left:r,right:n}}return e.check(W.LESS)?(e.advance(),{type:`CondBinary`,operator:`<`,left:r,right:e.parseWordNoBraceExpansion()}):e.check(W.GREAT)?(e.advance(),{type:`CondBinary`,operator:`>`,left:r,right:e.parseWordNoBraceExpansion()}):e.isWord()&&e.current().value===`=`?(e.advance(),{type:`CondBinary`,operator:`==`,left:r,right:ff(e)}):{type:`CondWord`,word:r}}e.error(`Expected conditional expression`)}function vf(e){let t=[],n=0,r=-1,i=e.getInput(),a=()=>e.check(W.DBRACK_END)||e.check(W.AND_AND)||e.check(W.OR_OR)||e.check(W.NEWLINE)||e.check(W.EOF);for(;!a();){let a=e.current(),o=r>=0&&a.start>r;if(n===0&&o)break;if(n>0&&o){let e=i.slice(r,a.start);t.push({type:`Literal`,value:e})}if(e.isWord()||e.check(W.ASSIGNMENT_WORD)){let n=e.parseWordForRegex();t.push(...n.parts),r=e.peek(-1).end}else if(e.check(W.LPAREN)){let i=e.advance();t.push({type:`Literal`,value:`(`}),n++,r=i.end}else if(e.check(W.DPAREN_START)){let i=e.advance();t.push({type:`Literal`,value:`((`}),n+=2,r=i.end}else if(e.check(W.DPAREN_END))if(n>=2){let i=e.advance();t.push({type:`Literal`,value:`))`}),n-=2,r=i.end}else{if(n===1)break;break}else if(e.check(W.RPAREN))if(n>0){let i=e.advance();t.push({type:`Literal`,value:`)`}),n--,r=i.end}else break;else if(e.check(W.PIPE)){let n=e.advance();t.push({type:`Literal`,value:`|`}),r=n.end}else if(e.check(W.SEMICOLON))if(n>0){let n=e.advance();t.push({type:`Literal`,value:`;`}),r=n.end}else break;else if(n>0&&e.check(W.LESS)){let n=e.advance();t.push({type:`Literal`,value:`<`}),r=n.end}else if(n>0&&e.check(W.GREAT)){let n=e.advance();t.push({type:`Literal`,value:`>`}),r=n.end}else if(n>0&&e.check(W.DGREAT)){let n=e.advance();t.push({type:`Literal`,value:`>>`}),r=n.end}else if(n>0&&e.check(W.DLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<`}),r=n.end}else if(n>0&&e.check(W.LESSAND)){let n=e.advance();t.push({type:`Literal`,value:`<&`}),r=n.end}else if(n>0&&e.check(W.GREATAND)){let n=e.advance();t.push({type:`Literal`,value:`>&`}),r=n.end}else if(n>0&&e.check(W.LESSGREAT)){let n=e.advance();t.push({type:`Literal`,value:`<>`}),r=n.end}else if(n>0&&e.check(W.CLOBBER)){let n=e.advance();t.push({type:`Literal`,value:`>|`}),r=n.end}else if(n>0&&e.check(W.TLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<<`}),r=n.end}else if(n>0&&e.check(W.AMP)){let n=e.advance();t.push({type:`Literal`,value:`&`}),r=n.end}else if(n>0&&e.check(W.LBRACE)){let n=e.advance();t.push({type:`Literal`,value:`{`}),r=n.end}else if(n>0&&e.check(W.RBRACE)){let n=e.advance();t.push({type:`Literal`,value:`}`}),r=n.end}else break}return t.length===0&&e.error(`Expected regex pattern after =~`),{type:`Word`,parts:t}}var yf,bf,xf=g(()=>{qu(),yf=`-a.-b.-c.-d.-e.-f.-g.-h.-k.-p.-r.-s.-t.-u.-w.-x.-G.-L.-N.-O.-S.-z.-n.-o.-v.-R`.split(`.`),bf=[`==`,`!=`,`=~`,`<`,`>`,`-eq`,`-ne`,`-lt`,`-le`,`-gt`,`-ge`,`-nt`,`-ot`,`-ef`]});function Sf(e){return e.length>0?e:[U.literal(``)]}function Cf(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(`@*+?!`.includes(t)&&r+1<e.length&&e[r+1]===`(`){r++,n++,r++;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function wf(e,t,n){let r=n+1,i=t[r];if(`@*#?$!-0123456789`.includes(i))return{part:U.parameterExpansion(i),endIndex:r+1};let a=``;for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)a+=t[r],r++;return{part:U.parameterExpansion(a),endIndex:r}}function Tf(e,t,n,r=!1){let i=n+2,a=!1;t[i]===`!`&&(a=!0,i++);let o=!1;t[i]===`#`&&!/[}:#%/^,]/.test(t[i+1]||`}`)&&(o=!0,i++);let s=``,c=t[i];if(/[@*#?$!-]/.test(c)&&!/[a-zA-Z0-9_]/.test(t[i+1]||``))s=c,i++;else for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)s+=t[i],i++;if(t[i]===`[`){let r=Pd(e,t,i,`[`,`]`);if(s+=t.slice(i,r+1),i=r+1,t[i]===`[`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;let a=t.slice(n+2,r);return{part:U.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}}if(s===``&&!a&&!o&&t[i]!==`}`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;if(e>0)throw new td(`unexpected EOF while looking for matching '}'`,0,0);let a=t.slice(n+2,r);return{part:U.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}let l=null;if(a){let n=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n)if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let a=Ef(e,t,i,s,r);a.operation?(l={type:`Indirection`,innerOp:a.operation},i=a.endIndex):(l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``)}else l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``;else if(t[i]===`*`||t[i]===`@`&&!/[QPaAEKkuUL]/.test(t[i+1]||``)){let e=t[i];i++,l={type:`VarNamePrefix`,prefix:s,star:e===`*`},s=``}else if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let n=Ef(e,t,i,s,r);n.operation?(l={type:`Indirection`,innerOp:n.operation},i=n.endIndex):l={type:`Indirection`}}else l={type:`Indirection`}}else if(o)if(t[i]===`:`)for(l={type:`LengthSliceError`};i<t.length&&t[i]!==`}`;)i++;else t[i]!==`}`&&/[-+=?]/.test(t[i])||t[i]===`/`?e.error(`\${#${s}${t.slice(i,t.indexOf(`}`,i))}}: bad substitution`):l={type:`Length`};if(!l&&i<t.length&&t[i]!==`}`){let n=Ef(e,t,i,s,r);l=n.operation,i=n.endIndex}if(i<t.length&&t[i]!==`}`){let r=t[i];if(!/[:\-+=?#%/^,@[]/.test(r)){let r=i;for(;r<t.length&&t[r]!==`}`;)r++;let a=t.slice(n,r+1);e.error(`\${${a.slice(2,-1)}}: bad substitution`)}}for(;i<t.length&&t[i]!==`}`;)i++;if(i>=t.length)throw new td(`unexpected EOF while looking for matching '}'`,0,0);return{part:U.parameterExpansion(s,l),endIndex:i+1}}function Ef(e,t,n,r,i=!1){let a=n,o=t[a],s=t[a+1]||``;if(o===`:`){let n=s;if(`-=?+`.includes(n)){a+=2;let r=Fd(e,t,a),o=Af(e,t.slice(a,r),!1,!1,!0,!1,i,!1,!1,!0),s=U.word(Sf(o));if(n===`-`)return{operation:{type:`DefaultValue`,word:s,checkEmpty:!0},endIndex:r};if(n===`=`)return{operation:{type:`AssignDefault`,word:s,checkEmpty:!0},endIndex:r};if(n===`?`)return{operation:{type:`ErrorIfUnset`,word:s,checkEmpty:!0},endIndex:r};if(n===`+`)return{operation:{type:`UseAlternative`,word:s,checkEmpty:!0},endIndex:r}}a++;let r=Fd(e,t,a),o=t.slice(a,r),c=-1,l=0,u=0;for(let e=0;e<o.length;e++){let t=o[e];if(t===`(`||t===`[`)l++;else if(t===`)`||t===`]`)l--;else if(t===`?`&&l===0)u++;else if(t===`:`&&l===0)if(u>0)u--;else{c=e;break}}let d=c>=0?o.slice(0,c):o,f=c>=0?o.slice(c+1):null;return{operation:{type:`Substring`,offset:Bd(e,d),length:f===null?null:Bd(e,f)},endIndex:r}}if(`-=?+`.includes(o)){a++;let n=Fd(e,t,a),r=t.slice(a,n),s=Af(e,r,!1,!1,!0,!1,i,!1,!1,!0),c=U.word(Sf(s));if(o===`-`)return{operation:{type:`DefaultValue`,word:c,checkEmpty:!1},endIndex:n};if(o===`=`)return{operation:{type:`AssignDefault`,word:c,checkEmpty:!1},endIndex:n};if(o===`?`)return{operation:{type:`ErrorIfUnset`,word:r?c:null,checkEmpty:!1},endIndex:n};if(o===`+`)return{operation:{type:`UseAlternative`,word:c,checkEmpty:!1},endIndex:n}}if(o===`#`||o===`%`){let n=s===o,r=o===`#`?`prefix`:`suffix`;a+=n?2:1;let i=Fd(e,t,a),c=Af(e,t.slice(a,i),!1,!1,!1);return{operation:{type:`PatternRemoval`,pattern:U.word(Sf(c)),side:r,greedy:n},endIndex:i}}if(o===`/`){let n=s===`/`;a+=n?2:1;let r=null;t[a]===`#`?(r=`start`,a++):t[a]===`%`&&(r=`end`,a++);let i;i=r!==null&&(t[a]===`/`||t[a]===`}`)?a:Id(e,t,a);let o=Af(e,t.slice(a,i),!1,!1,!1),c=U.word(Sf(o)),l=null,u=i;if(t[i]===`/`){let n=i+1,r=Fd(e,t,n),a=Af(e,t.slice(n,r),!1,!1,!1);l=U.word(Sf(a)),u=r}return{operation:{type:`PatternReplacement`,pattern:c,replacement:l,all:n,anchor:r},endIndex:u}}if(o===`^`||o===`,`){let n=s===o,r=o===`^`?`upper`:`lower`;a+=n?2:1;let i=Fd(e,t,a),c=t.slice(a,i);return{operation:{type:`CaseModification`,direction:r,all:n,pattern:c?U.word([U.literal(c)]):null},endIndex:i}}return o===`@`&&/[QPaAEKkuUL]/.test(s)?{operation:{type:`Transform`,operator:s},endIndex:a+2}:{operation:null,endIndex:a}}function Df(e,t,n,r=!1){let i=n+1;if(i>=t.length)return{part:U.literal(`$`),endIndex:i};let a=t[i];if(a===`(`&&t[i+1]===`(`)return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(a===`[`){let n=1,r=i+1;for(;r<t.length&&n>0;)t[r]===`[`?n++:t[r]===`]`&&n--,n>0&&r++;if(n===0){let n=ud(e,t.slice(i+1,r));return{part:U.arithmeticExpansion(n),endIndex:r+1}}}return a===`(`?e.parseCommandSubstitution(t,n):a===`{`?Tf(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(a)?wf(e,t,n):{part:U.literal(`$`),endIndex:i}}function Of(e,t){let n=[],r=0,i=``,a=()=>{i&&=(n.push(U.literal(i)),``)};for(;r<t.length;){let o=t[r];if(o===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`"`||e===`\\`){i+=e,r+=2;continue}i+=o,r++;continue}if(o===`$`){a();let{part:i,endIndex:o}=Df(e,t,r,!0);i&&n.push(i),r=o;continue}if(o==="`"){a();let{part:i,endIndex:o}=e.parseBacktickSubstitution(t,r,!0);n.push(i),r=o;continue}i+=o,r++}return a(),n}function kf(e,t,n){let r=[],i=n,a=``,o=()=>{a&&=(r.push(U.literal(a)),``)};for(;i<t.length&&t[i]!==`"`;){let n=t[i];if(n===`\\`&&i+1<t.length){let e=t[i+1];if(`"\\$\`
201
201
  `.includes(e)){a+=e,i+=2;continue}a+=n,i++;continue}if(n===`$`){o();let{part:n,endIndex:a}=Df(e,t,i,!0);n&&r.push(n),i=a;continue}if(n==="`"){o();let{part:n,endIndex:a}=e.parseBacktickSubstitution(t,i,!0);r.push(n),i=a;continue}a+=n,i++}return o(),{part:U.doubleQuoted(r),endIndex:i}}function Af(e,t,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1){if(r)return[U.singleQuoted(t)];if(n){let n=Of(e,t);return[U.doubleQuoted(n)]}if(t.length>=2&&t[0]===`"`&&t[t.length-1]===`"`){let n=t.slice(1,-1),r=!1;for(let e=0;e<n.length;e++){if(n[e]===`"`){r=!0;break}n[e]===`\\`&&e+1<n.length&&e++}if(!r){let t=Of(e,n);return[U.doubleQuoted(t)]}}let u=[],d=0,f=``,p=()=>{f&&=(u.push(U.literal(f)),``)};for(;d<t.length;){let n=t[d];if(n===`\\`&&d+1<t.length){let e=t[d+1];if(c){p(),u.push(U.escaped(e)),d+=2;continue}let n=a?e===`$`||e==="`"||e===`
202
202
  `:e===`$`||e==="`"||e===`"`||e===`'`||e===`
203
- `||l&&e===`}`,r=o?`*?[]\\`.includes(e):`*?[]\\(){}.^+`.includes(e);n?f+=e:r?(p(),u.push(U.escaped(e))):f+=`\\${e}`,d+=2;continue}if(n===`'`&&!o&&!a){p();let e=t.indexOf(`'`,d+1);if(e===-1){f+=t.slice(d);break}u.push(U.singleQuoted(t.slice(d+1,e))),d=e+1;continue}if(n===`"`&&!a){p();let{part:n,endIndex:r}=kf(e,t,d+1);u.push(n),d=r+1;continue}if(n===`$`&&t[d+1]===`'`){p();let{part:n,endIndex:r}=zd(e,t,d+2);u.push(n),d=r;continue}if(n===`$`){p();let{part:n,endIndex:r}=Df(e,t,d);n&&u.push(n),d=r;continue}if(n==="`"){p();let{part:n,endIndex:r}=e.parseBacktickSubstitution(t,d);u.push(n),d=r;continue}if(n===`~`){let n=d>0?t[d-1]:``;if(d===0||n===`=`||i&&n===`:`){let n=Nd(e,t,d),r=t[n];if(r===void 0||r===`/`||r===`:`){p();let e=t.slice(d+1,n)||null;u.push({type:`TildeExpansion`,user:e}),d=n;continue}}}if(`@*+?!`.includes(n)&&d+1<t.length&&t[d+1]===`(`){let e=Cf(t,d+1);if(e!==-1){p();let n=t.slice(d,e+1);u.push({type:`Glob`,pattern:n}),d=e+1;continue}}if(n===`*`||n===`?`||n===`[`){p();let{pattern:n,endIndex:r}=Ld(e,t,d);u.push({type:`Glob`,pattern:n}),d=r;continue}if(n===`{`&&!i&&!s&&!a){let n=Hd(e,t,d,Af);if(n){p(),u.push(n.part),d=n.endIndex;continue}}f+=n,d++}return p(),u}var jf=g(()=>{ku(),jd(),nd(),Gd()}),Mf,K=g(()=>{ku(),jd(),$d(),uf(),xf(),jf(),qu(),Fu(),nd(),nd(),Mf=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input=``;getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>Xu)throw new td(`Maximum parse iterations exceeded (possible infinite loop)`,this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>Zu)throw new td(`Maximum parser nesting depth exceeded (${Zu})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(e,t){if(e.length>Ju)throw new td(`Input too large: ${e.length} bytes exceeds limit of ${Ju}`,1,1);this._input=e;let n=new Ku(e,t);if(this.tokens=n.tokenize(),this.tokens.length>Yu)throw new td(`Too many tokens: ${this.tokens.length} exceeds limit of ${Yu}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(e){return this.tokens=e,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(e=0){return this.tokens[this.pos+e]||this.tokens[this.tokens.length-1]}advance(){let e=this.current();return this.pos<this.tokens.length-1&&this.pos++,e}getPos(){return this.pos}check(e,t,n,r,...i){let a=this.tokens[this.pos]?.type;return a===e||t!==void 0&&a===t||n!==void 0&&a===n||r!==void 0&&a===r?!0:i.length>0?i.includes(a):!1}expect(e,t){if(this.check(e))return this.advance();let n=this.current();throw new td(t||`Expected ${e}, got ${n.type}`,n.line,n.column,n)}error(e){let t=this.current();throw new td(e,t.line,t.column,t)}skipNewlines(){for(;this.check(W.NEWLINE,W.COMMENT);)this.check(W.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(e=!0){for(;;){if(this.check(W.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(W.SEMICOLON,W.COMMENT)){this.advance();continue}if(e&&this.check(W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(e,t,n,r){this.pendingHeredocs.push({redirect:e,delimiter:t,stripTabs:n,quoted:r})}processHeredocs(){for(let e of this.pendingHeredocs)if(this.check(W.HEREDOC_CONTENT)){let t=this.advance(),n;n=e.quoted?U.word([U.literal(t.value)]):this.parseWordFromString(t.value,!1,!1,!1,!0),e.redirect.target=U.hereDoc(e.delimiter,n,e.stripTabs,e.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(W.EOF,W.NEWLINE,W.SEMICOLON,W.AMP,W.AND_AND,W.OR_OR,W.RPAREN,W.RBRACE,W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)}isCommandStart(){let e=this.current().type;return e===W.WORD||e===W.NAME||e===W.NUMBER||e===W.ASSIGNMENT_WORD||e===W.IF||e===W.FOR||e===W.WHILE||e===W.UNTIL||e===W.CASE||e===W.LPAREN||e===W.LBRACE||e===W.DPAREN_START||e===W.DBRACK_START||e===W.FUNCTION||e===W.BANG||e===W.TIME||e===W.IN||e===W.LESS||e===W.GREAT||e===W.DLESS||e===W.DGREAT||e===W.LESSAND||e===W.GREATAND||e===W.LESSGREAT||e===W.DLESSDASH||e===W.CLOBBER||e===W.TLESS||e===W.AND_GREAT||e===W.AND_DGREAT}parseScript(){let e=[],t=0;for(this.skipNewlines();!this.check(W.EOF);){t++,t>1e4&&this.error(`Parser stuck: too many iterations (>10000)`);let n=this.checkUnexpectedToken();if(n){e.push(n),this.skipSeparators(!1);continue}let r=this.pos,i=this.parseStatement();i&&e.push(i),this.skipSeparators(!1),this.check(W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===r&&!this.check(W.EOF)&&this.advance()}return U.script(e)}checkUnexpectedToken(){let e=this.current().type,t=this.current().value;if((e===W.DO||e===W.DONE||e===W.THEN||e===W.ELSE||e===W.ELIF||e===W.FI||e===W.ESAC)&&this.error(`syntax error near unexpected token \`${t}'`),e===W.RBRACE||e===W.RPAREN){let e=`syntax error near unexpected token \`${t}'`;return this.advance(),U.statement([U.pipeline([U.simpleCommand(null,[],[],[])])],[],!1,{message:e,token:t})}return(e===W.DSEMI||e===W.SEMI_AND||e===W.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${t}'`),e===W.SEMICOLON&&this.error(`syntax error near unexpected token \`${t}'`),(e===W.PIPE||e===W.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${t}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let e=this.current().start,t=[],n=[],r=!1,i=this.parsePipeline();for(t.push(i);this.check(W.AND_AND,W.OR_OR);){let e=this.advance();n.push(e.type===W.AND_AND?`&&`:`||`),this.skipNewlines();let r=this.parsePipeline();t.push(r)}this.check(W.AMP)&&(this.advance(),r=!0);let a=this.pos>0?this.tokens[this.pos-1].end:e,o=this._input.slice(e,a);return U.statement(t,n,r,void 0,o)}parsePipeline(){let e=!1,t=!1;this.check(W.TIME)&&(this.advance(),e=!0,this.check(W.WORD,W.NAME)&&this.current().value===`-p`&&(this.advance(),t=!0));let n=0;for(;this.check(W.BANG);)this.advance(),n++;let r=n%2==1,i=[],a=[],o=this.parseCommand();for(i.push(o);this.check(W.PIPE,W.PIPE_AMP);){let e=this.advance();this.skipNewlines(),a.push(e.type===W.PIPE_AMP);let t=this.parseCommand();i.push(t)}return U.pipeline(i,r,e,t,a.length>0?a:void 0)}parseCommand(){return this.check(W.IF)?ef(this):this.check(W.FOR)?tf(this):this.check(W.WHILE)?rf(this):this.check(W.UNTIL)?af(this):this.check(W.CASE)?of(this):this.check(W.LPAREN)?cf(this):this.check(W.LBRACE)?lf(this):this.check(W.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(W.DBRACK_START)?this.parseConditionalCommand():this.check(W.FUNCTION)||this.check(W.NAME,W.WORD)&&this.peek(1).type===W.LPAREN&&this.peek(2).type===W.RPAREN?this.parseFunctionDef():Yd(this)}dparenClosesWithSpacedParens(){let e=1,t=1;for(;t<this.tokens.length-this.pos;){let n=this.peek(t);if(n.type===W.EOF)return!1;if(n.type===W.DPAREN_START||n.type===W.LPAREN)e++;else if(n.type===W.DPAREN_END){if(e-=2,e<=0)return!1}else if(n.type===W.RPAREN&&(e--,e===0&&this.peek(t+1).type===W.RPAREN))return!0;t++}return!1}parseNestedSubshellsFromDparen(){this.advance();let e=this.parseCompoundList();this.expect(W.RPAREN),this.expect(W.RPAREN);let t=this.parseOptionalRedirections(),n=U.subshell(e,[]);return U.subshell([U.statement([U.pipeline([n],!1,!1,!1)])],t)}isWord(){let e=this.current().type;return e===W.WORD||e===W.NAME||e===W.NUMBER||e===W.IF||e===W.FOR||e===W.WHILE||e===W.UNTIL||e===W.CASE||e===W.FUNCTION||e===W.ELSE||e===W.ELIF||e===W.FI||e===W.THEN||e===W.DO||e===W.DONE||e===W.ESAC||e===W.IN||e===W.SELECT||e===W.TIME||e===W.COPROC||e===W.BANG}parseWord(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted)}parseWordNoBraceExpansion(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0)}parseWordForRegex(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0,!0)}parseWordFromString(e,t=!1,n=!1,r=!1,i=!1,a=!1,o=!1){let s=Af(this,e,t,n,r,i,!1,a,o);return U.word(s)}parseCommandSubstitution(t,n){return Nu(t,n,()=>new e,e=>this.error(e))}parseBacktickSubstitution(t,n,r=!1){return Pu(t,n,r,()=>new e,e=>this.error(e))}isDollarDparenSubshell(e,t){return Au(e,t)}parseArithmeticExpansion(e,t){let n=t+3,r=1,i=0,a=n;for(;a<e.length-1&&r>0;)e[a]===`$`&&e[a+1]===`(`?e[a+2]===`(`?(r++,a+=3):(i++,a+=2):e[a]===`(`&&e[a+1]===`(`?(r++,a+=2):e[a]===`)`&&e[a+1]===`)`?i>0?(i--,a++):(r--,r>0&&(a+=2)):e[a]===`(`?(i++,a++):(e[a]===`)`&&i>0&&i--,a++);let o=e.slice(n,a),s=this.parseArithmeticExpression(o);return{part:U.arithmeticExpansion(s),endIndex:a+2}}parseArithmeticCommand(){let e=this.expect(W.DPAREN_START),t=``,n=1,r=0,i=!1,a=!1;for(;n>0&&!this.check(W.EOF);){if(i){if(i=!1,r>0){r--,t+=`)`;continue}if(this.check(W.RPAREN)){n--,a=!0,this.advance();continue}if(this.check(W.DPAREN_END)){n--,a=!0;continue}t+=`)`;continue}if(this.check(W.DPAREN_START))n++,t+=`((`,this.advance();else if(this.check(W.DPAREN_END))r>=2?(r-=2,t+=`))`,this.advance()):r===1?(r--,t+=`)`,i=!0,this.advance()):(n--,a=!0,n>0&&(t+=`))`),this.advance());else if(this.check(W.LPAREN))r++,t+=`(`,this.advance();else if(this.check(W.RPAREN))r>0&&r--,t+=`)`,this.advance();else{let e=this.current().value,n=t.length>0?t[t.length-1]:``;t.length>0&&!t.endsWith(` `)&&!(e===`=`&&/[|&^+\-*/%<>]$/.test(t))&&!(e===`<`&&n===`<`)&&!(e===`>`&&n===`>`)&&(t+=` `),t+=e,this.advance()}}a||this.expect(W.DPAREN_END);let o=this.parseArithmeticExpression(t.trim()),s=this.parseOptionalRedirections();return U.arithmeticCommand(o,s,e.line)}parseConditionalCommand(){let e=this.expect(W.DBRACK_START),t=pf(this);this.expect(W.DBRACK_END);let n=this.parseOptionalRedirections();return U.conditionalCommand(t,n,e.line)}parseFunctionDef(){let e;if(this.check(W.FUNCTION)){if(this.advance(),this.check(W.NAME)||this.check(W.WORD))e=this.advance().value;else{let e=this.current();throw new td(`Expected function name`,e.line,e.column,e)}this.check(W.LPAREN)&&(this.advance(),this.expect(W.RPAREN))}else e=this.advance().value,e.includes(`$`)&&this.error(`\`${e}': not a valid identifier`),this.expect(W.LPAREN),this.expect(W.RPAREN);this.skipNewlines();let t=this.parseCompoundCommandBody({forFunctionBody:!0}),n=this.parseOptionalRedirections();return U.functionDef(e,t,n)}parseCompoundCommandBody(e){let t=e?.forFunctionBody;if(this.check(W.LBRACE))return lf(this,{skipRedirections:t});if(this.check(W.LPAREN))return cf(this,{skipRedirections:t});if(this.check(W.IF))return ef(this,{skipRedirections:t});if(this.check(W.FOR))return tf(this,{skipRedirections:t});if(this.check(W.WHILE))return rf(this,{skipRedirections:t});if(this.check(W.UNTIL))return af(this,{skipRedirections:t});if(this.check(W.CASE))return of(this,{skipRedirections:t});this.error(`Expected compound command for function body`)}parseCompoundList(){let e=this.enterDepth(),t=[];for(this.skipNewlines();!this.check(W.EOF,W.FI,W.ELSE,W.ELIF,W.THEN,W.DO,W.DONE,W.ESAC,W.RPAREN,W.RBRACE,W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let e=this.pos,n=this.parseStatement();if(n&&t.push(n),this.skipSeparators(),this.pos===e&&!n)break}return e(),t}parseOptionalRedirections(){let e=[];for(;Kd(this);){this.checkIterationLimit();let t=this.pos;if(e.push(qd(this)),this.pos===t)break}return e}parseArithmeticExpression(e){return ud(this,e)}}});function Nf(e){return Rf.get(e)??``}function Pf(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`[`){for(n+=i,r++,r<e.length&&(e[r]===`!`||e[r]===`^`)&&(n+=e[r],r++),r<e.length&&e[r]===`]`&&(n+=e[r],r++);r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){n+=e.slice(r,t+2),r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]===`]`&&(n+=e[r],r++)}else i===`:`?(n!==``&&t.push(n),n=``,r++):i===`\\`&&r+1<e.length?(n+=i+e[r+1],r+=2):(n+=i,r++)}return n!==``&&t.push(n),t}function Ff(e){let t=`^`;for(let n=0;n<e.length;n++){let r=e[n];if(r===`*`)t+=`[^/]*`;else if(r===`?`)t+=`[^/]`;else if(r===`[`){let r=n+1,i=`[`;r<e.length&&(e[r]===`^`||e[r]===`!`)&&(i+=`^`,r++),r<e.length&&e[r]===`]`&&(i+=`\\]`,r++);let a=r;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=r;for(;r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){let n=Nf(e.slice(r+2,t));i+=n,r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){i+=`\\${e[r+1]}`,r+=2;continue}if(e[r]===`-`){let e=r===o,t=r+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[r];r++}i+=`]`,t+=i,n=r}else if(r===`\\`&&n+1<e.length){let r=e[n+1];/[.+^${}()|\\*?[\]]/.test(r)?t+=`\\${r}`:t+=r,n++}else/[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+=`$`,M(t)}function If(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function Lf(e){let t=[],n=``,r=0,i=!1,a=0;for(;a<e.length;){let o=e[a];if(o===`'`&&!i){i=!0,n+=`\0QUOTE_START\0`,a++;continue}if(o===`'`&&i){i=!1,n+=`\0QUOTE_END\0`,a++;continue}if(i){n+=o,a++;continue}if(o===`\\`){n+=o,a+1<e.length?(n+=e[a+1],a+=2):a++;continue}o===`(`?(r++,n+=o):o===`)`?(r--,n+=o):o===`|`&&r===0?(t.push(n),n=``):n+=o,a++}return t.push(n),t}var Rf,zf=g(()=>{ta(),Rf=new Map([[`alnum`,`a-zA-Z0-9`],[`alpha`,`a-zA-Z`],[`ascii`,`\\x00-\\x7F`],[`blank`,` \\t`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`digit`,`0-9`],[`graph`,`!-~`],[`lower`,`a-z`],[`print`,` -~`],[`punct`,"!-/:-@\\[-`{-~"],[`space`,` \\t\\n\\r\\f\\v`],[`upper`,`A-Z`],[`word`,`a-zA-Z0-9_`],[`xdigit`,`0-9a-fA-F`]])}),Bf,Vf,Hf=g(()=>{x(),ta(),tr(),zf(),Bf=5,Vf=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;constructor(e,t,n,r){this.fs=e,this.cwd=t,typeof r==`boolean`?(this.globstar=r,this.maxOps=1e5):r?(this.globstar=r.globstar??!1,this.nullglob=r.nullglob??!1,this.failglob=r.failglob??!1,this.dotglob=r.dotglob??!1,this.extglob=r.extglob??!1,this.globskipdots=r.globskipdots??!0,this.maxOps=r.maxGlobOperations??1e5):this.maxOps=1e5;let i=n?.get(`GLOBIGNORE`);i!==void 0&&i!==``&&(this.hasGlobignore=!0,this.globignorePatterns=Pf(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new b(`Glob operation limit exceeded (${this.maxOps})`,`glob_operations`)}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(e){return!this.hasGlobignore&&!this.globskipdots?e:e.filter(e=>{let t=e.split(`/`).pop()||e;if((this.hasGlobignore||this.globskipdots)&&(t===`.`||t===`..`))return!1;if(this.hasGlobignore){for(let t of this.globignorePatterns)if(this.matchGlobignorePattern(e,t))return!1}return!0})}matchGlobignorePattern(e,t){return Ff(t).test(e)}isGlobPattern(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandArgs(e,t){let n=e.map((e,n)=>(t?.[n]??!1)||!this.isGlobPattern(e)?null:this.expand(e)),r=await Promise.all(n.map(e=>e||Promise.resolve(null))),i=[];for(let t=0;t<e.length;t++){let n=r[t];n===null?i.push(e[t]):n.length>0?i.push(...n):i.push(e[t])}return i}async expand(e){if(this.globstar){let t=e.split(`/`),n=0;for(let e of t)if(e===`**`&&(n++,n>Bf))throw new b(`Glob pattern has too many ** segments (max ${Bf})`,`glob_operations`)}let t;if(e.includes(`**`)&&this.globstar&&this.isGlobstarValid(e))t=await this.expandRecursive(e);else{let n=e.replace(/\*\*+/g,`*`);t=await this.expandSimple(n)}return this.filterGlobignore(t)}isGlobstarValid(e){let t=e.split(`/`);for(let e of t)if(e.includes(`**`)&&e!==`**`)return!1;return!0}hasGlobChars(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandSimple(e){let t=e.startsWith(`/`),n=e.split(`/`).filter(e=>e!==``),r=-1;for(let e=0;e<n.length;e++)if(this.hasGlobChars(n[e])){r=e;break}if(r===-1)return[e];let i,a;if(r===0)t?(i=`/`,a=`/`):(i=this.cwd,a=``);else{let e=n.slice(0,r);t?(i=`/${e.join(`/`)}`,a=`/${e.join(`/`)}`):(i=this.fs.resolvePath(this.cwd,e.join(`/`)),a=e.join(`/`))}let o=n.slice(r);return(await this.expandSegments(i,a,o)).sort()}async expandSegments(e,t,n){if(this.checkOpsLimit(),n.length===0)return[t];let[r,...i]=n,a=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let n=await this.fs.readdirWithFileTypes(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;if(r.startsWith(`.`)||this.dotglob){let e=n.some(e=>e.name===`.`),t=n.some(e=>e.name===`..`);e||s.push({name:`.`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}),t||s.push({name:`..`,isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let n of s)if(!(n.name.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n.name,r)){let r=e===`/`?`/${n.name}`:`${e}/${n.name}`,a;a=t===``?n.name:t===`/`?`/${n.name}`:`${t}/${n.name}`,i.length===0?o.push(Promise.resolve([a])):n.isDirectory&&o.push(this.expandSegments(r,a,i))}let l=await Promise.all(o);for(let e of l)a.push(...e)}else{this.checkOpsLimit();let n=await this.fs.readdir(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;(r.startsWith(`.`)||this.dotglob)&&(n.includes(`.`)||s.push(`.`),n.includes(`..`)||s.push(`..`));for(let n of s)if(!(n.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n,r)){let r=e===`/`?`/${n}`:`${e}/${n}`,a;a=t===``?n:t===`/`?`/${n}`:`${t}/${n}`,i.length===0?o.push(Promise.resolve([a])):o.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory)return this.expandSegments(r,a,i)}catch(e){if(e instanceof b)throw e}return[]})())}let l=await Promise.all(o);for(let e of l)a.push(...e)}}catch(e){if(e instanceof b)throw e}return a}async expandRecursive(e){let t=[],n=e.indexOf(`**`),r=e.slice(0,n).replace(/\/$/,``)||`.`,i=e.slice(n+2).replace(/^\//,``);return i.includes(`**`)&&this.isGlobstarValid(i)?(await this.walkDirectoryMultiGlobstar(r,i,t),[...new Set(t)].sort()):(await this.walkDirectory(r,i,t),t.sort())}async walkDirectoryMultiGlobstar(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(r):null;if(i){let r=[];for(let t of i){let n=e===`.`?t.name:`${e}/${t.name}`;t.isDirectory&&r.push(n)}let a=e===`.`?t:`${e}/${t}`,o=await this.expandRecursive(a);n.push(...o);for(let e=0;e<r.length;e+=100){let i=r.slice(e,e+100);await Promise.all(i.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t of i){let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory&&a.push(n)}catch(e){if(e instanceof b)throw e}}let o=e===`.`?t:`${e}/${t}`,s=await this.expandRecursive(o);n.push(...s);for(let e=0;e<a.length;e+=100){let r=a.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}}catch(e){if(e instanceof b)throw e}}async walkDirectory(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(r),a=[],o=[];for(let n of i){let r=e===`.`?n.name:`${e}/${n.name}`;n.isDirectory?o.push(r):t&&this.matchPattern(n.name,t)&&a.push(r)}n.push(...a);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t=0;t<i.length;t+=100){let n=i.slice(t,t+100),r=await Promise.all(n.map(async t=>{let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{return this.checkOpsLimit(),{name:t,path:n,isDirectory:(await this.fs.stat(r)).isDirectory}}catch(e){if(e instanceof b)throw e;return null}}));a.push(...r.filter(e=>e!==null))}for(let e of a)!e.isDirectory&&t&&this.matchPattern(e.name,t)&&n.push(e.path);let o=a.filter(e=>e.isDirectory);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e.path,t,n)))}}}catch(e){if(e instanceof b)throw e}}matchPattern(e,t){return this.patternToRegex(t).test(e)}patternToRegex(e){return M(`^${this.patternToRegexStr(e)}$`)}patternToRegexStr(e){let t=``,n=!1;for(let r=0;r<e.length;r++){if(e.slice(r,r+13)===`\0QUOTE_START\0`){n=!0,r+=12;continue}if(e.slice(r,r+11)===`\0QUOTE_END\0`){n=!1,r+=10;continue}let i=e[r];if(n){/[.+^${}()|\\*?[\]]/.test(i)?t+=`\\${i}`:t+=i;continue}if(this.extglob&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let n=If(e,r+1);if(n!==-1){let a=Lf(e.slice(r+2,n)),o=a.map(e=>this.patternToRegexStr(e)),s=o.length>0?o.join(`|`):`(?:)`;if(i===`@`)t+=`(?:${s})`;else if(i===`*`)t+=`(?:${s})*`;else if(i===`+`)t+=`(?:${s})+`;else if(i===`?`)t+=`(?:${s})?`;else if(i===`!`)if(n<e.length-1){let e=a.map(e=>this.computePatternLength(e));if(e.every(e=>e!==null)&&e.every(t=>t===e[0])&&e[0]!==null){let n=e[0];if(n===0)t+=`(?:.+)`;else{let e=[];n>0&&e.push(`.{0,${n-1}}`),e.push(`.{${n+1},}`),e.push(`(?!(?:${s})).{${n}}`),t+=`(?:${e.join(`|`)})`}}else t+=`(?:(?!(?:${s})).)*?`}else t+=`(?!(?:${s})$).*`;r=n;continue}}if(i===`*`)t+=`.*`;else if(i===`?`)t+=`.`;else if(i===`[`){let n=r+1,i=`[`;n<e.length&&(e[n]===`^`||e[n]===`!`)&&(i+=`^`,n++),n<e.length&&e[n]===`]`&&(i+=`\\]`,n++);let a=n;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=n;for(;n<e.length&&e[n]!==`]`;){if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){let r=Nf(e.slice(n+2,t));i+=r,n=t+2;continue}}if(e[n]===`\\`&&n+1<e.length){i+=`\\${e[n+1]}`,n+=2;continue}if(e[n]===`-`){let e=n===o,t=n+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[n];n++}i+=`]`,t+=i,r=n}else if(i===`\\`&&r+1<e.length){let n=e[r+1];/[.+^${}()|\\*?[\]]/.test(n)?t+=`\\${n}`:t+=n,r++}else/[.+^${}()|]/.test(i)?t+=`\\${i}`:t+=i}return t}computePatternLength(e){let t=0,n=0,r=!1;for(;n<e.length;){if(e.slice(n,n+13)===`\0QUOTE_START\0`){r=!0,n+=13;continue}if(e.slice(n,n+11)===`\0QUOTE_END\0`){r=!1,n+=11;continue}let i=e[n];if(r){t+=1,n++;continue}if((i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&n+1<e.length&&e[n+1]===`(`){let r=If(e,n+1);if(r!==-1){if(i===`@`){let i=Lf(e.slice(n+2,r)).map(e=>this.computePatternLength(e));if(i.every(e=>e!==null)&&i.every(e=>e===i[0])){t+=i[0],n=r+1;continue}return null}return null}}if(i===`*`)return null;if(i===`?`){t+=1,n++;continue}if(i===`[`){let r=e.indexOf(`]`,n+1);if(r!==-1){t+=1,n=r+1;continue}t+=1,n++;continue}if(i===`\\`){t+=1,n+=2;continue}t+=1,n++}return t}}});function Uf(e){for(let t=0;t<e.length;t++){if(e[t]===`\\`){t++;continue}if(e[t]===`$`){let n=e[t+1];if(n===`{`||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function Wf(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n)return!1;for(let e of n)if(e.type===`DoubleQuoted`||e.type===`SingleQuoted`)return!0;return!1}function Gf(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n||n.length===0)return!1;for(let e of n)if(e.type!==`DoubleQuoted`&&e.type!==`SingleQuoted`)return!1;return!0}function Kf(e){let t=!1,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1;for(let c of e){if((c.type===`SingleQuoted`||c.type===`DoubleQuoted`)&&(t=!0,c.type===`DoubleQuoted`))for(let e of c.parts)e.type===`ParameterExpansion`&&(e.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!e.operation||e.operation.type===`PatternRemoval`||e.operation.type===`PatternReplacement`)&&(i=!0),(e.operation?.type===`VarNamePrefix`||e.operation?.type===`ArrayKeys`)&&(o=!0),e.operation?.type===`Indirection`&&(s=!0));c.type===`CommandSubstitution`&&(n=!0),c.type===`ParameterExpansion`&&(a=!0,(c.parameter===`@`||c.parameter===`*`)&&(r=!0),Wf(c)&&(t=!0),(c.operation?.type===`VarNamePrefix`||c.operation?.type===`ArrayKeys`)&&(o=!0),c.operation?.type===`Indirection`&&(s=!0)),c.type===`Glob`&&Uf(c.pattern)&&(a=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:i,hasParamExpansion:a,hasVarNamePrefixExpansion:o,hasIndirection:s}}var qf=g(()=>{});function Jf(e,t){let n=`${t}_`,r=[];for(let t of e.state.env.keys())if(t.startsWith(n)){let e=t.slice(n.length),i=Number.parseInt(e,10);!Number.isNaN(i)&&String(i)===e&&r.push(i)}return r.sort((e,t)=>e-t)}function Yf(e,t){let n=`${t}_`,r=`${t}__length`,i=[];for(let t of e.state.env.keys())if(t!==r&&t.startsWith(n)){let e=t.slice(n.length);if(e.startsWith(`_length`))continue;i.push(e)}return i.sort()}function Xf(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}var Zf=g(()=>{});function Qf(e){return e.get(`IFS`)??`
203
+ `||l&&e===`}`,r=o?`*?[]\\`.includes(e):`*?[]\\(){}.^+`.includes(e);n?f+=e:r?(p(),u.push(U.escaped(e))):f+=`\\${e}`,d+=2;continue}if(n===`'`&&!o&&!a){p();let e=t.indexOf(`'`,d+1);if(e===-1){f+=t.slice(d);break}u.push(U.singleQuoted(t.slice(d+1,e))),d=e+1;continue}if(n===`"`&&!a){p();let{part:n,endIndex:r}=kf(e,t,d+1);u.push(n),d=r+1;continue}if(n===`$`&&t[d+1]===`'`){p();let{part:n,endIndex:r}=zd(e,t,d+2);u.push(n),d=r;continue}if(n===`$`){p();let{part:n,endIndex:r}=Df(e,t,d);n&&u.push(n),d=r;continue}if(n==="`"){p();let{part:n,endIndex:r}=e.parseBacktickSubstitution(t,d);u.push(n),d=r;continue}if(n===`~`){let n=d>0?t[d-1]:``;if(d===0||n===`=`||i&&n===`:`){let n=Nd(e,t,d),r=t[n];if(r===void 0||r===`/`||r===`:`){p();let e=t.slice(d+1,n)||null;u.push({type:`TildeExpansion`,user:e}),d=n;continue}}}if(`@*+?!`.includes(n)&&d+1<t.length&&t[d+1]===`(`){let e=Cf(t,d+1);if(e!==-1){p();let n=t.slice(d,e+1);u.push({type:`Glob`,pattern:n}),d=e+1;continue}}if(n===`*`||n===`?`||n===`[`){p();let{pattern:n,endIndex:r}=Ld(e,t,d);u.push({type:`Glob`,pattern:n}),d=r;continue}if(n===`{`&&!i&&!s&&!a){let n=Hd(e,t,d,Af);if(n){p(),u.push(n.part),d=n.endIndex;continue}}f+=n,d++}return p(),u}var jf=g(()=>{ku(),jd(),nd(),Gd()}),Mf,K=g(()=>{ku(),jd(),$d(),uf(),xf(),jf(),qu(),Fu(),nd(),nd(),Mf=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input=``;getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>Xu)throw new td(`Maximum parse iterations exceeded (possible infinite loop)`,this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>Zu)throw new td(`Maximum parser nesting depth exceeded (${Zu})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(e,t){if(e.length>Ju)throw new td(`Input too large: ${e.length} bytes exceeds limit of ${Ju}`,1,1);this._input=e;let n=new Ku(e,t);if(this.tokens=n.tokenize(),this.tokens.length>Yu)throw new td(`Too many tokens: ${this.tokens.length} exceeds limit of ${Yu}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(e){return this.tokens=e,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(e=0){return this.tokens[this.pos+e]||this.tokens[this.tokens.length-1]}advance(){let e=this.current();return this.pos<this.tokens.length-1&&this.pos++,e}getPos(){return this.pos}check(e,t,n,r,...i){let a=this.tokens[this.pos]?.type;return a===e||t!==void 0&&a===t||n!==void 0&&a===n||r!==void 0&&a===r||i.length>0&&i.includes(a)}expect(e,t){if(this.check(e))return this.advance();let n=this.current();throw new td(t||`Expected ${e}, got ${n.type}`,n.line,n.column,n)}error(e){let t=this.current();throw new td(e,t.line,t.column,t)}skipNewlines(){for(;this.check(W.NEWLINE,W.COMMENT);)this.check(W.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(e=!0){for(;;){if(this.check(W.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(W.SEMICOLON,W.COMMENT)){this.advance();continue}if(e&&this.check(W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(e,t,n,r){this.pendingHeredocs.push({redirect:e,delimiter:t,stripTabs:n,quoted:r})}processHeredocs(){for(let e of this.pendingHeredocs)if(this.check(W.HEREDOC_CONTENT)){let t=this.advance(),n;n=e.quoted?U.word([U.literal(t.value)]):this.parseWordFromString(t.value,!1,!1,!1,!0),e.redirect.target=U.hereDoc(e.delimiter,n,e.stripTabs,e.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(W.EOF,W.NEWLINE,W.SEMICOLON,W.AMP,W.AND_AND,W.OR_OR,W.RPAREN,W.RBRACE,W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)}isCommandStart(){let e=this.current().type;return e===W.WORD||e===W.NAME||e===W.NUMBER||e===W.ASSIGNMENT_WORD||e===W.IF||e===W.FOR||e===W.WHILE||e===W.UNTIL||e===W.CASE||e===W.LPAREN||e===W.LBRACE||e===W.DPAREN_START||e===W.DBRACK_START||e===W.FUNCTION||e===W.BANG||e===W.TIME||e===W.IN||e===W.LESS||e===W.GREAT||e===W.DLESS||e===W.DGREAT||e===W.LESSAND||e===W.GREATAND||e===W.LESSGREAT||e===W.DLESSDASH||e===W.CLOBBER||e===W.TLESS||e===W.AND_GREAT||e===W.AND_DGREAT}parseScript(){let e=[],t=0;for(this.skipNewlines();!this.check(W.EOF);){t++,t>1e4&&this.error(`Parser stuck: too many iterations (>10000)`);let n=this.checkUnexpectedToken();if(n){e.push(n),this.skipSeparators(!1);continue}let r=this.pos,i=this.parseStatement();i&&e.push(i),this.skipSeparators(!1),this.check(W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===r&&!this.check(W.EOF)&&this.advance()}return U.script(e)}checkUnexpectedToken(){let e=this.current().type,t=this.current().value;if((e===W.DO||e===W.DONE||e===W.THEN||e===W.ELSE||e===W.ELIF||e===W.FI||e===W.ESAC)&&this.error(`syntax error near unexpected token \`${t}'`),e===W.RBRACE||e===W.RPAREN){let e=`syntax error near unexpected token \`${t}'`;return this.advance(),U.statement([U.pipeline([U.simpleCommand(null,[],[],[])])],[],!1,{message:e,token:t})}return(e===W.DSEMI||e===W.SEMI_AND||e===W.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${t}'`),e===W.SEMICOLON&&this.error(`syntax error near unexpected token \`${t}'`),(e===W.PIPE||e===W.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${t}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let e=this.current().start,t=[],n=[],r=!1,i=this.parsePipeline();for(t.push(i);this.check(W.AND_AND,W.OR_OR);){let e=this.advance();n.push(e.type===W.AND_AND?`&&`:`||`),this.skipNewlines();let r=this.parsePipeline();t.push(r)}this.check(W.AMP)&&(this.advance(),r=!0);let a=this.pos>0?this.tokens[this.pos-1].end:e,o=this._input.slice(e,a);return U.statement(t,n,r,void 0,o)}parsePipeline(){let e=!1,t=!1;this.check(W.TIME)&&(this.advance(),e=!0,this.check(W.WORD,W.NAME)&&this.current().value===`-p`&&(this.advance(),t=!0));let n=0;for(;this.check(W.BANG);)this.advance(),n++;let r=n%2==1,i=[],a=[],o=this.parseCommand();for(i.push(o);this.check(W.PIPE,W.PIPE_AMP);){let e=this.advance();this.skipNewlines(),a.push(e.type===W.PIPE_AMP);let t=this.parseCommand();i.push(t)}return U.pipeline(i,r,e,t,a.length>0?a:void 0)}parseCommand(){return this.check(W.IF)?ef(this):this.check(W.FOR)?tf(this):this.check(W.WHILE)?rf(this):this.check(W.UNTIL)?af(this):this.check(W.CASE)?of(this):this.check(W.LPAREN)?cf(this):this.check(W.LBRACE)?lf(this):this.check(W.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(W.DBRACK_START)?this.parseConditionalCommand():this.check(W.FUNCTION)||this.check(W.NAME,W.WORD)&&this.peek(1).type===W.LPAREN&&this.peek(2).type===W.RPAREN?this.parseFunctionDef():Yd(this)}dparenClosesWithSpacedParens(){let e=1,t=1;for(;t<this.tokens.length-this.pos;){let n=this.peek(t);if(n.type===W.EOF)return!1;if(n.type===W.DPAREN_START||n.type===W.LPAREN)e++;else if(n.type===W.DPAREN_END){if(e-=2,e<=0)return!1}else if(n.type===W.RPAREN&&(e--,e===0&&this.peek(t+1).type===W.RPAREN))return!0;t++}return!1}parseNestedSubshellsFromDparen(){this.advance();let e=this.parseCompoundList();this.expect(W.RPAREN),this.expect(W.RPAREN);let t=this.parseOptionalRedirections(),n=U.subshell(e,[]);return U.subshell([U.statement([U.pipeline([n],!1,!1,!1)])],t)}isWord(){let e=this.current().type;return e===W.WORD||e===W.NAME||e===W.NUMBER||e===W.IF||e===W.FOR||e===W.WHILE||e===W.UNTIL||e===W.CASE||e===W.FUNCTION||e===W.ELSE||e===W.ELIF||e===W.FI||e===W.THEN||e===W.DO||e===W.DONE||e===W.ESAC||e===W.IN||e===W.SELECT||e===W.TIME||e===W.COPROC||e===W.BANG}parseWord(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted)}parseWordNoBraceExpansion(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0)}parseWordForRegex(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0,!0)}parseWordFromString(e,t=!1,n=!1,r=!1,i=!1,a=!1,o=!1){let s=Af(this,e,t,n,r,i,!1,a,o);return U.word(s)}parseCommandSubstitution(t,n){return Nu(t,n,()=>new e,e=>this.error(e))}parseBacktickSubstitution(t,n,r=!1){return Pu(t,n,r,()=>new e,e=>this.error(e))}isDollarDparenSubshell(e,t){return Au(e,t)}parseArithmeticExpansion(e,t){let n=t+3,r=1,i=0,a=n;for(;a<e.length-1&&r>0;)e[a]===`$`&&e[a+1]===`(`?e[a+2]===`(`?(r++,a+=3):(i++,a+=2):e[a]===`(`&&e[a+1]===`(`?(r++,a+=2):e[a]===`)`&&e[a+1]===`)`?i>0?(i--,a++):(r--,r>0&&(a+=2)):e[a]===`(`?(i++,a++):(e[a]===`)`&&i>0&&i--,a++);let o=e.slice(n,a),s=this.parseArithmeticExpression(o);return{part:U.arithmeticExpansion(s),endIndex:a+2}}parseArithmeticCommand(){let e=this.expect(W.DPAREN_START),t=``,n=1,r=0,i=!1,a=!1;for(;n>0&&!this.check(W.EOF);){if(i){if(i=!1,r>0){r--,t+=`)`;continue}if(this.check(W.RPAREN)){n--,a=!0,this.advance();continue}if(this.check(W.DPAREN_END)){n--,a=!0;continue}t+=`)`;continue}if(this.check(W.DPAREN_START))n++,t+=`((`,this.advance();else if(this.check(W.DPAREN_END))r>=2?(r-=2,t+=`))`,this.advance()):r===1?(r--,t+=`)`,i=!0,this.advance()):(n--,a=!0,n>0&&(t+=`))`),this.advance());else if(this.check(W.LPAREN))r++,t+=`(`,this.advance();else if(this.check(W.RPAREN))r>0&&r--,t+=`)`,this.advance();else{let e=this.current().value,n=t.length>0?t[t.length-1]:``;t.length>0&&!t.endsWith(` `)&&!(e===`=`&&/[|&^+\-*/%<>]$/.test(t))&&!(e===`<`&&n===`<`)&&!(e===`>`&&n===`>`)&&(t+=` `),t+=e,this.advance()}}a||this.expect(W.DPAREN_END);let o=this.parseArithmeticExpression(t.trim()),s=this.parseOptionalRedirections();return U.arithmeticCommand(o,s,e.line)}parseConditionalCommand(){let e=this.expect(W.DBRACK_START),t=pf(this);this.expect(W.DBRACK_END);let n=this.parseOptionalRedirections();return U.conditionalCommand(t,n,e.line)}parseFunctionDef(){let e;if(this.check(W.FUNCTION)){if(this.advance(),this.check(W.NAME)||this.check(W.WORD))e=this.advance().value;else{let e=this.current();throw new td(`Expected function name`,e.line,e.column,e)}this.check(W.LPAREN)&&(this.advance(),this.expect(W.RPAREN))}else e=this.advance().value,e.includes(`$`)&&this.error(`\`${e}': not a valid identifier`),this.expect(W.LPAREN),this.expect(W.RPAREN);this.skipNewlines();let t=this.parseCompoundCommandBody({forFunctionBody:!0}),n=this.parseOptionalRedirections();return U.functionDef(e,t,n)}parseCompoundCommandBody(e){let t=e?.forFunctionBody;if(this.check(W.LBRACE))return lf(this,{skipRedirections:t});if(this.check(W.LPAREN))return cf(this,{skipRedirections:t});if(this.check(W.IF))return ef(this,{skipRedirections:t});if(this.check(W.FOR))return tf(this,{skipRedirections:t});if(this.check(W.WHILE))return rf(this,{skipRedirections:t});if(this.check(W.UNTIL))return af(this,{skipRedirections:t});if(this.check(W.CASE))return of(this,{skipRedirections:t});this.error(`Expected compound command for function body`)}parseCompoundList(){let e=this.enterDepth(),t=[];for(this.skipNewlines();!this.check(W.EOF,W.FI,W.ELSE,W.ELIF,W.THEN,W.DO,W.DONE,W.ESAC,W.RPAREN,W.RBRACE,W.DSEMI,W.SEMI_AND,W.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let e=this.pos,n=this.parseStatement();if(n&&t.push(n),this.skipSeparators(),this.pos===e&&!n)break}return e(),t}parseOptionalRedirections(){let e=[];for(;Kd(this);){this.checkIterationLimit();let t=this.pos;if(e.push(qd(this)),this.pos===t)break}return e}parseArithmeticExpression(e){return ud(this,e)}}});function Nf(e){return Rf.get(e)??``}function Pf(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`[`){for(n+=i,r++,r<e.length&&(e[r]===`!`||e[r]===`^`)&&(n+=e[r],r++),r<e.length&&e[r]===`]`&&(n+=e[r],r++);r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){n+=e.slice(r,t+2),r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]===`]`&&(n+=e[r],r++)}else i===`:`?(n!==``&&t.push(n),n=``,r++):i===`\\`&&r+1<e.length?(n+=i+e[r+1],r+=2):(n+=i,r++)}return n!==``&&t.push(n),t}function Ff(e){let t=`^`;for(let n=0;n<e.length;n++){let r=e[n];if(r===`*`)t+=`[^/]*`;else if(r===`?`)t+=`[^/]`;else if(r===`[`){let r=n+1,i=`[`;r<e.length&&(e[r]===`^`||e[r]===`!`)&&(i+=`^`,r++),r<e.length&&e[r]===`]`&&(i+=`\\]`,r++);let a=r;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=r;for(;r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){let n=Nf(e.slice(r+2,t));i+=n,r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){i+=`\\${e[r+1]}`,r+=2;continue}if(e[r]===`-`){let e=r===o,t=r+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[r];r++}i+=`]`,t+=i,n=r}else if(r===`\\`&&n+1<e.length){let r=e[n+1];/[.+^${}()|\\*?[\]]/.test(r)?t+=`\\${r}`:t+=r,n++}else/[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+=`$`,M(t)}function If(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function Lf(e){let t=[],n=``,r=0,i=!1,a=0;for(;a<e.length;){let o=e[a];if(o===`'`&&!i){i=!0,n+=`\0QUOTE_START\0`,a++;continue}if(o===`'`&&i){i=!1,n+=`\0QUOTE_END\0`,a++;continue}if(i){n+=o,a++;continue}if(o===`\\`){n+=o,a+1<e.length?(n+=e[a+1],a+=2):a++;continue}o===`(`?(r++,n+=o):o===`)`?(r--,n+=o):o===`|`&&r===0?(t.push(n),n=``):n+=o,a++}return t.push(n),t}var Rf,zf=g(()=>{ta(),Rf=new Map([[`alnum`,`a-zA-Z0-9`],[`alpha`,`a-zA-Z`],[`ascii`,`\\x00-\\x7F`],[`blank`,` \\t`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`digit`,`0-9`],[`graph`,`!-~`],[`lower`,`a-z`],[`print`,` -~`],[`punct`,"!-/:-@\\[-`{-~"],[`space`,` \\t\\n\\r\\f\\v`],[`upper`,`A-Z`],[`word`,`a-zA-Z0-9_`],[`xdigit`,`0-9a-fA-F`]])}),Bf,Vf,Hf=g(()=>{x(),ta(),tr(),zf(),Bf=5,Vf=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;constructor(e,t,n,r){this.fs=e,this.cwd=t,typeof r==`boolean`?(this.globstar=r,this.maxOps=1e5):r?(this.globstar=r.globstar??!1,this.nullglob=r.nullglob??!1,this.failglob=r.failglob??!1,this.dotglob=r.dotglob??!1,this.extglob=r.extglob??!1,this.globskipdots=r.globskipdots??!0,this.maxOps=r.maxGlobOperations??1e5):this.maxOps=1e5;let i=n?.get(`GLOBIGNORE`);i!==void 0&&i!==``&&(this.hasGlobignore=!0,this.globignorePatterns=Pf(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new b(`Glob operation limit exceeded (${this.maxOps})`,`glob_operations`)}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(e){return!this.hasGlobignore&&!this.globskipdots?e:e.filter(e=>{let t=e.split(`/`).pop()||e;if((this.hasGlobignore||this.globskipdots)&&(t===`.`||t===`..`))return!1;if(this.hasGlobignore){for(let t of this.globignorePatterns)if(this.matchGlobignorePattern(e,t))return!1}return!0})}matchGlobignorePattern(e,t){return Ff(t).test(e)}isGlobPattern(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandArgs(e,t){let n=e.map((e,n)=>(t?.[n]??!1)||!this.isGlobPattern(e)?null:this.expand(e)),r=await Promise.all(n.map(e=>e||Promise.resolve(null))),i=[];for(let t=0;t<e.length;t++){let n=r[t];n===null?i.push(e[t]):n.length>0?i.push(...n):i.push(e[t])}return i}async expand(e){if(this.globstar){let t=e.split(`/`),n=0;for(let e of t)if(e===`**`&&(n++,n>Bf))throw new b(`Glob pattern has too many ** segments (max ${Bf})`,`glob_operations`)}let t;if(e.includes(`**`)&&this.globstar&&this.isGlobstarValid(e))t=await this.expandRecursive(e);else{let n=e.replace(/\*\*+/g,`*`);t=await this.expandSimple(n)}return this.filterGlobignore(t)}isGlobstarValid(e){let t=e.split(`/`);for(let e of t)if(e.includes(`**`)&&e!==`**`)return!1;return!0}hasGlobChars(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandSimple(e){let t=e.startsWith(`/`),n=e.split(`/`).filter(e=>e!==``),r=-1;for(let e=0;e<n.length;e++)if(this.hasGlobChars(n[e])){r=e;break}if(r===-1)return[e];let i,a;if(r===0)t?(i=`/`,a=`/`):(i=this.cwd,a=``);else{let e=n.slice(0,r);t?(i=`/${e.join(`/`)}`,a=`/${e.join(`/`)}`):(i=this.fs.resolvePath(this.cwd,e.join(`/`)),a=e.join(`/`))}let o=n.slice(r);return(await this.expandSegments(i,a,o)).sort()}async expandSegments(e,t,n){if(this.checkOpsLimit(),n.length===0)return[t];let[r,...i]=n,a=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let n=await this.fs.readdirWithFileTypes(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;if(r.startsWith(`.`)||this.dotglob){let e=n.some(e=>e.name===`.`),t=n.some(e=>e.name===`..`);e||s.push({name:`.`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}),t||s.push({name:`..`,isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let n of s)if(!(n.name.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n.name,r)){let r=e===`/`?`/${n.name}`:`${e}/${n.name}`,a;a=t===``?n.name:t===`/`?`/${n.name}`:`${t}/${n.name}`,i.length===0?o.push(Promise.resolve([a])):n.isDirectory&&o.push(this.expandSegments(r,a,i))}let l=await Promise.all(o);for(let e of l)a.push(...e)}else{this.checkOpsLimit();let n=await this.fs.readdir(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;(r.startsWith(`.`)||this.dotglob)&&(n.includes(`.`)||s.push(`.`),n.includes(`..`)||s.push(`..`));for(let n of s)if(!(n.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n,r)){let r=e===`/`?`/${n}`:`${e}/${n}`,a;a=t===``?n:t===`/`?`/${n}`:`${t}/${n}`,i.length===0?o.push(Promise.resolve([a])):o.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory)return this.expandSegments(r,a,i)}catch(e){if(e instanceof b)throw e}return[]})())}let l=await Promise.all(o);for(let e of l)a.push(...e)}}catch(e){if(e instanceof b)throw e}return a}async expandRecursive(e){let t=[],n=e.indexOf(`**`),r=e.slice(0,n).replace(/\/$/,``)||`.`,i=e.slice(n+2).replace(/^\//,``);return i.includes(`**`)&&this.isGlobstarValid(i)?(await this.walkDirectoryMultiGlobstar(r,i,t),[...new Set(t)].sort()):(await this.walkDirectory(r,i,t),t.sort())}async walkDirectoryMultiGlobstar(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(r):null;if(i){let r=[];for(let t of i){let n=e===`.`?t.name:`${e}/${t.name}`;t.isDirectory&&r.push(n)}let a=e===`.`?t:`${e}/${t}`,o=await this.expandRecursive(a);n.push(...o);for(let e=0;e<r.length;e+=100){let i=r.slice(e,e+100);await Promise.all(i.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t of i){let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory&&a.push(n)}catch(e){if(e instanceof b)throw e}}let o=e===`.`?t:`${e}/${t}`,s=await this.expandRecursive(o);n.push(...s);for(let e=0;e<a.length;e+=100){let r=a.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}}catch(e){if(e instanceof b)throw e}}async walkDirectory(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(r),a=[],o=[];for(let n of i){let r=e===`.`?n.name:`${e}/${n.name}`;n.isDirectory?o.push(r):t&&this.matchPattern(n.name,t)&&a.push(r)}n.push(...a);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t=0;t<i.length;t+=100){let n=i.slice(t,t+100),r=await Promise.all(n.map(async t=>{let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{return this.checkOpsLimit(),{name:t,path:n,isDirectory:(await this.fs.stat(r)).isDirectory}}catch(e){if(e instanceof b)throw e;return null}}));a.push(...r.filter(e=>e!==null))}for(let e of a)!e.isDirectory&&t&&this.matchPattern(e.name,t)&&n.push(e.path);let o=a.filter(e=>e.isDirectory);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e.path,t,n)))}}}catch(e){if(e instanceof b)throw e}}matchPattern(e,t){return this.patternToRegex(t).test(e)}patternToRegex(e){return M(`^${this.patternToRegexStr(e)}$`)}patternToRegexStr(e){let t=``,n=!1;for(let r=0;r<e.length;r++){if(e.slice(r,r+13)===`\0QUOTE_START\0`){n=!0,r+=12;continue}if(e.slice(r,r+11)===`\0QUOTE_END\0`){n=!1,r+=10;continue}let i=e[r];if(n){/[.+^${}()|\\*?[\]]/.test(i)?t+=`\\${i}`:t+=i;continue}if(this.extglob&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let n=If(e,r+1);if(n!==-1){let a=Lf(e.slice(r+2,n)),o=a.map(e=>this.patternToRegexStr(e)),s=o.length>0?o.join(`|`):`(?:)`;if(i===`@`)t+=`(?:${s})`;else if(i===`*`)t+=`(?:${s})*`;else if(i===`+`)t+=`(?:${s})+`;else if(i===`?`)t+=`(?:${s})?`;else if(i===`!`)if(n<e.length-1){let e=a.map(e=>this.computePatternLength(e));if(e.every(e=>e!==null)&&e.every(t=>t===e[0])&&e[0]!==null){let n=e[0];if(n===0)t+=`(?:.+)`;else{let e=[];n>0&&e.push(`.{0,${n-1}}`),e.push(`.{${n+1},}`),e.push(`(?!(?:${s})).{${n}}`),t+=`(?:${e.join(`|`)})`}}else t+=`(?:(?!(?:${s})).)*?`}else t+=`(?!(?:${s})$).*`;r=n;continue}}if(i===`*`)t+=`.*`;else if(i===`?`)t+=`.`;else if(i===`[`){let n=r+1,i=`[`;n<e.length&&(e[n]===`^`||e[n]===`!`)&&(i+=`^`,n++),n<e.length&&e[n]===`]`&&(i+=`\\]`,n++);let a=n;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=n;for(;n<e.length&&e[n]!==`]`;){if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){let r=Nf(e.slice(n+2,t));i+=r,n=t+2;continue}}if(e[n]===`\\`&&n+1<e.length){i+=`\\${e[n+1]}`,n+=2;continue}if(e[n]===`-`){let e=n===o,t=n+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[n];n++}i+=`]`,t+=i,r=n}else if(i===`\\`&&r+1<e.length){let n=e[r+1];/[.+^${}()|\\*?[\]]/.test(n)?t+=`\\${n}`:t+=n,r++}else/[.+^${}()|]/.test(i)?t+=`\\${i}`:t+=i}return t}computePatternLength(e){let t=0,n=0,r=!1;for(;n<e.length;){if(e.slice(n,n+13)===`\0QUOTE_START\0`){r=!0,n+=13;continue}if(e.slice(n,n+11)===`\0QUOTE_END\0`){r=!1,n+=11;continue}let i=e[n];if(r){t+=1,n++;continue}if((i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&n+1<e.length&&e[n+1]===`(`){let r=If(e,n+1);if(r!==-1){if(i===`@`){let i=Lf(e.slice(n+2,r)).map(e=>this.computePatternLength(e));if(i.every(e=>e!==null)&&i.every(e=>e===i[0])){t+=i[0],n=r+1;continue}return null}return null}}if(i===`*`)return null;if(i===`?`){t+=1,n++;continue}if(i===`[`){let r=e.indexOf(`]`,n+1);if(r!==-1){t+=1,n=r+1;continue}t+=1,n++;continue}if(i===`\\`){t+=1,n+=2;continue}t+=1,n++}return t}}});function Uf(e){for(let t=0;t<e.length;t++){if(e[t]===`\\`){t++;continue}if(e[t]===`$`){let n=e[t+1];if(n===`{`||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function Wf(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n)return!1;for(let e of n)if(e.type===`DoubleQuoted`||e.type===`SingleQuoted`)return!0;return!1}function Gf(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n||n.length===0)return!1;for(let e of n)if(e.type!==`DoubleQuoted`&&e.type!==`SingleQuoted`)return!1;return!0}function Kf(e){let t=!1,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1;for(let c of e){if((c.type===`SingleQuoted`||c.type===`DoubleQuoted`)&&(t=!0,c.type===`DoubleQuoted`))for(let e of c.parts)e.type===`ParameterExpansion`&&(e.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!e.operation||e.operation.type===`PatternRemoval`||e.operation.type===`PatternReplacement`)&&(i=!0),(e.operation?.type===`VarNamePrefix`||e.operation?.type===`ArrayKeys`)&&(o=!0),e.operation?.type===`Indirection`&&(s=!0));c.type===`CommandSubstitution`&&(n=!0),c.type===`ParameterExpansion`&&(a=!0,(c.parameter===`@`||c.parameter===`*`)&&(r=!0),Wf(c)&&(t=!0),(c.operation?.type===`VarNamePrefix`||c.operation?.type===`ArrayKeys`)&&(o=!0),c.operation?.type===`Indirection`&&(s=!0)),c.type===`Glob`&&Uf(c.pattern)&&(a=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:i,hasParamExpansion:a,hasVarNamePrefixExpansion:o,hasIndirection:s}}var qf=g(()=>{});function Jf(e,t){let n=`${t}_`,r=[];for(let t of e.state.env.keys())if(t.startsWith(n)){let e=t.slice(n.length),i=Number.parseInt(e,10);!Number.isNaN(i)&&String(i)===e&&r.push(i)}return r.sort((e,t)=>e-t)}function Yf(e,t){let n=`${t}_`,r=`${t}__length`,i=[];for(let t of e.state.env.keys())if(t!==r&&t.startsWith(n)){let e=t.slice(n.length);if(e.startsWith(`_length`))continue;i.push(e)}return i.sort()}function Xf(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}var Zf=g(()=>{});function Qf(e){return e.get(`IFS`)??`
204
204
  `}function $f(e){return e.get(`IFS`)===``}function ep(e){let t=Qf(e);if(t===``)return!0;for(let e of t)if(e!==` `&&e!==` `&&e!==`
205
205
  `)return!1;return!0}function tp(e){let t=!1,n=[];for(let r of e.split(``))r===`-`?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===` `?n.push(`\\t`):r===`
206
206
  `?n.push(`\\n`):n.push(r);return t&&n.push(`\\-`),n.join(``)}function q(e){let t=e.get(`IFS`);return t===void 0?` `:t[0]||``}function np(e){return ap.includes(e)}function rp(e){let t=new Set,n=new Set;for(let r of e)np(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function ip(e,t){if(t===``)return{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e===``)return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:n,nonWhitespace:r}=rp(t),i=[],a=0,o=!1,s=!1,c=a;for(;a<e.length&&n.has(e[a]);)a++;if(a>c&&(o=!0),a>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(r.has(e[a]))for(i.push(``),a++;a<e.length&&n.has(e[a]);)a++;for(;a<e.length;){let t=a;for(;a<e.length;){let t=e[a];if(n.has(t)||r.has(t))break;a++}if(i.push(e.substring(t,a)),a>=e.length){s=!1;break}let o=a;for(;a<e.length&&n.has(e[a]);)a++;if(a<e.length&&r.has(e[a])){for(a++;a<e.length&&n.has(e[a]);)a++;for(;a<e.length&&r.has(e[a]);)for(i.push(``),a++;a<e.length&&n.has(e[a]);)a++}a>=e.length&&a>o&&(s=!0)}return{words:i,hadLeadingDelimiter:o,hadTrailingDelimiter:s}}function J(e,t){return ip(e,t).words}var ap,op=g(()=>{ap=`
207
207
  `});function sp(e,t){return e.state.namerefs?.has(t)??!1}function cp(e,t){return e.state.invalidNamerefs?.has(t)??!1}function lp(e,t,n=100){if(!sp(e,t)||cp(e,t))return t;let r=new Set,i=t;for(;n-->0;){if(r.has(i))return;if(r.add(i),!sp(e,i))return i;let t=e.state.env.get(i);if(t===void 0||t===``||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(t))return i;i=t}}function up(e,t){if(sp(e,t))return e.state.env.get(t)}var dp=g(()=>{});function fp(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(t,n)=>e.state.env.get(n)??``);return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,n)=>e.state.env.get(n)??``),n}function Y(e,t){return t===`FUNCNAME`?(e.state.funcNameStack??[]).map((e,t)=>[t,e]):t===`BASH_LINENO`?(e.state.callLineStack??[]).map((e,t)=>[t,String(e)]):t===`BASH_SOURCE`?(e.state.sourceStack??[]).map((e,t)=>[t,e]):e.state.associativeArrays?.has(t)?Yf(e,t).map(n=>[n,e.state.env.get(`${t}_${n}`)??``]):Jf(e,t).map(n=>[n,e.state.env.get(`${t}_${n}`)??``])}function pp(e,t){return t===`FUNCNAME`?(e.state.funcNameStack?.length??0)>0:t===`BASH_LINENO`?(e.state.callLineStack?.length??0)>0:t===`BASH_SOURCE`?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?Yf(e,t).length>0:Jf(e,t).length>0}async function X(e,t,n=!0,r=!1){switch(t){case`?`:return String(e.state.lastExitCode);case`$`:return String(e.state.virtualPid);case`#`:return e.state.env.get(`#`)||`0`;case`@`:return e.state.env.get(`@`)||``;case`_`:return e.state.lastArg;case`-`:{let t=``;return t+=`h`,e.state.options.errexit&&(t+=`e`),e.state.options.noglob&&(t+=`f`),e.state.options.nounset&&(t+=`u`),e.state.options.verbose&&(t+=`v`),e.state.options.xtrace&&(t+=`x`),t+=`B`,e.state.options.noclobber&&(t+=`C`),t+=`s`,t}case`*`:{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(t===0)return``;let n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return n.join(q(e.state.env))}case`0`:return e.state.env.get(`0`)||`bash`;case`PWD`:return e.state.env.get(`PWD`)??``;case`OLDPWD`:return e.state.env.get(`OLDPWD`)??``;case`PPID`:return String(e.state.virtualPpid);case`UID`:return String(e.state.virtualUid);case`EUID`:return String(e.state.virtualUid);case`RANDOM`:return String(Math.floor(Math.random()*32768));case`SECONDS`:return String(Math.floor((Date.now()-e.state.startTime)/1e3));case`BASH_VERSION`:return Du;case`!`:return String(e.state.lastBackgroundPid);case`BASHPID`:return String(e.state.bashPid);case`LINENO`:return String(e.state.currentLine);case`FUNCNAME`:{let t=e.state.funcNameStack?.[0];if(t!==void 0)return t;if(n&&e.state.options.nounset)throw new ar(`FUNCNAME`);return``}case`BASH_LINENO`:{let t=e.state.callLineStack?.[0];if(t!==void 0)return String(t);if(n&&e.state.options.nounset)throw new ar(`BASH_LINENO`);return``}case`BASH_SOURCE`:{let t=e.state.sourceStack?.[0];if(t!==void 0)return t;if(n&&e.state.options.nounset)throw new ar(`BASH_SOURCE`);return``}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new cr(`\${${t}}`);let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let t=i[1],r=i[2];if(sp(e,t)){let n=lp(e,t);if(n&&n!==t){if(n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return``;t=n}}if(r===`@`||r===`*`){let n=Y(e,t);if(n.length>0)return n.map(([,e])=>e).join(` `);let r=e.state.env.get(t);return r===void 0?``:r}if(t===`FUNCNAME`){let t=Number.parseInt(r,10);return!Number.isNaN(t)&&t>=0?e.state.funcNameStack?.[t]??``:``}if(t===`BASH_LINENO`){let t=Number.parseInt(r,10);if(!Number.isNaN(t)&&t>=0){let n=e.state.callLineStack?.[t];return n===void 0?``:String(n)}return``}if(t===`BASH_SOURCE`){let t=Number.parseInt(r,10);return!Number.isNaN(t)&&t>=0?e.state.sourceStack?.[t]??``:``}if(e.state.associativeArrays?.has(t)){let i=Xf(r);i=fp(e,i);let a=e.state.env.get(`${t}_${i}`);if(a===void 0&&n&&e.state.options.nounset)throw new ar(`${t}[${r}]`);return a||``}let a;if(/^-?\d+$/.test(r))a=Number.parseInt(r,10);else try{a=await $(e,ud(new Mf,r).expression)}catch{let t=e.state.env.get(r);a=t?Number.parseInt(t,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let n=Y(e,t),r=e.state.currentLine;if(n.length===0)return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${r}: ${t}: bad array subscript
208
208
  `,``;let i=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1+a;return i<0?(e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${r}: ${t}: bad array subscript
209
- `,``):e.state.env.get(`${t}_${i}`)||``}let o=e.state.env.get(`${t}_${a}`);if(o!==void 0)return o;if(a===0){let n=e.state.env.get(t);if(n!==void 0)return n}if(n&&e.state.options.nounset)throw new ar(`${t}[${a}]`);return``}if(/^[1-9][0-9]*$/.test(t)){let r=e.state.env.get(t);if(r===void 0&&n&&e.state.options.nounset)throw new ar(t);return r||``}if(sp(e,t)){let i=lp(e,t);if(i===void 0)return``;if(i!==t)return await X(e,i,n,r);let a=e.state.env.get(t);if((a===void 0||a===``)&&n&&e.state.options.nounset)throw new ar(t);return a||``}let a=e.state.env.get(t);if(a!==void 0)return e.state.tempEnvBindings?.some(e=>e.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),a;if(pp(e,t)){let n=e.state.env.get(`${t}_0`);return n===void 0?``:n}if(n&&e.state.options.nounset)throw new ar(t);return``}async function mp(e,t){if(new Set([`?`,`$`,`#`,`_`,`-`,`0`,`PPID`,`UID`,`EUID`,`RANDOM`,`SECONDS`,`BASH_VERSION`,`!`,`BASHPID`,`LINENO`]).has(t))return!0;if(t===`@`||t===`*`)return Number.parseInt(e.state.env.get(`#`)||`0`,10)>0;if(t===`PWD`||t===`OLDPWD`)return e.state.env.has(t);let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=n[2];if(sp(e,t)){let n=lp(e,t);if(n&&n!==t){if(n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;t=n}}if(r===`@`||r===`*`)return Y(e,t).length>0?!0:e.state.env.has(t);if(e.state.associativeArrays?.has(t)){let n=Xf(r);return e.state.env.has(`${t}_${n}`)}let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else try{i=await $(e,ud(new Mf,r).expression)}catch{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0,Number.isNaN(i)&&(i=0)}if(i<0){let n=Y(e,t);if(n.length===0)return!1;let r=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1+i;return r<0?!1:e.state.env.has(`${t}_${r}`)}return e.state.env.has(`${t}_${i}`)}if(sp(e,t)){let n=lp(e,t);return n===void 0||n===t?e.state.env.has(t):mp(e,n)}return!!(e.state.env.has(t)||pp(e,t))}var hp=g(()=>{jd(),K(),Ou(),sg(),x(),Zf(),op(),dp()});async function gp(e,t){let n=``,r=0;for(;r<t.length;){if(t[r]===`$`){if(t[r+1]===`{`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`{`?e++:t[i]===`}`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]===`(`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`(`?e++:t[i]===`)`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await X(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[0-9]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[0-9]/.test(t[i]);)i++;let a=await X(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[*@#?\-!$]/.test(t[r+1]||``)){let i=t[r+1],a=await X(e,i);n+=a,r+=2;continue}}if(t[r]===`"`){for(n+=`"`,r++;r<t.length&&t[r]!==`"`;)if(t[r]===`$`&&/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await X(e,t.slice(r+1,i));n+=a,r=i}else t[r]===`\\`?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+=`"`,r++);continue}n+=t[r],r++}return n}async function _p(e,t){let n=t,r=t.startsWith(`"`)&&t.endsWith(`"`),i=t.startsWith(`'`)&&t.endsWith(`'`);if((r||i)&&(n=t.slice(1,-1)),i)return n;let a=``,o=0;for(;o<n.length;)if(n[o]===`$`)if(n[o+1]===`(`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`(`&&n[r-1]===`$`||n[r]===`(`?t++:n[r]===`)`&&t--,r++;let i=n.slice(o+2,r-1);if(e.execFn){let t=await e.execFn(i,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=r}else if(n[o+1]===`{`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`{`?t++:n[r]===`}`&&t--,r++;let i=await X(e,n.slice(o+2,r-1));a+=i,o=r}else if(/[a-zA-Z_]/.test(n[o+1]||``)){let t=o+1;for(;t<n.length&&/[a-zA-Z0-9_]/.test(n[t]);)t++;let r=await X(e,n.slice(o+1,t));a+=r,o=t}else a+=n[o],o++;else if(n[o]==="`"){let t=o+1;for(;t<n.length&&n[t]!=="`";)t++;let r=n.slice(o+1,t);if(e.execFn){let t=await e.execFn(r,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=t+1}else a+=n[o],o++;return a}var vp=g(()=>{hp()});function yp(e,t,n,r,i){let a=n??1;a===0&&(a=1);let o=Math.abs(a),s=[],c=0;r?.match(/^-?0\d/)&&(c=Math.max(c,r.replace(/^-/,``).length)),i?.match(/^-?0\d/)&&(c=Math.max(c,i.replace(/^-/,``).length));let l=e=>{if(c>0){let t=e<0,n=String(Math.abs(e)).padStart(c,`0`);return t?`-${n}`:n}return String(e)};if(e<=t)for(let n=e,r=0;n<=t&&r<Sp;n+=o,r++)s.push(l(n));else for(let n=e,r=0;n>=t&&r<Sp;n-=o,r++)s.push(l(n));return s}function bp(e,t,n){let r=n??1;r===0&&(r=1);let i=e.charCodeAt(0),a=t.charCodeAt(0),o=Math.abs(r);if(e>=`A`&&e<=`Z`&&t>=`a`&&t<=`z`||e>=`a`&&e<=`z`&&t>=`A`&&t<=`Z`){let r=n===void 0?``:`..${n}`;throw new ur(`{${e}..${t}${r}}: invalid sequence`)}let s=[];if(i<=a)for(let e=i,t=0;e<=a&&t<Sp;e+=o,t++)s.push(String.fromCharCode(e));else for(let e=i,t=0;e>=a&&t<Sp;e-=o,t++)s.push(String.fromCharCode(e));return s}function xp(e,t,n,r,i){let a=n===void 0?``:`..${n}`;return typeof e==`number`&&typeof t==`number`?{expanded:yp(e,t,n,r,i),literal:`{${e}..${t}${a}}`}:typeof e==`string`&&typeof t==`string`?{expanded:bp(e,t,n),literal:`{${e}..${t}${a}}`}:{expanded:null,literal:`{${e}..${t}${a}}`}}var Sp,Cp=g(()=>{x(),Sp=1e4});function wp(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!==`SimpleCommand`)return null;let i=r;if(i.name!==null||i.args.length!==0||i.assignments.length!==0||i.redirections.length!==1)return null;let a=i.redirections[0];return a.operator!==`<`||a.target.type!==`Word`?null:{target:a.target}}var Tp=g(()=>{});function Ep(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function Dp(e){let t=``,n=0;for(;n<e.length;)e[n]===`\\`&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function Op(e){return e.replace(/([*?[\]\\()|])/g,`\\$1`)}function kp(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`)}var Ap=g(()=>{});function Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var jp=g(()=>{});function Q(e,t,n=!1){let r=``,i=0;for(;i<e.length;){let a=e[i];if(n&&(a===`@`||a===`*`||a===`+`||a===`?`||a===`!`)&&i+1<e.length&&e[i+1]===`(`){let o=Mp(e,i+1);if(o!==-1){let s=Np(e.slice(i+2,o)).map(e=>Q(e,t,n)),c=s.length>0?s.join(`|`):`(?:)`;a===`@`?r+=`(?:${c})`:a===`*`?r+=`(?:${c})*`:a===`+`?r+=`(?:${c})+`:a===`?`?r+=`(?:${c})?`:a===`!`&&(r+=`(?!(?:${c})$).*`),i=o+1;continue}}if(a===`\\`)if(i+1<e.length){let t=e[i+1];/[\\^$.|+(){}[\]*?]/.test(t)?r+=`\\${t}`:r+=t,i+=2}else r+=`\\\\`,i++;else if(a===`*`)r+=t?`.*`:`.*?`,i++;else if(a===`?`)r+=`.`,i++;else if(a===`[`){let t=Pp(e,i);if(t===-1)r+=`\\[`,i++;else{let n=e.slice(i+1,t);r+=Fp(n),i=t+1}}else/[\^$.|+(){}]/.test(a)?(r+=`\\${a}`,i++):(r+=a,i++)}return r}function Mp(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function Np(e){let t=[],n=``,r=0,i=0;for(;i<e.length;){let a=e[i];if(a===`\\`){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a===`(`?(r++,n+=a):a===`)`?(r--,n+=a):a===`|`&&r===0?(t.push(n),n=``):n+=a,i++}return t.push(n),t}function Pp(e,t){let n=t+1;for(n<e.length&&e[n]===`^`&&n++,n<e.length&&e[n]===`]`&&n++;n<e.length;){if(e[n]===`\\`&&n+1<e.length){n+=2;continue}if(e[n]===`]`)return n;if(e[n]===`'`){let t=e.indexOf(`'`,n+1);if(t!==-1){n=t+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){n=t+2;continue}}n++}return-1}function Fp(e){let t=`[`,n=0;for((e[0]===`^`||e[0]===`!`)&&(t+=`^`,n++);n<e.length;){if(e[n]===`'`){let r=e.indexOf(`'`,n+1);if(r!==-1){let i=e.slice(n+1,r);for(let e of i)e===`\\`?t+=`\\\\`:e===`]`?t+=`\\]`:e===`^`&&t===`[`?t+=`\\^`:t+=e;n=r+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let r=e.indexOf(`:]`,n+2);if(r!==-1){let i=e.slice(n+2,r);t+=Ip(i),n=r+2;continue}}let r=e[n];r===`\\`?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+=`\\\\`,n++):r===`-`&&n>0&&n<e.length-1?(t+=`-`,n++):r===`^`&&n===0?(t+=`^`,n++):(r===`]`&&n===0?t+=`\\]`:t+=r,n++)}return t+=`]`,t}function Ip(e){return Lp.get(e)??``}var Lp,Rp=g(()=>{Lp=new Map([[`alnum`,`a-zA-Z0-9`],[`alpha`,`a-zA-Z`],[`ascii`,`\\x00-\\x7F`],[`blank`,` \\t`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`digit`,`0-9`],[`graph`,`!-~`],[`lower`,`a-z`],[`print`,` -~`],[`punct`,"!-/:-@\\[-`{-~"],[`space`,` \\t\\n\\r\\f\\v`],[`upper`,`A-Z`],[`word`,`a-zA-Z0-9_`],[`xdigit`,`0-9A-Fa-f`]])});function zp(e,t,n,r){if(n===`prefix`)return M(`^${t}`,`s`).replace(e,``);let i=M(`${t}$`,`s`);if(r)return i.replace(e,``);for(let t=e.length;t>=0;t--){let n=e.slice(t);if(i.test(n))return e.slice(0,t)}return e}function Bp(e,t){let n=Array.from(e.state.env.keys()),r=new Set,i=e.state.associativeArrays??new Set,a=new Set;for(let e of n){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);t&&a.add(t[1]);let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n&&a.add(n[1])}let o=e=>{for(let t of i){let n=`${t}_`;if(e.startsWith(n)&&e!==t)return!0}return!1};for(let e of n)if(e.startsWith(t))if(e.includes(`__`)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n?.[1].startsWith(t)&&r.add(n[1])}else if(/_\d+$/.test(e)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);n?.[1].startsWith(t)&&r.add(n[1])}else o(e)||r.add(e);return[...r].sort()}var Vp=g(()=>{ta()});function Hp(e,t){let n=(e,t=2)=>String(e).padStart(t,`0`);if(e===``)return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;let r=``,i=0;for(;i<e.length;)if(e[i]===`%`){if(i+1>=e.length){r+=`%`,i++;continue}let a=e[i+1];switch(a){case`H`:r+=n(t.getHours());break;case`M`:r+=n(t.getMinutes());break;case`S`:r+=n(t.getSeconds());break;case`d`:r+=n(t.getDate());break;case`m`:r+=n(t.getMonth()+1);break;case`Y`:r+=t.getFullYear();break;case`y`:r+=n(t.getFullYear()%100);break;case`I`:{let e=t.getHours()%12;e===0&&(e=12),r+=n(e);break}case`p`:r+=t.getHours()<12?`AM`:`PM`;break;case`P`:r+=t.getHours()<12?`am`:`pm`;break;case`%`:r+=`%`;break;case`a`:r+=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][t.getDay()];break;case`b`:r+=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][t.getMonth()];break;default:r+=`%${a}`}i+=2}else r+=e[i],i++;return r}function Up(e,t){let n=``,r=0,i=e.state.env.get(`USER`)||e.state.env.get(`LOGNAME`)||`user`,a=e.state.env.get(`HOSTNAME`)||`localhost`,o=a.split(`.`)[0],s=e.state.env.get(`PWD`)||`/`,c=e.state.env.get(`HOME`)||`/`,l=s.startsWith(c)?`~${s.slice(c.length)}`:s,u=s.split(`/`).pop()||s,d=new Date,f=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],p=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],m=e.state.env.get(`__COMMAND_NUMBER`)||`1`;for(;r<t.length;){let e=t[r];if(e===`\\`){if(r+1>=t.length){n+=`\\`,r++;continue}let e=t[r+1];if(e>=`0`&&e<=`7`){let e=``,i=r+1;for(;i<t.length&&i<r+4&&t[i]>=`0`&&t[i]<=`7`;)e+=t[i],i++;let a=Number.parseInt(e,8)%256;n+=String.fromCharCode(a),r=i;continue}switch(e){case`\\`:n+=`\\`,r+=2;break;case`a`:n+=`\x07`,r+=2;break;case`e`:n+=`\x1B`,r+=2;break;case`n`:n+=`
209
+ `,``):e.state.env.get(`${t}_${i}`)||``}let o=e.state.env.get(`${t}_${a}`);if(o!==void 0)return o;if(a===0){let n=e.state.env.get(t);if(n!==void 0)return n}if(n&&e.state.options.nounset)throw new ar(`${t}[${a}]`);return``}if(/^[1-9][0-9]*$/.test(t)){let r=e.state.env.get(t);if(r===void 0&&n&&e.state.options.nounset)throw new ar(t);return r||``}if(sp(e,t)){let i=lp(e,t);if(i===void 0)return``;if(i!==t)return await X(e,i,n,r);let a=e.state.env.get(t);if((a===void 0||a===``)&&n&&e.state.options.nounset)throw new ar(t);return a||``}let a=e.state.env.get(t);if(a!==void 0)return e.state.tempEnvBindings?.some(e=>e.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),a;if(pp(e,t)){let n=e.state.env.get(`${t}_0`);return n===void 0?``:n}if(n&&e.state.options.nounset)throw new ar(t);return``}async function mp(e,t){if(new Set([`?`,`$`,`#`,`_`,`-`,`0`,`PPID`,`UID`,`EUID`,`RANDOM`,`SECONDS`,`BASH_VERSION`,`!`,`BASHPID`,`LINENO`]).has(t))return!0;if(t===`@`||t===`*`)return Number.parseInt(e.state.env.get(`#`)||`0`,10)>0;if(t===`PWD`||t===`OLDPWD`)return e.state.env.has(t);let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=n[2];if(sp(e,t)){let n=lp(e,t);if(n&&n!==t){if(n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;t=n}}if(r===`@`||r===`*`)return Y(e,t).length>0||e.state.env.has(t);if(e.state.associativeArrays?.has(t)){let n=Xf(r);return e.state.env.has(`${t}_${n}`)}let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else try{i=await $(e,ud(new Mf,r).expression)}catch{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0,Number.isNaN(i)&&(i=0)}if(i<0){let n=Y(e,t);if(n.length===0)return!1;let r=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1+i;return r<0?!1:e.state.env.has(`${t}_${r}`)}return e.state.env.has(`${t}_${i}`)}if(sp(e,t)){let n=lp(e,t);return n===void 0||n===t?e.state.env.has(t):mp(e,n)}return!!(e.state.env.has(t)||pp(e,t))}var hp=g(()=>{jd(),K(),Ou(),sg(),x(),Zf(),op(),dp()});async function gp(e,t){let n=``,r=0;for(;r<t.length;){if(t[r]===`$`){if(t[r+1]===`{`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`{`?e++:t[i]===`}`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]===`(`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`(`?e++:t[i]===`)`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await X(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[0-9]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[0-9]/.test(t[i]);)i++;let a=await X(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[*@#?\-!$]/.test(t[r+1]||``)){let i=t[r+1],a=await X(e,i);n+=a,r+=2;continue}}if(t[r]===`"`){for(n+=`"`,r++;r<t.length&&t[r]!==`"`;)if(t[r]===`$`&&/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await X(e,t.slice(r+1,i));n+=a,r=i}else t[r]===`\\`?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+=`"`,r++);continue}n+=t[r],r++}return n}async function _p(e,t){let n=t,r=t.startsWith(`"`)&&t.endsWith(`"`),i=t.startsWith(`'`)&&t.endsWith(`'`);if((r||i)&&(n=t.slice(1,-1)),i)return n;let a=``,o=0;for(;o<n.length;)if(n[o]===`$`)if(n[o+1]===`(`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`(`&&n[r-1]===`$`||n[r]===`(`?t++:n[r]===`)`&&t--,r++;let i=n.slice(o+2,r-1);if(e.execFn){let t=await e.execFn(i,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=r}else if(n[o+1]===`{`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`{`?t++:n[r]===`}`&&t--,r++;let i=await X(e,n.slice(o+2,r-1));a+=i,o=r}else if(/[a-zA-Z_]/.test(n[o+1]||``)){let t=o+1;for(;t<n.length&&/[a-zA-Z0-9_]/.test(n[t]);)t++;let r=await X(e,n.slice(o+1,t));a+=r,o=t}else a+=n[o],o++;else if(n[o]==="`"){let t=o+1;for(;t<n.length&&n[t]!=="`";)t++;let r=n.slice(o+1,t);if(e.execFn){let t=await e.execFn(r,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=t+1}else a+=n[o],o++;return a}var vp=g(()=>{hp()});function yp(e,t,n,r,i){let a=n??1;a===0&&(a=1);let o=Math.abs(a),s=[],c=0;r?.match(/^-?0\d/)&&(c=Math.max(c,r.replace(/^-/,``).length)),i?.match(/^-?0\d/)&&(c=Math.max(c,i.replace(/^-/,``).length));let l=e=>{if(c>0){let t=e<0,n=String(Math.abs(e)).padStart(c,`0`);return t?`-${n}`:n}return String(e)};if(e<=t)for(let n=e,r=0;n<=t&&r<Sp;n+=o,r++)s.push(l(n));else for(let n=e,r=0;n>=t&&r<Sp;n-=o,r++)s.push(l(n));return s}function bp(e,t,n){let r=n??1;r===0&&(r=1);let i=e.charCodeAt(0),a=t.charCodeAt(0),o=Math.abs(r);if(e>=`A`&&e<=`Z`&&t>=`a`&&t<=`z`||e>=`a`&&e<=`z`&&t>=`A`&&t<=`Z`){let r=n===void 0?``:`..${n}`;throw new ur(`{${e}..${t}${r}}: invalid sequence`)}let s=[];if(i<=a)for(let e=i,t=0;e<=a&&t<Sp;e+=o,t++)s.push(String.fromCharCode(e));else for(let e=i,t=0;e>=a&&t<Sp;e-=o,t++)s.push(String.fromCharCode(e));return s}function xp(e,t,n,r,i){let a=n===void 0?``:`..${n}`;return typeof e==`number`&&typeof t==`number`?{expanded:yp(e,t,n,r,i),literal:`{${e}..${t}${a}}`}:typeof e==`string`&&typeof t==`string`?{expanded:bp(e,t,n),literal:`{${e}..${t}${a}}`}:{expanded:null,literal:`{${e}..${t}${a}}`}}var Sp,Cp=g(()=>{x(),Sp=1e4});function wp(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!==`SimpleCommand`)return null;let i=r;if(i.name!==null||i.args.length!==0||i.assignments.length!==0||i.redirections.length!==1)return null;let a=i.redirections[0];return a.operator!==`<`||a.target.type!==`Word`?null:{target:a.target}}var Tp=g(()=>{});function Ep(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function Dp(e){let t=``,n=0;for(;n<e.length;)e[n]===`\\`&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function Op(e){return e.replace(/([*?[\]\\()|])/g,`\\$1`)}function kp(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`)}var Ap=g(()=>{});function Z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var jp=g(()=>{});function Q(e,t,n=!1){let r=``,i=0;for(;i<e.length;){let a=e[i];if(n&&(a===`@`||a===`*`||a===`+`||a===`?`||a===`!`)&&i+1<e.length&&e[i+1]===`(`){let o=Mp(e,i+1);if(o!==-1){let s=Np(e.slice(i+2,o)).map(e=>Q(e,t,n)),c=s.length>0?s.join(`|`):`(?:)`;a===`@`?r+=`(?:${c})`:a===`*`?r+=`(?:${c})*`:a===`+`?r+=`(?:${c})+`:a===`?`?r+=`(?:${c})?`:a===`!`&&(r+=`(?!(?:${c})$).*`),i=o+1;continue}}if(a===`\\`)if(i+1<e.length){let t=e[i+1];/[\\^$.|+(){}[\]*?]/.test(t)?r+=`\\${t}`:r+=t,i+=2}else r+=`\\\\`,i++;else if(a===`*`)r+=t?`.*`:`.*?`,i++;else if(a===`?`)r+=`.`,i++;else if(a===`[`){let t=Pp(e,i);if(t===-1)r+=`\\[`,i++;else{let n=e.slice(i+1,t);r+=Fp(n),i=t+1}}else/[\^$.|+(){}]/.test(a)?(r+=`\\${a}`,i++):(r+=a,i++)}return r}function Mp(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function Np(e){let t=[],n=``,r=0,i=0;for(;i<e.length;){let a=e[i];if(a===`\\`){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a===`(`?(r++,n+=a):a===`)`?(r--,n+=a):a===`|`&&r===0?(t.push(n),n=``):n+=a,i++}return t.push(n),t}function Pp(e,t){let n=t+1;for(n<e.length&&e[n]===`^`&&n++,n<e.length&&e[n]===`]`&&n++;n<e.length;){if(e[n]===`\\`&&n+1<e.length){n+=2;continue}if(e[n]===`]`)return n;if(e[n]===`'`){let t=e.indexOf(`'`,n+1);if(t!==-1){n=t+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){n=t+2;continue}}n++}return-1}function Fp(e){let t=`[`,n=0;for((e[0]===`^`||e[0]===`!`)&&(t+=`^`,n++);n<e.length;){if(e[n]===`'`){let r=e.indexOf(`'`,n+1);if(r!==-1){let i=e.slice(n+1,r);for(let e of i)e===`\\`?t+=`\\\\`:e===`]`?t+=`\\]`:e===`^`&&t===`[`?t+=`\\^`:t+=e;n=r+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let r=e.indexOf(`:]`,n+2);if(r!==-1){let i=e.slice(n+2,r);t+=Ip(i),n=r+2;continue}}let r=e[n];r===`\\`?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+=`\\\\`,n++):r===`-`&&n>0&&n<e.length-1?(t+=`-`,n++):r===`^`&&n===0?(t+=`^`,n++):(r===`]`&&n===0?t+=`\\]`:t+=r,n++)}return t+=`]`,t}function Ip(e){return Lp.get(e)??``}var Lp,Rp=g(()=>{Lp=new Map([[`alnum`,`a-zA-Z0-9`],[`alpha`,`a-zA-Z`],[`ascii`,`\\x00-\\x7F`],[`blank`,` \\t`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`digit`,`0-9`],[`graph`,`!-~`],[`lower`,`a-z`],[`print`,` -~`],[`punct`,"!-/:-@\\[-`{-~"],[`space`,` \\t\\n\\r\\f\\v`],[`upper`,`A-Z`],[`word`,`a-zA-Z0-9_`],[`xdigit`,`0-9A-Fa-f`]])});function zp(e,t,n,r){if(n===`prefix`)return M(`^${t}`,`s`).replace(e,``);let i=M(`${t}$`,`s`);if(r)return i.replace(e,``);for(let t=e.length;t>=0;t--){let n=e.slice(t);if(i.test(n))return e.slice(0,t)}return e}function Bp(e,t){let n=Array.from(e.state.env.keys()),r=new Set,i=e.state.associativeArrays??new Set,a=new Set;for(let e of n){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);t&&a.add(t[1]);let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n&&a.add(n[1])}let o=e=>{for(let t of i){let n=`${t}_`;if(e.startsWith(n)&&e!==t)return!0}return!1};for(let e of n)if(e.startsWith(t))if(e.includes(`__`)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n?.[1].startsWith(t)&&r.add(n[1])}else if(/_\d+$/.test(e)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);n?.[1].startsWith(t)&&r.add(n[1])}else o(e)||r.add(e);return[...r].sort()}var Vp=g(()=>{ta()});function Hp(e,t){let n=(e,t=2)=>String(e).padStart(t,`0`);if(e===``)return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;let r=``,i=0;for(;i<e.length;)if(e[i]===`%`){if(i+1>=e.length){r+=`%`,i++;continue}let a=e[i+1];switch(a){case`H`:r+=n(t.getHours());break;case`M`:r+=n(t.getMinutes());break;case`S`:r+=n(t.getSeconds());break;case`d`:r+=n(t.getDate());break;case`m`:r+=n(t.getMonth()+1);break;case`Y`:r+=t.getFullYear();break;case`y`:r+=n(t.getFullYear()%100);break;case`I`:{let e=t.getHours()%12;e===0&&(e=12),r+=n(e);break}case`p`:r+=t.getHours()<12?`AM`:`PM`;break;case`P`:r+=t.getHours()<12?`am`:`pm`;break;case`%`:r+=`%`;break;case`a`:r+=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][t.getDay()];break;case`b`:r+=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][t.getMonth()];break;default:r+=`%${a}`}i+=2}else r+=e[i],i++;return r}function Up(e,t){let n=``,r=0,i=e.state.env.get(`USER`)||e.state.env.get(`LOGNAME`)||`user`,a=e.state.env.get(`HOSTNAME`)||`localhost`,o=a.split(`.`)[0],s=e.state.env.get(`PWD`)||`/`,c=e.state.env.get(`HOME`)||`/`,l=s.startsWith(c)?`~${s.slice(c.length)}`:s,u=s.split(`/`).pop()||s,d=new Date,f=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],p=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],m=e.state.env.get(`__COMMAND_NUMBER`)||`1`;for(;r<t.length;){let e=t[r];if(e===`\\`){if(r+1>=t.length){n+=`\\`,r++;continue}let e=t[r+1];if(e>=`0`&&e<=`7`){let e=``,i=r+1;for(;i<t.length&&i<r+4&&t[i]>=`0`&&t[i]<=`7`;)e+=t[i],i++;let a=Number.parseInt(e,8)%256;n+=String.fromCharCode(a),r=i;continue}switch(e){case`\\`:n+=`\\`,r+=2;break;case`a`:n+=`\x07`,r+=2;break;case`e`:n+=`\x1B`,r+=2;break;case`n`:n+=`
210
210
  `,r+=2;break;case`r`:n+=`\r`,r+=2;break;case`$`:n+=`$`,r+=2;break;case`[`:case`]`:r+=2;break;case`u`:n+=i,r+=2;break;case`h`:n+=o,r+=2;break;case`H`:n+=a,r+=2;break;case`w`:n+=l,r+=2;break;case`W`:n+=u,r+=2;break;case`d`:{let e=String(d.getDate()).padStart(2,` `);n+=`${f[d.getDay()]} ${p[d.getMonth()]} ${e}`,r+=2;break}case`t`:{let e=String(d.getHours()).padStart(2,`0`),t=String(d.getMinutes()).padStart(2,`0`),i=String(d.getSeconds()).padStart(2,`0`);n+=`${e}:${t}:${i}`,r+=2;break}case`T`:{let e=d.getHours()%12;e===0&&(e=12);let t=String(e).padStart(2,`0`),i=String(d.getMinutes()).padStart(2,`0`),a=String(d.getSeconds()).padStart(2,`0`);n+=`${t}:${i}:${a}`,r+=2;break}case`@`:{let e=d.getHours()%12;e===0&&(e=12);let t=String(e).padStart(2,`0`),i=String(d.getMinutes()).padStart(2,`0`),a=d.getHours()<12?`AM`:`PM`;n+=`${t}:${i} ${a}`,r+=2;break}case`A`:{let e=String(d.getHours()).padStart(2,`0`),t=String(d.getMinutes()).padStart(2,`0`);n+=`${e}:${t}`,r+=2;break}case`D`:if(r+2<t.length&&t[r+2]===`{`){let e=t.indexOf(`}`,r+3);if(e!==-1){let i=t.slice(r+3,e);n+=Hp(i,d),r=e+1}else n+=`\\D`,r+=2}else n+=`\\D`,r+=2;break;case`s`:n+=`bash`,r+=2;break;case`v`:n+=`5.0`,r+=2;break;case`V`:n+=`5.0.0`,r+=2;break;case`j`:n+=`0`,r+=2;break;case`l`:n+=`tty`,r+=2;break;case`#`:n+=m,r+=2;break;case`!`:n+=m,r+=2;break;case`x`:n+=`\\x`,r+=2;break;default:n+=`\\${e}`,r+=2}}else n+=e,r++}return n}var Wp=g(()=>{});function Gp(e){if(e===``)return`''`;if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let t=`$'`;for(let n of e)switch(n){case`'`:t+=`\\'`;break;case`\\`:t+=`\\\\`;break;case`
211
211
  `:t+=`\\n`;break;case`\r`:t+=`\\r`;break;case` `:t+=`\\t`;break;default:{let e=n.charCodeAt(0);e<32||e===127?t+=`\\${e.toString(8).padStart(3,`0`)}`:t+=n}}return`${t}'`}return`'${e}'`}var Kp=g(()=>{});function qp(e,t){return e.state.readonlyVars?.has(t)??!1}var Jp=g(()=>{x()});function Yp(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return``;let n=``,r=e.state.env.has(`${t}__length`)||Array.from(e.state.env.keys()).some(e=>e.startsWith(`${t}_`)&&/^[0-9]+$/.test(e.slice(t.length+1))),i=e.state.associativeArrays?.has(t)??!1;return r&&!i&&(n+=`a`),i&&(n+=`A`),e.state.integerVars?.has(t)&&(n+=`i`),sp(e,t)&&(n+=`n`),qp(e,t)&&(n+=`r`),e.state.exportedVars?.has(t)&&(n+=`x`),n}var Xp=g(()=>{dp(),Jp()});async function Zp(e,t,n,r){return e.coverage?.hit(`bash:expansion:default_value`),(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):n.effectiveValue}async function Qp(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:assign_default`),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let a=await i(e,n.word.parts,r.inDoubleQuotes),o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(o){let[,t,n]=o,r;if(/^\d+$/.test(n))r=Number.parseInt(n,10);else{try{r=await $(e,ud(new Mf,n).expression)}catch{let t=e.state.env.get(n);r=t?Number.parseInt(t,10):0}Number.isNaN(r)&&(r=0)}e.state.env.set(`${t}_${r}`,a);let i=Number.parseInt(e.state.env.get(`${t}__length`)||`0`,10);r>=i&&e.state.env.set(`${t}__length`,String(r+1))}else e.state.env.set(t,a);return a}return r.effectiveValue}async function $p(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:error_if_unset`),r.isUnset||n.checkEmpty&&r.isEmpty){let a=n.word?await i(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new or(1,``,`bash: ${a}
212
212
  `)}return r.effectiveValue}async function em(e,t,n,r){return e.coverage?.hit(`bash:expansion:use_alternative`),!(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):``}async function tm(e,t,n,r,i){e.coverage?.hit(`bash:expansion:pattern_removal`);let a=``,o=e.state.shoptOptions.extglob;if(n.pattern)for(let t of n.pattern.parts)if(t.type===`Glob`)a+=Q(t.pattern,n.greedy,o);else if(t.type===`Literal`)a+=Q(t.value,n.greedy,o);else if(t.type===`SingleQuoted`||t.type===`Escaped`)a+=Z(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);a+=Z(n)}else if(t.type===`ParameterExpansion`){let r=await i(e,t);a+=Q(r,n.greedy,o)}else{let n=await i(e,t);a+=Z(n)}if(n.side===`prefix`)return M(`^${a}`,`s`).replace(t,``);let s=M(`${a}$`,`s`);if(n.greedy)return s.replace(t,``);for(let e=t.length;e>=0;e--){let n=t.slice(e);if(s.test(n))return t.slice(0,e)}return t}async function nm(e,t,n,r,i){e.coverage?.hit(`bash:expansion:pattern_replacement`);let a=``,o=e.state.shoptOptions.extglob;if(n.pattern)for(let t of n.pattern.parts)if(t.type===`Glob`)a+=Q(t.pattern,!0,o);else if(t.type===`Literal`)a+=Q(t.value,!0,o);else if(t.type===`SingleQuoted`||t.type===`Escaped`)a+=Z(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);a+=Z(n)}else if(t.type===`ParameterExpansion`){let n=await i(e,t);a+=Q(n,!0,o)}else{let n=await i(e,t);a+=Z(n)}let s=n.replacement?await r(e,n.replacement.parts):``;if(n.anchor===`start`?a=`^${a}`:n.anchor===`end`&&(a=`${a}$`),a===``)return t;let c=n.all?`gs`:`s`;try{let r=M(a,c);if(n.all){let n=``,i=0,a=0,o=e.limits.maxStringLength,c=r.exec(t);for(;c!==null&&!(c[0].length===0&&c.index===t.length);){if(n+=t.slice(i,c.index)+s,i=c.index+c[0].length,c[0].length===0&&i++,a++,a%100==0&&n.length>o)throw new b(`pattern replacement: string length limit exceeded (${o} bytes)`,`string_length`);c=r.exec(t)}return n+=t.slice(i),n}return r.replace(t,s)}catch(e){if(e instanceof b)throw e;return t}}function rm(e,t,n){e.coverage?.hit(`bash:expansion:length`);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let t=r[1],n=Y(e,t);return n.length>0?String(n.length):e.state.env.get(t)===void 0?`0`:`1`}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&pp(e,t)){if(t===`FUNCNAME`){let t=e.state.funcNameStack?.[0]||``;return String([...t].length)}if(t===`BASH_LINENO`){let t=e.state.callLineStack?.[0];return String(t===void 0?0:[...String(t)].length)}let n=e.state.env.get(`${t}_0`)||``;return String([...n].length)}return String([...n].length)}async function im(e,t,n,r){e.coverage?.hit(`bash:expansion:substring`);let i=await $(e,r.offset.expression),a=r.length?await $(e,r.length.expression):void 0;if(t===`@`||t===`*`){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);let r=e.state.env.get(`0`)||`bash`,o,s;if(i<=0)if(o=[r,...n],i<0){if(s=o.length+i,s<0)return``}else s=0;else o=n,s=i-1;if(s<0||s>=o.length)return``;if(a!==void 0){let e=a<0?o.length+a:s+a;return o.slice(s,Math.max(s,e)).join(` `)}return o.slice(s).join(` `)}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let t=o[1];if(e.state.associativeArrays?.has(t))throw new or(1,``,`bash: \${${t}[@]: 0: 3}: bad substitution
213
213
  `);let n=Y(e,t),r=0;if(i<0){if(n.length>0){let e=n[n.length-1][0],t=(typeof e==`number`?e:0)+1+i;if(t<0||(r=n.findIndex(([e])=>typeof e==`number`&&e>=t),r<0))return``}}else if(r=n.findIndex(([e])=>typeof e==`number`&&e>=i),r<0)return``;if(a!==void 0){if(a<0)throw new sr(`${o[1]}[@]: substring expression < 0`);return n.slice(r,r+a).map(([,e])=>e).join(` `)}return n.slice(r).map(([,e])=>e).join(` `)}let s=[...n],c=i;if(c<0&&(c=Math.max(0,s.length+c)),a!==void 0){if(a<0){let e=s.length+a;return s.slice(c,Math.max(c,e)).join(``)}return s.slice(c,c+a).join(``)}return s.slice(c).join(``)}async function am(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:case_modification`),n.pattern){let a=e.state.shoptOptions.extglob,o=``;for(let t of n.pattern.parts)if(t.type===`Glob`)o+=Q(t.pattern,!0,a);else if(t.type===`Literal`)o+=Q(t.value,!0,a);else if(t.type===`SingleQuoted`||t.type===`Escaped`)o+=Z(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);o+=Z(n)}else if(t.type===`ParameterExpansion`){let n=await i(e,t);o+=Q(n,!0,a)}let s=M(`^(?:${o})$`),c=n.direction===`upper`?e=>e.toUpperCase():e=>e.toLowerCase(),l=``,u=!1;for(let e of t)!n.all&&u?l+=e:s.test(e)?(l+=c(e),u=!0):l+=e;return l}return n.direction===`upper`?n.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):n.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function om(e,t,n,r,i){e.coverage?.hit(`bash:expansion:transform`);let a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(a&&i.operator===`Q`)return Y(e,a[1]).map(([,e])=>Gp(e)).join(` `);if(a&&i.operator===`a`)return Yp(e,a[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&i.operator===`a`)return Yp(e,o[1]);switch(i.operator){case`Q`:return r?``:Gp(n);case`P`:return Up(e,n);case`a`:return Yp(e,t);case`A`:return r?``:`${t}=${Gp(n)}`;case`E`:return n.replace(/\\([\\abefnrtv'"?])/g,(e,t)=>{switch(t){case`\\`:return`\\`;case`a`:return`\x07`;case`b`:return`\b`;case`e`:return`\x1B`;case`f`:return`\f`;case`n`:return`
214
214
  `;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;case`'`:return`'`;case`"`:return`"`;case`?`:return`?`;default:return t}});case`K`:case`k`:return r?``:Gp(n);case`u`:return n.charAt(0).toUpperCase()+n.slice(1);case`U`:return n.toUpperCase();case`L`:return n.toLowerCase();default:return n}}async function sm(e,t,n,r,i,a,o=!1){if(e.coverage?.hit(`bash:expansion:indirection`),sp(e,t))return up(e,t)||``;let s=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(i.innerOp?.type===`UseAlternative`)return``;throw new cr(`\${!${t}}`)}let c=n;if(s&&(c===``||c.includes(` `)))throw new cr(`\${!${t}}`);let l=c.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(l&&l[1].includes(`~`))throw new cr(`\${!${t}}`);return i.innerOp?a(e,{type:`ParameterExpansion`,parameter:c,operation:i.innerOp},o):await X(e,c)}function cm(e,t){e.coverage?.hit(`bash:expansion:array_keys`);let n=Y(e,t.array).map(([e])=>String(e));return t.star?n.join(q(e.state.env)):n.join(` `)}function lm(e,t){e.coverage?.hit(`bash:expansion:var_name_prefix`);let n=Bp(e,t.prefix);return t.star?n.join(q(e.state.env)):n.join(` `)}function um(e,t,n,r){let i=Number.parseInt(e.state.env.get(`#`)||`0`,10),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t===`*`)return{isEmpty:i===0,effectiveValue:n};if(t===`@`)return{isEmpty:i===0||i===1&&e.state.env.get(`1`)===``,effectiveValue:n};if(a){let[,t,n]=a,i=Y(e,t);if(i.length===0)return{isEmpty:!0,effectiveValue:``};if(n===`*`){let t=q(e.state.env),n=i.map(([,e])=>e).join(t);return{isEmpty:r?n===``:!1,effectiveValue:n}}return{isEmpty:i.length===1&&i.every(([,e])=>e===``),effectiveValue:i.map(([,e])=>e).join(` `)}}return{isEmpty:n===``,effectiveValue:n}}var dm=g(()=>{jd(),K(),ta(),sg(),x(),op(),dp(),jp(),Rp(),Vp(),Wp(),Kp(),hp(),Xp()});function fm(e){let t=0;for(;t<e.length;){let n=e[t];if(n===`\\`&&t+1<e.length){t+=2;continue}if(n===`'`){let n=e.indexOf(`'`,t+1);if(n!==-1){t=n+1;continue}}if(n===`$`&&t+1<e.length&&e[t+1]===`(`||n==="`")return!0;t++}return!1}function pm(e,t){let n=1,r=t,i=!1,a=!1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`&&!i&&r+1<e.length){r+=2;continue}if(t===`'`&&!a){i=!i,r++;continue}if(t===`"`&&!i){a=!a,r++;continue}if(!i&&!a){if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}r++}return-1}async function mm(e,t){let n=new Mf,r;try{r=n.parse(t)}catch{return``}let i=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let a=new Map(e.state.env),o=e.state.cwd,s=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let t=await e.executeScript(r),n=t.exitCode;return e.state.env=a,e.state.cwd=o,e.state.suppressVerbose=s,e.state.lastExitCode=n,e.state.env.set(`?`,String(n)),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr),e.state.bashPid=i,t.stdout.replace(/\n+$/,``)}catch(t){if(e.state.env=a,e.state.cwd=o,e.state.bashPid=i,e.state.suppressVerbose=s,t instanceof b)throw t;return t instanceof or?(e.state.lastExitCode=t.exitCode,e.state.env.set(`?`,String(t.exitCode)),t.stdout?.replace(/\n+$/,``)??``):``}}function hm(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){let i=t.slice(r+1,e);n+=Op(i),r=e+1;continue}}if(i===`"`){let i=-1,a=r+1;for(;a<t.length;){if(t[a]===`\\`){a+=2;continue}if(t[a]===`"`){i=a;break}a++}if(i!==-1){let a=gm(e,t.slice(r+1,i));n+=Op(a),r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}if(i===`\\`&&r+1<t.length){n+=i+t[r+1],r+=2;continue}n+=i,r++}return n}function gm(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`\\`||e===`"`){n+=e,r+=2;continue}n+=i,r++;continue}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}n+=i,r++}return n}async function _m(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){let i=t.slice(r+1,e);n+=Op(i),r=e+1;continue}}if(i===`"`){let i=-1,a=r+1;for(;a<t.length;){if(t[a]===`\\`){a+=2;continue}if(t[a]===`"`){i=a;break}a++}if(i!==-1){let a=await vm(e,t.slice(r+1,i));n+=Op(a),r=i+1;continue}}if(i===`$`&&r+1<t.length&&t[r+1]===`(`){let i=pm(t,r+2);if(i!==-1){let a=await mm(e,t.slice(r+2,i));n+=a,r=i+1;continue}}if(i==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=await mm(e,t.slice(r+1,i));n+=a,r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}if(i===`\\`&&r+1<t.length){n+=i+t[r+1],r+=2;continue}n+=i,r++}return n}async function vm(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`\\`||e===`"`){n+=e,r+=2;continue}n+=i,r++;continue}if(i===`$`&&r+1<t.length&&t[r+1]===`(`){let i=pm(t,r+2);if(i!==-1){let a=await mm(e,t.slice(r+2,i));n+=a,r=i+1;continue}}if(i==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=await mm(e,t.slice(r+1,i));n+=a,r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}n+=i,r++}return n}var ym=g(()=>{K(),x(),Ap()});function bm(e,t){if(!t.startsWith(`~`))return t;e.coverage?.hit(`bash:expansion:tilde`);let n=e.state.env.get(`HOME`)===void 0?`/home/user`:e.state.env.get(`HOME`);if(t===`~`||t.startsWith(`~/`))return n+t.slice(1);let r=1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;let i=t.slice(1,r),a=t.slice(r);return a!==``&&!a.startsWith(`/`)?t:i===`root`?`/root${a}`:t}var xm=g(()=>{});async function Sm(e,t,n,r){let i=``;for(let a of t.parts)if(a.type===`Glob`)i+=Q(a.pattern,!0,e.state.shoptOptions.extglob);else if(a.type===`Literal`)i+=Q(a.value,!0,e.state.shoptOptions.extglob);else if(a.type===`SingleQuoted`||a.type===`Escaped`)i+=Z(a.value);else if(a.type===`DoubleQuoted`){let t=await n(e,a.parts);i+=Z(t)}else if(a.type===`ParameterExpansion`){let t=await r(e,a);i+=Q(t,!0,e.state.shoptOptions.extglob)}else{let t=await r(e,a);i+=Z(t)}return i}async function Cm(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!==`ParameterExpansion`||i.parts[0].operation?.type!==`PatternReplacement`)return null;let a=i.parts[0],o=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let s=o[1],c=o[2]===`*`,l=a.operation,u=Y(e,s),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(s);t!==void 0&&d.push(t)}if(d.length===0)return{values:[],quoted:!0};let f=``;l.pattern&&(f=await Sm(e,l.pattern,n,r));let p=l.replacement?await n(e,l.replacement.parts):``,m=f;l.anchor===`start`?m=`^${f}`:l.anchor===`end`&&(m=`${f}$`);let h=[];try{let e=M(m,l.all?`g`:``);for(let t of d)h.push(e.replace(t,p))}catch{h.push(...d)}if(c){let t=q(e.state.env);return{values:[h.join(t)],quoted:!0}}return{values:h,quoted:!0}}async function wm(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!==`ParameterExpansion`||i.parts[0].operation?.type!==`PatternRemoval`)return null;let a=i.parts[0],o=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let s=o[1],c=o[2]===`*`,l=a.operation,u=Y(e,s),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(s);t!==void 0&&d.push(t)}if(d.length===0)return{values:[],quoted:!0};let f=``,p=e.state.shoptOptions.extglob;if(l.pattern)for(let t of l.pattern.parts)if(t.type===`Glob`)f+=Q(t.pattern,l.greedy,p);else if(t.type===`Literal`)f+=Q(t.value,l.greedy,p);else if(t.type===`SingleQuoted`||t.type===`Escaped`)f+=Z(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);f+=Z(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);f+=Q(n,l.greedy,p)}else{let n=await r(e,t);f+=Z(n)}let m=[];for(let e of d)m.push(zp(e,f,l.side,l.greedy));if(c){let t=q(e.state.env);return{values:[m.join(t)],quoted:!0}}return{values:m,quoted:!0}}var Tm=g(()=>{ta(),op(),jp(),Rp(),Vp(),hp()});async function Em(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation?.type!==`DefaultValue`&&n.parts[0].operation?.type!==`UseAlternative`&&n.parts[0].operation?.type!==`AssignDefault`)return null;let r=n.parts[0],i=r.operation,a=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),o,s=!1;if(a){let t=a[1];s=a[2]===`*`;let n=Y(e,t),r=n.length>0||e.state.env.has(t),c=n.length===0||n.length===1&&n.every(([,e])=>e===``),l=i.checkEmpty??!1;if(o=i.type===`UseAlternative`?r&&!(l&&c):!r||l&&c,!o){if(n.length>0){let t=n.map(([,e])=>e);if(s){let n=q(e.state.env);return{values:[t.join(n)],quoted:!0}}return{values:t,quoted:!0}}let r=e.state.env.get(t);return r===void 0?{values:[],quoted:!0}:{values:[r],quoted:!0}}}else{let t=r.parameter,n=await mp(e,t),a=await X(e,t),s=a===``,c=i.checkEmpty??!1;if(o=i.type===`UseAlternative`?n&&!(c&&s):!n||c&&s,!o)return{values:[a],quoted:!0}}if(o&&i.word){let t=i.word.parts,n=null,r=!1;for(let e of t)if(e.type===`ParameterExpansion`&&!e.operation){let t=e.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){n=t[1],r=t[2]===`*`;break}}if(n){let t=Y(e,n);if(t.length>0){let n=t.map(([,e])=>e);if(r||s){let t=q(e.state.env);return{values:[n.join(t)],quoted:!0}}return{values:n,quoted:!0}}let i=e.state.env.get(n);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}}return null}async function Dm(e,t,n,r,i){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let a=t[0],o=-1,s=``,c=!1,l=null;for(let e=0;e<a.parts.length;e++){let t=a.parts[e];if(t.type===`ParameterExpansion`&&(t.operation?.type===`PatternRemoval`||t.operation?.type===`PatternReplacement`)){let n=t.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n){o=e,s=n[1],c=n[2]===`*`,l=t.operation;break}}}if(o===-1||o===0&&o===a.parts.length-1)return null;let u=``;for(let t=0;t<o;t++)u+=await r(e,a.parts[t]);let d=``;for(let t=o+1;t<a.parts.length;t++)d+=await r(e,a.parts[t]);let f=Y(e,s),p=f.map(([,e])=>e);if(f.length===0){let t=e.state.env.get(s);if(t!==void 0)p=[t];else{if(c)return{values:[u+d],quoted:!0};let e=u+d;return{values:e?[e]:[],quoted:!0}}}if(l?.type===`PatternRemoval`){let t=l,n=``,a=e.state.shoptOptions.extglob;if(t.pattern)for(let o of t.pattern.parts)if(o.type===`Glob`)n+=Q(o.pattern,t.greedy,a);else if(o.type===`Literal`)n+=Q(o.value,t.greedy,a);else if(o.type===`SingleQuoted`||o.type===`Escaped`)n+=Z(o.value);else if(o.type===`DoubleQuoted`){let t=await i(e,o.parts);n+=Z(t)}else if(o.type===`ParameterExpansion`){let i=await r(e,o);n+=Q(i,t.greedy,a)}else{let t=await r(e,o);n+=Z(t)}p=p.map(e=>zp(e,n,t.side,t.greedy))}else if(l?.type===`PatternReplacement`){let t=l,n=``;if(t.pattern)for(let a of t.pattern.parts)if(a.type===`Glob`)n+=Q(a.pattern,!0,e.state.shoptOptions.extglob);else if(a.type===`Literal`)n+=Q(a.value,!0,e.state.shoptOptions.extglob);else if(a.type===`SingleQuoted`||a.type===`Escaped`)n+=Z(a.value);else if(a.type===`DoubleQuoted`){let t=await i(e,a.parts);n+=Z(t)}else if(a.type===`ParameterExpansion`){let t=await r(e,a);n+=Q(t,!0,e.state.shoptOptions.extglob)}else{let t=await r(e,a);n+=Z(t)}let a=t.replacement?await i(e,t.replacement.parts):``,o=n;t.anchor===`start`?o=`^${n}`:t.anchor===`end`&&(o=`${n}$`);try{let e=M(o,t.all?`g`:``);p=p.map(t=>e.replace(t,a))}catch{}}if(c){let t=q(e.state.env);return{values:[u+p.join(t)+d],quoted:!0}}return p.length===1?{values:[u+p[0]+d],quoted:!0}:{values:[u+p[0],...p.slice(1,-1),p[p.length-1]+d],quoted:!0}}async function Om(e,t,n,r){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=``,s=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&!t.operation){let n=t.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n){a=e,o=n[1],s=n[2]===`*`;break}}}if(a===-1)return null;let c=``;for(let t=0;t<a;t++)c+=await r(e,i.parts[t]);let l=``;for(let t=a+1;t<i.parts.length;t++)l+=await r(e,i.parts[t]);let u=Y(e,o),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(o);if(t!==void 0)return{values:[c+t+l],quoted:!0};if(s)return{values:[c+l],quoted:!0};let n=c+l;return{values:n?[n]:[],quoted:!0}}if(s){let t=q(e.state.env);return{values:[c+d.join(t)+l],quoted:!0}}return d.length===1?{values:[c+d[0]+l],quoted:!0}:{values:[c+d[0],...d.slice(1,-1),d[d.length-1]+l],quoted:!0}}var km=g(()=>{ta(),op(),jp(),Rp(),Vp(),hp()});async function Am(e,t,n){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!==`ParameterExpansion`||r.parts[0].operation?.type!==`Substring`)return null;let i=r.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let o=a[1],s=a[2]===`*`,c=i.operation;if(e.state.associativeArrays?.has(o))throw new or(1,``,`bash: \${${o}[@]: 0: 3}: bad substitution
215
- `);let l=c.offset?await n(e,c.offset.expression):0,u=c.length?await n(e,c.length.expression):void 0,d=Y(e,o),f=0;if(l<0){if(d.length>0){let e=d[d.length-1][0],t=(typeof e==`number`?e:0)+1+l;if(t<0)return{values:[],quoted:!0};f=d.findIndex(([e])=>typeof e==`number`&&e>=t),f<0&&(f=d.length)}}else f=d.findIndex(([e])=>typeof e==`number`&&e>=l),f<0&&(f=d.length);let p;if(u!==void 0){if(u<0)throw new sr(`${o}[@]: substring expression < 0`);p=d.slice(f,f+u).map(([,e])=>e)}else p=d.slice(f).map(([,e])=>e);if(p.length===0)return{values:[],quoted:!0};if(s){let t=q(e.state.env);return{values:[p.join(t)],quoted:!0}}return{values:p,quoted:!0}}function jm(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation?.type!==`Transform`)return null;let r=n.parts[0],i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let a=i[1],o=i[2]===`*`,s=r.operation,c=Y(e,a);if(c.length===0){let t=e.state.env.get(a);if(t!==void 0){let n;switch(s.operator){case`a`:n=``;break;case`P`:n=Up(e,t);break;case`Q`:n=Gp(t);break;default:n=t}return{values:[n],quoted:!0}}return o?{values:[``],quoted:!0}:{values:[],quoted:!0}}let l=Yp(e,a),u;switch(s.operator){case`a`:u=c.map(()=>l);break;case`P`:u=c.map(([,t])=>Up(e,t));break;case`Q`:u=c.map(([,e])=>Gp(e));break;case`u`:u=c.map(([,e])=>e.charAt(0).toUpperCase()+e.slice(1));break;case`U`:u=c.map(([,e])=>e.toUpperCase());break;case`L`:u=c.map(([,e])=>e.toLowerCase());break;default:u=c.map(([,e])=>e)}if(o){let t=q(e.state.env);return{values:[u.join(t)],quoted:!0}}return{values:u,quoted:!0}}var Mm=g(()=>{x(),op(),Wp(),Kp(),hp(),Xp()});function Nm(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`)return null;let r=n.parts[0];if(r.operation)return null;let i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!i)return null;let a=i[1];if(sp(e,a)){let t=up(e,a);if(t?.endsWith(`[@]`)||t?.endsWith(`[*]`))return{values:[],quoted:!0}}let o=Y(e,a);if(o.length>0)return{values:o.map(([,e])=>e),quoted:!0};let s=e.state.env.get(a);return s===void 0?{values:[],quoted:!0}:{values:[s],quoted:!0}}function Pm(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation)return null;let r=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)||!sp(e,r))return null;let i=up(e,r);if(!i)return null;let a=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!a)return null;let o=a[1],s=Y(e,o);if(s.length>0)return{values:s.map(([,e])=>e),quoted:!0};let c=e.state.env.get(o);return c===void 0?{values:[],quoted:!0}:{values:[c],quoted:!0}}var Fm=g(()=>{dp(),hp()});async function Im(e,t,n,r,i){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let a=t[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=o.operation,c=await X(e,o.parameter),l=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l){if(!s.innerOp&&(c===`@`||c===`*`)){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return c===`*`?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}return null}let u=l[1],d=l[2]===`*`,f=Y(e,u);if(s.innerOp){if(s.innerOp.type===`Substring`)return Lm(e,f,u,d,s.innerOp);if(s.innerOp.type===`DefaultValue`||s.innerOp.type===`UseAlternative`||s.innerOp.type===`AssignDefault`||s.innerOp.type===`ErrorIfUnset`)return Rm(e,f,u,d,s.innerOp,i);if(s.innerOp.type===`Transform`&&s.innerOp.operator===`a`){let t=Yp(e,u),n=f.map(()=>t);return d?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}let t=[];for(let[,n]of f){let i={type:`ParameterExpansion`,parameter:`_indirect_elem_`,operation:s.innerOp},a=e.state.env.get(`_indirect_elem_`);e.state.env.set(`_indirect_elem_`,n);try{let n=await r(e,i,!0);t.push(n)}finally{a===void 0?e.state.env.delete(`_indirect_elem_`):e.state.env.set(`_indirect_elem_`,a)}}return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}if(f.length>0){let t=f.map(([,e])=>e);return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let p=e.state.env.get(u);return p===void 0?{values:[],quoted:!0}:{values:[p],quoted:!0}}async function Lm(e,t,n,r,i){let a=i.offset?await $(e,i.offset.expression):0,o=i.length?await $(e,i.length.expression):void 0,s=0;if(a<0){if(t.length>0){let e=t[t.length-1][0],n=(typeof e==`number`?e:0)+1+a;if(n<0||(s=t.findIndex(([e])=>typeof e==`number`&&e>=n),s<0))return{values:[],quoted:!0}}}else if(s=t.findIndex(([e])=>typeof e==`number`&&e>=a),s<0)return{values:[],quoted:!0};let c;if(o!==void 0){if(o<0)throw new sr(`${n}[@]: substring expression < 0`);c=t.slice(s,s+o)}else c=t.slice(s);let l=c.map(([,e])=>e);return r?{values:[l.join(q(e.state.env))],quoted:!0}:{values:l,quoted:!0}}async function Rm(e,t,n,r,i,a){let o=i.checkEmpty??!1,s=t.map(([,e])=>e),c=t.length===0,l=t.length===0;if(i.type===`UseAlternative`)return!l&&!(o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(i.type===`DefaultValue`)return(l||o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0};if(i.type===`AssignDefault`){if((l||o&&c)&&i.word){let t=await a(e,i.word.parts,!0);return e.state.env.set(`${n}_0`,t),e.state.env.set(`${n}__length`,`1`),{values:[t],quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}async function zm(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`UseAlternative`&&t[0].operation?.type!==`DefaultValue`)return null;let n=t[0],r=n.operation,i=r?.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await X(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await mp(e,n.parameter),l=await X(e,n.parameter)===``,u=r.checkEmpty??!1,d;if(d=r.type===`UseAlternative`?c&&!(u&&l):!c||u&&l,d){let t=s[1],n=s[2]===`*`,r=Y(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}async function Bm(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`Indirection`)return null;let n=t[0],r=n.operation.innerOp;if(!r||r.type!==`UseAlternative`&&r.type!==`DefaultValue`)return null;let i=r.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await X(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await X(e,n.parameter),l=await mp(e,n.parameter),u=c===``,d=r.checkEmpty??!1,f;if(f=r.type===`UseAlternative`?l&&!(d&&u):!l||d&&u,f){let t=s[1],n=s[2]===`*`,r=Y(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}var Vm=g(()=>{sg(),x(),op(),hp(),Xp()});function Hm(e){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return n}async function Um(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`Substring`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=s.offset?await n(e,s.offset.expression):0,l=s.length?await n(e,s.length.expression):void 0,u=Number.parseInt(e.state.env.get(`#`)||`0`,10),d=[];for(let t=1;t<=u;t++)d.push(e.state.env.get(String(t))||``);let f=e.state.env.get(`0`)||`bash`,p;if(c<=0){let e=[f,...d],t=e.length+c;if(t<0)p=[];else{let n=c<0?t:0;if(l!==void 0){let t=l<0?e.length+l:n+l;p=e.slice(n,Math.max(n,t))}else p=e.slice(n)}}else{let e=c-1;if(e>=d.length)p=[];else if(l!==void 0){let t=l<0?d.length+l:e+l;p=d.slice(e,Math.max(e,t))}else p=d.slice(e)}let m=``;for(let t=0;t<a;t++)m+=await r(e,i.parts[t]);let h=``;for(let t=a+1;t<i.parts.length;t++)h+=await r(e,i.parts[t]);if(p.length===0){let e=m+h;return{values:e?[e]:[],quoted:!0}}if(o){let t=q(e.state.env);return{values:[m+p.join(t)+h],quoted:!0}}return p.length===1?{values:[m+p[0]+h],quoted:!0}:{values:[m+p[0],...p.slice(1,-1),p[p.length-1]+h],quoted:!0}}async function Wm(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternReplacement`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=Hm(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Q(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)d+=Q(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=Z(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=Z(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Q(r,!0,e.state.shoptOptions.extglob)}else{let r=await n(e,t);d+=Z(r)}let f=s.replacement?await r(e,s.replacement.parts):``,p=d;s.anchor===`start`?p=`^${d}`:s.anchor===`end`&&(p=`${d}$`);let m=[];try{let e=M(p,s.all?`g`:``);for(let t of c)m.push(e.replace(t,f))}catch{m.push(...c)}if(o){let t=q(e.state.env);return{values:[l+m.join(t)+u],quoted:!0}}return m.length===1?{values:[l+m[0]+u],quoted:!0}:{values:[l+m[0],...m.slice(1,-1),m[m.length-1]+u],quoted:!0}}async function Gm(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternRemoval`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=Hm(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``,f=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Q(t.pattern,s.greedy,f);else if(t.type===`Literal`)d+=Q(t.value,s.greedy,f);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=Z(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=Z(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Q(r,s.greedy,f)}else{let r=await n(e,t);d+=Z(r)}let p=[];for(let e of c)p.push(zp(e,d,s.side,s.greedy));if(o){let t=q(e.state.env);return{values:[l+p.join(t)+u],quoted:!0}}return p.length===1?{values:[l+p[0]+u],quoted:!0}:{values:[l+p[0],...p.slice(1,-1),p[p.length-1]+u],quoted:!0}}async function Km(e,t,n){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let r=t[0],i=-1,a=!1;for(let e=0;e<r.parts.length;e++){let t=r.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)){i=e,a=t.parameter===`*`;break}}if(i===-1)return null;let o=r.parts[i];if(o.type===`ParameterExpansion`&&o.operation)return null;let s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=``;for(let t=0;t<i;t++)c+=await n(e,r.parts[t]);let l=``;for(let t=i+1;t<r.parts.length;t++)l+=await n(e,r.parts[t]);if(s===0){if(a)return{values:[c+l],quoted:!0};let e=c+l;return{values:e?[e]:[],quoted:!0}}let u=[];for(let t=1;t<=s;t++)u.push(e.state.env.get(String(t))||``);if(a){let t=q(e.state.env);return{values:[c+u.join(t)+l],quoted:!0}}return u.length===1?{values:[c+u[0]+l],quoted:!0}:{values:[c+u[0],...u.slice(1,-1),u[u.length-1]+l],quoted:!0}}var qm=g(()=>{ta(),op(),jp(),Rp(),Vp()});function Jm(e){return new Vf(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations})}async function Ym(e,t){if(e.state.options.noglob)return t;let n=Jm(e),r=[];for(let i of t)if(Ep(i,e.state.shoptOptions.extglob)){let e=await n.expand(i);if(e.length>0)r.push(...e);else{if(n.hasFailglob())throw new lr(i);n.hasNullglob()||r.push(i)}}else r.push(i);return r}async function Xm(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternReplacement`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=Y(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Q(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)u+=Q(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=Z(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=Z(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Q(n,!0,e.state.shoptOptions.extglob)}else{let n=await r(e,t);u+=Z(n)}let d=s.replacement?await n(e,s.replacement.parts):``,f=u;s.anchor===`start`?f=`^${u}`:s.anchor===`end`&&(f=`${u}$`);let p=[];try{let e=M(f,s.all?`g`:``);for(let t of l)p.push(e.replace(t,d))}catch{p.push(...l)}let m=Qf(e.state.env),h=$f(e.state.env);if(o){let t=q(e.state.env),n=p.join(t);return h?{values:n?[n]:[],quoted:!1}:{values:J(n,m),quoted:!1}}if(h)return{values:p,quoted:!1};let ee=[];for(let e of p)e===``?ee.push(``):ee.push(...J(e,m));return{values:ee,quoted:!1}}async function Zm(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternRemoval`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=Y(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``,d=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Q(t.pattern,s.greedy,d);else if(t.type===`Literal`)u+=Q(t.value,s.greedy,d);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=Z(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=Z(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Q(n,s.greedy,d)}else{let n=await r(e,t);u+=Z(n)}let f=[];for(let e of l)f.push(zp(e,u,s.side,s.greedy));let p=Qf(e.state.env),m=$f(e.state.env);if(o){let t=q(e.state.env),n=f.join(t);return m?{values:n?[n]:[],quoted:!1}:{values:J(n,p),quoted:!1}}if(m)return{values:f,quoted:!1};let h=[];for(let e of f)e===``?h.push(``):h.push(...J(e,p));return{values:h,quoted:!1}}async function Qm(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`PatternRemoval`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=[];for(let t=1;t<=s;t++)c.push(e.state.env.get(String(t))||``);if(c.length===0)return{values:[],quoted:!1};let l=``,u=e.state.shoptOptions.extglob;if(o.pattern)for(let t of o.pattern.parts)if(t.type===`Glob`)l+=Q(t.pattern,o.greedy,u);else if(t.type===`Literal`)l+=Q(t.value,o.greedy,u);else if(t.type===`SingleQuoted`||t.type===`Escaped`)l+=Z(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);l+=Z(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);l+=Q(n,o.greedy,u)}else{let n=await r(e,t);l+=Z(n)}let d=[];for(let e of c)d.push(zp(e,l,o.side,o.greedy));let f=Qf(e.state.env),p=$f(e.state.env);if(a){let t=q(e.state.env),n=d.join(t);return p?{values:n?[n]:[],quoted:!1}:{values:J(n,f),quoted:!1}}if(p)return{values:d,quoted:!1};let m=[];for(let e of d)e===``?m.push(``):m.push(...J(e,f));return{values:m,quoted:!1}}async function $m(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`Substring`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=o.offset?await n(e,o.offset.expression):0,c=o.length?await n(e,o.length.expression):void 0,l=Number.parseInt(e.state.env.get(`#`)||`0`,10),u=[];for(let t=1;t<=l;t++)u.push(e.state.env.get(String(t))||``);let d=e.state.env.get(`0`)||`bash`,f;if(s<=0){let e=[d,...u],t=e.length+s;if(t<0)f=[];else{let n=s<0?t:0;if(c!==void 0){let t=c<0?e.length+c:n+c;f=e.slice(n,Math.max(n,t))}else f=e.slice(n)}}else{let e=s-1;if(e>=u.length)f=[];else if(c!==void 0){let t=c<0?u.length+c:e+c;f=u.slice(e,Math.max(e,t))}else f=u.slice(e)}let p=``;for(let n=0;n<i;n++)p+=await r(e,t[n]);let m=``;for(let n=i+1;n<t.length;n++)m+=await r(e,t[n]);let h=Qf(e.state.env),ee=$f(e.state.env);if(f.length===0){let e=p+m;return e?ee?{values:[e],quoted:!1}:{values:J(e,h),quoted:!1}:{values:[],quoted:!1}}let te;if(a){let t=q(e.state.env),n=p+f.join(t)+m;te=ee?n?[n]:[]:J(n,h)}else if(ee)te=f.length===1?[p+f[0]+m]:[p+f[0],...f.slice(1,-1),f[f.length-1]+m];else{te=[];for(let e=0;e<f.length;e++){let t=f[e];if(e===0&&(t=p+t),e===f.length-1&&(t+=m),t===``)te.push(``);else{let e=J(t,h);te.push(...e)}}}return{values:await Ym(e,te),quoted:!1}}async function eh(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].parameter!==`@`&&t[0].parameter!==`*`||t[0].operation)return null;let n=t[0].parameter===`*`,r=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(r===0)return{values:[],quoted:!1};let i=[];for(let t=1;t<=r;t++)i.push(e.state.env.get(String(t))||``);let a=Qf(e.state.env),o=$f(e.state.env),s=ep(e.state.env),c;if(n)if(o)c=i.filter(e=>e!==``);else{let t=q(e.state.env);c=J(i.join(t),a)}else if(o)c=i.filter(e=>e!==``);else if(s){c=[];for(let e of i){if(e===``)continue;let t=J(e,a);c.push(...t)}}else{c=[];for(let e of i)if(e===``)c.push(``);else{let t=J(e,a);c.push(...t)}for(;c.length>0&&c[c.length-1]===``;)c.pop()}return{values:await Ym(e,c),quoted:!1}}async function th(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],i=n[2]===`*`,a=Y(e,r),o;if(a.length===0){let t=e.state.env.get(r);if(t!==void 0)o=[t];else return{values:[],quoted:!1}}else o=a.map(([,e])=>e);let s=Qf(e.state.env),c=$f(e.state.env),l=ep(e.state.env),u;if(i)if(c)u=o.filter(e=>e!==``);else{let t=q(e.state.env);u=J(o.join(t),s)}else if(c)u=o.filter(e=>e!==``);else if(l){u=[];for(let e of o){if(e===``)continue;let t=J(e,s);u.push(...t)}}else{u=[];for(let e of o)if(e===``)u.push(``);else{let t=J(e,s);u.push(...t)}for(;u.length>0&&u[u.length-1]===``;)u.pop()}return{values:await Ym(e,u),quoted:!1}}function nh(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`VarNamePrefix`)return null;let n=t[0].operation,r=Bp(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let i=Qf(e.state.env),a=$f(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=J(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=J(e,i);o.push(...t)}}return{values:o,quoted:!1}}function rh(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`ArrayKeys`)return null;let n=t[0].operation,r=Y(e,n.array).map(([e])=>String(e));if(r.length===0)return{values:[],quoted:!1};let i=Qf(e.state.env),a=$f(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=J(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=J(e,i);o.push(...t)}}return{values:o,quoted:!1}}async function ih(e,t,n){let r=-1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&!n.operation){r=e;break}}if(r===-1||t.length<=1)return null;let i=Number.parseInt(e.state.env.get(`#`)||`0`,10),a=[];for(let t=1;t<=i;t++)a.push(e.state.env.get(String(t))||``);let o=``;for(let i=0;i<r;i++)o+=await n(e,t[i]);let s=``;for(let i=r+1;i<t.length;i++)s+=await n(e,t[i]);let c=Qf(e.state.env),l=$f(e.state.env),u=ep(e.state.env);if(i===0){let e=o+s;return{values:e?[e]:[],quoted:!1}}let d;{let e=[];for(let t=0;t<a.length;t++){let n=a[t];t===0&&(n=o+n),t===a.length-1&&(n+=s),e.push(n)}if(l)d=e.filter(e=>e!==``);else if(u){d=[];for(let t of e){if(t===``)continue;let e=J(t,c);d.push(...e)}}else{d=[];for(let t of e)if(t===``)d.push(``);else{let e=J(t,c);d.push(...e)}for(;d.length>0&&d[d.length-1]===``;)d.pop()}}return d.length===0?{values:[],quoted:!1}:{values:await Ym(e,d),quoted:!1}}var ah=g(()=>{ta(),Hf(),x(),op(),jp(),Ap(),Rp(),Vp(),hp()});async function oh(e,t,n){e.coverage?.hit(`bash:expansion:word_glob`);let r=t.parts,{hasQuoted:i,hasCommandSub:a,hasArrayVar:o,hasArrayAtExpansion:s,hasParamExpansion:c,hasVarNamePrefixExpansion:l,hasIndirection:u}=Kf(r),d=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(d&&d.length>1)return sh(e,d,i);let f=await ch(e,r,s,l,u,n);if(f!==null)return f;let p=await uh(e,r,n);if(p!==null)return p;let m=await dh(e,r,n);if(m!==null)return m;let h=await mh(e,r,n.expandPart);if(h!==null)return hh(e,h);if((a||o||c)&&!$f(e.state.env)){let t=Qf(e.state.env),i=n.buildIfsCharClassPattern(t);return hh(e,await n.smartWordSplit(e,r,t,i,n.expandPart))}return _h(e,t,r,await n.expandWordAsync(e,t),i,n.expandWordForGlobbing)}async function sh(e,t,n){let r=[];for(let i of t)if(!(!n&&i===``))if(!n&&!e.state.options.noglob&&Ep(i,e.state.shoptOptions.extglob)){let t=await gh(e,i);r.push(...t)}else r.push(i);return{values:r,quoted:!1}}async function ch(e,t,n,r,i,a){if(n){let n=Nm(e,t);if(n!==null)return n}{let n=Pm(e,t);if(n!==null)return n}{let n=await Em(e,t);if(n!==null)return n}{let r=await Dm(e,t,n,a.expandPart,a.expandWordPartsAsync);if(r!==null)return r}{let r=await Om(e,t,n,a.expandPart);if(r!==null)return r}{let n=await Am(e,t,a.evaluateArithmetic);if(n!==null)return n}{let n=jm(e,t);if(n!==null)return n}{let n=await Cm(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}{let n=await wm(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}if(r&&t.length===1&&t[0].type===`DoubleQuoted`){let n=lh(e,t);if(n!==null)return n}{let n=await Im(e,t,i,a.expandParameterAsync,a.expandWordPartsAsync);if(n!==null)return n}{let n=await zm(e,t);if(n!==null)return n}{let n=await Bm(e,t);if(n!==null)return n}return null}function lh(e,t){let n=t[0];if(n.type!==`DoubleQuoted`)return null;if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`VarNamePrefix`){let t=n.parts[0].operation,r=Bp(e,t.prefix);return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`ArrayKeys`){let t=n.parts[0].operation,r=Y(e,t.array).map(([e])=>String(e));return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}return null}async function uh(e,t,n){{let r=await Um(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await Wm(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await Gm(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await Km(e,t,n.expandPart);if(r!==null)return r}return null}async function dh(e,t,n){{let r=await Xm(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Zm(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Qm(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await $m(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let n=await eh(e,t);if(n!==null)return n}{let n=await th(e,t);if(n!==null)return n}{let n=nh(e,t);if(n!==null)return n}{let n=rh(e,t);if(n!==null)return n}{let r=await ih(e,t,n.expandPart);if(r!==null)return r}return null}function fh(e){if(e.type!==`DoubleQuoted`)return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!==`ParameterExpansion`||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:`array`,name:r[1],atIndex:t,isStar:r[2]===`*`};if(n.parameter===`@`||n.parameter===`*`)return{type:`positional`,atIndex:t,isStar:n.parameter===`*`}}return null}async function ph(e,t,n,r){let i=``;for(let a=0;a<n.atIndex;a++)i+=await r(e,t.parts[a]);let a=``;for(let i=n.atIndex+1;i<t.parts.length;i++)a+=await r(e,t.parts[i]);let o;if(n.type===`array`){if(o=Y(e,n.name).map(([,e])=>e),o.length===0){let t=e.state.env.get(n.name);t!==void 0&&(o=[t])}}else{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);o=[];for(let n=1;n<=t;n++)o.push(e.state.env.get(String(n))||``)}if(n.isStar){let t=q(e.state.env),n=o.join(t);return[i+n+a]}if(o.length===0){let e=i+a;return e?[e]:[]}return o.length===1?[i+o[0]+a]:[i+o[0],...o.slice(1,-1),o[o.length-1]+a]}async function mh(e,t,n){if(t.length<2)return null;let r=!1;for(let e of t)if(fh(e)){r=!0;break}if(!r)return null;let i=Qf(e.state.env),a=$f(e.state.env),o=[];for(let r of t){let t=fh(r);if(t&&r.type===`DoubleQuoted`){let i=await ph(e,r,t,n);o.push(i)}else if(r.type===`DoubleQuoted`||r.type===`SingleQuoted`){let t=await n(e,r);o.push([t])}else if(r.type===`Literal`)o.push([r.value]);else if(r.type===`ParameterExpansion`){let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=J(t,i);o.push(e)}}else{let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=J(t,i);o.push(e)}}}let s=[];for(let e of o)if(e.length!==0)if(s.length===0)s.push(...e);else{let t=s.length-1;s[t]=s[t]+e[0];for(let t=1;t<e.length;t++)s.push(e[t])}return s}async function hh(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(Ep(r,e.state.shoptOptions.extglob)){let t=await gh(e,r);n.push(...t)}else n.push(r);return{values:n,quoted:!1}}async function gh(e,t){let n=new Vf(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new lr(t);return n.hasNullglob()?[]:[t]}async function _h(e,t,n,r,i,a){let o=n.some(e=>e.type===`Glob`);if(!e.state.options.noglob&&o){let n=await a(e,t);if(Ep(n,e.state.shoptOptions.extglob)){let t=await gh(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1};if(t.length===0)return{values:[],quoted:!1}}let i=Dp(r);return $f(e.state.env)?{values:[i],quoted:!1}:{values:J(i,Qf(e.state.env)),quoted:!1}}if(!i&&!e.state.options.noglob&&Ep(r,e.state.shoptOptions.extglob)){let n=await a(e,t);if(Ep(n,e.state.shoptOptions.extglob)){let t=await gh(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1}}}if(r===``&&!i)return{values:[],quoted:!1};if(o&&!i){let t=Dp(r);return $f(e.state.env)?{values:[t],quoted:!1}:{values:J(t,Qf(e.state.env)),quoted:!1}}return{values:[r],quoted:i}}var vh=g(()=>{Hf(),x(),op(),qf(),Tm(),km(),Mm(),Fm(),Ap(),Vm(),Vp(),qm(),ah(),hp()});async function yh(e,t){let n=t.operation;if(!n||n.type!==`DefaultValue`&&n.type!==`AssignDefault`&&n.type!==`UseAlternative`)return null;let r=n.word;if(!r||r.parts.length===0)return null;let i=await mp(e,t.parameter),a=await X(e,t.parameter,!1)===``,o=n.checkEmpty??!1,s;return s=n.type===`UseAlternative`?i&&!(o&&a):!i||o&&a,s?r.parts:null}function bh(e){return e.type===`SingleQuoted`?!0:e.type===`DoubleQuoted`?e.parts.every(e=>e.type===`Literal`):!1}async function xh(e,t){if(t.type!==`ParameterExpansion`)return null;let n=await yh(e,t);if(!n||n.length<=1)return null;let r=n.some(e=>bh(e)),i=n.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`);return r&&i?n:null}function Sh(e){return e.type===`DoubleQuoted`||e.type===`SingleQuoted`||e.type===`Literal`?!1:e.type===`Glob`?Uf(e.pattern):!(!(e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`)||e.type===`ParameterExpansion`&&Gf(e))}async function Ch(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:word_split`),t.length===1&&t[0].type===`ParameterExpansion`){let a=t[0],o=await yh(e,a);if(o&&o.length>0&&o.length>1&&o.some(e=>e.type===`DoubleQuoted`||e.type===`SingleQuoted`)&&o.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`))return Th(e,o,n,r,i)}let a=[],o=!1;for(let n of t){let t=Sh(n),r=n.type===`DoubleQuoted`||n.type===`SingleQuoted`,s=t?await xh(e,n):null,c=await i(e,n);a.push({value:c,isSplittable:t,isQuoted:r,mixedDefaultParts:s??void 0}),t&&(o=!0)}if(!o){let e=a.map(e=>e.value).join(``);return e?[e]:[]}let s=[],c=``,l=!1,u=!1,d=!1;for(let t of a)if(!t.isSplittable)u?t.isQuoted&&t.value===``?(c!==``&&s.push(c),s.push(``),l=!0,c=``,u=!1,d=!0):t.value===``?(c+=t.value,d=!1):(c!==``&&s.push(c),c=t.value,u=!1,d=!1):(c+=t.value,d=t.isQuoted&&t.value===``);else if(t.mixedDefaultParts){let a=await Th(e,t.mixedDefaultParts,n,r,i);if(a.length!==0)if(a.length===1)c+=a[0],l=!0;else{c+=a[0],s.push(c),l=!0;for(let e=1;e<a.length-1;e++)s.push(a[e]);c=a[a.length-1]}u=!1,d=!1}else{let{words:e,hadLeadingDelimiter:r,hadTrailingDelimiter:i}=ip(t.value,n);if(d&&r&&c===``&&(s.push(``),l=!0),e.length===0)i&&(u=!0);else if(e.length===1)c+=e[0],l=!0,u=i;else{c+=e[0],s.push(c),l=!0;for(let t=1;t<e.length-1;t++)s.push(e[t]);c=e[e.length-1],u=i}d=!1}return c===``?s.length===0&&l&&s.push(``):s.push(c),s}function wh(e,t){return e.length>0&&t.includes(e[0])}async function Th(e,t,n,r,i){let a=[];for(let n of t){let t=!(n.type===`DoubleQuoted`||n.type===`SingleQuoted`),r=await i(e,n);a.push({value:r,isSplittable:t})}let o=[],s=``,c=!1,l=!1;for(let e of a)if(!e.isSplittable)l&&e.value!==``?(s!==``&&o.push(s),s=e.value,l=!1):s+=e.value;else{wh(e.value,n)&&s!==``&&(o.push(s),s=``,c=!0);let{words:t,hadTrailingDelimiter:r}=ip(e.value,n);if(t.length===0)r&&(l=!0);else if(t.length===1)s+=t[0],c=!0,l=r;else{s+=t[0],o.push(s),c=!0;for(let e=1;e<t.length-1;e++)o.push(t[e]);s=t[t.length-1],l=r}}return s===``?o.length===0&&c&&o.push(``):o.push(s),o}var Eh=g(()=>{hp(),op(),qf()});function Dh(e){switch(e.type){case`Literal`:return e.value;case`SingleQuoted`:return e.value;case`Escaped`:return e.value;default:return null}}function Oh(e){switch(e.type){case`SingleQuoted`:case`Escaped`:case`DoubleQuoted`:return!0;case`Literal`:return e.value===``;default:return!1}}var kh=g(()=>{});_({},{escapeGlobChars:()=>Op,escapeRegexChars:()=>kp,expandRedirectTarget:()=>Kh,expandWord:()=>Fh,expandWordForPattern:()=>Lh,expandWordForRegex:()=>Ih,expandWordWithGlob:()=>Uh,getArrayElements:()=>Y,getVariable:()=>X,hasQuotedMultiValueAt:()=>Gh,isArray:()=>pp,isWordFullyQuoted:()=>Nh});function Ah(e,t,n){if(e.length>t)throw new b(`${n}: string length limit exceeded (${t} bytes)`,`string_length`)}async function jh(e,t,n=!1){let r=[];for(let i of t)r.push(await Jh(e,i,n));return r.join(``)}function Mh(e){return Oh(e)}function Nh(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!Mh(t))return!1;return!0}function Ph(e,t,n=!1){let r=Dh(t);if(r!==null)return r;switch(t.type){case`TildeExpansion`:return n?t.user===null?`~`:`~${t.user}`:(e.coverage?.hit(`bash:expansion:tilde`),t.user===null?e.state.env.get(`HOME`)??`/home/user`:t.user===`root`?`/root`:`~${t.user}`);case`Glob`:return hm(e,t.pattern);default:return null}}async function Fh(e,t){return qh(e,t)}async function Ih(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`)n.push(`\\${r.value}`);else if(r.type===`SingleQuoted`)n.push(r.value);else if(r.type===`DoubleQuoted`){let t=await jh(e,r.parts);n.push(t)}else if(r.type===`TildeExpansion`){let t=await Jh(e,r);n.push(kp(t))}else n.push(await Jh(e,r));return n.join(``)}async function Lh(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`){let e=r.value;`()|*?[]`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`SingleQuoted`)n.push(Op(r.value));else if(r.type===`DoubleQuoted`){let t=await jh(e,r.parts);n.push(Op(t))}else n.push(await Jh(e,r));return n.join(``)}async function Rh(e,t){let n=[];for(let r of t.parts)if(r.type===`SingleQuoted`)n.push(Op(r.value));else if(r.type===`Escaped`){let e=r.value;`*?[]\\()|`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`DoubleQuoted`){let t=await jh(e,r.parts);n.push(Op(t))}else r.type===`Glob`?fm(r.pattern)?n.push(await _m(e,r.pattern)):n.push(hm(e,r.pattern)):r.type===`Literal`?n.push(r.value):n.push(await Jh(e,r));return n.join(``)}function zh(e){for(let t of e)if(t.type===`BraceExpansion`||t.type===`DoubleQuoted`&&zh(t.parts))return!0;return!1}async function Bh(e,t,n={count:0}){if(n.count>Xh)return[[]];let r=[[]];for(let i of t)if(i.type===`BraceExpansion`){let t=[],a=!1,o=``;for(let r of i.items)if(r.type===`Range`){let e=xp(r.start,r.end,r.step,r.startStr,r.endStr);if(e.expanded)for(let r of e.expanded)n.count++,t.push(r);else{a=!0,o=e.literal;break}}else{let i=await Bh(e,r.word.parts,n);for(let r of i){n.count++;let i=[];for(let t of r)typeof t==`string`?i.push(t):i.push(await Jh(e,t));t.push(i.join(``))}}if(a){for(let e of r)n.count++,e.push(o);continue}if(r.length*t.length>e.limits.maxBraceExpansionResults||n.count>Xh)return r;let s=[];for(let e of r)for(let i of t){if(n.count++,n.count>Xh)return s.length>0?s:r;s.push([...e,i])}r=s}else for(let e of r)n.count++,e.push(i);return r}async function Vh(e,t){let n=t.parts;if(!zh(n))return[await Fh(e,t)];let r=await Bh(e,n),i=[];for(let t of r){let n=[];for(let r of t)typeof r==`string`?n.push(r):n.push(await Jh(e,r));i.push(bm(e,n.join(``)))}return i}function Hh(){return{expandWordAsync:qh,expandWordForGlobbing:Rh,expandWordWithBracesAsync:Vh,expandWordPartsAsync:jh,expandPart:Jh,expandParameterAsync:Yh,hasBraceExpansion:zh,evaluateArithmetic:$,buildIfsCharClassPattern:tp,smartWordSplit:Ch}}async function Uh(e,t){return oh(e,t,Hh())}function Wh(e){for(let t of e){if(t.type===`ParameterExpansion`)return t.parameter;if(t.type===`Literal`)return t.value}return``}function Gh(e,t){if(Number.parseInt(e.state.env.get(`#`)||`0`,10)<2)return!1;function n(e){for(let t of e)if(t.type===`DoubleQuoted`){for(let e of t.parts)if(e.type===`ParameterExpansion`&&e.parameter===`@`&&!e.operation)return!0}return!1}return n(t.parts)}async function Kh(e,t){if(Gh(e,t))return{error:`bash: $@: ambiguous redirect
215
+ `);let l=c.offset?await n(e,c.offset.expression):0,u=c.length?await n(e,c.length.expression):void 0,d=Y(e,o),f=0;if(l<0){if(d.length>0){let e=d[d.length-1][0],t=(typeof e==`number`?e:0)+1+l;if(t<0)return{values:[],quoted:!0};f=d.findIndex(([e])=>typeof e==`number`&&e>=t),f<0&&(f=d.length)}}else f=d.findIndex(([e])=>typeof e==`number`&&e>=l),f<0&&(f=d.length);let p;if(u!==void 0){if(u<0)throw new sr(`${o}[@]: substring expression < 0`);p=d.slice(f,f+u).map(([,e])=>e)}else p=d.slice(f).map(([,e])=>e);if(p.length===0)return{values:[],quoted:!0};if(s){let t=q(e.state.env);return{values:[p.join(t)],quoted:!0}}return{values:p,quoted:!0}}function jm(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation?.type!==`Transform`)return null;let r=n.parts[0],i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let a=i[1],o=i[2]===`*`,s=r.operation,c=Y(e,a);if(c.length===0){let t=e.state.env.get(a);if(t!==void 0){let n;switch(s.operator){case`a`:n=``;break;case`P`:n=Up(e,t);break;case`Q`:n=Gp(t);break;default:n=t}return{values:[n],quoted:!0}}return o?{values:[``],quoted:!0}:{values:[],quoted:!0}}let l=Yp(e,a),u;switch(s.operator){case`a`:u=c.map(()=>l);break;case`P`:u=c.map(([,t])=>Up(e,t));break;case`Q`:u=c.map(([,e])=>Gp(e));break;case`u`:u=c.map(([,e])=>e.charAt(0).toUpperCase()+e.slice(1));break;case`U`:u=c.map(([,e])=>e.toUpperCase());break;case`L`:u=c.map(([,e])=>e.toLowerCase());break;default:u=c.map(([,e])=>e)}if(o){let t=q(e.state.env);return{values:[u.join(t)],quoted:!0}}return{values:u,quoted:!0}}var Mm=g(()=>{x(),op(),Wp(),Kp(),hp(),Xp()});function Nm(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`)return null;let r=n.parts[0];if(r.operation)return null;let i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!i)return null;let a=i[1];if(sp(e,a)){let t=up(e,a);if(t?.endsWith(`[@]`)||t?.endsWith(`[*]`))return{values:[],quoted:!0}}let o=Y(e,a);if(o.length>0)return{values:o.map(([,e])=>e),quoted:!0};let s=e.state.env.get(a);return s===void 0?{values:[],quoted:!0}:{values:[s],quoted:!0}}function Pm(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation)return null;let r=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)||!sp(e,r))return null;let i=up(e,r);if(!i)return null;let a=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!a)return null;let o=a[1],s=Y(e,o);if(s.length>0)return{values:s.map(([,e])=>e),quoted:!0};let c=e.state.env.get(o);return c===void 0?{values:[],quoted:!0}:{values:[c],quoted:!0}}var Fm=g(()=>{dp(),hp()});async function Im(e,t,n,r,i){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let a=t[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=o.operation,c=await X(e,o.parameter),l=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l){if(!s.innerOp&&(c===`@`||c===`*`)){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return c===`*`?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}return null}let u=l[1],d=l[2]===`*`,f=Y(e,u);if(s.innerOp){if(s.innerOp.type===`Substring`)return Lm(e,f,u,d,s.innerOp);if(s.innerOp.type===`DefaultValue`||s.innerOp.type===`UseAlternative`||s.innerOp.type===`AssignDefault`||s.innerOp.type===`ErrorIfUnset`)return Rm(e,f,u,d,s.innerOp,i);if(s.innerOp.type===`Transform`&&s.innerOp.operator===`a`){let t=Yp(e,u),n=f.map(()=>t);return d?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}let t=[];for(let[,n]of f){let i={type:`ParameterExpansion`,parameter:`_indirect_elem_`,operation:s.innerOp},a=e.state.env.get(`_indirect_elem_`);e.state.env.set(`_indirect_elem_`,n);try{let n=await r(e,i,!0);t.push(n)}finally{a===void 0?e.state.env.delete(`_indirect_elem_`):e.state.env.set(`_indirect_elem_`,a)}}return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}if(f.length>0){let t=f.map(([,e])=>e);return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let p=e.state.env.get(u);return p===void 0?{values:[],quoted:!0}:{values:[p],quoted:!0}}async function Lm(e,t,n,r,i){let a=i.offset?await $(e,i.offset.expression):0,o=i.length?await $(e,i.length.expression):void 0,s=0;if(a<0){if(t.length>0){let e=t[t.length-1][0],n=(typeof e==`number`?e:0)+1+a;if(n<0||(s=t.findIndex(([e])=>typeof e==`number`&&e>=n),s<0))return{values:[],quoted:!0}}}else if(s=t.findIndex(([e])=>typeof e==`number`&&e>=a),s<0)return{values:[],quoted:!0};let c;if(o!==void 0){if(o<0)throw new sr(`${n}[@]: substring expression < 0`);c=t.slice(s,s+o)}else c=t.slice(s);let l=c.map(([,e])=>e);return r?{values:[l.join(q(e.state.env))],quoted:!0}:{values:l,quoted:!0}}async function Rm(e,t,n,r,i,a){let o=i.checkEmpty??!1,s=t.map(([,e])=>e),c=t.length===0,l=t.length===0;if(i.type===`UseAlternative`)return!l&&!(o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(i.type===`DefaultValue`)return(l||o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0};if(i.type===`AssignDefault`){if((l||o&&c)&&i.word){let t=await a(e,i.word.parts,!0);return e.state.env.set(`${n}_0`,t),e.state.env.set(`${n}__length`,`1`),{values:[t],quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}async function zm(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`UseAlternative`&&t[0].operation?.type!==`DefaultValue`)return null;let n=t[0],r=n.operation,i=r?.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await X(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await mp(e,n.parameter),l=await X(e,n.parameter)===``,u=r.checkEmpty??!1,d;if(d=r.type===`UseAlternative`?c&&!(u&&l):!c||u&&l,d){let t=s[1],n=s[2]===`*`,r=Y(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}async function Bm(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`Indirection`)return null;let n=t[0],r=n.operation.innerOp;if(!r||r.type!==`UseAlternative`&&r.type!==`DefaultValue`)return null;let i=r.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await X(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await X(e,n.parameter),l=await mp(e,n.parameter),u=c===``,d=r.checkEmpty??!1,f;if(f=r.type===`UseAlternative`?l&&!(d&&u):!l||d&&u,f){let t=s[1],n=s[2]===`*`,r=Y(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}var Vm=g(()=>{sg(),x(),op(),hp(),Xp()});function Hm(e){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return n}async function Um(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`Substring`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=s.offset?await n(e,s.offset.expression):0,l=s.length?await n(e,s.length.expression):void 0,u=Number.parseInt(e.state.env.get(`#`)||`0`,10),d=[];for(let t=1;t<=u;t++)d.push(e.state.env.get(String(t))||``);let f=e.state.env.get(`0`)||`bash`,p;if(c<=0){let e=[f,...d],t=e.length+c;if(t<0)p=[];else{let n=c<0?t:0;if(l!==void 0){let t=l<0?e.length+l:n+l;p=e.slice(n,Math.max(n,t))}else p=e.slice(n)}}else{let e=c-1;if(e>=d.length)p=[];else if(l!==void 0){let t=l<0?d.length+l:e+l;p=d.slice(e,Math.max(e,t))}else p=d.slice(e)}let m=``;for(let t=0;t<a;t++)m+=await r(e,i.parts[t]);let h=``;for(let t=a+1;t<i.parts.length;t++)h+=await r(e,i.parts[t]);if(p.length===0){let e=m+h;return{values:e?[e]:[],quoted:!0}}if(o){let t=q(e.state.env);return{values:[m+p.join(t)+h],quoted:!0}}return p.length===1?{values:[m+p[0]+h],quoted:!0}:{values:[m+p[0],...p.slice(1,-1),p[p.length-1]+h],quoted:!0}}async function Wm(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternReplacement`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=Hm(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Q(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)d+=Q(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=Z(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=Z(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Q(r,!0,e.state.shoptOptions.extglob)}else{let r=await n(e,t);d+=Z(r)}let f=s.replacement?await r(e,s.replacement.parts):``,p=d;s.anchor===`start`?p=`^${d}`:s.anchor===`end`&&(p=`${d}$`);let m=[];try{let e=M(p,s.all?`g`:``);for(let t of c)m.push(e.replace(t,f))}catch{m.push(...c)}if(o){let t=q(e.state.env);return{values:[l+m.join(t)+u],quoted:!0}}return m.length===1?{values:[l+m[0]+u],quoted:!0}:{values:[l+m[0],...m.slice(1,-1),m[m.length-1]+u],quoted:!0}}async function Gm(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternRemoval`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=Hm(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``,f=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Q(t.pattern,s.greedy,f);else if(t.type===`Literal`)d+=Q(t.value,s.greedy,f);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=Z(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=Z(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Q(r,s.greedy,f)}else{let r=await n(e,t);d+=Z(r)}let p=[];for(let e of c)p.push(zp(e,d,s.side,s.greedy));if(o){let t=q(e.state.env);return{values:[l+p.join(t)+u],quoted:!0}}return p.length===1?{values:[l+p[0]+u],quoted:!0}:{values:[l+p[0],...p.slice(1,-1),p[p.length-1]+u],quoted:!0}}async function Km(e,t,n){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let r=t[0],i=-1,a=!1;for(let e=0;e<r.parts.length;e++){let t=r.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)){i=e,a=t.parameter===`*`;break}}if(i===-1)return null;let o=r.parts[i];if(o.type===`ParameterExpansion`&&o.operation)return null;let s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=``;for(let t=0;t<i;t++)c+=await n(e,r.parts[t]);let l=``;for(let t=i+1;t<r.parts.length;t++)l+=await n(e,r.parts[t]);if(s===0){if(a)return{values:[c+l],quoted:!0};let e=c+l;return{values:e?[e]:[],quoted:!0}}let u=[];for(let t=1;t<=s;t++)u.push(e.state.env.get(String(t))||``);if(a){let t=q(e.state.env);return{values:[c+u.join(t)+l],quoted:!0}}return u.length===1?{values:[c+u[0]+l],quoted:!0}:{values:[c+u[0],...u.slice(1,-1),u[u.length-1]+l],quoted:!0}}var qm=g(()=>{ta(),op(),jp(),Rp(),Vp()});function Jm(e){return new Vf(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations})}async function Ym(e,t){if(e.state.options.noglob)return t;let n=Jm(e),r=[];for(let i of t)if(Ep(i,e.state.shoptOptions.extglob)){let e=await n.expand(i);if(e.length>0)r.push(...e);else{if(n.hasFailglob())throw new lr(i);n.hasNullglob()||r.push(i)}}else r.push(i);return r}async function Xm(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternReplacement`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=Y(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Q(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)u+=Q(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=Z(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=Z(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Q(n,!0,e.state.shoptOptions.extglob)}else{let n=await r(e,t);u+=Z(n)}let d=s.replacement?await n(e,s.replacement.parts):``,f=u;s.anchor===`start`?f=`^${u}`:s.anchor===`end`&&(f=`${u}$`);let p=[];try{let e=M(f,s.all?`g`:``);for(let t of l)p.push(e.replace(t,d))}catch{p.push(...l)}let m=Qf(e.state.env),h=$f(e.state.env);if(o){let t=q(e.state.env),n=p.join(t);return h?{values:n?[n]:[],quoted:!1}:{values:J(n,m),quoted:!1}}if(h)return{values:p,quoted:!1};let ee=[];for(let e of p)e===``?ee.push(``):ee.push(...J(e,m));return{values:ee,quoted:!1}}async function Zm(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternRemoval`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=Y(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``,d=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Q(t.pattern,s.greedy,d);else if(t.type===`Literal`)u+=Q(t.value,s.greedy,d);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=Z(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=Z(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Q(n,s.greedy,d)}else{let n=await r(e,t);u+=Z(n)}let f=[];for(let e of l)f.push(zp(e,u,s.side,s.greedy));let p=Qf(e.state.env),m=$f(e.state.env);if(o){let t=q(e.state.env),n=f.join(t);return m?{values:n?[n]:[],quoted:!1}:{values:J(n,p),quoted:!1}}if(m)return{values:f,quoted:!1};let h=[];for(let e of f)e===``?h.push(``):h.push(...J(e,p));return{values:h,quoted:!1}}async function Qm(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`PatternRemoval`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=[];for(let t=1;t<=s;t++)c.push(e.state.env.get(String(t))||``);if(c.length===0)return{values:[],quoted:!1};let l=``,u=e.state.shoptOptions.extglob;if(o.pattern)for(let t of o.pattern.parts)if(t.type===`Glob`)l+=Q(t.pattern,o.greedy,u);else if(t.type===`Literal`)l+=Q(t.value,o.greedy,u);else if(t.type===`SingleQuoted`||t.type===`Escaped`)l+=Z(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);l+=Z(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);l+=Q(n,o.greedy,u)}else{let n=await r(e,t);l+=Z(n)}let d=[];for(let e of c)d.push(zp(e,l,o.side,o.greedy));let f=Qf(e.state.env),p=$f(e.state.env);if(a){let t=q(e.state.env),n=d.join(t);return p?{values:n?[n]:[],quoted:!1}:{values:J(n,f),quoted:!1}}if(p)return{values:d,quoted:!1};let m=[];for(let e of d)e===``?m.push(``):m.push(...J(e,f));return{values:m,quoted:!1}}async function $m(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`Substring`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=o.offset?await n(e,o.offset.expression):0,c=o.length?await n(e,o.length.expression):void 0,l=Number.parseInt(e.state.env.get(`#`)||`0`,10),u=[];for(let t=1;t<=l;t++)u.push(e.state.env.get(String(t))||``);let d=e.state.env.get(`0`)||`bash`,f;if(s<=0){let e=[d,...u],t=e.length+s;if(t<0)f=[];else{let n=s<0?t:0;if(c!==void 0){let t=c<0?e.length+c:n+c;f=e.slice(n,Math.max(n,t))}else f=e.slice(n)}}else{let e=s-1;if(e>=u.length)f=[];else if(c!==void 0){let t=c<0?u.length+c:e+c;f=u.slice(e,Math.max(e,t))}else f=u.slice(e)}let p=``;for(let n=0;n<i;n++)p+=await r(e,t[n]);let m=``;for(let n=i+1;n<t.length;n++)m+=await r(e,t[n]);let h=Qf(e.state.env),ee=$f(e.state.env);if(f.length===0){let e=p+m;return e?ee?{values:[e],quoted:!1}:{values:J(e,h),quoted:!1}:{values:[],quoted:!1}}let te;if(a){let t=q(e.state.env),n=p+f.join(t)+m;te=ee?n?[n]:[]:J(n,h)}else if(ee)te=f.length===1?[p+f[0]+m]:[p+f[0],...f.slice(1,-1),f[f.length-1]+m];else{te=[];for(let e=0;e<f.length;e++){let t=f[e];if(e===0&&(t=p+t),e===f.length-1&&(t+=m),t===``)te.push(``);else{let e=J(t,h);te.push(...e)}}}return{values:await Ym(e,te),quoted:!1}}async function eh(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].parameter!==`@`&&t[0].parameter!==`*`||t[0].operation)return null;let n=t[0].parameter===`*`,r=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(r===0)return{values:[],quoted:!1};let i=[];for(let t=1;t<=r;t++)i.push(e.state.env.get(String(t))||``);let a=Qf(e.state.env),o=$f(e.state.env),s=ep(e.state.env),c;if(n)if(o)c=i.filter(e=>e!==``);else{let t=q(e.state.env);c=J(i.join(t),a)}else if(o)c=i.filter(e=>e!==``);else if(s){c=[];for(let e of i){if(e===``)continue;let t=J(e,a);c.push(...t)}}else{c=[];for(let e of i)if(e===``)c.push(``);else{let t=J(e,a);c.push(...t)}for(;c.length>0&&c[c.length-1]===``;)c.pop()}return{values:await Ym(e,c),quoted:!1}}async function th(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],i=n[2]===`*`,a=Y(e,r),o;if(a.length===0){let t=e.state.env.get(r);if(t!==void 0)o=[t];else return{values:[],quoted:!1}}else o=a.map(([,e])=>e);let s=Qf(e.state.env),c=$f(e.state.env),l=ep(e.state.env),u;if(i)if(c)u=o.filter(e=>e!==``);else{let t=q(e.state.env);u=J(o.join(t),s)}else if(c)u=o.filter(e=>e!==``);else if(l){u=[];for(let e of o){if(e===``)continue;let t=J(e,s);u.push(...t)}}else{u=[];for(let e of o)if(e===``)u.push(``);else{let t=J(e,s);u.push(...t)}for(;u.length>0&&u[u.length-1]===``;)u.pop()}return{values:await Ym(e,u),quoted:!1}}function nh(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`VarNamePrefix`)return null;let n=t[0].operation,r=Bp(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let i=Qf(e.state.env),a=$f(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=J(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=J(e,i);o.push(...t)}}return{values:o,quoted:!1}}function rh(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`ArrayKeys`)return null;let n=t[0].operation,r=Y(e,n.array).map(([e])=>String(e));if(r.length===0)return{values:[],quoted:!1};let i=Qf(e.state.env),a=$f(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=J(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=J(e,i);o.push(...t)}}return{values:o,quoted:!1}}async function ih(e,t,n){let r=-1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&!n.operation){r=e;break}}if(r===-1||t.length<=1)return null;let i=Number.parseInt(e.state.env.get(`#`)||`0`,10),a=[];for(let t=1;t<=i;t++)a.push(e.state.env.get(String(t))||``);let o=``;for(let i=0;i<r;i++)o+=await n(e,t[i]);let s=``;for(let i=r+1;i<t.length;i++)s+=await n(e,t[i]);let c=Qf(e.state.env),l=$f(e.state.env),u=ep(e.state.env);if(i===0){let e=o+s;return{values:e?[e]:[],quoted:!1}}let d;{let e=[];for(let t=0;t<a.length;t++){let n=a[t];t===0&&(n=o+n),t===a.length-1&&(n+=s),e.push(n)}if(l)d=e.filter(e=>e!==``);else if(u){d=[];for(let t of e){if(t===``)continue;let e=J(t,c);d.push(...e)}}else{d=[];for(let t of e)if(t===``)d.push(``);else{let e=J(t,c);d.push(...e)}for(;d.length>0&&d[d.length-1]===``;)d.pop()}}return d.length===0?{values:[],quoted:!1}:{values:await Ym(e,d),quoted:!1}}var ah=g(()=>{ta(),Hf(),x(),op(),jp(),Ap(),Rp(),Vp(),hp()});async function oh(e,t,n){e.coverage?.hit(`bash:expansion:word_glob`);let r=t.parts,{hasQuoted:i,hasCommandSub:a,hasArrayVar:o,hasArrayAtExpansion:s,hasParamExpansion:c,hasVarNamePrefixExpansion:l,hasIndirection:u}=Kf(r),d=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(d&&d.length>1)return sh(e,d,i);let f=await ch(e,r,s,l,u,n);if(f!==null)return f;let p=await uh(e,r,n);if(p!==null)return p;let m=await dh(e,r,n);if(m!==null)return m;let h=await mh(e,r,n.expandPart);if(h!==null)return hh(e,h);if((a||o||c)&&!$f(e.state.env)){let t=Qf(e.state.env),i=n.buildIfsCharClassPattern(t);return hh(e,await n.smartWordSplit(e,r,t,i,n.expandPart))}return _h(e,t,r,await n.expandWordAsync(e,t),i,n.expandWordForGlobbing)}async function sh(e,t,n){let r=[];for(let i of t)if(!(!n&&i===``))if(!n&&!e.state.options.noglob&&Ep(i,e.state.shoptOptions.extglob)){let t=await gh(e,i);r.push(...t)}else r.push(i);return{values:r,quoted:!1}}async function ch(e,t,n,r,i,a){if(n){let n=Nm(e,t);if(n!==null)return n}{let n=Pm(e,t);if(n!==null)return n}{let n=await Em(e,t);if(n!==null)return n}{let r=await Dm(e,t,n,a.expandPart,a.expandWordPartsAsync);if(r!==null)return r}{let r=await Om(e,t,n,a.expandPart);if(r!==null)return r}{let n=await Am(e,t,a.evaluateArithmetic);if(n!==null)return n}{let n=jm(e,t);if(n!==null)return n}{let n=await Cm(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}{let n=await wm(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}if(r&&t.length===1&&t[0].type===`DoubleQuoted`){let n=lh(e,t);if(n!==null)return n}{let n=await Im(e,t,i,a.expandParameterAsync,a.expandWordPartsAsync);if(n!==null)return n}{let n=await zm(e,t);if(n!==null)return n}{let n=await Bm(e,t);if(n!==null)return n}return null}function lh(e,t){let n=t[0];if(n.type!==`DoubleQuoted`)return null;if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`VarNamePrefix`){let t=n.parts[0].operation,r=Bp(e,t.prefix);return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`ArrayKeys`){let t=n.parts[0].operation,r=Y(e,t.array).map(([e])=>String(e));return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}return null}async function uh(e,t,n){{let r=await Um(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await Wm(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await Gm(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await Km(e,t,n.expandPart);if(r!==null)return r}return null}async function dh(e,t,n){{let r=await Xm(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Zm(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await Qm(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await $m(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let n=await eh(e,t);if(n!==null)return n}{let n=await th(e,t);if(n!==null)return n}{let n=nh(e,t);if(n!==null)return n}{let n=rh(e,t);if(n!==null)return n}{let r=await ih(e,t,n.expandPart);if(r!==null)return r}return null}function fh(e){if(e.type!==`DoubleQuoted`)return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!==`ParameterExpansion`||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:`array`,name:r[1],atIndex:t,isStar:r[2]===`*`};if(n.parameter===`@`||n.parameter===`*`)return{type:`positional`,atIndex:t,isStar:n.parameter===`*`}}return null}async function ph(e,t,n,r){let i=``;for(let a=0;a<n.atIndex;a++)i+=await r(e,t.parts[a]);let a=``;for(let i=n.atIndex+1;i<t.parts.length;i++)a+=await r(e,t.parts[i]);let o;if(n.type===`array`){if(o=Y(e,n.name).map(([,e])=>e),o.length===0){let t=e.state.env.get(n.name);t!==void 0&&(o=[t])}}else{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);o=[];for(let n=1;n<=t;n++)o.push(e.state.env.get(String(n))||``)}if(n.isStar){let t=q(e.state.env),n=o.join(t);return[i+n+a]}if(o.length===0){let e=i+a;return e?[e]:[]}return o.length===1?[i+o[0]+a]:[i+o[0],...o.slice(1,-1),o[o.length-1]+a]}async function mh(e,t,n){if(t.length<2)return null;let r=!1;for(let e of t)if(fh(e)){r=!0;break}if(!r)return null;let i=Qf(e.state.env),a=$f(e.state.env),o=[];for(let r of t){let t=fh(r);if(t&&r.type===`DoubleQuoted`){let i=await ph(e,r,t,n);o.push(i)}else if(r.type===`DoubleQuoted`||r.type===`SingleQuoted`){let t=await n(e,r);o.push([t])}else if(r.type===`Literal`)o.push([r.value]);else if(r.type===`ParameterExpansion`){let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=J(t,i);o.push(e)}}else{let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=J(t,i);o.push(e)}}}let s=[];for(let e of o)if(e.length!==0)if(s.length===0)s.push(...e);else{let t=s.length-1;s[t]=s[t]+e[0];for(let t=1;t<e.length;t++)s.push(e[t])}return s}async function hh(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(Ep(r,e.state.shoptOptions.extglob)){let t=await gh(e,r);n.push(...t)}else n.push(r);return{values:n,quoted:!1}}async function gh(e,t){let n=new Vf(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new lr(t);return n.hasNullglob()?[]:[t]}async function _h(e,t,n,r,i,a){let o=n.some(e=>e.type===`Glob`);if(!e.state.options.noglob&&o){let n=await a(e,t);if(Ep(n,e.state.shoptOptions.extglob)){let t=await gh(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1};if(t.length===0)return{values:[],quoted:!1}}let i=Dp(r);return $f(e.state.env)?{values:[i],quoted:!1}:{values:J(i,Qf(e.state.env)),quoted:!1}}if(!i&&!e.state.options.noglob&&Ep(r,e.state.shoptOptions.extglob)){let n=await a(e,t);if(Ep(n,e.state.shoptOptions.extglob)){let t=await gh(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1}}}if(r===``&&!i)return{values:[],quoted:!1};if(o&&!i){let t=Dp(r);return $f(e.state.env)?{values:[t],quoted:!1}:{values:J(t,Qf(e.state.env)),quoted:!1}}return{values:[r],quoted:i}}var vh=g(()=>{Hf(),x(),op(),qf(),Tm(),km(),Mm(),Fm(),Ap(),Vm(),Vp(),qm(),ah(),hp()});async function yh(e,t){let n=t.operation;if(!n||n.type!==`DefaultValue`&&n.type!==`AssignDefault`&&n.type!==`UseAlternative`)return null;let r=n.word;if(!r||r.parts.length===0)return null;let i=await mp(e,t.parameter),a=await X(e,t.parameter,!1)===``,o=n.checkEmpty??!1,s;return s=n.type===`UseAlternative`?i&&!(o&&a):!i||o&&a,s?r.parts:null}function bh(e){return e.type===`SingleQuoted`||e.type===`DoubleQuoted`&&e.parts.every(e=>e.type===`Literal`)}async function xh(e,t){if(t.type!==`ParameterExpansion`)return null;let n=await yh(e,t);if(!n||n.length<=1)return null;let r=n.some(e=>bh(e)),i=n.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`);return r&&i?n:null}function Sh(e){return e.type===`DoubleQuoted`||e.type===`SingleQuoted`||e.type===`Literal`?!1:e.type===`Glob`?Uf(e.pattern):!(!(e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`)||e.type===`ParameterExpansion`&&Gf(e))}async function Ch(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:word_split`),t.length===1&&t[0].type===`ParameterExpansion`){let a=t[0],o=await yh(e,a);if(o&&o.length>0&&o.length>1&&o.some(e=>e.type===`DoubleQuoted`||e.type===`SingleQuoted`)&&o.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`))return Th(e,o,n,r,i)}let a=[],o=!1;for(let n of t){let t=Sh(n),r=n.type===`DoubleQuoted`||n.type===`SingleQuoted`,s=t?await xh(e,n):null,c=await i(e,n);a.push({value:c,isSplittable:t,isQuoted:r,mixedDefaultParts:s??void 0}),t&&(o=!0)}if(!o){let e=a.map(e=>e.value).join(``);return e?[e]:[]}let s=[],c=``,l=!1,u=!1,d=!1;for(let t of a)if(!t.isSplittable)u?t.isQuoted&&t.value===``?(c!==``&&s.push(c),s.push(``),l=!0,c=``,u=!1,d=!0):t.value===``?(c+=t.value,d=!1):(c!==``&&s.push(c),c=t.value,u=!1,d=!1):(c+=t.value,d=t.isQuoted&&t.value===``);else if(t.mixedDefaultParts){let a=await Th(e,t.mixedDefaultParts,n,r,i);if(a.length!==0)if(a.length===1)c+=a[0],l=!0;else{c+=a[0],s.push(c),l=!0;for(let e=1;e<a.length-1;e++)s.push(a[e]);c=a[a.length-1]}u=!1,d=!1}else{let{words:e,hadLeadingDelimiter:r,hadTrailingDelimiter:i}=ip(t.value,n);if(d&&r&&c===``&&(s.push(``),l=!0),e.length===0)i&&(u=!0);else if(e.length===1)c+=e[0],l=!0,u=i;else{c+=e[0],s.push(c),l=!0;for(let t=1;t<e.length-1;t++)s.push(e[t]);c=e[e.length-1],u=i}d=!1}return c===``?s.length===0&&l&&s.push(``):s.push(c),s}function wh(e,t){return e.length>0&&t.includes(e[0])}async function Th(e,t,n,r,i){let a=[];for(let n of t){let t=!(n.type===`DoubleQuoted`||n.type===`SingleQuoted`),r=await i(e,n);a.push({value:r,isSplittable:t})}let o=[],s=``,c=!1,l=!1;for(let e of a)if(!e.isSplittable)l&&e.value!==``?(s!==``&&o.push(s),s=e.value,l=!1):s+=e.value;else{wh(e.value,n)&&s!==``&&(o.push(s),s=``,c=!0);let{words:t,hadTrailingDelimiter:r}=ip(e.value,n);if(t.length===0)r&&(l=!0);else if(t.length===1)s+=t[0],c=!0,l=r;else{s+=t[0],o.push(s),c=!0;for(let e=1;e<t.length-1;e++)o.push(t[e]);s=t[t.length-1],l=r}}return s===``?o.length===0&&c&&o.push(``):o.push(s),o}var Eh=g(()=>{hp(),op(),qf()});function Dh(e){switch(e.type){case`Literal`:return e.value;case`SingleQuoted`:return e.value;case`Escaped`:return e.value;default:return null}}function Oh(e){switch(e.type){case`SingleQuoted`:case`Escaped`:case`DoubleQuoted`:return!0;case`Literal`:return e.value===``;default:return!1}}var kh=g(()=>{});_({},{escapeGlobChars:()=>Op,escapeRegexChars:()=>kp,expandRedirectTarget:()=>Kh,expandWord:()=>Fh,expandWordForPattern:()=>Lh,expandWordForRegex:()=>Ih,expandWordWithGlob:()=>Uh,getArrayElements:()=>Y,getVariable:()=>X,hasQuotedMultiValueAt:()=>Gh,isArray:()=>pp,isWordFullyQuoted:()=>Nh});function Ah(e,t,n){if(e.length>t)throw new b(`${n}: string length limit exceeded (${t} bytes)`,`string_length`)}async function jh(e,t,n=!1){let r=[];for(let i of t)r.push(await Jh(e,i,n));return r.join(``)}function Mh(e){return Oh(e)}function Nh(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!Mh(t))return!1;return!0}function Ph(e,t,n=!1){let r=Dh(t);if(r!==null)return r;switch(t.type){case`TildeExpansion`:return n?t.user===null?`~`:`~${t.user}`:(e.coverage?.hit(`bash:expansion:tilde`),t.user===null?e.state.env.get(`HOME`)??`/home/user`:t.user===`root`?`/root`:`~${t.user}`);case`Glob`:return hm(e,t.pattern);default:return null}}async function Fh(e,t){return qh(e,t)}async function Ih(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`)n.push(`\\${r.value}`);else if(r.type===`SingleQuoted`)n.push(r.value);else if(r.type===`DoubleQuoted`){let t=await jh(e,r.parts);n.push(t)}else if(r.type===`TildeExpansion`){let t=await Jh(e,r);n.push(kp(t))}else n.push(await Jh(e,r));return n.join(``)}async function Lh(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`){let e=r.value;`()|*?[]`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`SingleQuoted`)n.push(Op(r.value));else if(r.type===`DoubleQuoted`){let t=await jh(e,r.parts);n.push(Op(t))}else n.push(await Jh(e,r));return n.join(``)}async function Rh(e,t){let n=[];for(let r of t.parts)if(r.type===`SingleQuoted`)n.push(Op(r.value));else if(r.type===`Escaped`){let e=r.value;`*?[]\\()|`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`DoubleQuoted`){let t=await jh(e,r.parts);n.push(Op(t))}else r.type===`Glob`?fm(r.pattern)?n.push(await _m(e,r.pattern)):n.push(hm(e,r.pattern)):r.type===`Literal`?n.push(r.value):n.push(await Jh(e,r));return n.join(``)}function zh(e){for(let t of e)if(t.type===`BraceExpansion`||t.type===`DoubleQuoted`&&zh(t.parts))return!0;return!1}async function Bh(e,t,n={count:0}){if(n.count>Xh)return[[]];let r=[[]];for(let i of t)if(i.type===`BraceExpansion`){let t=[],a=!1,o=``;for(let r of i.items)if(r.type===`Range`){let e=xp(r.start,r.end,r.step,r.startStr,r.endStr);if(e.expanded)for(let r of e.expanded)n.count++,t.push(r);else{a=!0,o=e.literal;break}}else{let i=await Bh(e,r.word.parts,n);for(let r of i){n.count++;let i=[];for(let t of r)typeof t==`string`?i.push(t):i.push(await Jh(e,t));t.push(i.join(``))}}if(a){for(let e of r)n.count++,e.push(o);continue}if(r.length*t.length>e.limits.maxBraceExpansionResults||n.count>Xh)return r;let s=[];for(let e of r)for(let i of t){if(n.count++,n.count>Xh)return s.length>0?s:r;s.push([...e,i])}r=s}else for(let e of r)n.count++,e.push(i);return r}async function Vh(e,t){let n=t.parts;if(!zh(n))return[await Fh(e,t)];let r=await Bh(e,n),i=[];for(let t of r){let n=[];for(let r of t)typeof r==`string`?n.push(r):n.push(await Jh(e,r));i.push(bm(e,n.join(``)))}return i}function Hh(){return{expandWordAsync:qh,expandWordForGlobbing:Rh,expandWordWithBracesAsync:Vh,expandWordPartsAsync:jh,expandPart:Jh,expandParameterAsync:Yh,hasBraceExpansion:zh,evaluateArithmetic:$,buildIfsCharClassPattern:tp,smartWordSplit:Ch}}async function Uh(e,t){return oh(e,t,Hh())}function Wh(e){for(let t of e){if(t.type===`ParameterExpansion`)return t.parameter;if(t.type===`Literal`)return t.value}return``}function Gh(e,t){if(Number.parseInt(e.state.env.get(`#`)||`0`,10)<2)return!1;function n(e){for(let t of e)if(t.type===`DoubleQuoted`){for(let e of t.parts)if(e.type===`ParameterExpansion`&&e.parameter===`@`&&!e.operation)return!0}return!1}return n(t.parts)}async function Kh(e,t){if(Gh(e,t))return{error:`bash: $@: ambiguous redirect
216
216
  `};let n=t.parts,{hasQuoted:r}=Kf(n);if(zh(n)&&(await Vh(e,t)).length>1)return{error:`bash: ${n.map(e=>e.type===`Literal`?e.value:e.type===`BraceExpansion`?`{${e.items.map(e=>{if(e.type===`Range`){let t=e.step?`..${e.step}`:``;return`${e.startStr??e.start}..${e.endStr??e.end}${t}`}return e.word.parts.map(e=>e.type===`Literal`?e.value:``).join(``)}).join(`,`)}}`:``).join(``)}: ambiguous redirect
217
217
  `};let i=await qh(e,t),{hasParamExpansion:a,hasCommandSub:o}=Kf(n);if((a||o)&&!r&&!$f(e.state.env)&&J(i,Qf(e.state.env)).length>1)return{error:`bash: $${Wh(n)}: ambiguous redirect
218
218
  `};if(r||e.state.options.noglob)return{target:i};let s=await Rh(e,t);if(!Ep(s,e.state.shoptOptions.extglob))return{target:i};let c=new Vf(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),l=await c.expand(s);return l.length===0?c.hasFailglob()?{error:`bash: no match: ${i}