@effect-uai/core 0.12.0 → 0.13.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 (301) hide show
  1. package/dist/{AiError-Bf1pq4BB.d.mts → AiError-eLV9t1lU.d.mts} +12 -16
  2. package/dist/AiError-eLV9t1lU.d.mts.map +1 -0
  3. package/dist/{Audio-CR7CSljJ.d.mts → Audio-60lKKHxS.d.mts} +4 -5
  4. package/dist/Audio-60lKKHxS.d.mts.map +1 -0
  5. package/dist/{Image-C4vuBmu0.d.mts → Image-BK8-4H6s.d.mts} +12 -14
  6. package/dist/Image-BK8-4H6s.d.mts.map +1 -0
  7. package/dist/{Items-BKQgqJ8A.d.mts → Items-SfUabNuB.d.mts} +74 -76
  8. package/dist/Items-SfUabNuB.d.mts.map +1 -0
  9. package/dist/{Loop-D8nWpowc.d.mts → Loop-B54AB1ME.d.mts} +19 -21
  10. package/dist/Loop-B54AB1ME.d.mts.map +1 -0
  11. package/dist/{Media-D_CpcM1Z.d.mts → Media-DwgpifPD.d.mts} +1 -1
  12. package/dist/Media-DwgpifPD.d.mts.map +1 -0
  13. package/dist/{SandboxError-CIrVDOMV.d.mts → SandboxError-BN8b28Bh.d.mts} +11 -15
  14. package/dist/SandboxError-BN8b28Bh.d.mts.map +1 -0
  15. package/dist/{StructuredFormat-DHaUJBdd.d.mts → StructuredFormat-BlZhyOsi.d.mts} +3 -7
  16. package/dist/StructuredFormat-BlZhyOsi.d.mts.map +1 -0
  17. package/dist/{Tool-u5bag8SO.d.mts → Tool-DE-rnvkw.d.mts} +5 -8
  18. package/dist/Tool-DE-rnvkw.d.mts.map +1 -0
  19. package/dist/{ToolEvent-BBfOdhF_.d.mts → ToolEvent-D99MGQYH.d.mts} +56 -63
  20. package/dist/ToolEvent-D99MGQYH.d.mts.map +1 -0
  21. package/dist/{ToolResult-CRpmkBXR.d.mts → ToolResult-Cj8ChodL.d.mts} +49 -54
  22. package/dist/ToolResult-Cj8ChodL.d.mts.map +1 -0
  23. package/dist/{Toolkit-D4mQvhjq.d.mts → Toolkit-BEZrNPTI.d.mts} +13 -16
  24. package/dist/Toolkit-BEZrNPTI.d.mts.map +1 -0
  25. package/dist/browser/Browser.d.mts +11 -7
  26. package/dist/browser/Browser.d.mts.map +1 -1
  27. package/dist/browser/Browser.mjs +1 -1
  28. package/dist/browser/Browser.mjs.map +1 -1
  29. package/dist/browser/BrowserError.d.mts +9 -13
  30. package/dist/browser/BrowserError.d.mts.map +1 -1
  31. package/dist/browser/BrowserError.mjs +1 -1
  32. package/dist/browser/BrowserError.mjs.map +1 -1
  33. package/dist/browser/BrowserTool.d.mts +33 -36
  34. package/dist/browser/BrowserTool.d.mts.map +1 -1
  35. package/dist/browser/BrowserTool.mjs +1 -1
  36. package/dist/browser/BrowserTool.mjs.map +1 -1
  37. package/dist/capabilities/Capabilities.d.mts +8 -6
  38. package/dist/capabilities/Capabilities.d.mts.map +1 -1
  39. package/dist/capabilities/Capabilities.mjs +1 -1
  40. package/dist/capabilities/Capabilities.mjs.map +1 -1
  41. package/dist/chunker/Chunker.d.mts +32 -0
  42. package/dist/chunker/Chunker.d.mts.map +1 -0
  43. package/dist/chunker/Chunker.mjs +14 -0
  44. package/dist/chunker/Chunker.mjs.map +1 -0
  45. package/dist/dist-BaenoU1A.mjs +145 -0
  46. package/dist/dist-BaenoU1A.mjs.map +1 -0
  47. package/dist/{dist-C0m0QnUP.mjs → dist-nohcnkD6.mjs} +16 -15
  48. package/dist/dist-nohcnkD6.mjs.map +1 -0
  49. package/dist/domain/AiError.d.mts +1 -1
  50. package/dist/domain/AiError.mjs +1 -1
  51. package/dist/domain/AiError.mjs.map +1 -1
  52. package/dist/domain/Audio.d.mts +1 -1
  53. package/dist/domain/Audio.mjs +1 -1
  54. package/dist/domain/Citation.d.mts +0 -2
  55. package/dist/domain/Citation.d.mts.map +1 -1
  56. package/dist/domain/Citation.mjs +1 -1
  57. package/dist/domain/Image.d.mts +1 -1
  58. package/dist/domain/Image.mjs +1 -1
  59. package/dist/domain/Image.mjs.map +1 -1
  60. package/dist/domain/Items.d.mts +1 -1
  61. package/dist/domain/Items.mjs +1 -1
  62. package/dist/domain/Items.mjs.map +1 -1
  63. package/dist/domain/Media.d.mts +1 -1
  64. package/dist/domain/Media.mjs +1 -1
  65. package/dist/domain/Music.d.mts +18 -11
  66. package/dist/domain/Music.d.mts.map +1 -1
  67. package/dist/domain/Music.mjs +1 -1
  68. package/dist/domain/Music.mjs.map +1 -1
  69. package/dist/domain/Research.d.mts +3 -4
  70. package/dist/domain/Research.d.mts.map +1 -1
  71. package/dist/domain/Research.mjs +1 -1
  72. package/dist/domain/Transcript.d.mts +2 -3
  73. package/dist/domain/Transcript.d.mts.map +1 -1
  74. package/dist/domain/Transcript.mjs +1 -1
  75. package/dist/domain/Turn.d.mts +143 -164
  76. package/dist/domain/Turn.d.mts.map +1 -1
  77. package/dist/domain/Turn.mjs +1 -1
  78. package/dist/domain/Turn.mjs.map +1 -1
  79. package/dist/domain/Turn.test.d.mts +1 -1
  80. package/dist/domain/Turn.test.mjs +28 -18
  81. package/dist/domain/Turn.test.mjs.map +1 -1
  82. package/dist/embedding-model/Embedding.d.mts +1 -3
  83. package/dist/embedding-model/Embedding.d.mts.map +1 -1
  84. package/dist/embedding-model/Embedding.mjs +1 -1
  85. package/dist/embedding-model/EmbeddingModel.d.mts +1 -3
  86. package/dist/embedding-model/EmbeddingModel.d.mts.map +1 -1
  87. package/dist/embedding-model/EmbeddingModel.mjs +1 -1
  88. package/dist/embedding-model/EmbeddingModel.mjs.map +1 -1
  89. package/dist/embedding-model/EmbeddingModel.test.d.mts +1 -1
  90. package/dist/embedding-model/EmbeddingModel.test.mjs +14 -9
  91. package/dist/embedding-model/EmbeddingModel.test.mjs.map +1 -1
  92. package/dist/index.d.mts +16 -13
  93. package/dist/index.mjs +4 -1
  94. package/dist/job/Job.d.mts +4 -4
  95. package/dist/job/Job.d.mts.map +1 -1
  96. package/dist/job/Job.mjs +1 -1
  97. package/dist/job/Job.mjs.map +1 -1
  98. package/dist/language-model/LanguageModel.d.mts +4 -6
  99. package/dist/language-model/LanguageModel.d.mts.map +1 -1
  100. package/dist/language-model/LanguageModel.mjs +1 -1
  101. package/dist/language-model/LanguageModel.mjs.map +1 -1
  102. package/dist/language-model/LanguageModel.test.d.mts +1 -1
  103. package/dist/language-model/LanguageModel.test.mjs +6 -3
  104. package/dist/language-model/LanguageModel.test.mjs.map +1 -1
  105. package/dist/loop/Loop.d.mts +1 -1
  106. package/dist/loop/Loop.mjs +1 -1
  107. package/dist/loop/Loop.mjs.map +1 -1
  108. package/dist/loop/Loop.test.d.mts +1 -1
  109. package/dist/loop/Loop.test.mjs +60 -34
  110. package/dist/loop/Loop.test.mjs.map +1 -1
  111. package/dist/{magic-string.es-Dk-MMA0F.mjs → magic-string.es-CB2hOw9v.mjs} +14 -13
  112. package/dist/{magic-string.es-Dk-MMA0F.mjs.map → magic-string.es-CB2hOw9v.mjs.map} +1 -1
  113. package/dist/math/Vector.d.mts +0 -2
  114. package/dist/math/Vector.d.mts.map +1 -1
  115. package/dist/math/Vector.mjs +1 -1
  116. package/dist/math/Vector.mjs.map +1 -1
  117. package/dist/music-generator/MusicGenerator.d.mts +2 -4
  118. package/dist/music-generator/MusicGenerator.d.mts.map +1 -1
  119. package/dist/music-generator/MusicGenerator.mjs +1 -1
  120. package/dist/music-generator/MusicGenerator.mjs.map +1 -1
  121. package/dist/music-generator/MusicGenerator.test.d.mts +1 -1
  122. package/dist/music-generator/MusicGenerator.test.mjs +19 -10
  123. package/dist/music-generator/MusicGenerator.test.mjs.map +1 -1
  124. package/dist/observability/Metrics.d.mts +10 -7
  125. package/dist/observability/Metrics.d.mts.map +1 -1
  126. package/dist/observability/Metrics.mjs +1 -1
  127. package/dist/observability/Metrics.mjs.map +1 -1
  128. package/dist/observability/Metrics.test.d.mts +1 -1
  129. package/dist/observability/Metrics.test.mjs +50 -28
  130. package/dist/observability/Metrics.test.mjs.map +1 -1
  131. package/dist/observability/Telemetry.d.mts +2 -3
  132. package/dist/observability/Telemetry.d.mts.map +1 -1
  133. package/dist/observability/Telemetry.mjs +1 -1
  134. package/dist/observability/Telemetry.mjs.map +1 -1
  135. package/dist/observability/Telemetry.test.d.mts +1 -1
  136. package/dist/observability/Telemetry.test.mjs +15 -7
  137. package/dist/observability/Telemetry.test.mjs.map +1 -1
  138. package/dist/reranker/Reranker.d.mts +46 -0
  139. package/dist/reranker/Reranker.d.mts.map +1 -0
  140. package/dist/reranker/Reranker.mjs +14 -0
  141. package/dist/reranker/Reranker.mjs.map +1 -0
  142. package/dist/research/DeepResearch.d.mts +1 -3
  143. package/dist/research/DeepResearch.d.mts.map +1 -1
  144. package/dist/research/DeepResearch.mjs +1 -1
  145. package/dist/research/DeepResearch.mjs.map +1 -1
  146. package/dist/retry/Retry.d.mts +2 -6
  147. package/dist/retry/Retry.d.mts.map +1 -1
  148. package/dist/retry/Retry.mjs +1 -1
  149. package/dist/retry/Retry.mjs.map +1 -1
  150. package/dist/retry/Retry.test.d.mts +1 -1
  151. package/dist/retry/Retry.test.mjs +6 -3
  152. package/dist/retry/Retry.test.mjs.map +1 -1
  153. package/dist/sandbox/Memory.d.mts +0 -2
  154. package/dist/sandbox/Memory.d.mts.map +1 -1
  155. package/dist/sandbox/Memory.mjs +4 -4
  156. package/dist/sandbox/Memory.mjs.map +1 -1
  157. package/dist/sandbox/Sandbox.d.mts +144 -156
  158. package/dist/sandbox/Sandbox.d.mts.map +1 -1
  159. package/dist/sandbox/Sandbox.mjs +1 -1
  160. package/dist/sandbox/Sandbox.mjs.map +1 -1
  161. package/dist/sandbox/SandboxError.d.mts +1 -1
  162. package/dist/sandbox/SandboxError.mjs +1 -1
  163. package/dist/sandbox/SandboxError.mjs.map +1 -1
  164. package/dist/sandbox/SandboxImage.d.mts +0 -2
  165. package/dist/sandbox/SandboxImage.d.mts.map +1 -1
  166. package/dist/sandbox/SandboxImage.mjs +1 -1
  167. package/dist/sandbox/SandboxImage.mjs.map +1 -1
  168. package/dist/sandbox/SandboxNetwork.d.mts +0 -2
  169. package/dist/sandbox/SandboxNetwork.d.mts.map +1 -1
  170. package/dist/sandbox/SandboxNetwork.mjs +1 -1
  171. package/dist/sandbox/SandboxNetwork.mjs.map +1 -1
  172. package/dist/speech-synthesizer/SpeechSynthesizer.d.mts +8 -7
  173. package/dist/speech-synthesizer/SpeechSynthesizer.d.mts.map +1 -1
  174. package/dist/speech-synthesizer/SpeechSynthesizer.mjs +1 -1
  175. package/dist/speech-synthesizer/SpeechSynthesizer.mjs.map +1 -1
  176. package/dist/speech-synthesizer/SpeechSynthesizer.test.d.mts +1 -1
  177. package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +31 -16
  178. package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs.map +1 -1
  179. package/dist/streaming/JSONL.d.mts +1 -5
  180. package/dist/streaming/JSONL.d.mts.map +1 -1
  181. package/dist/streaming/JSONL.mjs +1 -1
  182. package/dist/streaming/JSONL.mjs.map +1 -1
  183. package/dist/streaming/JSONL.test.d.mts +1 -1
  184. package/dist/streaming/JSONL.test.mjs +16 -8
  185. package/dist/streaming/JSONL.test.mjs.map +1 -1
  186. package/dist/streaming/Lines.d.mts +0 -2
  187. package/dist/streaming/Lines.d.mts.map +1 -1
  188. package/dist/streaming/Lines.mjs +1 -1
  189. package/dist/streaming/Lines.mjs.map +1 -1
  190. package/dist/streaming/SSE.d.mts +0 -2
  191. package/dist/streaming/SSE.d.mts.map +1 -1
  192. package/dist/streaming/SSE.mjs +1 -1
  193. package/dist/streaming/SSE.mjs.map +1 -1
  194. package/dist/streaming/SSE.test.d.mts +1 -1
  195. package/dist/streaming/SSE.test.mjs +34 -17
  196. package/dist/streaming/SSE.test.mjs.map +1 -1
  197. package/dist/structured-format/StructuredFormat.d.mts +1 -1
  198. package/dist/structured-format/StructuredFormat.mjs +1 -1
  199. package/dist/structured-format/StructuredFormat.mjs.map +1 -1
  200. package/dist/structured-format/StructuredFormat.test.d.mts +1 -1
  201. package/dist/structured-format/StructuredFormat.test.mjs +7 -4
  202. package/dist/structured-format/StructuredFormat.test.mjs.map +1 -1
  203. package/dist/{dist-CcRV3-A5.mjs → test.DNmyFkvJ-YPzDR0Co.mjs} +1644 -5172
  204. package/dist/test.DNmyFkvJ-YPzDR0Co.mjs.map +1 -0
  205. package/dist/testing/MockMusicGenerator.d.mts +4 -3
  206. package/dist/testing/MockMusicGenerator.d.mts.map +1 -1
  207. package/dist/testing/MockMusicGenerator.mjs.map +1 -1
  208. package/dist/testing/MockProvider.d.mts +1 -2
  209. package/dist/testing/MockProvider.d.mts.map +1 -1
  210. package/dist/testing/MockProvider.mjs.map +1 -1
  211. package/dist/testing/MockSandbox.d.mts +256 -290
  212. package/dist/testing/MockSandbox.d.mts.map +1 -1
  213. package/dist/testing/MockSandbox.mjs.map +1 -1
  214. package/dist/testing/MockSpeechSynthesizer.d.mts +10 -6
  215. package/dist/testing/MockSpeechSynthesizer.d.mts.map +1 -1
  216. package/dist/testing/MockSpeechSynthesizer.mjs.map +1 -1
  217. package/dist/testing/MockTranscriber.d.mts +3 -2
  218. package/dist/testing/MockTranscriber.d.mts.map +1 -1
  219. package/dist/testing/MockTranscriber.mjs.map +1 -1
  220. package/dist/tokenizer/Tokenizer.d.mts +22 -0
  221. package/dist/tokenizer/Tokenizer.d.mts.map +1 -0
  222. package/dist/tokenizer/Tokenizer.mjs +9 -0
  223. package/dist/tokenizer/Tokenizer.mjs.map +1 -0
  224. package/dist/tool/Approval.d.mts +31 -36
  225. package/dist/tool/Approval.d.mts.map +1 -1
  226. package/dist/tool/Approval.mjs +1 -1
  227. package/dist/tool/Approval.mjs.map +1 -1
  228. package/dist/tool/Approval.test.d.mts +1 -1
  229. package/dist/tool/Approval.test.mjs +37 -24
  230. package/dist/tool/Approval.test.mjs.map +1 -1
  231. package/dist/tool/HistoryCheck.d.mts +2 -4
  232. package/dist/tool/HistoryCheck.d.mts.map +1 -1
  233. package/dist/tool/HistoryCheck.mjs +1 -1
  234. package/dist/tool/HistoryCheck.mjs.map +1 -1
  235. package/dist/tool/Tool.d.mts +1 -1
  236. package/dist/tool/Tool.mjs +4 -4
  237. package/dist/tool/Tool.mjs.map +1 -1
  238. package/dist/tool/Tool.test.d.mts +1 -1
  239. package/dist/tool/Tool.test.mjs +23 -11
  240. package/dist/tool/Tool.test.mjs.map +1 -1
  241. package/dist/tool/ToolEvent.d.mts +1 -1
  242. package/dist/tool/ToolEvent.mjs +1 -1
  243. package/dist/tool/ToolEvent.mjs.map +1 -1
  244. package/dist/tool/ToolResult.d.mts +1 -1
  245. package/dist/tool/ToolResult.mjs +1 -1
  246. package/dist/tool/ToolResult.mjs.map +1 -1
  247. package/dist/tool/Toolkit.d.mts +1 -1
  248. package/dist/tool/Toolkit.mjs +4 -3
  249. package/dist/tool/Toolkit.mjs.map +1 -1
  250. package/dist/tool/Toolkit.test.d.mts +1 -1
  251. package/dist/tool/Toolkit.test.mjs +40 -21
  252. package/dist/tool/Toolkit.test.mjs.map +1 -1
  253. package/dist/transcriber/Transcriber.d.mts +6 -6
  254. package/dist/transcriber/Transcriber.d.mts.map +1 -1
  255. package/dist/transcriber/Transcriber.mjs +1 -1
  256. package/dist/transcriber/Transcriber.mjs.map +1 -1
  257. package/dist/transcriber/Transcriber.test.d.mts +1 -1
  258. package/dist/transcriber/Transcriber.test.mjs +20 -10
  259. package/dist/transcriber/Transcriber.test.mjs.map +1 -1
  260. package/dist/utils-CiH_DjFW.mjs +3918 -0
  261. package/dist/utils-CiH_DjFW.mjs.map +1 -0
  262. package/dist/web-read/WebRead.d.mts +15 -9
  263. package/dist/web-read/WebRead.d.mts.map +1 -1
  264. package/dist/web-read/WebRead.mjs +1 -1
  265. package/dist/web-read/WebRead.mjs.map +1 -1
  266. package/dist/web-read/WebReadTool.d.mts +4 -5
  267. package/dist/web-read/WebReadTool.d.mts.map +1 -1
  268. package/dist/web-read/WebReadTool.mjs +1 -1
  269. package/dist/web-read/WebReadTool.mjs.map +1 -1
  270. package/dist/web-search/WebSearch.d.mts +22 -13
  271. package/dist/web-search/WebSearch.d.mts.map +1 -1
  272. package/dist/web-search/WebSearch.mjs +1 -1
  273. package/dist/web-search/WebSearch.mjs.map +1 -1
  274. package/dist/web-search/WebSearchTool.d.mts +6 -6
  275. package/dist/web-search/WebSearchTool.d.mts.map +1 -1
  276. package/dist/web-search/WebSearchTool.mjs +1 -1
  277. package/dist/web-search/WebSearchTool.mjs.map +1 -1
  278. package/package.json +16 -4
  279. package/src/chunker/Chunker.ts +34 -0
  280. package/src/index.ts +3 -0
  281. package/src/loop/Loop.test.ts +13 -14
  282. package/src/loop/Loop.ts +74 -76
  283. package/src/reranker/Reranker.ts +51 -0
  284. package/src/testing/MockProvider.ts +8 -9
  285. package/src/tokenizer/Tokenizer.ts +19 -0
  286. package/src/tool/Tool.ts +13 -13
  287. package/dist/AiError-Bf1pq4BB.d.mts.map +0 -1
  288. package/dist/Audio-CR7CSljJ.d.mts.map +0 -1
  289. package/dist/Image-C4vuBmu0.d.mts.map +0 -1
  290. package/dist/Items-BKQgqJ8A.d.mts.map +0 -1
  291. package/dist/Loop-D8nWpowc.d.mts.map +0 -1
  292. package/dist/Media-D_CpcM1Z.d.mts.map +0 -1
  293. package/dist/SandboxError-CIrVDOMV.d.mts.map +0 -1
  294. package/dist/StructuredFormat-DHaUJBdd.d.mts.map +0 -1
  295. package/dist/Tool-u5bag8SO.d.mts.map +0 -1
  296. package/dist/ToolEvent-BBfOdhF_.d.mts.map +0 -1
  297. package/dist/ToolResult-CRpmkBXR.d.mts.map +0 -1
  298. package/dist/Toolkit-D4mQvhjq.d.mts.map +0 -1
  299. package/dist/dist-C0m0QnUP.mjs.map +0 -1
  300. package/dist/dist-CcRV3-A5.mjs.map +0 -1
  301. /package/dist/{chunk-uyGKjUfl.mjs → rolldown-runtime-EAsCxrDo.mjs} +0 -0
@@ -0,0 +1,3918 @@
1
+ //#region ../../node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js
2
+ var b = {
3
+ reset: [0, 0],
4
+ bold: [
5
+ 1,
6
+ 22,
7
+ "\x1B[22m\x1B[1m"
8
+ ],
9
+ dim: [
10
+ 2,
11
+ 22,
12
+ "\x1B[22m\x1B[2m"
13
+ ],
14
+ italic: [3, 23],
15
+ underline: [4, 24],
16
+ inverse: [7, 27],
17
+ hidden: [8, 28],
18
+ strikethrough: [9, 29],
19
+ black: [30, 39],
20
+ red: [31, 39],
21
+ green: [32, 39],
22
+ yellow: [33, 39],
23
+ blue: [34, 39],
24
+ magenta: [35, 39],
25
+ cyan: [36, 39],
26
+ white: [37, 39],
27
+ gray: [90, 39],
28
+ bgBlack: [40, 49],
29
+ bgRed: [41, 49],
30
+ bgGreen: [42, 49],
31
+ bgYellow: [43, 49],
32
+ bgBlue: [44, 49],
33
+ bgMagenta: [45, 49],
34
+ bgCyan: [46, 49],
35
+ bgWhite: [47, 49],
36
+ blackBright: [90, 39],
37
+ redBright: [91, 39],
38
+ greenBright: [92, 39],
39
+ yellowBright: [93, 39],
40
+ blueBright: [94, 39],
41
+ magentaBright: [95, 39],
42
+ cyanBright: [96, 39],
43
+ whiteBright: [97, 39],
44
+ bgBlackBright: [100, 49],
45
+ bgRedBright: [101, 49],
46
+ bgGreenBright: [102, 49],
47
+ bgYellowBright: [103, 49],
48
+ bgBlueBright: [104, 49],
49
+ bgMagentaBright: [105, 49],
50
+ bgCyanBright: [106, 49],
51
+ bgWhiteBright: [107, 49]
52
+ };
53
+ function i(e) {
54
+ return String(e);
55
+ }
56
+ i.open = "";
57
+ i.close = "";
58
+ function B() {
59
+ let e = typeof process != "undefined" ? process : void 0, r = (e == null ? void 0 : e.env) || {}, a = r.FORCE_TTY !== "false", l = (e == null ? void 0 : e.argv) || [];
60
+ return !("NO_COLOR" in r || l.includes("--no-color")) && ("FORCE_COLOR" in r || l.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && r.TERM !== "dumb" || "CI" in r) || typeof window != "undefined" && !!window.chrome;
61
+ }
62
+ function C({ force: e } = {}) {
63
+ let r = e || B(), a = (t, o, u, n) => {
64
+ let g = "", s = 0;
65
+ do
66
+ g += t.substring(s, n) + u, s = n + o.length, n = t.indexOf(o, s);
67
+ while (~n);
68
+ return g + t.substring(s);
69
+ }, l = (t, o, u = t) => {
70
+ let n = (g) => {
71
+ let s = String(g), h = s.indexOf(o, t.length);
72
+ return ~h ? t + a(s, o, u, h) + o : t + s + o;
73
+ };
74
+ return n.open = t, n.close = o, n;
75
+ }, c = { isColorSupported: r }, f = (t) => `\x1B[${t}m`;
76
+ for (let t in b) {
77
+ let o = b[t];
78
+ c[t] = r ? l(f(o[0]), f(o[1]), o[2]) : i;
79
+ }
80
+ return c;
81
+ }
82
+ var y = C();
83
+ //#endregion
84
+ //#region ../../node_modules/.pnpm/@vitest+pretty-format@4.1.11/node_modules/@vitest/pretty-format/dist/index.js
85
+ function _mergeNamespaces(n, m) {
86
+ m.forEach(function(e) {
87
+ e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
88
+ if (k !== "default" && !(k in n)) {
89
+ var d = Object.getOwnPropertyDescriptor(e, k);
90
+ Object.defineProperty(n, k, d.get ? d : {
91
+ enumerable: true,
92
+ get: function() {
93
+ return e[k];
94
+ }
95
+ });
96
+ }
97
+ });
98
+ });
99
+ return Object.freeze(n);
100
+ }
101
+ function getKeysOfEnumerableProperties(object, compareKeys) {
102
+ const rawKeys = Object.keys(object);
103
+ const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
104
+ if (Object.getOwnPropertySymbols) {
105
+ for (const symbol of Object.getOwnPropertySymbols(object)) if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) keys.push(symbol);
106
+ }
107
+ return keys;
108
+ }
109
+ /**
110
+ * Return entries (for example, of a map)
111
+ * with spacing, indentation, and comma
112
+ * without surrounding punctuation (for example, braces)
113
+ */
114
+ function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ") {
115
+ let result = "";
116
+ let width = 0;
117
+ let current = iterator.next();
118
+ if (!current.done) {
119
+ result += config.spacingOuter;
120
+ const indentationNext = indentation + config.indent;
121
+ while (!current.done) {
122
+ result += indentationNext;
123
+ if (width++ === config.maxWidth) {
124
+ result += "…";
125
+ break;
126
+ }
127
+ const name = printer(current.value[0], config, indentationNext, depth, refs);
128
+ const value = printer(current.value[1], config, indentationNext, depth, refs);
129
+ result += name + separator + value;
130
+ current = iterator.next();
131
+ if (!current.done) result += `,${config.spacingInner}`;
132
+ else if (!config.min) result += ",";
133
+ }
134
+ result += config.spacingOuter + indentation;
135
+ }
136
+ return result;
137
+ }
138
+ /**
139
+ * Return values (for example, of a set)
140
+ * with spacing, indentation, and comma
141
+ * without surrounding punctuation (braces or brackets)
142
+ */
143
+ function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
144
+ let result = "";
145
+ let width = 0;
146
+ let current = iterator.next();
147
+ if (!current.done) {
148
+ result += config.spacingOuter;
149
+ const indentationNext = indentation + config.indent;
150
+ while (!current.done) {
151
+ result += indentationNext;
152
+ if (width++ === config.maxWidth) {
153
+ result += "…";
154
+ break;
155
+ }
156
+ result += printer(current.value, config, indentationNext, depth, refs);
157
+ current = iterator.next();
158
+ if (!current.done) result += `,${config.spacingInner}`;
159
+ else if (!config.min) result += ",";
160
+ }
161
+ result += config.spacingOuter + indentation;
162
+ }
163
+ return result;
164
+ }
165
+ /**
166
+ * Return items (for example, of an array)
167
+ * with spacing, indentation, and comma
168
+ * without surrounding punctuation (for example, brackets)
169
+ */
170
+ function printListItems(list, config, indentation, depth, refs, printer) {
171
+ let result = "";
172
+ list = list instanceof ArrayBuffer ? new DataView(list) : list;
173
+ const isDataView = (l) => l instanceof DataView;
174
+ const length = isDataView(list) ? list.byteLength : list.length;
175
+ if (length > 0) {
176
+ result += config.spacingOuter;
177
+ const indentationNext = indentation + config.indent;
178
+ for (let i = 0; i < length; i++) {
179
+ result += indentationNext;
180
+ if (i === config.maxWidth) {
181
+ result += "…";
182
+ break;
183
+ }
184
+ if (isDataView(list) || i in list) result += printer(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
185
+ if (i < length - 1) result += `,${config.spacingInner}`;
186
+ else if (!config.min) result += ",";
187
+ }
188
+ result += config.spacingOuter + indentation;
189
+ }
190
+ return result;
191
+ }
192
+ /**
193
+ * Return properties of an object
194
+ * with spacing, indentation, and comma
195
+ * without surrounding punctuation (for example, braces)
196
+ */
197
+ function printObjectProperties(val, config, indentation, depth, refs, printer) {
198
+ let result = "";
199
+ const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
200
+ if (keys.length > 0) {
201
+ result += config.spacingOuter;
202
+ const indentationNext = indentation + config.indent;
203
+ for (let i = 0; i < keys.length; i++) {
204
+ const key = keys[i];
205
+ const name = printer(key, config, indentationNext, depth, refs);
206
+ const value = printer(val[key], config, indentationNext, depth, refs);
207
+ result += `${indentationNext + name}: ${value}`;
208
+ if (i < keys.length - 1) result += `,${config.spacingInner}`;
209
+ else if (!config.min) result += ",";
210
+ }
211
+ result += config.spacingOuter + indentation;
212
+ }
213
+ return result;
214
+ }
215
+ const asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621;
216
+ const SPACE$2 = " ";
217
+ const serialize$5 = (val, config, indentation, depth, refs, printer) => {
218
+ const stringedValue = val.toString();
219
+ if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
220
+ if (++depth > config.maxDepth) return `[${stringedValue}]`;
221
+ return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer)}]`;
222
+ }
223
+ if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
224
+ if (++depth > config.maxDepth) return `[${stringedValue}]`;
225
+ return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer)}}`;
226
+ }
227
+ if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs);
228
+ if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs);
229
+ if (typeof val.toAsymmetricMatcher !== "function") throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
230
+ return val.toAsymmetricMatcher();
231
+ };
232
+ const test$5 = (val) => val && val.$$typeof === asymmetricMatcher;
233
+ const plugin$5 = {
234
+ serialize: serialize$5,
235
+ test: test$5
236
+ };
237
+ const SPACE$1 = " ";
238
+ const OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
239
+ const ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
240
+ function testName(name) {
241
+ return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
242
+ }
243
+ const test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
244
+ function isNamedNodeMap(collection) {
245
+ return collection.constructor.name === "NamedNodeMap";
246
+ }
247
+ const serialize$4 = (collection, config, indentation, depth, refs, printer) => {
248
+ const name = collection.constructor.name;
249
+ if (++depth > config.maxDepth) return `[${name}]`;
250
+ return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
251
+ props[attribute.name] = attribute.value;
252
+ return props;
253
+ }, {}) : { ...collection }, config, indentation, depth, refs, printer)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer)}]`);
254
+ };
255
+ const plugin$4 = {
256
+ serialize: serialize$4,
257
+ test: test$4
258
+ };
259
+ /**
260
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
261
+ *
262
+ * This source code is licensed under the MIT license found in the
263
+ * LICENSE file in the root directory of this source tree.
264
+ */
265
+ function escapeHTML(str) {
266
+ return str.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
267
+ }
268
+ function printProps(keys, props, config, indentation, depth, refs, printer) {
269
+ const indentationNext = indentation + config.indent;
270
+ const colors = config.colors;
271
+ return keys.map((key) => {
272
+ const value = props[key];
273
+ if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) return "";
274
+ let printed = printer(value, config, indentationNext, depth, refs);
275
+ if (typeof value !== "string") {
276
+ if (printed.includes("\n")) printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
277
+ printed = `{${printed}}`;
278
+ }
279
+ return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
280
+ }).join("");
281
+ }
282
+ function printChildren(children, config, indentation, depth, refs, printer) {
283
+ return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join("");
284
+ }
285
+ function printShadowRoot(children, config, indentation, depth, refs, printer) {
286
+ if (config.printShadowRoot === false) return "";
287
+ return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer)].join("");
288
+ }
289
+ function printText(text, config) {
290
+ const contentColor = config.colors.content;
291
+ return contentColor.open + escapeHTML(text) + contentColor.close;
292
+ }
293
+ function printComment(comment, config) {
294
+ const commentColor = config.colors.comment;
295
+ return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
296
+ }
297
+ function printElement(type, printedProps, printedChildren, config, indentation) {
298
+ const tagColor = config.colors.tag;
299
+ return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
300
+ }
301
+ function printElementAsLeaf(type, config) {
302
+ const tagColor = config.colors.tag;
303
+ return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`;
304
+ }
305
+ const ELEMENT_NODE = 1;
306
+ const TEXT_NODE = 3;
307
+ const COMMENT_NODE = 8;
308
+ const FRAGMENT_NODE = 11;
309
+ const ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
310
+ function testHasAttribute(val) {
311
+ try {
312
+ return typeof val.hasAttribute === "function" && val.hasAttribute("is");
313
+ } catch {
314
+ return false;
315
+ }
316
+ }
317
+ function testNode(val) {
318
+ const constructorName = val.constructor.name;
319
+ const { nodeType, tagName } = val;
320
+ const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
321
+ return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
322
+ }
323
+ const test$3 = (val) => val?.constructor?.name && testNode(val);
324
+ function nodeIsText(node) {
325
+ return node.nodeType === TEXT_NODE;
326
+ }
327
+ function nodeIsComment(node) {
328
+ return node.nodeType === COMMENT_NODE;
329
+ }
330
+ function nodeIsFragment(node) {
331
+ return node.nodeType === FRAGMENT_NODE;
332
+ }
333
+ function filterChildren(children, filterNode) {
334
+ let filtered = children.filter((node) => {
335
+ if (node.nodeType === TEXT_NODE) return (node.data || "").trim().length > 0;
336
+ return true;
337
+ });
338
+ if (filterNode) filtered = filtered.filter(filterNode);
339
+ return filtered;
340
+ }
341
+ function serializeDOM(node, config, indentation, depth, refs, printer, filterNode) {
342
+ if (nodeIsText(node)) return printText(node.data, config);
343
+ if (nodeIsComment(node)) return printComment(node.data, config);
344
+ const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
345
+ if (++depth > config.maxDepth) return printElementAsLeaf(type, config);
346
+ const children = Array.prototype.slice.call(node.childNodes || node.children);
347
+ const shadowChildren = nodeIsFragment(node) || !node.shadowRoot ? [] : Array.prototype.slice.call(node.shadowRoot.children);
348
+ const resolvedChildren = filterNode ? filterChildren(children, filterNode) : children;
349
+ const resolvedShadowChildren = filterNode ? filterChildren(shadowChildren, filterNode) : shadowChildren;
350
+ return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
351
+ props[attribute.name] = attribute.value;
352
+ return props;
353
+ }, {}), config, indentation + config.indent, depth, refs, printer), (resolvedShadowChildren.length > 0 ? printShadowRoot(resolvedShadowChildren, config, indentation + config.indent, depth, refs, printer) : "") + printChildren(resolvedChildren, config, indentation + config.indent, depth, refs, printer), config, indentation);
354
+ }
355
+ const serialize$3 = (node, config, indentation, depth, refs, printer) => serializeDOM(node, config, indentation, depth, refs, printer);
356
+ function createDOMElementFilter(filterNode) {
357
+ return {
358
+ test: test$3,
359
+ serialize: (node, config, indentation, depth, refs, printer) => serializeDOM(node, config, indentation, depth, refs, printer, filterNode)
360
+ };
361
+ }
362
+ const plugin$3 = {
363
+ serialize: serialize$3,
364
+ test: test$3
365
+ };
366
+ const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
367
+ const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
368
+ const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
369
+ const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
370
+ const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
371
+ const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
372
+ const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
373
+ const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
374
+ const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
375
+ const getImmutableName = (name) => `Immutable.${name}`;
376
+ const printAsLeaf = (name) => `[${name}]`;
377
+ const SPACE = " ";
378
+ const LAZY = "…";
379
+ function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
380
+ return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer)}}`;
381
+ }
382
+ function getRecordEntries(val) {
383
+ let i = 0;
384
+ return { next() {
385
+ if (i < val._keys.length) {
386
+ const key = val._keys[i++];
387
+ return {
388
+ done: false,
389
+ value: [key, val.get(key)]
390
+ };
391
+ }
392
+ return {
393
+ done: true,
394
+ value: void 0
395
+ };
396
+ } };
397
+ }
398
+ function printImmutableRecord(val, config, indentation, depth, refs, printer) {
399
+ const name = getImmutableName(val._name || "Record");
400
+ return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer)}}`;
401
+ }
402
+ function printImmutableSeq(val, config, indentation, depth, refs, printer) {
403
+ const name = getImmutableName("Seq");
404
+ if (++depth > config.maxDepth) return printAsLeaf(name);
405
+ if (val[IS_KEYED_SENTINEL]) return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) : LAZY}}`;
406
+ return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer) : LAZY}]`;
407
+ }
408
+ function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
409
+ return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}]`;
410
+ }
411
+ const serialize$2 = (val, config, indentation, depth, refs, printer) => {
412
+ if (val[IS_MAP_SENTINEL]) return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
413
+ if (val[IS_LIST_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer, "List");
414
+ if (val[IS_SET_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
415
+ if (val[IS_STACK_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer, "Stack");
416
+ if (val[IS_SEQ_SENTINEL]) return printImmutableSeq(val, config, indentation, depth, refs, printer);
417
+ return printImmutableRecord(val, config, indentation, depth, refs, printer);
418
+ };
419
+ const test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
420
+ const plugin$2 = {
421
+ serialize: serialize$2,
422
+ test: test$2
423
+ };
424
+ function getDefaultExportFromCjs(x) {
425
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
426
+ }
427
+ var reactIs$1 = { exports: {} };
428
+ var reactIs_production = {};
429
+ /**
430
+ * @license React
431
+ * react-is.production.js
432
+ *
433
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
434
+ *
435
+ * This source code is licensed under the MIT license found in the
436
+ * LICENSE file in the root directory of this source tree.
437
+ */
438
+ var hasRequiredReactIs_production;
439
+ function requireReactIs_production() {
440
+ if (hasRequiredReactIs_production) return reactIs_production;
441
+ hasRequiredReactIs_production = 1;
442
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
443
+ function typeOf(object) {
444
+ if ("object" === typeof object && null !== object) {
445
+ var $$typeof = object.$$typeof;
446
+ switch ($$typeof) {
447
+ case REACT_ELEMENT_TYPE: switch (object = object.type, object) {
448
+ case REACT_FRAGMENT_TYPE:
449
+ case REACT_PROFILER_TYPE:
450
+ case REACT_STRICT_MODE_TYPE:
451
+ case REACT_SUSPENSE_TYPE:
452
+ case REACT_SUSPENSE_LIST_TYPE:
453
+ case REACT_VIEW_TRANSITION_TYPE: return object;
454
+ default: switch (object = object && object.$$typeof, object) {
455
+ case REACT_CONTEXT_TYPE:
456
+ case REACT_FORWARD_REF_TYPE:
457
+ case REACT_LAZY_TYPE:
458
+ case REACT_MEMO_TYPE: return object;
459
+ case REACT_CONSUMER_TYPE: return object;
460
+ default: return $$typeof;
461
+ }
462
+ }
463
+ case REACT_PORTAL_TYPE: return $$typeof;
464
+ }
465
+ }
466
+ }
467
+ reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
468
+ reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
469
+ reactIs_production.Element = REACT_ELEMENT_TYPE;
470
+ reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
471
+ reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
472
+ reactIs_production.Lazy = REACT_LAZY_TYPE;
473
+ reactIs_production.Memo = REACT_MEMO_TYPE;
474
+ reactIs_production.Portal = REACT_PORTAL_TYPE;
475
+ reactIs_production.Profiler = REACT_PROFILER_TYPE;
476
+ reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
477
+ reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
478
+ reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
479
+ reactIs_production.isContextConsumer = function(object) {
480
+ return typeOf(object) === REACT_CONSUMER_TYPE;
481
+ };
482
+ reactIs_production.isContextProvider = function(object) {
483
+ return typeOf(object) === REACT_CONTEXT_TYPE;
484
+ };
485
+ reactIs_production.isElement = function(object) {
486
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
487
+ };
488
+ reactIs_production.isForwardRef = function(object) {
489
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
490
+ };
491
+ reactIs_production.isFragment = function(object) {
492
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
493
+ };
494
+ reactIs_production.isLazy = function(object) {
495
+ return typeOf(object) === REACT_LAZY_TYPE;
496
+ };
497
+ reactIs_production.isMemo = function(object) {
498
+ return typeOf(object) === REACT_MEMO_TYPE;
499
+ };
500
+ reactIs_production.isPortal = function(object) {
501
+ return typeOf(object) === REACT_PORTAL_TYPE;
502
+ };
503
+ reactIs_production.isProfiler = function(object) {
504
+ return typeOf(object) === REACT_PROFILER_TYPE;
505
+ };
506
+ reactIs_production.isStrictMode = function(object) {
507
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
508
+ };
509
+ reactIs_production.isSuspense = function(object) {
510
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
511
+ };
512
+ reactIs_production.isSuspenseList = function(object) {
513
+ return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
514
+ };
515
+ reactIs_production.isValidElementType = function(type) {
516
+ return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
517
+ };
518
+ reactIs_production.typeOf = typeOf;
519
+ return reactIs_production;
520
+ }
521
+ var hasRequiredReactIs$1;
522
+ function requireReactIs$1() {
523
+ if (hasRequiredReactIs$1) return reactIs$1.exports;
524
+ hasRequiredReactIs$1 = 1;
525
+ reactIs$1.exports = requireReactIs_production();
526
+ return reactIs$1.exports;
527
+ }
528
+ var reactIsExports$1 = requireReactIs$1();
529
+ var ReactIs19 = /*#__PURE__*/ _mergeNamespaces({
530
+ __proto__: null,
531
+ default: /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports$1)
532
+ }, [reactIsExports$1]);
533
+ var reactIs = { exports: {} };
534
+ var reactIs_production_min = {};
535
+ /**
536
+ * @license React
537
+ * react-is.production.min.js
538
+ *
539
+ * Copyright (c) Facebook, Inc. and its affiliates.
540
+ *
541
+ * This source code is licensed under the MIT license found in the
542
+ * LICENSE file in the root directory of this source tree.
543
+ */
544
+ var hasRequiredReactIs_production_min;
545
+ function requireReactIs_production_min() {
546
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
547
+ hasRequiredReactIs_production_min = 1;
548
+ var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u = Symbol.for("react.module.reference");
549
+ function v(a) {
550
+ if ("object" === typeof a && null !== a) {
551
+ var r = a.$$typeof;
552
+ switch (r) {
553
+ case b: switch (a = a.type, a) {
554
+ case d:
555
+ case f:
556
+ case e:
557
+ case m:
558
+ case n: return a;
559
+ default: switch (a = a && a.$$typeof, a) {
560
+ case k:
561
+ case h:
562
+ case l:
563
+ case q:
564
+ case p:
565
+ case g: return a;
566
+ default: return r;
567
+ }
568
+ }
569
+ case c: return r;
570
+ }
571
+ }
572
+ }
573
+ reactIs_production_min.ContextConsumer = h;
574
+ reactIs_production_min.ContextProvider = g;
575
+ reactIs_production_min.Element = b;
576
+ reactIs_production_min.ForwardRef = l;
577
+ reactIs_production_min.Fragment = d;
578
+ reactIs_production_min.Lazy = q;
579
+ reactIs_production_min.Memo = p;
580
+ reactIs_production_min.Portal = c;
581
+ reactIs_production_min.Profiler = f;
582
+ reactIs_production_min.StrictMode = e;
583
+ reactIs_production_min.Suspense = m;
584
+ reactIs_production_min.SuspenseList = n;
585
+ reactIs_production_min.isAsyncMode = function() {
586
+ return false;
587
+ };
588
+ reactIs_production_min.isConcurrentMode = function() {
589
+ return false;
590
+ };
591
+ reactIs_production_min.isContextConsumer = function(a) {
592
+ return v(a) === h;
593
+ };
594
+ reactIs_production_min.isContextProvider = function(a) {
595
+ return v(a) === g;
596
+ };
597
+ reactIs_production_min.isElement = function(a) {
598
+ return "object" === typeof a && null !== a && a.$$typeof === b;
599
+ };
600
+ reactIs_production_min.isForwardRef = function(a) {
601
+ return v(a) === l;
602
+ };
603
+ reactIs_production_min.isFragment = function(a) {
604
+ return v(a) === d;
605
+ };
606
+ reactIs_production_min.isLazy = function(a) {
607
+ return v(a) === q;
608
+ };
609
+ reactIs_production_min.isMemo = function(a) {
610
+ return v(a) === p;
611
+ };
612
+ reactIs_production_min.isPortal = function(a) {
613
+ return v(a) === c;
614
+ };
615
+ reactIs_production_min.isProfiler = function(a) {
616
+ return v(a) === f;
617
+ };
618
+ reactIs_production_min.isStrictMode = function(a) {
619
+ return v(a) === e;
620
+ };
621
+ reactIs_production_min.isSuspense = function(a) {
622
+ return v(a) === m;
623
+ };
624
+ reactIs_production_min.isSuspenseList = function(a) {
625
+ return v(a) === n;
626
+ };
627
+ reactIs_production_min.isValidElementType = function(a) {
628
+ return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? true : false;
629
+ };
630
+ reactIs_production_min.typeOf = v;
631
+ return reactIs_production_min;
632
+ }
633
+ var hasRequiredReactIs;
634
+ function requireReactIs() {
635
+ if (hasRequiredReactIs) return reactIs.exports;
636
+ hasRequiredReactIs = 1;
637
+ reactIs.exports = requireReactIs_production_min();
638
+ return reactIs.exports;
639
+ }
640
+ var reactIsExports = requireReactIs();
641
+ var ReactIs18 = /*#__PURE__*/ _mergeNamespaces({
642
+ __proto__: null,
643
+ default: /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports)
644
+ }, [reactIsExports]);
645
+ const ReactIs = Object.fromEntries([
646
+ "isAsyncMode",
647
+ "isConcurrentMode",
648
+ "isContextConsumer",
649
+ "isContextProvider",
650
+ "isElement",
651
+ "isForwardRef",
652
+ "isFragment",
653
+ "isLazy",
654
+ "isMemo",
655
+ "isPortal",
656
+ "isProfiler",
657
+ "isStrictMode",
658
+ "isSuspense",
659
+ "isSuspenseList",
660
+ "isValidElementType"
661
+ ].map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)]));
662
+ function getChildren(arg, children = []) {
663
+ if (Array.isArray(arg)) for (const item of arg) getChildren(item, children);
664
+ else if (arg != null && arg !== false && arg !== "") children.push(arg);
665
+ return children;
666
+ }
667
+ function getType$1(element) {
668
+ const type = element.type;
669
+ if (typeof type === "string") return type;
670
+ if (typeof type === "function") return type.displayName || type.name || "Unknown";
671
+ if (ReactIs.isFragment(element)) return "React.Fragment";
672
+ if (ReactIs.isSuspense(element)) return "React.Suspense";
673
+ if (typeof type === "object" && type !== null) {
674
+ if (ReactIs.isContextProvider(element)) return "Context.Provider";
675
+ if (ReactIs.isContextConsumer(element)) return "Context.Consumer";
676
+ if (ReactIs.isForwardRef(element)) {
677
+ if (type.displayName) return type.displayName;
678
+ const functionName = type.render.displayName || type.render.name || "";
679
+ return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
680
+ }
681
+ if (ReactIs.isMemo(element)) {
682
+ const functionName = type.displayName || type.type.displayName || type.type.name || "";
683
+ return functionName === "" ? "Memo" : `Memo(${functionName})`;
684
+ }
685
+ }
686
+ return "UNDEFINED";
687
+ }
688
+ function getPropKeys$1(element) {
689
+ const { props } = element;
690
+ return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
691
+ }
692
+ const serialize$1 = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(getType$1(element), config) : printElement(getType$1(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
693
+ const test$1 = (val) => val != null && ReactIs.isElement(val);
694
+ const plugin$1 = {
695
+ serialize: serialize$1,
696
+ test: test$1
697
+ };
698
+ const testSymbol = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
699
+ function getPropKeys(object) {
700
+ const { props } = object;
701
+ return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
702
+ }
703
+ const serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation);
704
+ const test$6 = (val) => val && val.$$typeof === testSymbol;
705
+ const plugin = {
706
+ serialize,
707
+ test: test$6
708
+ };
709
+ const toString$1 = Object.prototype.toString;
710
+ const toISOString = Date.prototype.toISOString;
711
+ const errorToString = Error.prototype.toString;
712
+ const regExpToString = RegExp.prototype.toString;
713
+ /**
714
+ * Explicitly comparing typeof constructor to function avoids undefined as name
715
+ * when mock identity-obj-proxy returns the key as the value for any key.
716
+ */
717
+ function getConstructorName(val) {
718
+ return typeof val.constructor === "function" && val.constructor.name || "Object";
719
+ }
720
+ /** Is val is equal to global window object? Works even if it does not exist :) */
721
+ function isWindow(val) {
722
+ return typeof window !== "undefined" && val === window;
723
+ }
724
+ const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
725
+ const NEWLINE_REGEXP = /\n/g;
726
+ var PrettyFormatPluginError = class extends Error {
727
+ constructor(message, stack) {
728
+ super(message);
729
+ this.stack = stack;
730
+ this.name = this.constructor.name;
731
+ }
732
+ };
733
+ function isToStringedArrayType(toStringed) {
734
+ return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
735
+ }
736
+ function printNumber(val) {
737
+ return Object.is(val, -0) ? "-0" : String(val);
738
+ }
739
+ function printBigInt(val) {
740
+ return String(`${val}n`);
741
+ }
742
+ function printFunction(val, printFunctionName) {
743
+ if (!printFunctionName) return "[Function]";
744
+ return `[Function ${val.name || "anonymous"}]`;
745
+ }
746
+ function printSymbol(val) {
747
+ return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
748
+ }
749
+ function printError(val) {
750
+ return `[${errorToString.call(val)}]`;
751
+ }
752
+ /**
753
+ * The first port of call for printing an object, handles most of the
754
+ * data-types in JS.
755
+ */
756
+ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
757
+ if (val === true || val === false) return `${val}`;
758
+ if (val === void 0) return "undefined";
759
+ if (val === null) return "null";
760
+ const typeOf = typeof val;
761
+ if (typeOf === "number") return printNumber(val);
762
+ if (typeOf === "bigint") return printBigInt(val);
763
+ if (typeOf === "string") {
764
+ if (escapeString) return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
765
+ return `"${val}"`;
766
+ }
767
+ if (typeOf === "function") return printFunction(val, printFunctionName);
768
+ if (typeOf === "symbol") return printSymbol(val);
769
+ const toStringed = toString$1.call(val);
770
+ if (toStringed === "[object WeakMap]") return "WeakMap {}";
771
+ if (toStringed === "[object WeakSet]") return "WeakSet {}";
772
+ if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") return printFunction(val, printFunctionName);
773
+ if (toStringed === "[object Symbol]") return printSymbol(val);
774
+ if (toStringed === "[object Date]") return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
775
+ if (toStringed === "[object Error]") return printError(val);
776
+ if (toStringed === "[object RegExp]") {
777
+ if (escapeRegex) return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
778
+ return regExpToString.call(val);
779
+ }
780
+ if (val instanceof Error) return printError(val);
781
+ return null;
782
+ }
783
+ /**
784
+ * Handles more complex objects ( such as objects with circular references.
785
+ * maps and sets etc )
786
+ */
787
+ function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
788
+ if (refs.includes(val)) return "[Circular]";
789
+ refs = [...refs];
790
+ refs.push(val);
791
+ const hitMaxDepth = ++depth > config.maxDepth;
792
+ const min = config.min;
793
+ if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) return printer(val.toJSON(), config, indentation, depth, refs, true);
794
+ const toStringed = toString$1.call(val);
795
+ if (toStringed === "[object Arguments]") return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
796
+ if (isToStringedArrayType(toStringed)) return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
797
+ if (toStringed === "[object Map]") return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
798
+ if (toStringed === "[object Set]") return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
799
+ return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
800
+ }
801
+ const ErrorPlugin = {
802
+ test: (val) => val && val instanceof Error,
803
+ serialize(val, config, indentation, depth, refs, printer) {
804
+ if (refs.includes(val)) return "[Circular]";
805
+ refs = [...refs, val];
806
+ const hitMaxDepth = ++depth > config.maxDepth;
807
+ const { message, cause, ...rest } = val;
808
+ const entries = {
809
+ message,
810
+ ...typeof cause !== "undefined" ? { cause } : {},
811
+ ...val instanceof AggregateError ? { errors: val.errors } : {},
812
+ ...rest
813
+ };
814
+ const name = val.name !== "Error" ? val.name : getConstructorName(val);
815
+ return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer)}}`;
816
+ }
817
+ };
818
+ function isNewPlugin(plugin) {
819
+ return plugin.serialize != null;
820
+ }
821
+ function printPlugin(plugin, val, config, indentation, depth, refs) {
822
+ let printed;
823
+ try {
824
+ printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
825
+ const indentationNext = indentation + config.indent;
826
+ return indentationNext + str.replaceAll(NEWLINE_REGEXP, `\n${indentationNext}`);
827
+ }, {
828
+ edgeSpacing: config.spacingOuter,
829
+ min: config.min,
830
+ spacing: config.spacingInner
831
+ }, config.colors);
832
+ } catch (error) {
833
+ throw new PrettyFormatPluginError(error.message, error.stack);
834
+ }
835
+ if (typeof printed !== "string") throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
836
+ return printed;
837
+ }
838
+ function findPlugin(plugins, val) {
839
+ for (const plugin of plugins) try {
840
+ if (plugin.test(val)) return plugin;
841
+ } catch (error) {
842
+ throw new PrettyFormatPluginError(error.message, error.stack);
843
+ }
844
+ return null;
845
+ }
846
+ function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
847
+ let result;
848
+ const plugin = findPlugin(config.plugins, val);
849
+ if (plugin !== null) result = printPlugin(plugin, val, config, indentation, depth, refs);
850
+ else {
851
+ const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
852
+ if (basicResult !== null) result = basicResult;
853
+ else result = printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
854
+ }
855
+ config._outputLengthPerDepth[depth] ??= 0;
856
+ config._outputLengthPerDepth[depth] += result.length;
857
+ if (config._outputLengthPerDepth[depth] > config.maxOutputLength) config.maxDepth = 0;
858
+ return result;
859
+ }
860
+ const DEFAULT_THEME = {
861
+ comment: "gray",
862
+ content: "reset",
863
+ prop: "yellow",
864
+ tag: "cyan",
865
+ value: "green"
866
+ };
867
+ const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
868
+ const DEFAULT_OPTIONS = {
869
+ callToJSON: true,
870
+ compareKeys: void 0,
871
+ escapeRegex: false,
872
+ escapeString: true,
873
+ highlight: false,
874
+ indent: 2,
875
+ maxDepth: Number.POSITIVE_INFINITY,
876
+ maxOutputLength: 1e6,
877
+ maxWidth: Number.POSITIVE_INFINITY,
878
+ min: false,
879
+ plugins: [],
880
+ printBasicPrototype: true,
881
+ printFunctionName: true,
882
+ printShadowRoot: true,
883
+ theme: DEFAULT_THEME
884
+ };
885
+ function validateOptions(options) {
886
+ for (const key of Object.keys(options)) if (!Object.hasOwn(DEFAULT_OPTIONS, key)) throw new Error(`pretty-format: Unknown option "${key}".`);
887
+ if (options.min && options.indent !== void 0 && options.indent !== 0) throw new Error("pretty-format: Options \"min\" and \"indent\" cannot be used together.");
888
+ }
889
+ function getColorsHighlight() {
890
+ return DEFAULT_THEME_KEYS.reduce((colors, key) => {
891
+ const value = DEFAULT_THEME[key];
892
+ const color = value && y[value];
893
+ if (color && typeof color.close === "string" && typeof color.open === "string") colors[key] = color;
894
+ else throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
895
+ return colors;
896
+ }, Object.create(null));
897
+ }
898
+ function getColorsEmpty() {
899
+ return DEFAULT_THEME_KEYS.reduce((colors, key) => {
900
+ colors[key] = {
901
+ close: "",
902
+ open: ""
903
+ };
904
+ return colors;
905
+ }, Object.create(null));
906
+ }
907
+ function getPrintFunctionName(options) {
908
+ return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
909
+ }
910
+ function getEscapeRegex(options) {
911
+ return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
912
+ }
913
+ function getEscapeString(options) {
914
+ return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
915
+ }
916
+ function getConfig(options) {
917
+ return {
918
+ callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
919
+ colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
920
+ compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
921
+ escapeRegex: getEscapeRegex(options),
922
+ escapeString: getEscapeString(options),
923
+ indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
924
+ maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
925
+ maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
926
+ min: options?.min ?? DEFAULT_OPTIONS.min,
927
+ plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
928
+ printBasicPrototype: options?.printBasicPrototype ?? true,
929
+ printFunctionName: getPrintFunctionName(options),
930
+ printShadowRoot: options?.printShadowRoot ?? true,
931
+ spacingInner: options?.min ? " " : "\n",
932
+ spacingOuter: options?.min ? "" : "\n",
933
+ maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS.maxOutputLength,
934
+ _outputLengthPerDepth: []
935
+ };
936
+ }
937
+ function createIndent(indent) {
938
+ return Array.from({ length: indent + 1 }).join(" ");
939
+ }
940
+ /**
941
+ * Returns a presentation string of your `val` object
942
+ * @param val any potential JavaScript object
943
+ * @param options Custom settings
944
+ */
945
+ function format$1(val, options) {
946
+ if (options) {
947
+ validateOptions(options);
948
+ if (options.plugins) {
949
+ const plugin = findPlugin(options.plugins, val);
950
+ if (plugin !== null) return printPlugin(plugin, val, getConfig(options), "", 0, []);
951
+ }
952
+ }
953
+ const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
954
+ if (basicResult !== null) return basicResult;
955
+ return printComplexValue(val, getConfig(options), "", 0, []);
956
+ }
957
+ const plugins = {
958
+ AsymmetricMatcher: plugin$5,
959
+ DOMCollection: plugin$4,
960
+ DOMElement: plugin$3,
961
+ Immutable: plugin$2,
962
+ ReactElement: plugin$1,
963
+ ReactTestComponent: plugin,
964
+ Error: ErrorPlugin
965
+ };
966
+ //#endregion
967
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/display.js
968
+ const ansiColors = {
969
+ bold: ["1", "22"],
970
+ dim: ["2", "22"],
971
+ italic: ["3", "23"],
972
+ underline: ["4", "24"],
973
+ inverse: ["7", "27"],
974
+ hidden: ["8", "28"],
975
+ strike: ["9", "29"],
976
+ black: ["30", "39"],
977
+ red: ["31", "39"],
978
+ green: ["32", "39"],
979
+ yellow: ["33", "39"],
980
+ blue: ["34", "39"],
981
+ magenta: ["35", "39"],
982
+ cyan: ["36", "39"],
983
+ white: ["37", "39"],
984
+ brightblack: ["30;1", "39"],
985
+ brightred: ["31;1", "39"],
986
+ brightgreen: ["32;1", "39"],
987
+ brightyellow: ["33;1", "39"],
988
+ brightblue: ["34;1", "39"],
989
+ brightmagenta: ["35;1", "39"],
990
+ brightcyan: ["36;1", "39"],
991
+ brightwhite: ["37;1", "39"],
992
+ grey: ["90", "39"]
993
+ };
994
+ const styles = {
995
+ special: "cyan",
996
+ number: "yellow",
997
+ bigint: "yellow",
998
+ boolean: "yellow",
999
+ undefined: "grey",
1000
+ null: "bold",
1001
+ string: "green",
1002
+ symbol: "green",
1003
+ date: "magenta",
1004
+ regexp: "red"
1005
+ };
1006
+ const truncator = "…";
1007
+ function colorise(value, styleType) {
1008
+ const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
1009
+ if (!color) return String(value);
1010
+ return `\u001b[${color[0]}m${String(value)}\u001b[${color[1]}m`;
1011
+ }
1012
+ function normaliseOptions({ showHidden = false, depth = 2, colors = false, customInspect = true, showProxy = false, maxArrayLength = Infinity, breakLength = Infinity, seen = [], truncate = Infinity, stylize = String } = {}, inspect) {
1013
+ const options = {
1014
+ showHidden: Boolean(showHidden),
1015
+ depth: Number(depth),
1016
+ colors: Boolean(colors),
1017
+ customInspect: Boolean(customInspect),
1018
+ showProxy: Boolean(showProxy),
1019
+ maxArrayLength: Number(maxArrayLength),
1020
+ breakLength: Number(breakLength),
1021
+ truncate: Number(truncate),
1022
+ seen,
1023
+ inspect,
1024
+ stylize
1025
+ };
1026
+ if (options.colors) options.stylize = colorise;
1027
+ return options;
1028
+ }
1029
+ function isHighSurrogate(char) {
1030
+ return char >= "\ud800" && char <= "\udbff";
1031
+ }
1032
+ function truncate(string, length, tail = truncator) {
1033
+ string = String(string);
1034
+ const tailLength = tail.length;
1035
+ const stringLength = string.length;
1036
+ if (tailLength > length && stringLength > tailLength) return tail;
1037
+ if (stringLength > length && stringLength > tailLength) {
1038
+ let end = length - tailLength;
1039
+ if (end > 0 && isHighSurrogate(string[end - 1])) end = end - 1;
1040
+ return `${string.slice(0, end)}${tail}`;
1041
+ }
1042
+ return string;
1043
+ }
1044
+ function inspectList(list, options, inspectItem, separator = ", ") {
1045
+ inspectItem = inspectItem || options.inspect;
1046
+ const size = list.length;
1047
+ if (size === 0) return "";
1048
+ const originalLength = options.truncate;
1049
+ let output = "";
1050
+ let peek = "";
1051
+ let truncated = "";
1052
+ for (let i = 0; i < size; i += 1) {
1053
+ const last = i + 1 === list.length;
1054
+ const secondToLast = i + 2 === list.length;
1055
+ truncated = `${truncator}(${list.length - i})`;
1056
+ const value = list[i];
1057
+ options.truncate = originalLength - output.length - (last ? 0 : separator.length);
1058
+ const string = peek || inspectItem(value, options) + (last ? "" : separator);
1059
+ const nextLength = output.length + string.length;
1060
+ const truncatedLength = nextLength + truncated.length;
1061
+ if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) break;
1062
+ if (!last && !secondToLast && truncatedLength > originalLength) break;
1063
+ peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
1064
+ if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) break;
1065
+ output += string;
1066
+ if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
1067
+ truncated = `${truncator}(${list.length - i - 1})`;
1068
+ break;
1069
+ }
1070
+ truncated = "";
1071
+ }
1072
+ return `${output}${truncated}`;
1073
+ }
1074
+ function quoteComplexKey(key) {
1075
+ if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) return key;
1076
+ return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'");
1077
+ }
1078
+ function inspectProperty([key, value], options) {
1079
+ options.truncate -= 2;
1080
+ if (typeof key === "string") key = quoteComplexKey(key);
1081
+ else if (typeof key !== "number") key = `[${options.inspect(key, options)}]`;
1082
+ options.truncate -= key.length;
1083
+ value = options.inspect(value, options);
1084
+ return `${key}: ${value}`;
1085
+ }
1086
+ function inspectArray(array, options) {
1087
+ const nonIndexProperties = Object.keys(array).slice(array.length);
1088
+ if (!array.length && !nonIndexProperties.length) return "[]";
1089
+ options.truncate -= 4;
1090
+ const listContents = inspectList(array, options);
1091
+ options.truncate -= listContents.length;
1092
+ let propertyContents = "";
1093
+ if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
1094
+ return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
1095
+ }
1096
+ const getArrayName = (array) => {
1097
+ if (typeof Buffer === "function" && array instanceof Buffer) return "Buffer";
1098
+ if (array[Symbol.toStringTag]) return array[Symbol.toStringTag];
1099
+ return array.constructor.name;
1100
+ };
1101
+ function inspectTypedArray(array, options) {
1102
+ const name = getArrayName(array);
1103
+ options.truncate -= name.length + 4;
1104
+ const nonIndexProperties = Object.keys(array).slice(array.length);
1105
+ if (!array.length && !nonIndexProperties.length) return `${name}[]`;
1106
+ let output = "";
1107
+ for (let i = 0; i < array.length; i++) {
1108
+ const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
1109
+ options.truncate -= string.length;
1110
+ if (array[i] !== array.length && options.truncate <= 3) {
1111
+ output += `${truncator}(${array.length - array[i] + 1})`;
1112
+ break;
1113
+ }
1114
+ output += string;
1115
+ }
1116
+ let propertyContents = "";
1117
+ if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
1118
+ return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
1119
+ }
1120
+ function inspectDate(dateObject, options) {
1121
+ const stringRepresentation = dateObject.toJSON();
1122
+ if (stringRepresentation === null) return "Invalid Date";
1123
+ const split = stringRepresentation.split("T");
1124
+ const date = split[0];
1125
+ return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
1126
+ }
1127
+ function inspectFunction(func, options) {
1128
+ const functionType = func[Symbol.toStringTag] || "Function";
1129
+ const name = func.name;
1130
+ if (!name) return options.stylize(`[${functionType}]`, "special");
1131
+ return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
1132
+ }
1133
+ function inspectMapEntry([key, value], options) {
1134
+ options.truncate -= 4;
1135
+ key = options.inspect(key, options);
1136
+ options.truncate -= key.length;
1137
+ value = options.inspect(value, options);
1138
+ return `${key} => ${value}`;
1139
+ }
1140
+ function mapToEntries(map) {
1141
+ const entries = [];
1142
+ map.forEach((value, key) => {
1143
+ entries.push([key, value]);
1144
+ });
1145
+ return entries;
1146
+ }
1147
+ function inspectMap(map, options) {
1148
+ if (map.size === 0) return "Map{}";
1149
+ options.truncate -= 7;
1150
+ return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
1151
+ }
1152
+ const isNaN = Number.isNaN || ((i) => i !== i);
1153
+ function inspectNumber(number, options) {
1154
+ if (isNaN(number)) return options.stylize("NaN", "number");
1155
+ if (number === Infinity) return options.stylize("Infinity", "number");
1156
+ if (number === -Infinity) return options.stylize("-Infinity", "number");
1157
+ if (number === 0) return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
1158
+ return options.stylize(truncate(String(number), options.truncate), "number");
1159
+ }
1160
+ function inspectBigInt(number, options) {
1161
+ let nums = truncate(number.toString(), options.truncate - 1);
1162
+ if (nums !== truncator) nums += "n";
1163
+ return options.stylize(nums, "bigint");
1164
+ }
1165
+ function inspectRegExp(value, options) {
1166
+ const flags = value.toString().split("/")[2];
1167
+ const sourceLength = options.truncate - (2 + flags.length);
1168
+ const source = value.source;
1169
+ return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
1170
+ }
1171
+ function arrayFromSet(set) {
1172
+ const values = [];
1173
+ set.forEach((value) => {
1174
+ values.push(value);
1175
+ });
1176
+ return values;
1177
+ }
1178
+ function inspectSet(set, options) {
1179
+ if (set.size === 0) return "Set{}";
1180
+ options.truncate -= 7;
1181
+ return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
1182
+ }
1183
+ const stringEscapeChars = /* @__PURE__ */ new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
1184
+ const escapeCharacters = {
1185
+ "\b": "\\b",
1186
+ " ": "\\t",
1187
+ "\n": "\\n",
1188
+ "\f": "\\f",
1189
+ "\r": "\\r",
1190
+ "'": "\\'",
1191
+ "\\": "\\\\"
1192
+ };
1193
+ const hex = 16;
1194
+ function escape(char) {
1195
+ return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`;
1196
+ }
1197
+ function inspectString(string, options) {
1198
+ if (stringEscapeChars.test(string)) string = string.replace(stringEscapeChars, escape);
1199
+ return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
1200
+ }
1201
+ function inspectSymbol(value) {
1202
+ if ("description" in Symbol.prototype) return value.description ? `Symbol(${value.description})` : "Symbol()";
1203
+ return value.toString();
1204
+ }
1205
+ const getPromiseValue = () => "Promise{…}";
1206
+ function inspectObject$1(object, options) {
1207
+ const properties = Object.getOwnPropertyNames(object);
1208
+ const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
1209
+ if (properties.length === 0 && symbols.length === 0) return "{}";
1210
+ options.truncate -= 4;
1211
+ options.seen = options.seen || [];
1212
+ if (options.seen.includes(object)) return "[Circular]";
1213
+ options.seen.push(object);
1214
+ const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
1215
+ const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
1216
+ options.seen.pop();
1217
+ let sep = "";
1218
+ if (propertyContents && symbolContents) sep = ", ";
1219
+ return `{ ${propertyContents}${sep}${symbolContents} }`;
1220
+ }
1221
+ const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
1222
+ function inspectClass(value, options) {
1223
+ let name = "";
1224
+ if (toStringTag && toStringTag in value) name = value[toStringTag];
1225
+ name = name || value.constructor.name;
1226
+ if (!name || name === "_class") name = "<Anonymous Class>";
1227
+ options.truncate -= name.length;
1228
+ return `${name}${inspectObject$1(value, options)}`;
1229
+ }
1230
+ function inspectArguments(args, options) {
1231
+ if (args.length === 0) return "Arguments[]";
1232
+ options.truncate -= 13;
1233
+ return `Arguments[ ${inspectList(args, options)} ]`;
1234
+ }
1235
+ const errorKeys = [
1236
+ "stack",
1237
+ "line",
1238
+ "column",
1239
+ "name",
1240
+ "message",
1241
+ "fileName",
1242
+ "lineNumber",
1243
+ "columnNumber",
1244
+ "number",
1245
+ "description",
1246
+ "cause"
1247
+ ];
1248
+ function inspectObject(error, options) {
1249
+ const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
1250
+ const name = error.name;
1251
+ options.truncate -= name.length;
1252
+ let message = "";
1253
+ if (typeof error.message === "string") message = truncate(error.message, options.truncate);
1254
+ else properties.unshift("message");
1255
+ message = message ? `: ${message}` : "";
1256
+ options.truncate -= message.length + 5;
1257
+ options.seen = options.seen || [];
1258
+ if (options.seen.includes(error)) return "[Circular]";
1259
+ options.seen.push(error);
1260
+ const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
1261
+ return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
1262
+ }
1263
+ function inspectAttribute([key, value], options) {
1264
+ options.truncate -= 3;
1265
+ if (!value) return `${options.stylize(String(key), "yellow")}`;
1266
+ return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
1267
+ }
1268
+ function inspectNodeCollection(collection, options) {
1269
+ return inspectList(collection, options, inspectNode, "\n");
1270
+ }
1271
+ function inspectNode(node, options) {
1272
+ switch (node.nodeType) {
1273
+ case 1: return inspectHTML(node, options);
1274
+ case 3: return options.inspect(node.data, options);
1275
+ default: return options.inspect(node, options);
1276
+ }
1277
+ }
1278
+ function inspectHTML(element, options) {
1279
+ const properties = element.getAttributeNames();
1280
+ const name = element.tagName.toLowerCase();
1281
+ const head = options.stylize(`<${name}`, "special");
1282
+ const headClose = options.stylize(`>`, "special");
1283
+ const tail = options.stylize(`</${name}>`, "special");
1284
+ options.truncate -= name.length * 2 + 5;
1285
+ let propertyContents = "";
1286
+ if (properties.length > 0) {
1287
+ propertyContents += " ";
1288
+ propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
1289
+ }
1290
+ options.truncate -= propertyContents.length;
1291
+ const truncate = options.truncate;
1292
+ let children = inspectNodeCollection(element.children, options);
1293
+ if (children && children.length > truncate) children = `${truncator}(${element.children.length})`;
1294
+ return `${head}${propertyContents}${headClose}${children}${tail}`;
1295
+ }
1296
+ const chaiInspect = typeof Symbol === "function" && typeof Symbol.for === "function" ? Symbol.for("chai/inspect") : "@@chai/inspect";
1297
+ const nodeInspect = Symbol.for("nodejs.util.inspect.custom");
1298
+ const constructorMap = /* @__PURE__ */ new WeakMap();
1299
+ const stringTagMap = {};
1300
+ const baseTypesMap = {
1301
+ undefined: (value, options) => options.stylize("undefined", "undefined"),
1302
+ null: (value, options) => options.stylize("null", "null"),
1303
+ boolean: (value, options) => options.stylize(String(value), "boolean"),
1304
+ Boolean: (value, options) => options.stylize(String(value), "boolean"),
1305
+ number: inspectNumber,
1306
+ Number: inspectNumber,
1307
+ bigint: inspectBigInt,
1308
+ BigInt: inspectBigInt,
1309
+ string: inspectString,
1310
+ String: inspectString,
1311
+ function: inspectFunction,
1312
+ Function: inspectFunction,
1313
+ symbol: inspectSymbol,
1314
+ Symbol: inspectSymbol,
1315
+ Array: inspectArray,
1316
+ Date: inspectDate,
1317
+ Map: inspectMap,
1318
+ Set: inspectSet,
1319
+ RegExp: inspectRegExp,
1320
+ Promise: getPromiseValue,
1321
+ WeakSet: (value, options) => options.stylize("WeakSet{…}", "special"),
1322
+ WeakMap: (value, options) => options.stylize("WeakMap{…}", "special"),
1323
+ Arguments: inspectArguments,
1324
+ Int8Array: inspectTypedArray,
1325
+ Uint8Array: inspectTypedArray,
1326
+ Uint8ClampedArray: inspectTypedArray,
1327
+ Int16Array: inspectTypedArray,
1328
+ Uint16Array: inspectTypedArray,
1329
+ Int32Array: inspectTypedArray,
1330
+ Uint32Array: inspectTypedArray,
1331
+ Float32Array: inspectTypedArray,
1332
+ Float64Array: inspectTypedArray,
1333
+ Generator: () => "",
1334
+ DataView: () => "",
1335
+ ArrayBuffer: () => "",
1336
+ Error: inspectObject,
1337
+ HTMLCollection: inspectNodeCollection,
1338
+ NodeList: inspectNodeCollection
1339
+ };
1340
+ const inspectCustom = (value, options, type, inspectFn) => {
1341
+ if (chaiInspect in value && typeof value[chaiInspect] === "function") return value[chaiInspect](options);
1342
+ if (nodeInspect in value && typeof value[nodeInspect] === "function") return value[nodeInspect](options.depth, options, inspectFn);
1343
+ if ("inspect" in value && typeof value.inspect === "function") return value.inspect(options.depth, options);
1344
+ if ("constructor" in value && constructorMap.has(value.constructor)) return constructorMap.get(value.constructor)(value, options);
1345
+ if (stringTagMap[type]) return stringTagMap[type](value, options);
1346
+ return "";
1347
+ };
1348
+ const toString = Object.prototype.toString;
1349
+ function inspect$1(value, opts = {}) {
1350
+ const options = normaliseOptions(opts, inspect$1);
1351
+ const { customInspect } = options;
1352
+ let type = value === null ? "null" : typeof value;
1353
+ if (type === "object") type = toString.call(value).slice(8, -1);
1354
+ if (type in baseTypesMap) return baseTypesMap[type](value, options);
1355
+ if (customInspect && value) {
1356
+ const output = inspectCustom(value, options, type, inspect$1);
1357
+ if (output) {
1358
+ if (typeof output === "string") return output;
1359
+ return inspect$1(output, options);
1360
+ }
1361
+ }
1362
+ const proto = value ? Object.getPrototypeOf(value) : false;
1363
+ if (proto === Object.prototype || proto === null) return inspectObject$1(value, options);
1364
+ if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) return inspectHTML(value, options);
1365
+ if ("constructor" in value) {
1366
+ if (value.constructor !== Object) return inspectClass(value, options);
1367
+ return inspectObject$1(value, options);
1368
+ }
1369
+ if (value === Object(value)) return inspectObject$1(value, options);
1370
+ return options.stylize(String(value), type);
1371
+ }
1372
+ const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
1373
+ const PLUGINS = [
1374
+ ReactTestComponent,
1375
+ ReactElement,
1376
+ DOMElement,
1377
+ DOMCollection,
1378
+ Immutable,
1379
+ AsymmetricMatcher
1380
+ ];
1381
+ function stringify(object, maxDepth = 10, { maxLength, filterNode, ...options } = {}) {
1382
+ const MAX_LENGTH = maxLength ?? 1e4;
1383
+ let result;
1384
+ const filterFn = typeof filterNode === "string" ? createNodeFilterFromSelector(filterNode) : filterNode;
1385
+ const plugins = filterFn ? [
1386
+ ReactTestComponent,
1387
+ ReactElement,
1388
+ createDOMElementFilter(filterFn),
1389
+ DOMCollection,
1390
+ Immutable,
1391
+ AsymmetricMatcher
1392
+ ] : PLUGINS;
1393
+ try {
1394
+ result = format$1(object, {
1395
+ maxDepth,
1396
+ escapeString: false,
1397
+ plugins,
1398
+ ...options
1399
+ });
1400
+ } catch {
1401
+ result = format$1(object, {
1402
+ callToJSON: false,
1403
+ maxDepth,
1404
+ escapeString: false,
1405
+ plugins,
1406
+ ...options
1407
+ });
1408
+ }
1409
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
1410
+ maxLength,
1411
+ filterNode,
1412
+ ...options
1413
+ }) : result;
1414
+ }
1415
+ function createNodeFilterFromSelector(selector) {
1416
+ const ELEMENT_NODE = 1;
1417
+ const COMMENT_NODE = 8;
1418
+ return (node) => {
1419
+ if (node.nodeType === COMMENT_NODE) return false;
1420
+ if (node.nodeType === ELEMENT_NODE && node.matches) try {
1421
+ return !node.matches(selector);
1422
+ } catch {
1423
+ return true;
1424
+ }
1425
+ return true;
1426
+ };
1427
+ }
1428
+ const formatRegExp = /%[sdjifoOc%]/g;
1429
+ function baseFormat(args, options = {}) {
1430
+ const formatArg = (item, inspecOptions) => {
1431
+ if (options.prettifyObject) return stringify(item, void 0, {
1432
+ printBasicPrototype: false,
1433
+ escapeString: false
1434
+ });
1435
+ return inspect(item, inspecOptions);
1436
+ };
1437
+ if (typeof args[0] !== "string") {
1438
+ const objects = [];
1439
+ for (let i = 0; i < args.length; i++) objects.push(formatArg(args[i], {
1440
+ depth: 0,
1441
+ colors: false
1442
+ }));
1443
+ return objects.join(" ");
1444
+ }
1445
+ const len = args.length;
1446
+ let i = 1;
1447
+ const template = args[0];
1448
+ let str = String(template).replace(formatRegExp, (x) => {
1449
+ if (x === "%%") return "%";
1450
+ if (i >= len) return x;
1451
+ switch (x) {
1452
+ case "%s": {
1453
+ const value = args[i++];
1454
+ if (typeof value === "bigint") return `${value.toString()}n`;
1455
+ if (typeof value === "number" && value === 0 && 1 / value < 0) return "-0";
1456
+ if (typeof value === "object" && value !== null) {
1457
+ if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) return value.toString();
1458
+ return formatArg(value, {
1459
+ depth: 0,
1460
+ colors: false
1461
+ });
1462
+ }
1463
+ return String(value);
1464
+ }
1465
+ case "%d": {
1466
+ const value = args[i++];
1467
+ if (typeof value === "bigint") return `${value.toString()}n`;
1468
+ if (typeof value === "symbol") return "NaN";
1469
+ return Number(value).toString();
1470
+ }
1471
+ case "%i": {
1472
+ const value = args[i++];
1473
+ if (typeof value === "bigint") return `${value.toString()}n`;
1474
+ return Number.parseInt(String(value)).toString();
1475
+ }
1476
+ case "%f": return Number.parseFloat(String(args[i++])).toString();
1477
+ case "%o": return formatArg(args[i++], {
1478
+ showHidden: true,
1479
+ showProxy: true
1480
+ });
1481
+ case "%O": return formatArg(args[i++]);
1482
+ case "%c":
1483
+ i++;
1484
+ return "";
1485
+ case "%j": try {
1486
+ return JSON.stringify(args[i++]);
1487
+ } catch (err) {
1488
+ const m = err.message;
1489
+ if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) return "[Circular]";
1490
+ throw err;
1491
+ }
1492
+ default: return x;
1493
+ }
1494
+ });
1495
+ for (let x = args[i]; i < len; x = args[++i]) if (x === null || typeof x !== "object") str += ` ${typeof x === "symbol" ? x.toString() : x}`;
1496
+ else str += ` ${formatArg(x)}`;
1497
+ return str;
1498
+ }
1499
+ function format(...args) {
1500
+ return baseFormat(args);
1501
+ }
1502
+ function inspect(obj, options = {}) {
1503
+ if (options.truncate === 0) options.truncate = Number.POSITIVE_INFINITY;
1504
+ return inspect$1(obj, options);
1505
+ }
1506
+ function objDisplay(obj, options = {}) {
1507
+ if (typeof options.truncate === "undefined") options.truncate = 40;
1508
+ const str = inspect(obj, options);
1509
+ const type = Object.prototype.toString.call(obj);
1510
+ if (options.truncate && str.length >= options.truncate) {
1511
+ if (type === "[object Function]") {
1512
+ const fn = obj;
1513
+ return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
1514
+ } else if (type === "[object Array]") return `[ Array(${obj.length}) ]`;
1515
+ else if (type === "[object Object]") {
1516
+ const keys = Object.keys(obj);
1517
+ return `{ Object (${keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ")}) }`;
1518
+ } else return str;
1519
+ }
1520
+ return str;
1521
+ }
1522
+ //#endregion
1523
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/helpers.js
1524
+ /**
1525
+ * Get original stacktrace without source map support the most performant way.
1526
+ * - Create only 1 stack frame.
1527
+ * - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms).
1528
+ */
1529
+ function createSimpleStackTrace(options) {
1530
+ const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
1531
+ const limit = Error.stackTraceLimit;
1532
+ const prepareStackTrace = Error.prepareStackTrace;
1533
+ Error.stackTraceLimit = stackTraceLimit;
1534
+ Error.prepareStackTrace = (e) => e.stack;
1535
+ const stackTrace = new Error(message).stack || "";
1536
+ Error.prepareStackTrace = prepareStackTrace;
1537
+ Error.stackTraceLimit = limit;
1538
+ return stackTrace;
1539
+ }
1540
+ function notNullish(v) {
1541
+ return v != null;
1542
+ }
1543
+ function assertTypes(value, name, types) {
1544
+ const receivedType = typeof value;
1545
+ if (!types.includes(receivedType)) throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
1546
+ }
1547
+ function isPrimitive(value) {
1548
+ return value === null || typeof value !== "function" && typeof value !== "object";
1549
+ }
1550
+ function filterOutComments(s) {
1551
+ const result = [];
1552
+ let commentState = "none";
1553
+ for (let i = 0; i < s.length; ++i) if (commentState === "singleline") {
1554
+ if (s[i] === "\n") commentState = "none";
1555
+ } else if (commentState === "multiline") {
1556
+ if (s[i - 1] === "*" && s[i] === "/") commentState = "none";
1557
+ } else if (commentState === "none") {
1558
+ if (s[i] === "/" && s[i + 1] === "/") commentState = "singleline";
1559
+ else if (s[i] === "/" && s[i + 1] === "*") {
1560
+ commentState = "multiline";
1561
+ i += 2;
1562
+ } else result.push(s[i]);
1563
+ }
1564
+ return result.join("");
1565
+ }
1566
+ function toArray(array) {
1567
+ if (array === null || array === void 0) array = [];
1568
+ if (Array.isArray(array)) return array;
1569
+ return [array];
1570
+ }
1571
+ function isObject(item) {
1572
+ return item != null && typeof item === "object" && !Array.isArray(item);
1573
+ }
1574
+ function isFinalObj(obj) {
1575
+ return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
1576
+ }
1577
+ function getType(value) {
1578
+ return Object.prototype.toString.apply(value).slice(8, -1);
1579
+ }
1580
+ function collectOwnProperties(obj, collector) {
1581
+ const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
1582
+ Object.getOwnPropertyNames(obj).forEach(collect);
1583
+ Object.getOwnPropertySymbols(obj).forEach(collect);
1584
+ }
1585
+ function getOwnProperties(obj) {
1586
+ const ownProps = /* @__PURE__ */ new Set();
1587
+ if (isFinalObj(obj)) return [];
1588
+ collectOwnProperties(obj, ownProps);
1589
+ return Array.from(ownProps);
1590
+ }
1591
+ const defaultCloneOptions = { forceWritable: false };
1592
+ function deepClone(val, options = defaultCloneOptions) {
1593
+ return clone(val, /* @__PURE__ */ new WeakMap(), options);
1594
+ }
1595
+ function clone(val, seen, options = defaultCloneOptions) {
1596
+ let k, out;
1597
+ if (seen.has(val)) return seen.get(val);
1598
+ if (Array.isArray(val)) {
1599
+ out = Array.from({ length: k = val.length });
1600
+ seen.set(val, out);
1601
+ while (k--) out[k] = clone(val[k], seen, options);
1602
+ return out;
1603
+ }
1604
+ if (Object.prototype.toString.call(val) === "[object Object]") {
1605
+ out = Object.create(Object.getPrototypeOf(val));
1606
+ seen.set(val, out);
1607
+ const props = getOwnProperties(val);
1608
+ for (const k of props) {
1609
+ const descriptor = Object.getOwnPropertyDescriptor(val, k);
1610
+ if (!descriptor) continue;
1611
+ const cloned = clone(val[k], seen, options);
1612
+ if (options.forceWritable) Object.defineProperty(out, k, {
1613
+ enumerable: descriptor.enumerable,
1614
+ configurable: true,
1615
+ writable: true,
1616
+ value: cloned
1617
+ });
1618
+ else if ("get" in descriptor) Object.defineProperty(out, k, {
1619
+ ...descriptor,
1620
+ get() {
1621
+ return cloned;
1622
+ }
1623
+ });
1624
+ else Object.defineProperty(out, k, {
1625
+ ...descriptor,
1626
+ value: cloned
1627
+ });
1628
+ }
1629
+ return out;
1630
+ }
1631
+ return val;
1632
+ }
1633
+ function noop() {}
1634
+ function objectAttr(source, path, defaultValue = void 0) {
1635
+ const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
1636
+ let result = source;
1637
+ for (const p of paths) {
1638
+ result = new Object(result)[p];
1639
+ if (result === void 0) return defaultValue;
1640
+ }
1641
+ return result;
1642
+ }
1643
+ function createDefer() {
1644
+ let resolve = null;
1645
+ let reject = null;
1646
+ const p = new Promise((_resolve, _reject) => {
1647
+ resolve = _resolve;
1648
+ reject = _reject;
1649
+ });
1650
+ p.resolve = resolve;
1651
+ p.reject = reject;
1652
+ return p;
1653
+ }
1654
+ /**
1655
+ * If code starts with a function call, will return its last index, respecting arguments.
1656
+ * This will return 25 - last ending character of toMatch ")"
1657
+ * Also works with callbacks
1658
+ * ```
1659
+ * toMatch({ test: '123' });
1660
+ * toBeAliased('123')
1661
+ * ```
1662
+ */
1663
+ function getCallLastIndex(code) {
1664
+ let charIndex = -1;
1665
+ let inString = null;
1666
+ let startedBracers = 0;
1667
+ let endedBracers = 0;
1668
+ let beforeChar = null;
1669
+ while (charIndex <= code.length) {
1670
+ beforeChar = code[charIndex];
1671
+ charIndex++;
1672
+ const char = code[charIndex];
1673
+ if ((char === "\"" || char === "'" || char === "`") && beforeChar !== "\\") {
1674
+ if (inString === char) inString = null;
1675
+ else if (!inString) inString = char;
1676
+ }
1677
+ if (!inString) {
1678
+ if (char === "(") startedBracers++;
1679
+ if (char === ")") endedBracers++;
1680
+ }
1681
+ if (startedBracers && endedBracers && startedBracers === endedBracers) return charIndex;
1682
+ }
1683
+ return null;
1684
+ }
1685
+ function isNegativeNaN(val) {
1686
+ if (!Number.isNaN(val)) return false;
1687
+ const f64 = /* @__PURE__ */ new Float64Array(1);
1688
+ f64[0] = val;
1689
+ return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
1690
+ }
1691
+ function ordinal(i) {
1692
+ const j = i % 10;
1693
+ const k = i % 100;
1694
+ if (j === 1 && k !== 11) return `${i}st`;
1695
+ if (j === 2 && k !== 12) return `${i}nd`;
1696
+ if (j === 3 && k !== 13) return `${i}rd`;
1697
+ return `${i}th`;
1698
+ }
1699
+ function unique(array) {
1700
+ return Array.from(new Set(array));
1701
+ }
1702
+ //#endregion
1703
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/timers.js
1704
+ const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");
1705
+ function getSafeTimers() {
1706
+ const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
1707
+ const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || {};
1708
+ return {
1709
+ nextTick: safeNextTick,
1710
+ setTimeout: safeSetTimeout,
1711
+ setInterval: safeSetInterval,
1712
+ clearInterval: safeClearInterval,
1713
+ clearTimeout: safeClearTimeout,
1714
+ setImmediate: safeSetImmediate,
1715
+ clearImmediate: safeClearImmediate,
1716
+ queueMicrotask: safeQueueMicrotask
1717
+ };
1718
+ }
1719
+ /**
1720
+ * Returns a promise that resolves after the specified duration.
1721
+ *
1722
+ * @param timeout - Delay in milliseconds
1723
+ * @param scheduler - Timer function to use, defaults to `setTimeout`. Useful for mocked timers.
1724
+ *
1725
+ * @example
1726
+ * await delay(100)
1727
+ *
1728
+ * @example
1729
+ * // With mocked timers
1730
+ * const { setTimeout } = getSafeTimers()
1731
+ * await delay(100, setTimeout)
1732
+ */
1733
+ function delay(timeout, scheduler = setTimeout) {
1734
+ return new Promise((resolve) => scheduler(resolve, timeout));
1735
+ }
1736
+ //#endregion
1737
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
1738
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
1739
+ function normalizeWindowsPath(input = "") {
1740
+ if (!input) return input;
1741
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
1742
+ }
1743
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
1744
+ function cwd() {
1745
+ if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
1746
+ return "/";
1747
+ }
1748
+ const resolve = function(...arguments_) {
1749
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
1750
+ let resolvedPath = "";
1751
+ let resolvedAbsolute = false;
1752
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
1753
+ const path = index >= 0 ? arguments_[index] : cwd();
1754
+ if (!path || path.length === 0) continue;
1755
+ resolvedPath = `${path}/${resolvedPath}`;
1756
+ resolvedAbsolute = isAbsolute(path);
1757
+ }
1758
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
1759
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
1760
+ return resolvedPath.length > 0 ? resolvedPath : ".";
1761
+ };
1762
+ function normalizeString(path, allowAboveRoot) {
1763
+ let res = "";
1764
+ let lastSegmentLength = 0;
1765
+ let lastSlash = -1;
1766
+ let dots = 0;
1767
+ let char = null;
1768
+ for (let index = 0; index <= path.length; ++index) {
1769
+ if (index < path.length) char = path[index];
1770
+ else if (char === "/") break;
1771
+ else char = "/";
1772
+ if (char === "/") {
1773
+ if (lastSlash === index - 1 || dots === 1);
1774
+ else if (dots === 2) {
1775
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
1776
+ if (res.length > 2) {
1777
+ const lastSlashIndex = res.lastIndexOf("/");
1778
+ if (lastSlashIndex === -1) {
1779
+ res = "";
1780
+ lastSegmentLength = 0;
1781
+ } else {
1782
+ res = res.slice(0, lastSlashIndex);
1783
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
1784
+ }
1785
+ lastSlash = index;
1786
+ dots = 0;
1787
+ continue;
1788
+ } else if (res.length > 0) {
1789
+ res = "";
1790
+ lastSegmentLength = 0;
1791
+ lastSlash = index;
1792
+ dots = 0;
1793
+ continue;
1794
+ }
1795
+ }
1796
+ if (allowAboveRoot) {
1797
+ res += res.length > 0 ? "/.." : "..";
1798
+ lastSegmentLength = 2;
1799
+ }
1800
+ } else {
1801
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
1802
+ else res = path.slice(lastSlash + 1, index);
1803
+ lastSegmentLength = index - lastSlash - 1;
1804
+ }
1805
+ lastSlash = index;
1806
+ dots = 0;
1807
+ } else if (char === "." && dots !== -1) ++dots;
1808
+ else dots = -1;
1809
+ }
1810
+ return res;
1811
+ }
1812
+ const isAbsolute = function(p) {
1813
+ return _IS_ABSOLUTE_RE.test(p);
1814
+ };
1815
+ //#endregion
1816
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.11/node_modules/@vitest/utils/dist/source-map.js
1817
+ var comma = ",".charCodeAt(0);
1818
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1819
+ var intToChar = /* @__PURE__ */ new Uint8Array(64);
1820
+ var charToInt = /* @__PURE__ */ new Uint8Array(128);
1821
+ for (let i = 0; i < chars.length; i++) {
1822
+ const c = chars.charCodeAt(i);
1823
+ intToChar[i] = c;
1824
+ charToInt[c] = i;
1825
+ }
1826
+ function decodeInteger(reader, relative) {
1827
+ let value = 0;
1828
+ let shift = 0;
1829
+ let integer = 0;
1830
+ do {
1831
+ integer = charToInt[reader.next()];
1832
+ value |= (integer & 31) << shift;
1833
+ shift += 5;
1834
+ } while (integer & 32);
1835
+ const shouldNegate = value & 1;
1836
+ value >>>= 1;
1837
+ if (shouldNegate) value = -2147483648 | -value;
1838
+ return relative + value;
1839
+ }
1840
+ function hasMoreVlq(reader, max) {
1841
+ if (reader.pos >= max) return false;
1842
+ return reader.peek() !== comma;
1843
+ }
1844
+ var StringReader = class {
1845
+ constructor(buffer) {
1846
+ this.pos = 0;
1847
+ this.buffer = buffer;
1848
+ }
1849
+ next() {
1850
+ return this.buffer.charCodeAt(this.pos++);
1851
+ }
1852
+ peek() {
1853
+ return this.buffer.charCodeAt(this.pos);
1854
+ }
1855
+ indexOf(char) {
1856
+ const { buffer, pos } = this;
1857
+ const idx = buffer.indexOf(char, pos);
1858
+ return idx === -1 ? buffer.length : idx;
1859
+ }
1860
+ };
1861
+ function decode(mappings) {
1862
+ const { length } = mappings;
1863
+ const reader = new StringReader(mappings);
1864
+ const decoded = [];
1865
+ let genColumn = 0;
1866
+ let sourcesIndex = 0;
1867
+ let sourceLine = 0;
1868
+ let sourceColumn = 0;
1869
+ let namesIndex = 0;
1870
+ do {
1871
+ const semi = reader.indexOf(";");
1872
+ const line = [];
1873
+ let sorted = true;
1874
+ let lastCol = 0;
1875
+ genColumn = 0;
1876
+ while (reader.pos < semi) {
1877
+ let seg;
1878
+ genColumn = decodeInteger(reader, genColumn);
1879
+ if (genColumn < lastCol) sorted = false;
1880
+ lastCol = genColumn;
1881
+ if (hasMoreVlq(reader, semi)) {
1882
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
1883
+ sourceLine = decodeInteger(reader, sourceLine);
1884
+ sourceColumn = decodeInteger(reader, sourceColumn);
1885
+ if (hasMoreVlq(reader, semi)) {
1886
+ namesIndex = decodeInteger(reader, namesIndex);
1887
+ seg = [
1888
+ genColumn,
1889
+ sourcesIndex,
1890
+ sourceLine,
1891
+ sourceColumn,
1892
+ namesIndex
1893
+ ];
1894
+ } else seg = [
1895
+ genColumn,
1896
+ sourcesIndex,
1897
+ sourceLine,
1898
+ sourceColumn
1899
+ ];
1900
+ } else seg = [genColumn];
1901
+ line.push(seg);
1902
+ reader.pos++;
1903
+ }
1904
+ if (!sorted) sort(line);
1905
+ decoded.push(line);
1906
+ reader.pos = semi + 1;
1907
+ } while (reader.pos <= length);
1908
+ return decoded;
1909
+ }
1910
+ function sort(line) {
1911
+ line.sort(sortComparator);
1912
+ }
1913
+ function sortComparator(a, b) {
1914
+ return a[0] - b[0];
1915
+ }
1916
+ var COLUMN = 0;
1917
+ var SOURCES_INDEX = 1;
1918
+ var SOURCE_LINE = 2;
1919
+ var SOURCE_COLUMN = 3;
1920
+ var NAMES_INDEX = 4;
1921
+ var found = false;
1922
+ function binarySearch(haystack, needle, low, high) {
1923
+ while (low <= high) {
1924
+ const mid = low + (high - low >> 1);
1925
+ const cmp = haystack[mid][COLUMN] - needle;
1926
+ if (cmp === 0) {
1927
+ found = true;
1928
+ return mid;
1929
+ }
1930
+ if (cmp < 0) low = mid + 1;
1931
+ else high = mid - 1;
1932
+ }
1933
+ found = false;
1934
+ return low - 1;
1935
+ }
1936
+ function upperBound(haystack, needle, index) {
1937
+ for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN] !== needle) break;
1938
+ return index;
1939
+ }
1940
+ function lowerBound(haystack, needle, index) {
1941
+ for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN] !== needle) break;
1942
+ return index;
1943
+ }
1944
+ function memoizedBinarySearch(haystack, needle, state, key) {
1945
+ const { lastKey, lastNeedle, lastIndex } = state;
1946
+ let low = 0;
1947
+ let high = haystack.length - 1;
1948
+ if (key === lastKey) {
1949
+ if (needle === lastNeedle) {
1950
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
1951
+ return lastIndex;
1952
+ }
1953
+ if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
1954
+ else high = lastIndex;
1955
+ }
1956
+ state.lastKey = key;
1957
+ state.lastNeedle = needle;
1958
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
1959
+ }
1960
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
1961
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
1962
+ var LEAST_UPPER_BOUND = -1;
1963
+ var GREATEST_LOWER_BOUND = 1;
1964
+ function cast(map) {
1965
+ return map;
1966
+ }
1967
+ function decodedMappings(map) {
1968
+ var _a;
1969
+ return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
1970
+ }
1971
+ function originalPositionFor(map, needle) {
1972
+ let { line, column, bias } = needle;
1973
+ line--;
1974
+ if (line < 0) throw new Error(LINE_GTR_ZERO);
1975
+ if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
1976
+ const decoded = decodedMappings(map);
1977
+ if (line >= decoded.length) return OMapping(null, null, null, null);
1978
+ const segments = decoded[line];
1979
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
1980
+ if (index === -1) return OMapping(null, null, null, null);
1981
+ const segment = segments[index];
1982
+ if (segment.length === 1) return OMapping(null, null, null, null);
1983
+ const { names, resolvedSources } = map;
1984
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
1985
+ }
1986
+ function OMapping(source, line, column, name) {
1987
+ return {
1988
+ source,
1989
+ line,
1990
+ column,
1991
+ name
1992
+ };
1993
+ }
1994
+ function traceSegmentInternal(segments, memo, line, column, bias) {
1995
+ let index = memoizedBinarySearch(segments, column, memo, line);
1996
+ if (found) index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
1997
+ else if (bias === LEAST_UPPER_BOUND) index++;
1998
+ if (index === -1 || index === segments.length) return -1;
1999
+ return index;
2000
+ }
2001
+ const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
2002
+ const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
2003
+ const stackIgnorePatterns = [
2004
+ "node:internal",
2005
+ /\/packages\/\w+\/dist\//,
2006
+ /\/@vitest\/\w+\/dist\//,
2007
+ "/vitest/dist/",
2008
+ "/vitest/src/",
2009
+ "/node_modules/chai/",
2010
+ "/node_modules/tinyspy/",
2011
+ "/vite/dist/node/module-runner",
2012
+ "/rolldown-vite/dist/node/module-runner",
2013
+ "/deps/chunk-",
2014
+ "/deps/@vitest",
2015
+ "/deps/loupe",
2016
+ "/deps/chai",
2017
+ "/browser-playwright/dist/locators.js",
2018
+ "/browser-webdriverio/dist/locators.js",
2019
+ "/browser-preview/dist/locators.js",
2020
+ /node:\w+/,
2021
+ /__vitest_test__/,
2022
+ /__vitest_browser__/,
2023
+ "/@id/__x00__vitest/browser",
2024
+ /\/deps\/vitest_/
2025
+ ];
2026
+ const NOW_LENGTH = Date.now().toString().length;
2027
+ const REGEXP_VITEST = new RegExp(`vitest=\\d{${NOW_LENGTH}}`);
2028
+ function extractLocation(urlLike) {
2029
+ if (!urlLike.includes(":")) return [urlLike];
2030
+ const parts = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(urlLike.replace(/^\(|\)$/g, ""));
2031
+ if (!parts) return [urlLike];
2032
+ let url = parts[1];
2033
+ if (url.startsWith("async ")) url = url.slice(6);
2034
+ if (url.startsWith("http:") || url.startsWith("https:")) {
2035
+ const urlObj = new URL(url);
2036
+ urlObj.searchParams.delete("import");
2037
+ urlObj.searchParams.delete("browserv");
2038
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
2039
+ }
2040
+ if (url.startsWith("/@fs/")) {
2041
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
2042
+ url = url.slice(isWindows ? 5 : 4);
2043
+ }
2044
+ if (url.includes("vitest=")) url = url.replace(REGEXP_VITEST, "").replace(/[?&]$/, "");
2045
+ return [
2046
+ url,
2047
+ parts[2] || void 0,
2048
+ parts[3] || void 0
2049
+ ];
2050
+ }
2051
+ function parseSingleFFOrSafariStack(raw) {
2052
+ let line = raw.trim();
2053
+ if (SAFARI_NATIVE_CODE_REGEXP.test(line)) return null;
2054
+ if (line.includes(" > eval")) line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
2055
+ if (!line.includes("@")) return null;
2056
+ let atIndex = -1;
2057
+ let locationPart = "";
2058
+ let functionName;
2059
+ for (let i = 0; i < line.length; i++) if (line[i] === "@") {
2060
+ const candidateLocation = line.slice(i + 1);
2061
+ if (candidateLocation.includes(":") && candidateLocation.length >= 3) {
2062
+ atIndex = i;
2063
+ locationPart = candidateLocation;
2064
+ functionName = i > 0 ? line.slice(0, i) : void 0;
2065
+ break;
2066
+ }
2067
+ }
2068
+ if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) return null;
2069
+ const [url, lineNumber, columnNumber] = extractLocation(locationPart);
2070
+ if (!url || !lineNumber || !columnNumber) return null;
2071
+ return {
2072
+ file: url,
2073
+ method: functionName || "",
2074
+ line: Number.parseInt(lineNumber),
2075
+ column: Number.parseInt(columnNumber)
2076
+ };
2077
+ }
2078
+ function parseSingleStack(raw) {
2079
+ const line = raw.trim();
2080
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return parseSingleFFOrSafariStack(line);
2081
+ return parseSingleV8Stack(line);
2082
+ }
2083
+ function parseSingleV8Stack(raw) {
2084
+ let line = raw.trim();
2085
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return null;
2086
+ if (line.includes("(eval ")) line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
2087
+ let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
2088
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
2089
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
2090
+ const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
2091
+ let method = location && sanitizedLine || "";
2092
+ let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
2093
+ if (!file || !lineNumber || !columnNumber) return null;
2094
+ if (method.startsWith("async ")) method = method.slice(6);
2095
+ if (file.startsWith("file://")) file = file.slice(7);
2096
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
2097
+ if (method) method = method.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
2098
+ return {
2099
+ method,
2100
+ file,
2101
+ line: Number.parseInt(lineNumber),
2102
+ column: Number.parseInt(columnNumber)
2103
+ };
2104
+ }
2105
+ function parseStacktrace(stack, options = {}) {
2106
+ const { ignoreStackEntries = stackIgnorePatterns } = options;
2107
+ let stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
2108
+ const helperIndex = stacks.findLastIndex((s) => s.method.includes("__VITEST_HELPER__"));
2109
+ if (helperIndex >= 0) stacks = stacks.slice(helperIndex + 1);
2110
+ return stacks.map((stack) => {
2111
+ if (options.getUrlId) stack.file = options.getUrlId(stack.file);
2112
+ const map = options.getSourceMap?.(stack.file);
2113
+ if (!map || typeof map !== "object" || !map.version) return shouldFilter(ignoreStackEntries, stack.file) ? null : stack;
2114
+ const position = getOriginalPosition(new DecodedMap(map, stack.file), stack);
2115
+ if (!position) return stack;
2116
+ const { line, column, source, name } = position;
2117
+ let file = source || stack.file;
2118
+ if (file.match(/\/\w:\//)) file = file.slice(1);
2119
+ if (shouldFilter(ignoreStackEntries, file)) return null;
2120
+ if (line != null && column != null) return {
2121
+ line,
2122
+ column,
2123
+ file,
2124
+ method: name || stack.method
2125
+ };
2126
+ return stack;
2127
+ }).filter((s) => s != null);
2128
+ }
2129
+ function shouldFilter(ignoreStackEntries, file) {
2130
+ return ignoreStackEntries.some((p) => file.match(p));
2131
+ }
2132
+ function parseFFOrSafariStackTrace(stack) {
2133
+ return stack.split("\n").map((line) => parseSingleFFOrSafariStack(line)).filter(notNullish);
2134
+ }
2135
+ function parseV8Stacktrace(stack) {
2136
+ return stack.split("\n").map((line) => parseSingleV8Stack(line)).filter(notNullish);
2137
+ }
2138
+ function parseErrorStacktrace(e, options = {}) {
2139
+ if (!e || isPrimitive(e)) return [];
2140
+ if ("stacks" in e && e.stacks) return e.stacks;
2141
+ const stackStr = e.stack || "";
2142
+ let stackFrames = typeof stackStr === "string" ? parseStacktrace(stackStr, options) : [];
2143
+ if (!stackFrames.length) {
2144
+ const e_ = e;
2145
+ if (e_.fileName != null && e_.lineNumber != null && e_.columnNumber != null) stackFrames = parseStacktrace(`${e_.fileName}:${e_.lineNumber}:${e_.columnNumber}`, options);
2146
+ if (e_.sourceURL != null && e_.line != null && e_._column != null) stackFrames = parseStacktrace(`${e_.sourceURL}:${e_.line}:${e_.column}`, options);
2147
+ }
2148
+ if (options.frameFilter) stackFrames = stackFrames.filter((f) => options.frameFilter(e, f) !== false);
2149
+ e.stacks = stackFrames;
2150
+ return stackFrames;
2151
+ }
2152
+ var DecodedMap = class {
2153
+ _encoded;
2154
+ _decoded;
2155
+ _decodedMemo;
2156
+ url;
2157
+ version;
2158
+ names = [];
2159
+ resolvedSources;
2160
+ constructor(map, from) {
2161
+ this.map = map;
2162
+ const { mappings, names, sources } = map;
2163
+ this.version = map.version;
2164
+ this.names = names || [];
2165
+ this._encoded = mappings || "";
2166
+ this._decodedMemo = memoizedState();
2167
+ this.url = from;
2168
+ this.resolvedSources = (sources || []).map((s) => resolve(from, "..", s || ""));
2169
+ }
2170
+ };
2171
+ function memoizedState() {
2172
+ return {
2173
+ lastKey: -1,
2174
+ lastNeedle: -1,
2175
+ lastIndex: -1
2176
+ };
2177
+ }
2178
+ function getOriginalPosition(map, needle) {
2179
+ const result = originalPositionFor(map, needle);
2180
+ if (result.column == null) return null;
2181
+ return result;
2182
+ }
2183
+ //#endregion
2184
+ //#region ../../node_modules/.pnpm/@vitest+runner@4.1.11/node_modules/@vitest/runner/dist/chunk-artifact.js
2185
+ var PendingError = class extends Error {
2186
+ code = "VITEST_PENDING";
2187
+ taskId;
2188
+ constructor(message, task, note) {
2189
+ super(message);
2190
+ this.message = message;
2191
+ this.note = note;
2192
+ this.taskId = task.id;
2193
+ }
2194
+ };
2195
+ var FixtureDependencyError = class extends Error {
2196
+ name = "FixtureDependencyError";
2197
+ };
2198
+ var FixtureAccessError = class extends Error {
2199
+ name = "FixtureAccessError";
2200
+ };
2201
+ var FixtureParseError = class extends Error {
2202
+ name = "FixtureParseError";
2203
+ };
2204
+ const fnMap = /* @__PURE__ */ new WeakMap();
2205
+ const testFixtureMap = /* @__PURE__ */ new WeakMap();
2206
+ const hooksMap = /* @__PURE__ */ new WeakMap();
2207
+ function setFn(key, fn) {
2208
+ fnMap.set(key, fn);
2209
+ }
2210
+ function getFn(key) {
2211
+ return fnMap.get(key);
2212
+ }
2213
+ function setTestFixture(key, fixture) {
2214
+ testFixtureMap.set(key, fixture);
2215
+ }
2216
+ function getTestFixtures(key) {
2217
+ return testFixtureMap.get(key);
2218
+ }
2219
+ function setHooks(key, hooks) {
2220
+ hooksMap.set(key, hooks);
2221
+ }
2222
+ function getHooks(key) {
2223
+ return hooksMap.get(key);
2224
+ }
2225
+ const FIXTURE_STACK_TRACE_KEY = Symbol.for("VITEST_FIXTURE_STACK_TRACE");
2226
+ var TestFixtures = class TestFixtures {
2227
+ _suiteContexts;
2228
+ _overrides = /* @__PURE__ */ new WeakMap();
2229
+ _registrations;
2230
+ static _definitions = [];
2231
+ static _builtinFixtures = [
2232
+ "task",
2233
+ "signal",
2234
+ "onTestFailed",
2235
+ "onTestFinished",
2236
+ "skip",
2237
+ "annotate"
2238
+ ];
2239
+ static _fixtureOptionKeys = [
2240
+ "auto",
2241
+ "injected",
2242
+ "scope"
2243
+ ];
2244
+ static _fixtureScopes = [
2245
+ "test",
2246
+ "file",
2247
+ "worker"
2248
+ ];
2249
+ static _workerContextSuite = { type: "worker" };
2250
+ static clearDefinitions() {
2251
+ TestFixtures._definitions.length = 0;
2252
+ }
2253
+ static getWorkerContexts() {
2254
+ return TestFixtures._definitions.map((f) => f.getWorkerContext());
2255
+ }
2256
+ static getFileContexts(file) {
2257
+ return TestFixtures._definitions.map((f) => f.getFileContext(file));
2258
+ }
2259
+ static isFixtureOptions(obj) {
2260
+ return isObject(obj) && Object.keys(obj).some((key) => TestFixtures._fixtureOptionKeys.includes(key));
2261
+ }
2262
+ constructor(registrations) {
2263
+ this._registrations = registrations ?? /* @__PURE__ */ new Map();
2264
+ this._suiteContexts = /* @__PURE__ */ new WeakMap();
2265
+ TestFixtures._definitions.push(this);
2266
+ }
2267
+ extend(runner, userFixtures) {
2268
+ const { suite } = getCurrentSuite();
2269
+ const isTopLevel = !suite || suite.file === suite;
2270
+ const registrations = this.parseUserFixtures(runner, userFixtures, isTopLevel);
2271
+ return new TestFixtures(registrations);
2272
+ }
2273
+ get(suite) {
2274
+ let currentSuite = suite;
2275
+ while (currentSuite) {
2276
+ const overrides = this._overrides.get(currentSuite);
2277
+ if (overrides) return overrides;
2278
+ if (currentSuite === currentSuite.file) break;
2279
+ currentSuite = currentSuite.suite || currentSuite.file;
2280
+ }
2281
+ return this._registrations;
2282
+ }
2283
+ override(runner, userFixtures) {
2284
+ const { suite: currentSuite, file } = getCurrentSuite();
2285
+ const suite = currentSuite || file;
2286
+ const isTopLevel = !currentSuite || currentSuite.file === currentSuite;
2287
+ const suiteRegistrations = new Map(this.get(suite));
2288
+ const registrations = this.parseUserFixtures(runner, userFixtures, isTopLevel, suiteRegistrations);
2289
+ if (isTopLevel) this._registrations = registrations;
2290
+ else this._overrides.set(suite, registrations);
2291
+ }
2292
+ getFileContext(file) {
2293
+ if (!this._suiteContexts.has(file)) this._suiteContexts.set(file, Object.create(null));
2294
+ return this._suiteContexts.get(file);
2295
+ }
2296
+ getWorkerContext() {
2297
+ if (!this._suiteContexts.has(TestFixtures._workerContextSuite)) this._suiteContexts.set(TestFixtures._workerContextSuite, Object.create(null));
2298
+ return this._suiteContexts.get(TestFixtures._workerContextSuite);
2299
+ }
2300
+ parseUserFixtures(runner, userFixtures, supportNonTest, registrations = new Map(this._registrations)) {
2301
+ const errors = [];
2302
+ Object.entries(userFixtures).forEach(([name, fn]) => {
2303
+ let options;
2304
+ let value;
2305
+ let _options;
2306
+ if (Array.isArray(fn) && fn.length >= 2 && TestFixtures.isFixtureOptions(fn[1])) {
2307
+ _options = fn[1];
2308
+ options = {
2309
+ auto: _options.auto ?? false,
2310
+ scope: _options.scope ?? "test",
2311
+ injected: _options.injected ?? false
2312
+ };
2313
+ value = options.injected ? runner.injectValue?.(name) ?? fn[0] : fn[0];
2314
+ } else value = fn;
2315
+ const parent = registrations.get(name);
2316
+ if (parent && options) {
2317
+ if (parent.scope !== options.scope) errors.push(new FixtureDependencyError(`The "${name}" fixture was already registered with a "${options.scope}" scope.`));
2318
+ if (parent.auto !== options.auto) errors.push(new FixtureDependencyError(`The "${name}" fixture was already registered as { auto: ${options.auto} }.`));
2319
+ } else if (parent) options = {
2320
+ auto: parent.auto,
2321
+ scope: parent.scope,
2322
+ injected: parent.injected
2323
+ };
2324
+ else if (!options) options = {
2325
+ auto: false,
2326
+ injected: false,
2327
+ scope: "test"
2328
+ };
2329
+ if (options.scope && !TestFixtures._fixtureScopes.includes(options.scope)) errors.push(new FixtureDependencyError(`The "${name}" fixture has unknown scope "${options.scope}".`));
2330
+ if (!supportNonTest && options.scope !== "test") errors.push(new FixtureDependencyError(`The "${name}" fixture cannot be defined with a ${options.scope} scope${!_options?.scope && parent?.scope ? " (inherited from the base fixture)" : ""} inside the describe block. Define it at the top level of the file instead.`));
2331
+ const deps = isFixtureFunction(value) ? getUsedProps(value) : /* @__PURE__ */ new Set();
2332
+ const item = {
2333
+ name,
2334
+ value,
2335
+ auto: options.auto ?? false,
2336
+ injected: options.injected ?? false,
2337
+ scope: options.scope ?? "test",
2338
+ deps,
2339
+ parent
2340
+ };
2341
+ if (isFixtureFunction(value)) Object.assign(value, { [FIXTURE_STACK_TRACE_KEY]: /* @__PURE__ */ new Error("STACK_TRACE_ERROR") });
2342
+ registrations.set(name, item);
2343
+ if (item.scope === "worker" && (runner.pool === "vmThreads" || runner.pool === "vmForks")) item.scope = "file";
2344
+ });
2345
+ for (const fixture of registrations.values()) for (const depName of fixture.deps) {
2346
+ if (TestFixtures._builtinFixtures.includes(depName)) continue;
2347
+ const dep = registrations.get(depName);
2348
+ if (!dep) {
2349
+ errors.push(new FixtureDependencyError(`The "${fixture.name}" fixture depends on unknown fixture "${depName}".`));
2350
+ continue;
2351
+ }
2352
+ if (depName === fixture.name && !fixture.parent) {
2353
+ errors.push(new FixtureDependencyError(`The "${fixture.name}" fixture depends on itself, but does not have a base implementation.`));
2354
+ continue;
2355
+ }
2356
+ if (TestFixtures._fixtureScopes.indexOf(fixture.scope) > TestFixtures._fixtureScopes.indexOf(dep.scope)) {
2357
+ errors.push(new FixtureDependencyError(`The ${fixture.scope} "${fixture.name}" fixture cannot depend on a ${dep.scope} fixture "${dep.name}".`));
2358
+ continue;
2359
+ }
2360
+ }
2361
+ if (errors.length === 1) throw errors[0];
2362
+ else if (errors.length > 1) throw new AggregateError(errors, "Cannot resolve user fixtures. See errors for more information.");
2363
+ return registrations;
2364
+ }
2365
+ };
2366
+ const cleanupFnArrayMap = /* @__PURE__ */ new WeakMap();
2367
+ const contextHasFixturesCache = /* @__PURE__ */ new WeakMap();
2368
+ function withFixtures(fn, options) {
2369
+ const collector = getCurrentSuite();
2370
+ const suite = options?.suite || collector.suite || collector.file;
2371
+ return async (hookContext) => {
2372
+ const context = hookContext || options?.context;
2373
+ if (!context) {
2374
+ if (options?.suiteHook) validateSuiteHook(fn, options.suiteHook, options.stackTraceError);
2375
+ return fn({});
2376
+ }
2377
+ const fixtures = options?.fixtures || getTestFixtures(context);
2378
+ if (!fixtures) return fn(context);
2379
+ const registrations = fixtures.get(suite);
2380
+ if (!registrations.size) return fn(context);
2381
+ const usedFixtures = [];
2382
+ const usedProps = getUsedProps(fn);
2383
+ for (const fixture of registrations.values()) if (isAutoFixture(fixture, options) || usedProps.has(fixture.name)) usedFixtures.push(fixture);
2384
+ if (!usedFixtures.length) return fn(context);
2385
+ if (!cleanupFnArrayMap.has(context)) cleanupFnArrayMap.set(context, []);
2386
+ const cleanupFnArray = cleanupFnArrayMap.get(context);
2387
+ const pendingFixtures = resolveDeps(usedFixtures, registrations);
2388
+ if (!pendingFixtures.length) return fn(context);
2389
+ if (options?.suiteHook) {
2390
+ const testScopedFixtures = pendingFixtures.filter((f) => f.scope === "test");
2391
+ if (testScopedFixtures.length > 0) {
2392
+ const fixtureNames = testScopedFixtures.map((f) => `"${f.name}"`).join(", ");
2393
+ const error = new FixtureDependencyError(`Test-scoped fixtures cannot be used inside ${options.suiteHook} hook. The following fixtures are test-scoped: ${fixtureNames}. Use { scope: 'file' } or { scope: 'worker' } fixtures instead, or move the logic to ${{
2394
+ aroundAll: "aroundEach",
2395
+ beforeAll: "beforeEach",
2396
+ afterAll: "afterEach"
2397
+ }[options.suiteHook]} hook.`);
2398
+ if (options.stackTraceError?.stack) error.stack = error.message + options.stackTraceError.stack.replace(options.stackTraceError.message, "");
2399
+ throw error;
2400
+ }
2401
+ }
2402
+ if (!contextHasFixturesCache.has(context)) contextHasFixturesCache.set(context, /* @__PURE__ */ new WeakSet());
2403
+ const cachedFixtures = contextHasFixturesCache.get(context);
2404
+ for (const fixture of pendingFixtures) if (fixture.scope === "test") {
2405
+ if (cachedFixtures.has(fixture)) continue;
2406
+ cachedFixtures.add(fixture);
2407
+ const resolvedValue = await resolveTestFixtureValue(fixture, context, cleanupFnArray);
2408
+ context[fixture.name] = resolvedValue;
2409
+ cleanupFnArray.push(() => {
2410
+ cachedFixtures.delete(fixture);
2411
+ });
2412
+ } else {
2413
+ const resolvedValue = await resolveScopeFixtureValue(fixtures, suite, fixture);
2414
+ context[fixture.name] = resolvedValue;
2415
+ }
2416
+ return fn(context);
2417
+ };
2418
+ }
2419
+ function isAutoFixture(fixture, options) {
2420
+ if (!fixture.auto) return false;
2421
+ if (options?.suiteHook && fixture.scope === "test") return false;
2422
+ return true;
2423
+ }
2424
+ function isFixtureFunction(value) {
2425
+ return typeof value === "function";
2426
+ }
2427
+ function resolveTestFixtureValue(fixture, context, cleanupFnArray) {
2428
+ if (!isFixtureFunction(fixture.value)) return fixture.value;
2429
+ return resolveFixtureFunction(fixture.value, fixture.name, context, cleanupFnArray);
2430
+ }
2431
+ const scopedFixturePromiseCache = /* @__PURE__ */ new WeakMap();
2432
+ async function resolveScopeFixtureValue(fixtures, suite, fixture) {
2433
+ const workerContext = fixtures.getWorkerContext();
2434
+ const fileContext = fixtures.getFileContext(suite.file);
2435
+ const fixtureContext = fixture.scope === "worker" ? workerContext : fileContext;
2436
+ if (!isFixtureFunction(fixture.value)) {
2437
+ fixtureContext[fixture.name] = fixture.value;
2438
+ return fixture.value;
2439
+ }
2440
+ if (fixture.name in fixtureContext) return fixtureContext[fixture.name];
2441
+ if (scopedFixturePromiseCache.has(fixture)) return scopedFixturePromiseCache.get(fixture);
2442
+ if (!cleanupFnArrayMap.has(fixtureContext)) cleanupFnArrayMap.set(fixtureContext, []);
2443
+ const cleanupFnFileArray = cleanupFnArrayMap.get(fixtureContext);
2444
+ const promise = resolveFixtureFunction(fixture.value, fixture.name, fixture.scope === "file" ? {
2445
+ ...workerContext,
2446
+ ...fileContext
2447
+ } : fixtureContext, cleanupFnFileArray).then((value) => {
2448
+ fixtureContext[fixture.name] = value;
2449
+ scopedFixturePromiseCache.delete(fixture);
2450
+ return value;
2451
+ });
2452
+ scopedFixturePromiseCache.set(fixture, promise);
2453
+ return promise;
2454
+ }
2455
+ async function resolveFixtureFunction(fixtureFn, fixtureName, context, cleanupFnArray) {
2456
+ const useFnArgPromise = createDefer();
2457
+ const stackTraceError = FIXTURE_STACK_TRACE_KEY in fixtureFn && fixtureFn[FIXTURE_STACK_TRACE_KEY] instanceof Error ? fixtureFn[FIXTURE_STACK_TRACE_KEY] : void 0;
2458
+ let isUseFnArgResolved = false;
2459
+ const fixtureReturn = fixtureFn(context, async (useFnArg) => {
2460
+ isUseFnArgResolved = true;
2461
+ useFnArgPromise.resolve(useFnArg);
2462
+ const useReturnPromise = createDefer();
2463
+ cleanupFnArray.push(async () => {
2464
+ useReturnPromise.resolve();
2465
+ await fixtureReturn;
2466
+ });
2467
+ await useReturnPromise;
2468
+ }).then(() => {
2469
+ if (!isUseFnArgResolved) {
2470
+ const error = /* @__PURE__ */ new Error(`Fixture "${fixtureName}" returned without calling "use". Make sure to call "use" in every code path of the fixture function.`);
2471
+ if (stackTraceError?.stack) error.stack = error.message + stackTraceError.stack.replace(stackTraceError.message, "");
2472
+ useFnArgPromise.reject(error);
2473
+ }
2474
+ }).catch((e) => {
2475
+ if (!isUseFnArgResolved) {
2476
+ useFnArgPromise.reject(e);
2477
+ return;
2478
+ }
2479
+ throw e;
2480
+ });
2481
+ return useFnArgPromise;
2482
+ }
2483
+ function resolveDeps(usedFixtures, registrations, depSet = /* @__PURE__ */ new Set(), pendingFixtures = []) {
2484
+ usedFixtures.forEach((fixture) => {
2485
+ if (pendingFixtures.includes(fixture)) return;
2486
+ if (!isFixtureFunction(fixture.value) || !fixture.deps) {
2487
+ pendingFixtures.push(fixture);
2488
+ return;
2489
+ }
2490
+ if (depSet.has(fixture)) {
2491
+ if (fixture.parent) fixture = fixture.parent;
2492
+ else throw new Error(`Circular fixture dependency detected: ${fixture.name} <- ${[...depSet].reverse().map((d) => d.name).join(" <- ")}`);
2493
+ }
2494
+ depSet.add(fixture);
2495
+ resolveDeps([...fixture.deps].map((n) => n === fixture.name ? fixture.parent : registrations.get(n)).filter((n) => !!n), registrations, depSet, pendingFixtures);
2496
+ pendingFixtures.push(fixture);
2497
+ depSet.clear();
2498
+ });
2499
+ return pendingFixtures;
2500
+ }
2501
+ function validateSuiteHook(fn, hook, suiteError) {
2502
+ const usedProps = getUsedProps(fn, {
2503
+ sourceError: suiteError,
2504
+ suiteHook: hook
2505
+ });
2506
+ if (usedProps.size) {
2507
+ const error = new FixtureAccessError(`The ${hook} hook uses fixtures "${[...usedProps].join("\", \"")}", but has no access to context. Did you forget to call it as "test.${hook}()" instead of "${hook}()"?\nIf you used internal "suite" task as the first argument previously, access it in the second argument instead. See https://vitest.dev/guide/test-context#suite-level-hooks`);
2508
+ if (suiteError) error.stack = suiteError.stack?.replace(suiteError.message, error.message);
2509
+ throw error;
2510
+ }
2511
+ }
2512
+ const kPropsSymbol = Symbol("$vitest:fixture-props");
2513
+ const kPropNamesSymbol = Symbol("$vitest:fixture-prop-names");
2514
+ function configureProps(fn, options) {
2515
+ Object.defineProperty(fn, kPropsSymbol, {
2516
+ value: options,
2517
+ enumerable: false
2518
+ });
2519
+ }
2520
+ function memoProps(fn, props) {
2521
+ fn[kPropNamesSymbol] = props;
2522
+ return props;
2523
+ }
2524
+ function getUsedProps(fn, { sourceError, suiteHook } = {}) {
2525
+ if (kPropNamesSymbol in fn) return fn[kPropNamesSymbol];
2526
+ const { index: fixturesIndex = 0, original: implementation = fn } = kPropsSymbol in fn ? fn[kPropsSymbol] : {};
2527
+ let fnString = filterOutComments(implementation.toString());
2528
+ if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) fnString = fnString.split(/__async\((?:this|null),/)[1];
2529
+ const match = fnString.match(/[^(]*\(([^)]*)/);
2530
+ if (!match) return memoProps(fn, /* @__PURE__ */ new Set());
2531
+ const args = splitByComma(match[1]);
2532
+ if (!args.length) return memoProps(fn, /* @__PURE__ */ new Set());
2533
+ const fixturesArgument = args[fixturesIndex];
2534
+ if (!fixturesArgument) return memoProps(fn, /* @__PURE__ */ new Set());
2535
+ if (!(fixturesArgument[0] === "{" && fixturesArgument.endsWith("}"))) {
2536
+ const ordinalArgument = ordinal(fixturesIndex + 1);
2537
+ const error = new FixtureParseError(`The ${ordinalArgument} argument inside a fixture must use object destructuring pattern, e.g. ({ task } => {}). Instead, received "${fixturesArgument}".${suiteHook ? ` If you used internal "suite" task as the ${ordinalArgument} argument previously, access it in the ${ordinal(fixturesIndex + 2)} argument instead.` : ""}`);
2538
+ if (sourceError) error.stack = sourceError.stack?.replace(sourceError.message, error.message);
2539
+ throw error;
2540
+ }
2541
+ const props = splitByComma(fixturesArgument.slice(1, -1).replace(/\s/g, "")).map((prop) => {
2542
+ return prop.replace(/:.*|=.*/g, "");
2543
+ });
2544
+ const last = props.at(-1);
2545
+ if (last && last.startsWith("...")) {
2546
+ const error = new FixtureParseError(`Rest parameters are not supported in fixtures, received "${last}".`);
2547
+ if (sourceError) error.stack = sourceError.stack?.replace(sourceError.message, error.message);
2548
+ throw error;
2549
+ }
2550
+ return memoProps(fn, new Set(props));
2551
+ }
2552
+ function splitByComma(s) {
2553
+ const result = [];
2554
+ const stack = [];
2555
+ let start = 0;
2556
+ for (let i = 0; i < s.length; i++) if (s[i] === "{" || s[i] === "[") stack.push(s[i] === "{" ? "}" : "]");
2557
+ else if (s[i] === stack.at(-1)) stack.pop();
2558
+ else if (!stack.length && s[i] === ",") {
2559
+ const token = s.substring(start, i).trim();
2560
+ if (token) result.push(token);
2561
+ start = i + 1;
2562
+ }
2563
+ const lastToken = s.substring(start).trim();
2564
+ if (lastToken) result.push(lastToken);
2565
+ return result;
2566
+ }
2567
+ function getCurrentTest() {}
2568
+ const kChainableContext = Symbol("kChainableContext");
2569
+ function getChainableContext(chainable) {
2570
+ return chainable?.[kChainableContext];
2571
+ }
2572
+ function createChainable(keys, fn, context) {
2573
+ function create(context) {
2574
+ const chain = function(...args) {
2575
+ return fn.apply(context, args);
2576
+ };
2577
+ Object.assign(chain, fn);
2578
+ Object.defineProperty(chain, kChainableContext, {
2579
+ value: {
2580
+ withContext: () => chain.bind(context),
2581
+ getFixtures: () => context.fixtures,
2582
+ setContext: (key, value) => {
2583
+ context[key] = value;
2584
+ },
2585
+ mergeContext: (ctx) => {
2586
+ Object.assign(context, ctx);
2587
+ }
2588
+ },
2589
+ enumerable: false
2590
+ });
2591
+ for (const key of keys) Object.defineProperty(chain, key, { get() {
2592
+ return create({
2593
+ ...context,
2594
+ [key]: true
2595
+ });
2596
+ } });
2597
+ return chain;
2598
+ }
2599
+ const chain = create(context ?? {});
2600
+ Object.defineProperty(chain, "fn", {
2601
+ value: fn,
2602
+ enumerable: false
2603
+ });
2604
+ return chain;
2605
+ }
2606
+ function getDefaultHookTimeout() {
2607
+ return getRunner().config.hookTimeout;
2608
+ }
2609
+ const CLEANUP_TIMEOUT_KEY = Symbol.for("VITEST_CLEANUP_TIMEOUT");
2610
+ const CLEANUP_STACK_TRACE_KEY = Symbol.for("VITEST_CLEANUP_STACK_TRACE");
2611
+ const AROUND_TIMEOUT_KEY = Symbol.for("VITEST_AROUND_TIMEOUT");
2612
+ const AROUND_STACK_TRACE_KEY = Symbol.for("VITEST_AROUND_STACK_TRACE");
2613
+ /**
2614
+ * Registers a callback function to be executed once before all tests within the current suite.
2615
+ * This hook is useful for scenarios where you need to perform setup operations that are common to all tests in a suite, such as initializing a database connection or setting up a test environment.
2616
+ *
2617
+ * **Note:** The `beforeAll` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file.
2618
+ *
2619
+ * @param {Function} fn - The callback function to be executed before all tests.
2620
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2621
+ * @returns {void}
2622
+ * @example
2623
+ * ```ts
2624
+ * // Example of using beforeAll to set up a database connection
2625
+ * beforeAll(async () => {
2626
+ * await database.connect();
2627
+ * });
2628
+ * ```
2629
+ */
2630
+ function beforeAll(fn, timeout = getDefaultHookTimeout()) {
2631
+ assertTypes(fn, "\"beforeAll\" callback", ["function"]);
2632
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2633
+ const context = getChainableContext(this);
2634
+ return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(withSuiteFixtures("beforeAll", fn, context, stackTraceError), timeout, true, stackTraceError), {
2635
+ [CLEANUP_TIMEOUT_KEY]: timeout,
2636
+ [CLEANUP_STACK_TRACE_KEY]: stackTraceError
2637
+ }));
2638
+ }
2639
+ /**
2640
+ * Registers a callback function to be executed once after all tests within the current suite have completed.
2641
+ * This hook is useful for scenarios where you need to perform cleanup operations after all tests in a suite have run, such as closing database connections or cleaning up temporary files.
2642
+ *
2643
+ * **Note:** The `afterAll` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
2644
+ *
2645
+ * @param {Function} fn - The callback function to be executed after all tests.
2646
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2647
+ * @returns {void}
2648
+ * @example
2649
+ * ```ts
2650
+ * // Example of using afterAll to close a database connection
2651
+ * afterAll(async () => {
2652
+ * await database.disconnect();
2653
+ * });
2654
+ * ```
2655
+ */
2656
+ function afterAll(fn, timeout) {
2657
+ assertTypes(fn, "\"afterAll\" callback", ["function"]);
2658
+ const context = getChainableContext(this);
2659
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2660
+ return getCurrentSuite().on("afterAll", withTimeout(withSuiteFixtures("afterAll", fn, context, stackTraceError), timeout ?? getDefaultHookTimeout(), true, stackTraceError));
2661
+ }
2662
+ /**
2663
+ * Registers a callback function to be executed before each test within the current suite.
2664
+ * This hook is useful for scenarios where you need to reset or reinitialize the test environment before each test runs, such as resetting database states, clearing caches, or reinitializing variables.
2665
+ *
2666
+ * **Note:** The `beforeEach` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file.
2667
+ *
2668
+ * @param {Function} fn - The callback function to be executed before each test. This function receives an `TestContext` parameter if additional test context is needed.
2669
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2670
+ * @returns {void}
2671
+ * @example
2672
+ * ```ts
2673
+ * // Example of using beforeEach to reset a database state
2674
+ * beforeEach(async () => {
2675
+ * await database.reset();
2676
+ * });
2677
+ * ```
2678
+ */
2679
+ function beforeEach(fn, timeout = getDefaultHookTimeout()) {
2680
+ assertTypes(fn, "\"beforeEach\" callback", ["function"]);
2681
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2682
+ const wrapper = (context, suite) => {
2683
+ return withFixtures(fn, { suite })(context);
2684
+ };
2685
+ return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
2686
+ [CLEANUP_TIMEOUT_KEY]: timeout,
2687
+ [CLEANUP_STACK_TRACE_KEY]: stackTraceError
2688
+ }));
2689
+ }
2690
+ /**
2691
+ * Registers a callback function to be executed after each test within the current suite has completed.
2692
+ * This hook is useful for scenarios where you need to clean up or reset the test environment after each test runs, such as deleting temporary files, clearing test-specific database entries, or resetting mocked functions.
2693
+ *
2694
+ * **Note:** The `afterEach` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
2695
+ *
2696
+ * @param {Function} fn - The callback function to be executed after each test. This function receives an `TestContext` parameter if additional test context is needed.
2697
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2698
+ * @returns {void}
2699
+ * @example
2700
+ * ```ts
2701
+ * // Example of using afterEach to delete temporary files created during a test
2702
+ * afterEach(async () => {
2703
+ * await fileSystem.deleteTempFiles();
2704
+ * });
2705
+ * ```
2706
+ */
2707
+ function afterEach(fn, timeout) {
2708
+ assertTypes(fn, "\"afterEach\" callback", ["function"]);
2709
+ const wrapper = (context, suite) => {
2710
+ return withFixtures(fn, { suite })(context);
2711
+ };
2712
+ return getCurrentSuite().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2713
+ }
2714
+ /**
2715
+ * Registers a callback function that wraps around all tests within the current suite.
2716
+ * The callback receives a `runSuite` function that must be called to run the suite's tests.
2717
+ * This hook is useful for scenarios where you need to wrap an entire suite in a context
2718
+ * (e.g., starting a server, opening a database connection that all tests share).
2719
+ *
2720
+ * **Note:** When multiple `aroundAll` hooks are registered, they are nested inside each other.
2721
+ * The first registered hook is the outermost wrapper.
2722
+ *
2723
+ * @param {Function} fn - The callback function that wraps the suite. Must call `runSuite()` to run the tests.
2724
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2725
+ * @returns {void}
2726
+ * @example
2727
+ * ```ts
2728
+ * // Example of using aroundAll to wrap suite in a tracing span
2729
+ * aroundAll(async (runSuite) => {
2730
+ * await tracer.trace('test-suite', runSuite);
2731
+ * });
2732
+ * ```
2733
+ * @example
2734
+ * ```ts
2735
+ * // Example of using aroundAll with fixtures
2736
+ * aroundAll(async (runSuite, { db }) => {
2737
+ * await db.transaction(() => runSuite());
2738
+ * });
2739
+ * ```
2740
+ */
2741
+ function aroundAll(fn, timeout) {
2742
+ assertTypes(fn, "\"aroundAll\" callback", ["function"]);
2743
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2744
+ const resolvedTimeout = timeout ?? getDefaultHookTimeout();
2745
+ const context = getChainableContext(this);
2746
+ return getCurrentSuite().on("aroundAll", Object.assign(withSuiteFixtures("aroundAll", fn, context, stackTraceError, 1), {
2747
+ [AROUND_TIMEOUT_KEY]: resolvedTimeout,
2748
+ [AROUND_STACK_TRACE_KEY]: stackTraceError
2749
+ }));
2750
+ }
2751
+ /**
2752
+ * Registers a callback function that wraps around each test within the current suite.
2753
+ * The callback receives a `runTest` function that must be called to run the test.
2754
+ * This hook is useful for scenarios where you need to wrap tests in a context (e.g., database transactions).
2755
+ *
2756
+ * **Note:** When multiple `aroundEach` hooks are registered, they are nested inside each other.
2757
+ * The first registered hook is the outermost wrapper.
2758
+ *
2759
+ * @param {Function} fn - The callback function that wraps the test. Must call `runTest()` to run the test.
2760
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2761
+ * @returns {void}
2762
+ * @example
2763
+ * ```ts
2764
+ * // Example of using aroundEach to wrap tests in a database transaction
2765
+ * aroundEach(async (runTest) => {
2766
+ * await database.transaction(() => runTest());
2767
+ * });
2768
+ * ```
2769
+ * @example
2770
+ * ```ts
2771
+ * // Example of using aroundEach with fixtures
2772
+ * aroundEach(async (runTest, { db }) => {
2773
+ * await db.transaction(() => runTest());
2774
+ * });
2775
+ * ```
2776
+ */
2777
+ function aroundEach(fn, timeout) {
2778
+ assertTypes(fn, "\"aroundEach\" callback", ["function"]);
2779
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2780
+ const resolvedTimeout = timeout ?? getDefaultHookTimeout();
2781
+ const wrapper = (runTest, context, suite) => {
2782
+ const innerFn = (ctx) => fn(runTest, ctx, suite);
2783
+ configureProps(innerFn, {
2784
+ index: 1,
2785
+ original: fn
2786
+ });
2787
+ return withFixtures(innerFn, { suite })(context);
2788
+ };
2789
+ return getCurrentSuite().on("aroundEach", Object.assign(wrapper, {
2790
+ [AROUND_TIMEOUT_KEY]: resolvedTimeout,
2791
+ [AROUND_STACK_TRACE_KEY]: stackTraceError
2792
+ }));
2793
+ }
2794
+ function withSuiteFixtures(suiteHook, fn, context, stackTraceError, contextIndex = 0) {
2795
+ return (...args) => {
2796
+ const suite = args.at(-1);
2797
+ const prefix = args.slice(0, -1);
2798
+ const wrapper = (ctx) => fn(...prefix, ctx, suite);
2799
+ configureProps(wrapper, {
2800
+ index: contextIndex,
2801
+ original: fn
2802
+ });
2803
+ const fixtures = context?.getFixtures();
2804
+ const fileContext = fixtures?.getFileContext(suite.file);
2805
+ return withFixtures(wrapper, {
2806
+ suiteHook,
2807
+ fixtures,
2808
+ context: fileContext,
2809
+ stackTraceError
2810
+ })();
2811
+ };
2812
+ }
2813
+ function findTestFileStackTrace(testFilePath, error) {
2814
+ const lines = error.split("\n").slice(1);
2815
+ for (const line of lines) {
2816
+ const stack = parseSingleStack(line);
2817
+ if (stack && stack.file === testFilePath) return stack;
2818
+ }
2819
+ }
2820
+ const filterMap = /* @__PURE__ */ new WeakMap();
2821
+ /**
2822
+ * @experimental
2823
+ */
2824
+ function matchesTags(testTags) {
2825
+ const runner = getRunner();
2826
+ const tagsFilter = runner._currentSpecification?.testTagsFilter ?? runner.config.tagsFilter;
2827
+ if (!tagsFilter) return true;
2828
+ let tagsFilterPredicate = filterMap.get(tagsFilter);
2829
+ if (!tagsFilterPredicate) {
2830
+ tagsFilterPredicate = createTagsFilter(tagsFilter, runner.config.tags);
2831
+ filterMap.set(tagsFilter, tagsFilterPredicate);
2832
+ }
2833
+ return tagsFilterPredicate(testTags);
2834
+ }
2835
+ function validateTags(config, tags) {
2836
+ if (!config.strictTags) return;
2837
+ const availableTags = new Set(config.tags.map((tag) => tag.name));
2838
+ for (const tag of tags) if (!availableTags.has(tag)) throw createNoTagsError(config.tags, tag);
2839
+ }
2840
+ function createNoTagsError(availableTags, tag, prefix = "tag") {
2841
+ if (!availableTags.length) throw new Error(`The Vitest config does't define any "tags", cannot apply "${tag}" ${prefix} for this test. See: https://vitest.dev/guide/test-tags`);
2842
+ throw new Error(`The ${prefix} "${tag}" is not defined in the configuration. Available tags are:\n${availableTags.map((t) => `- ${t.name}${t.description ? `: ${t.description}` : ""}`).join("\n")}`);
2843
+ }
2844
+ function createTagsFilter(tagsExpr, availableTags) {
2845
+ const matchers = tagsExpr.map((expr) => parseTagsExpression(expr, availableTags));
2846
+ return (testTags) => {
2847
+ return matchers.every((matcher) => matcher(testTags));
2848
+ };
2849
+ }
2850
+ function parseTagsExpression(expr, availableTags) {
2851
+ const stream = new TokenStream(tokenize(expr), expr);
2852
+ const ast = parseOrExpression(stream, availableTags);
2853
+ if (stream.peek().type !== "EOF") throw new Error(`Invalid tags expression: unexpected "${formatToken(stream.peek())}" in "${expr}"`);
2854
+ return (tags) => evaluateNode(ast, tags);
2855
+ }
2856
+ function formatToken(token) {
2857
+ switch (token.type) {
2858
+ case "TAG": return token.value;
2859
+ default: return formatTokenType(token.type);
2860
+ }
2861
+ }
2862
+ function tokenize(expr) {
2863
+ const tokens = [];
2864
+ let i = 0;
2865
+ while (i < expr.length) {
2866
+ if (expr[i] === " " || expr[i] === " ") {
2867
+ i++;
2868
+ continue;
2869
+ }
2870
+ if (expr[i] === "(") {
2871
+ tokens.push({ type: "LPAREN" });
2872
+ i++;
2873
+ continue;
2874
+ }
2875
+ if (expr[i] === ")") {
2876
+ tokens.push({ type: "RPAREN" });
2877
+ i++;
2878
+ continue;
2879
+ }
2880
+ if (expr[i] === "!") {
2881
+ tokens.push({ type: "NOT" });
2882
+ i++;
2883
+ continue;
2884
+ }
2885
+ if (expr.slice(i, i + 2) === "&&") {
2886
+ tokens.push({ type: "AND" });
2887
+ i += 2;
2888
+ continue;
2889
+ }
2890
+ if (expr.slice(i, i + 2) === "||") {
2891
+ tokens.push({ type: "OR" });
2892
+ i += 2;
2893
+ continue;
2894
+ }
2895
+ if (/^and(?:\s|\)|$)/i.test(expr.slice(i))) {
2896
+ tokens.push({ type: "AND" });
2897
+ i += 3;
2898
+ continue;
2899
+ }
2900
+ if (/^or(?:\s|\)|$)/i.test(expr.slice(i))) {
2901
+ tokens.push({ type: "OR" });
2902
+ i += 2;
2903
+ continue;
2904
+ }
2905
+ if (/^not\s/i.test(expr.slice(i))) {
2906
+ tokens.push({ type: "NOT" });
2907
+ i += 3;
2908
+ continue;
2909
+ }
2910
+ let tag = "";
2911
+ while (i < expr.length && expr[i] !== " " && expr[i] !== " " && expr[i] !== "(" && expr[i] !== ")" && expr[i] !== "!" && expr[i] !== "&" && expr[i] !== "|") {
2912
+ const remaining = expr.slice(i);
2913
+ if (tag === "" && (/^and(?:\s|\)|$)/i.test(remaining) || /^or(?:\s|\)|$)/i.test(remaining) || /^not\s/i.test(remaining))) break;
2914
+ tag += expr[i];
2915
+ i++;
2916
+ }
2917
+ if (tag) tokens.push({
2918
+ type: "TAG",
2919
+ value: tag
2920
+ });
2921
+ }
2922
+ tokens.push({ type: "EOF" });
2923
+ return tokens;
2924
+ }
2925
+ var TokenStream = class {
2926
+ pos = 0;
2927
+ constructor(tokens, expr) {
2928
+ this.tokens = tokens;
2929
+ this.expr = expr;
2930
+ }
2931
+ peek() {
2932
+ return this.tokens[this.pos];
2933
+ }
2934
+ next() {
2935
+ return this.tokens[this.pos++];
2936
+ }
2937
+ expect(type) {
2938
+ const token = this.next();
2939
+ if (token.type !== type) {
2940
+ if (type === "RPAREN" && token.type === "EOF") throw new Error(`Invalid tags expression: missing closing ")" in "${this.expr}"`);
2941
+ throw new Error(`Invalid tags expression: expected "${formatTokenType(type)}" but got "${formatToken(token)}" in "${this.expr}"`);
2942
+ }
2943
+ return token;
2944
+ }
2945
+ unexpectedToken() {
2946
+ const token = this.peek();
2947
+ if (token.type === "EOF") throw new Error(`Invalid tags expression: unexpected end of expression in "${this.expr}"`);
2948
+ throw new Error(`Invalid tags expression: unexpected "${formatToken(token)}" in "${this.expr}"`);
2949
+ }
2950
+ };
2951
+ function formatTokenType(type) {
2952
+ switch (type) {
2953
+ case "TAG": return "tag";
2954
+ case "AND": return "and";
2955
+ case "OR": return "or";
2956
+ case "NOT": return "not";
2957
+ case "LPAREN": return "(";
2958
+ case "RPAREN": return ")";
2959
+ case "EOF": return "end of expression";
2960
+ }
2961
+ }
2962
+ function parseOrExpression(stream, availableTags) {
2963
+ let left = parseAndExpression(stream, availableTags);
2964
+ while (stream.peek().type === "OR") {
2965
+ stream.next();
2966
+ const right = parseAndExpression(stream, availableTags);
2967
+ left = {
2968
+ type: "or",
2969
+ left,
2970
+ right
2971
+ };
2972
+ }
2973
+ return left;
2974
+ }
2975
+ function parseAndExpression(stream, availableTags) {
2976
+ let left = parseUnaryExpression(stream, availableTags);
2977
+ while (stream.peek().type === "AND") {
2978
+ stream.next();
2979
+ const right = parseUnaryExpression(stream, availableTags);
2980
+ left = {
2981
+ type: "and",
2982
+ left,
2983
+ right
2984
+ };
2985
+ }
2986
+ return left;
2987
+ }
2988
+ function parseUnaryExpression(stream, availableTags) {
2989
+ if (stream.peek().type === "NOT") {
2990
+ stream.next();
2991
+ return {
2992
+ type: "not",
2993
+ operand: parseUnaryExpression(stream, availableTags)
2994
+ };
2995
+ }
2996
+ return parsePrimaryExpression(stream, availableTags);
2997
+ }
2998
+ function parsePrimaryExpression(stream, availableTags) {
2999
+ const token = stream.peek();
3000
+ if (token.type === "LPAREN") {
3001
+ stream.next();
3002
+ const expr = parseOrExpression(stream, availableTags);
3003
+ stream.expect("RPAREN");
3004
+ return expr;
3005
+ }
3006
+ if (token.type === "TAG") {
3007
+ stream.next();
3008
+ const tagValue = token.value;
3009
+ return {
3010
+ type: "tag",
3011
+ value: tagValue,
3012
+ pattern: resolveTagPattern(tagValue, availableTags)
3013
+ };
3014
+ }
3015
+ stream.unexpectedToken();
3016
+ }
3017
+ function createWildcardRegex(pattern) {
3018
+ return new RegExp(`^${pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`);
3019
+ }
3020
+ function resolveTagPattern(tagPattern, availableTags) {
3021
+ if (tagPattern.includes("*")) {
3022
+ const regex = createWildcardRegex(tagPattern);
3023
+ if (!availableTags.some((tag) => regex.test(tag.name))) throw createNoTagsError(availableTags, tagPattern, "tag pattern");
3024
+ return regex;
3025
+ }
3026
+ if (!availableTags.length || !availableTags.some((tag) => tag.name === tagPattern)) throw createNoTagsError(availableTags, tagPattern, "tag pattern");
3027
+ return null;
3028
+ }
3029
+ function evaluateNode(node, tags) {
3030
+ switch (node.type) {
3031
+ case "tag":
3032
+ if (node.pattern) return tags.some((tag) => node.pattern.test(tag));
3033
+ return tags.includes(node.value);
3034
+ case "not": return !evaluateNode(node.operand, tags);
3035
+ case "and": return evaluateNode(node.left, tags) && evaluateNode(node.right, tags);
3036
+ case "or": return evaluateNode(node.left, tags) || evaluateNode(node.right, tags);
3037
+ }
3038
+ }
3039
+ function isTestCase(s) {
3040
+ return s.type === "test";
3041
+ }
3042
+ function getTests(suite) {
3043
+ const tests = [];
3044
+ const arraySuites = toArray(suite);
3045
+ for (const s of arraySuites) if (isTestCase(s)) tests.push(s);
3046
+ else for (const task of s.tasks) if (isTestCase(task)) tests.push(task);
3047
+ else {
3048
+ const taskTests = getTests(task);
3049
+ for (const test of taskTests) tests.push(test);
3050
+ }
3051
+ return tests;
3052
+ }
3053
+ function getNames(task) {
3054
+ const names = [task.name];
3055
+ let current = task;
3056
+ while (current?.suite) {
3057
+ current = current.suite;
3058
+ if (current?.name) names.unshift(current.name);
3059
+ }
3060
+ if (current !== task.file) names.unshift(task.file.name);
3061
+ return names;
3062
+ }
3063
+ function getTestName(task, separator = " > ") {
3064
+ return getNames(task).slice(1).join(separator);
3065
+ }
3066
+ function createTaskName(names, separator = " > ") {
3067
+ return names.filter((name) => name !== void 0).join(separator);
3068
+ }
3069
+ /**
3070
+ * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
3071
+ * Suites can contain both tests and other suites, enabling complex test structures.
3072
+ *
3073
+ * @param {string} name - The name of the suite, used for identification and reporting.
3074
+ * @param {Function} fn - A function that defines the tests and suites within this suite.
3075
+ * @example
3076
+ * ```ts
3077
+ * // Define a suite with two tests
3078
+ * suite('Math operations', () => {
3079
+ * test('should add two numbers', () => {
3080
+ * expect(add(1, 2)).toBe(3);
3081
+ * });
3082
+ *
3083
+ * test('should subtract two numbers', () => {
3084
+ * expect(subtract(5, 2)).toBe(3);
3085
+ * });
3086
+ * });
3087
+ * ```
3088
+ * @example
3089
+ * ```ts
3090
+ * // Define nested suites
3091
+ * suite('String operations', () => {
3092
+ * suite('Trimming', () => {
3093
+ * test('should trim whitespace from start and end', () => {
3094
+ * expect(' hello '.trim()).toBe('hello');
3095
+ * });
3096
+ * });
3097
+ *
3098
+ * suite('Concatenation', () => {
3099
+ * test('should concatenate two strings', () => {
3100
+ * expect('hello' + ' ' + 'world').toBe('hello world');
3101
+ * });
3102
+ * });
3103
+ * });
3104
+ * ```
3105
+ */
3106
+ const suite = createSuite();
3107
+ /**
3108
+ * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
3109
+ *
3110
+ * @param {string | Function} name - The name of the test or a function that will be used as a test name.
3111
+ * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
3112
+ * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
3113
+ * @throws {Error} If called inside another test function.
3114
+ * @example
3115
+ * ```ts
3116
+ * // Define a simple test
3117
+ * test('should add two numbers', () => {
3118
+ * expect(add(1, 2)).toBe(3);
3119
+ * });
3120
+ * ```
3121
+ * @example
3122
+ * ```ts
3123
+ * // Define a test with options
3124
+ * test('should subtract two numbers', { retry: 3 }, () => {
3125
+ * expect(subtract(5, 2)).toBe(3);
3126
+ * });
3127
+ * ```
3128
+ */
3129
+ const test = createTest(function(name, optionsOrFn, optionsOrTest) {
3130
+ getCurrentSuite().test.fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
3131
+ });
3132
+ /**
3133
+ * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
3134
+ * Suites can contain both tests and other suites, enabling complex test structures.
3135
+ *
3136
+ * @param {string} name - The name of the suite, used for identification and reporting.
3137
+ * @param {Function} fn - A function that defines the tests and suites within this suite.
3138
+ * @example
3139
+ * ```ts
3140
+ * // Define a suite with two tests
3141
+ * describe('Math operations', () => {
3142
+ * test('should add two numbers', () => {
3143
+ * expect(add(1, 2)).toBe(3);
3144
+ * });
3145
+ *
3146
+ * test('should subtract two numbers', () => {
3147
+ * expect(subtract(5, 2)).toBe(3);
3148
+ * });
3149
+ * });
3150
+ * ```
3151
+ * @example
3152
+ * ```ts
3153
+ * // Define nested suites
3154
+ * describe('String operations', () => {
3155
+ * describe('Trimming', () => {
3156
+ * test('should trim whitespace from start and end', () => {
3157
+ * expect(' hello '.trim()).toBe('hello');
3158
+ * });
3159
+ * });
3160
+ *
3161
+ * describe('Concatenation', () => {
3162
+ * test('should concatenate two strings', () => {
3163
+ * expect('hello' + ' ' + 'world').toBe('hello world');
3164
+ * });
3165
+ * });
3166
+ * });
3167
+ * ```
3168
+ */
3169
+ const describe = suite;
3170
+ /**
3171
+ * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
3172
+ *
3173
+ * @param {string | Function} name - The name of the test or a function that will be used as a test name.
3174
+ * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
3175
+ * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
3176
+ * @throws {Error} If called inside another test function.
3177
+ * @example
3178
+ * ```ts
3179
+ * // Define a simple test
3180
+ * it('adds two numbers', () => {
3181
+ * expect(add(1, 2)).toBe(3);
3182
+ * });
3183
+ * ```
3184
+ * @example
3185
+ * ```ts
3186
+ * // Define a test with options
3187
+ * it('subtracts two numbers', { retry: 3 }, () => {
3188
+ * expect(subtract(5, 2)).toBe(3);
3189
+ * });
3190
+ * ```
3191
+ */
3192
+ const it = test;
3193
+ let runner;
3194
+ let defaultSuite;
3195
+ let currentTestFilepath;
3196
+ function assert(condition, message) {
3197
+ if (!condition) throw new Error(`Vitest failed to find ${message}. One of the following is possible:
3198
+ - "vitest" is imported directly without running "vitest" command
3199
+ - "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
3200
+ - "vitest" is imported inside Vite / Vitest config file
3201
+ - Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
3202
+ `);
3203
+ }
3204
+ function getRunner() {
3205
+ assert(runner, "the runner");
3206
+ }
3207
+ function getCurrentSuite() {
3208
+ const currentSuite = collectorContext.currentSuite || defaultSuite;
3209
+ assert(currentSuite, "the current suite");
3210
+ return currentSuite;
3211
+ }
3212
+ function createSuiteHooks() {
3213
+ return {
3214
+ beforeAll: [],
3215
+ afterAll: [],
3216
+ beforeEach: [],
3217
+ afterEach: [],
3218
+ aroundEach: [],
3219
+ aroundAll: []
3220
+ };
3221
+ }
3222
+ const POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
3223
+ function parseArguments(optionsOrFn, timeoutOrTest) {
3224
+ if (timeoutOrTest != null && typeof timeoutOrTest === "object") throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
3225
+ let options = {};
3226
+ let fn;
3227
+ if (typeof timeoutOrTest === "number") options = { timeout: timeoutOrTest };
3228
+ else if (typeof optionsOrFn === "object") options = optionsOrFn;
3229
+ if (typeof optionsOrFn === "function") {
3230
+ if (typeof timeoutOrTest === "function") throw new TypeError("Cannot use two functions as arguments. Please use the second argument for options.");
3231
+ fn = optionsOrFn;
3232
+ } else if (typeof timeoutOrTest === "function") fn = timeoutOrTest;
3233
+ return {
3234
+ options,
3235
+ handler: fn
3236
+ };
3237
+ }
3238
+ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions) {
3239
+ const tasks = [];
3240
+ let suite;
3241
+ initSuite(true);
3242
+ const task = function(name = "", options = {}) {
3243
+ const currentSuite = collectorContext.currentSuite?.suite;
3244
+ const testTags = unique([...(currentSuite ?? collectorContext.currentSuite?.file)?.tags || [], ...toArray(options.tags)]);
3245
+ const tagsOptions = testTags.map((tag) => {
3246
+ const tagDefinition = runner.config.tags?.find((t) => t.name === tag);
3247
+ if (!tagDefinition && runner.config.strictTags) throw createNoTagsError(runner.config.tags, tag);
3248
+ return tagDefinition;
3249
+ }).filter((r) => r != null).sort((tag1, tag2) => (tag2.priority ?? POSITIVE_INFINITY) - (tag1.priority ?? POSITIVE_INFINITY)).reduce((acc, tag) => {
3250
+ const { name, description, priority, meta, ...options } = tag;
3251
+ Object.assign(acc, options);
3252
+ if (meta) acc.meta = Object.assign(acc.meta ?? Object.create(null), meta);
3253
+ return acc;
3254
+ }, {});
3255
+ const testOwnMeta = options.meta;
3256
+ options = {
3257
+ ...tagsOptions,
3258
+ ...options
3259
+ };
3260
+ const timeout = options.timeout ?? runner.config.testTimeout;
3261
+ const parentMeta = currentSuite?.meta;
3262
+ const tagMeta = tagsOptions.meta;
3263
+ const testMeta = Object.create(null);
3264
+ if (tagMeta) Object.assign(testMeta, tagMeta);
3265
+ if (parentMeta) Object.assign(testMeta, parentMeta);
3266
+ if (testOwnMeta) Object.assign(testMeta, testOwnMeta);
3267
+ const task = {
3268
+ id: "",
3269
+ name,
3270
+ fullName: createTaskName([currentSuite?.fullName ?? collectorContext.currentSuite?.file?.fullName, name]),
3271
+ fullTestName: createTaskName([currentSuite?.fullTestName, name]),
3272
+ suite: currentSuite,
3273
+ each: options.each,
3274
+ fails: options.fails,
3275
+ context: void 0,
3276
+ type: "test",
3277
+ file: currentSuite?.file ?? collectorContext.currentSuite?.file,
3278
+ timeout,
3279
+ retry: options.retry ?? runner.config.retry,
3280
+ repeats: options.repeats,
3281
+ mode: options.only ? "only" : options.skip ? "skip" : options.todo ? "todo" : "run",
3282
+ meta: testMeta,
3283
+ annotations: [],
3284
+ artifacts: [],
3285
+ tags: testTags
3286
+ };
3287
+ const handler = options.handler;
3288
+ if (task.mode === "run" && !handler) task.mode = "todo";
3289
+ if (options.concurrent ?? (!options.sequential && runner.config.sequence.concurrent)) task.concurrent = true;
3290
+ task.shuffle = suiteOptions?.shuffle;
3291
+ const context = createTestContext(task, runner);
3292
+ Object.defineProperty(task, "context", {
3293
+ value: context,
3294
+ enumerable: false
3295
+ });
3296
+ setTestFixture(context, options.fixtures ?? new TestFixtures());
3297
+ const limit = Error.stackTraceLimit;
3298
+ Error.stackTraceLimit = 10;
3299
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
3300
+ Error.stackTraceLimit = limit;
3301
+ if (handler) setFn(task, withTimeout(withCancel(withAwaitAsyncAssertions(withFixtures(handler, { context }), task), task.context.signal), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
3302
+ if (runner.config.includeTaskLocation) {
3303
+ const error = stackTraceError.stack;
3304
+ const stack = findTestFileStackTrace(currentTestFilepath, error);
3305
+ if (stack) task.location = {
3306
+ line: stack.line,
3307
+ column: stack.column
3308
+ };
3309
+ }
3310
+ tasks.push(task);
3311
+ return task;
3312
+ };
3313
+ const test = createTest(function(name, optionsOrFn, timeoutOrTest) {
3314
+ let { options, handler } = parseArguments(optionsOrFn, timeoutOrTest);
3315
+ if (typeof suiteOptions === "object") options = Object.assign({}, suiteOptions, options);
3316
+ const concurrent = this.concurrent ?? (!this.sequential && options?.concurrent);
3317
+ if (options.concurrent != null && concurrent != null) options.concurrent = concurrent;
3318
+ const sequential = this.sequential ?? (!this.concurrent && options?.sequential);
3319
+ if (options.sequential != null && sequential != null) options.sequential = sequential;
3320
+ const test = task(formatName(name), {
3321
+ ...this,
3322
+ ...options,
3323
+ handler
3324
+ });
3325
+ test.type = "test";
3326
+ });
3327
+ const collector = {
3328
+ type: "collector",
3329
+ name,
3330
+ mode,
3331
+ suite,
3332
+ options: suiteOptions,
3333
+ test,
3334
+ file: suite.file,
3335
+ tasks,
3336
+ collect,
3337
+ task,
3338
+ clear,
3339
+ on: addHook
3340
+ };
3341
+ function addHook(name, ...fn) {
3342
+ getHooks(suite)[name].push(...fn);
3343
+ }
3344
+ function initSuite(includeLocation) {
3345
+ if (typeof suiteOptions === "number") suiteOptions = { timeout: suiteOptions };
3346
+ const currentSuite = collectorContext.currentSuite?.suite;
3347
+ const parentTask = currentSuite ?? collectorContext.currentSuite?.file;
3348
+ const suiteTags = toArray(suiteOptions?.tags);
3349
+ validateTags(runner.config, suiteTags);
3350
+ suite = {
3351
+ id: "",
3352
+ type: "suite",
3353
+ name,
3354
+ fullName: createTaskName([currentSuite?.fullName ?? collectorContext.currentSuite?.file?.fullName, name]),
3355
+ fullTestName: createTaskName([currentSuite?.fullTestName, name]),
3356
+ suite: currentSuite,
3357
+ mode,
3358
+ each,
3359
+ file: currentSuite?.file ?? collectorContext.currentSuite?.file,
3360
+ shuffle: suiteOptions?.shuffle,
3361
+ tasks: [],
3362
+ meta: suiteOptions?.meta ?? Object.create(null),
3363
+ concurrent: suiteOptions?.concurrent,
3364
+ tags: unique([...parentTask?.tags || [], ...suiteTags])
3365
+ };
3366
+ setHooks(suite, createSuiteHooks());
3367
+ }
3368
+ function clear() {
3369
+ tasks.length = 0;
3370
+ initSuite(false);
3371
+ }
3372
+ async function collect(file) {
3373
+ if (!file) throw new TypeError("File is required to collect tasks.");
3374
+ if (factory) await runWithSuite(collector, () => factory(test));
3375
+ const allChildren = [];
3376
+ for (const i of tasks) allChildren.push(i.type === "collector" ? await i.collect(file) : i);
3377
+ suite.tasks = allChildren;
3378
+ return suite;
3379
+ }
3380
+ collectTask(collector);
3381
+ return collector;
3382
+ }
3383
+ function withAwaitAsyncAssertions(fn, task) {
3384
+ return (async (...args) => {
3385
+ const fnResult = await fn(...args);
3386
+ if (task.promises) {
3387
+ const errors = (await Promise.allSettled(task.promises)).map((r) => r.status === "rejected" ? r.reason : void 0).filter(Boolean);
3388
+ if (errors.length) throw errors;
3389
+ }
3390
+ return fnResult;
3391
+ });
3392
+ }
3393
+ function createSuite() {
3394
+ function suiteFn(name, factoryOrOptions, optionsOrFactory) {
3395
+ const currentSuite = collectorContext.currentSuite || defaultSuite;
3396
+ let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
3397
+ const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false;
3398
+ const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false;
3399
+ const { meta: parentMeta, ...parentOptions } = currentSuite?.options || {};
3400
+ options = {
3401
+ ...parentOptions,
3402
+ ...options
3403
+ };
3404
+ const shuffle = this.shuffle ?? options.shuffle ?? currentSuite?.options?.shuffle ?? void 0;
3405
+ if (shuffle != null) options.shuffle = shuffle;
3406
+ let mode = this.only ?? options.only ? "only" : this.skip ?? options.skip ? "skip" : this.todo ?? options.todo ? "todo" : "run";
3407
+ if (mode === "run" && !factory) mode = "todo";
3408
+ const isConcurrent = isConcurrentSpecified || options.concurrent && !isSequentialSpecified;
3409
+ const isSequential = isSequentialSpecified || options.sequential && !isConcurrentSpecified;
3410
+ if (isConcurrent != null) options.concurrent = isConcurrent && !isSequential;
3411
+ if (isSequential != null) options.sequential = isSequential && !isConcurrent;
3412
+ if (parentMeta) options.meta = Object.assign(Object.create(null), parentMeta, options.meta);
3413
+ return createSuiteCollector(formatName(name), factory, mode, this.each, options);
3414
+ }
3415
+ suiteFn.each = function(cases, ...args) {
3416
+ const context = getChainableContext(this);
3417
+ const suite = context.withContext();
3418
+ context.setContext("each", true);
3419
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
3420
+ return (name, optionsOrFn, fnOrOptions) => {
3421
+ const _name = formatName(name);
3422
+ const arrayOnlyCases = cases.every(Array.isArray);
3423
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
3424
+ const fnFirst = typeof optionsOrFn === "function";
3425
+ cases.forEach((i, idx) => {
3426
+ const items = Array.isArray(i) ? i : [i];
3427
+ if (fnFirst) {
3428
+ if (arrayOnlyCases) suite(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
3429
+ else suite(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
3430
+ } else if (arrayOnlyCases) suite(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
3431
+ else suite(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
3432
+ });
3433
+ context.setContext("each", void 0);
3434
+ };
3435
+ };
3436
+ suiteFn.for = function(cases, ...args) {
3437
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
3438
+ return (name, optionsOrFn, fnOrOptions) => {
3439
+ const name_ = formatName(name);
3440
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
3441
+ cases.forEach((item, idx) => {
3442
+ suite(formatTitle(name_, toArray(item), idx), options, handler ? () => handler(item) : void 0);
3443
+ });
3444
+ };
3445
+ };
3446
+ suiteFn.skipIf = (condition) => condition ? suite.skip : suite;
3447
+ suiteFn.runIf = (condition) => condition ? suite : suite.skip;
3448
+ return createChainable([
3449
+ "concurrent",
3450
+ "sequential",
3451
+ "shuffle",
3452
+ "skip",
3453
+ "only",
3454
+ "todo"
3455
+ ], suiteFn);
3456
+ }
3457
+ function createTaskCollector(fn) {
3458
+ const taskFn = fn;
3459
+ taskFn.each = function(cases, ...args) {
3460
+ const context = getChainableContext(this);
3461
+ const test = context.withContext();
3462
+ context.setContext("each", true);
3463
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
3464
+ return (name, optionsOrFn, fnOrOptions) => {
3465
+ const _name = formatName(name);
3466
+ const arrayOnlyCases = cases.every(Array.isArray);
3467
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
3468
+ const fnFirst = typeof optionsOrFn === "function";
3469
+ cases.forEach((i, idx) => {
3470
+ const items = Array.isArray(i) ? i : [i];
3471
+ if (fnFirst) {
3472
+ if (arrayOnlyCases) test(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
3473
+ else test(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
3474
+ } else if (arrayOnlyCases) test(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
3475
+ else test(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
3476
+ });
3477
+ context.setContext("each", void 0);
3478
+ };
3479
+ };
3480
+ taskFn.for = function(cases, ...args) {
3481
+ const test = getChainableContext(this).withContext();
3482
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
3483
+ return (name, optionsOrFn, fnOrOptions) => {
3484
+ const _name = formatName(name);
3485
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
3486
+ cases.forEach((item, idx) => {
3487
+ const handlerWrapper = handler ? (ctx) => handler(item, ctx) : void 0;
3488
+ if (handlerWrapper) configureProps(handlerWrapper, {
3489
+ index: 1,
3490
+ original: handler
3491
+ });
3492
+ test(formatTitle(_name, toArray(item), idx), options, handlerWrapper);
3493
+ });
3494
+ };
3495
+ };
3496
+ taskFn.skipIf = function(condition) {
3497
+ return condition ? this.skip : this;
3498
+ };
3499
+ taskFn.runIf = function(condition) {
3500
+ return condition ? this : this.skip;
3501
+ };
3502
+ /**
3503
+ * Parse builder pattern arguments into a fixtures object.
3504
+ * Handles both builder pattern (name, options?, value) and object syntax.
3505
+ */
3506
+ function parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn) {
3507
+ if (typeof fixturesOrName !== "string") return fixturesOrName;
3508
+ const fixtureName = fixturesOrName;
3509
+ let fixtureOptions;
3510
+ let fixtureValue;
3511
+ if (maybeFn !== void 0) {
3512
+ fixtureOptions = optionsOrFn;
3513
+ fixtureValue = maybeFn;
3514
+ } else if (optionsOrFn !== null && typeof optionsOrFn === "object" && !Array.isArray(optionsOrFn) && TestFixtures.isFixtureOptions(optionsOrFn)) {
3515
+ fixtureOptions = optionsOrFn;
3516
+ fixtureValue = {};
3517
+ } else {
3518
+ fixtureOptions = void 0;
3519
+ fixtureValue = optionsOrFn;
3520
+ }
3521
+ if (typeof fixtureValue === "function") {
3522
+ const builderFn = fixtureValue;
3523
+ const fixture = async (ctx, use) => {
3524
+ let cleanup;
3525
+ const onCleanup = (fn) => {
3526
+ if (cleanup !== void 0) throw new Error("onCleanup can only be called once per fixture. Define separate fixtures if you need multiple cleanup functions.");
3527
+ cleanup = fn;
3528
+ };
3529
+ await use(await builderFn(ctx, { onCleanup }));
3530
+ if (cleanup) await cleanup();
3531
+ };
3532
+ configureProps(fixture, { original: builderFn });
3533
+ if (fixtureOptions) return { [fixtureName]: [fixture, fixtureOptions] };
3534
+ return { [fixtureName]: fixture };
3535
+ }
3536
+ if (fixtureOptions) return { [fixtureName]: [fixtureValue, fixtureOptions] };
3537
+ return { [fixtureName]: fixtureValue };
3538
+ }
3539
+ taskFn.override = function(fixturesOrName, optionsOrFn, maybeFn) {
3540
+ const userFixtures = parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn);
3541
+ getChainableContext(this).getFixtures().override(runner, userFixtures);
3542
+ return this;
3543
+ };
3544
+ taskFn.scoped = function(fixtures) {
3545
+ console.warn(`test.scoped() is deprecated and will be removed in future versions. Please use test.override() instead.`);
3546
+ return this.override(fixtures);
3547
+ };
3548
+ taskFn.extend = function(fixturesOrName, optionsOrFn, maybeFn) {
3549
+ const userFixtures = parseBuilderFixtures(fixturesOrName, optionsOrFn, maybeFn);
3550
+ const fixtures = getChainableContext(this).getFixtures().extend(runner, userFixtures);
3551
+ const _test = createTest(function(name, optionsOrFn, optionsOrTest) {
3552
+ fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
3553
+ });
3554
+ getChainableContext(_test).mergeContext({ fixtures });
3555
+ return _test;
3556
+ };
3557
+ taskFn.describe = suite;
3558
+ taskFn.suite = suite;
3559
+ taskFn.beforeEach = beforeEach;
3560
+ taskFn.afterEach = afterEach;
3561
+ taskFn.beforeAll = beforeAll;
3562
+ taskFn.afterAll = afterAll;
3563
+ taskFn.aroundEach = aroundEach;
3564
+ taskFn.aroundAll = aroundAll;
3565
+ return createChainable([
3566
+ "concurrent",
3567
+ "sequential",
3568
+ "skip",
3569
+ "only",
3570
+ "todo",
3571
+ "fails"
3572
+ ], taskFn, { fixtures: new TestFixtures() });
3573
+ }
3574
+ function createTest(fn) {
3575
+ return createTaskCollector(fn);
3576
+ }
3577
+ function formatName(name) {
3578
+ return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
3579
+ }
3580
+ function formatTitle(template, items, idx) {
3581
+ if (template.includes("%#") || template.includes("%$")) template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/%\$/g, `${idx + 1}`).replace(/__vitest_escaped_%__/g, "%%");
3582
+ const count = template.split("%").length - 1;
3583
+ if (template.includes("%f")) (template.match(/%f/g) || []).forEach((_, i) => {
3584
+ if (isNegativeNaN(items[i]) || Object.is(items[i], -0)) {
3585
+ let occurrence = 0;
3586
+ template = template.replace(/%f/g, (match) => {
3587
+ occurrence++;
3588
+ return occurrence === i + 1 ? "-%f" : match;
3589
+ });
3590
+ }
3591
+ });
3592
+ const isObjectItem = isObject(items[0]);
3593
+ function formatAttribute(s) {
3594
+ return s.replace(/\$([$\w.]+)/g, (_, key) => {
3595
+ const isArrayKey = /^\d+$/.test(key);
3596
+ if (!isObjectItem && !isArrayKey) return `$${key}`;
3597
+ const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
3598
+ return objDisplay(isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement, { truncate: void 0 });
3599
+ });
3600
+ }
3601
+ let output = "";
3602
+ let i = 0;
3603
+ handleRegexMatch(template, formatRegExp, (match) => {
3604
+ if (i < count) output += format(match[0], items[i++]);
3605
+ else output += match[0];
3606
+ }, (nonMatch) => {
3607
+ output += formatAttribute(nonMatch);
3608
+ });
3609
+ return output;
3610
+ }
3611
+ function handleRegexMatch(input, regex, onMatch, onNonMatch) {
3612
+ let lastIndex = 0;
3613
+ for (const m of input.matchAll(regex)) {
3614
+ if (lastIndex < m.index) onNonMatch(input.slice(lastIndex, m.index));
3615
+ onMatch(m);
3616
+ lastIndex = m.index + m[0].length;
3617
+ }
3618
+ if (lastIndex < input.length) onNonMatch(input.slice(lastIndex));
3619
+ }
3620
+ function formatTemplateString(cases, args) {
3621
+ const header = cases.join("").trim().replace(/ /g, "").split("\n").map((i) => i.split("|"))[0];
3622
+ const res = [];
3623
+ for (let i = 0; i < Math.floor(args.length / header.length); i++) {
3624
+ const oneCase = {};
3625
+ for (let j = 0; j < header.length; j++) oneCase[header[j]] = args[i * header.length + j];
3626
+ res.push(oneCase);
3627
+ }
3628
+ return res;
3629
+ }
3630
+ const now$2 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
3631
+ const collectorContext = {
3632
+ tasks: [],
3633
+ currentSuite: null
3634
+ };
3635
+ function collectTask(task) {
3636
+ collectorContext.currentSuite?.tasks.push(task);
3637
+ }
3638
+ async function runWithSuite(suite, fn) {
3639
+ const prev = collectorContext.currentSuite;
3640
+ collectorContext.currentSuite = suite;
3641
+ await fn();
3642
+ collectorContext.currentSuite = prev;
3643
+ }
3644
+ function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
3645
+ if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) return fn;
3646
+ const { setTimeout, clearTimeout } = getSafeTimers();
3647
+ return (function runWithTimeout(...args) {
3648
+ const startTime = now$2();
3649
+ const runner = getRunner();
3650
+ runner._currentTaskStartTime = startTime;
3651
+ runner._currentTaskTimeout = timeout;
3652
+ return new Promise((resolve_, reject_) => {
3653
+ const timer = setTimeout(() => {
3654
+ clearTimeout(timer);
3655
+ rejectTimeoutError();
3656
+ }, timeout);
3657
+ timer.unref?.();
3658
+ function rejectTimeoutError() {
3659
+ const error = makeTimeoutError(isHook, timeout, stackTraceError);
3660
+ onTimeout?.(args, error);
3661
+ reject_(error);
3662
+ }
3663
+ function resolve(result) {
3664
+ runner._currentTaskStartTime = void 0;
3665
+ runner._currentTaskTimeout = void 0;
3666
+ clearTimeout(timer);
3667
+ if (now$2() - startTime >= timeout) {
3668
+ rejectTimeoutError();
3669
+ return;
3670
+ }
3671
+ resolve_(result);
3672
+ }
3673
+ function reject(error) {
3674
+ runner._currentTaskStartTime = void 0;
3675
+ runner._currentTaskTimeout = void 0;
3676
+ clearTimeout(timer);
3677
+ reject_(error);
3678
+ }
3679
+ try {
3680
+ const result = fn(...args);
3681
+ if (typeof result === "object" && result != null && typeof result.then === "function") result.then(resolve, reject);
3682
+ else resolve(result);
3683
+ } catch (error) {
3684
+ reject(error);
3685
+ }
3686
+ });
3687
+ });
3688
+ }
3689
+ function withCancel(fn, signal) {
3690
+ return (function runWithCancel(...args) {
3691
+ return new Promise((resolve, reject) => {
3692
+ signal.addEventListener("abort", () => reject(signal.reason));
3693
+ try {
3694
+ const result = fn(...args);
3695
+ if (typeof result === "object" && result != null && typeof result.then === "function") result.then(resolve, reject);
3696
+ else resolve(result);
3697
+ } catch (error) {
3698
+ reject(error);
3699
+ }
3700
+ });
3701
+ });
3702
+ }
3703
+ const abortControllers = /* @__PURE__ */ new WeakMap();
3704
+ function abortIfTimeout([context], error) {
3705
+ if (context) abortContextSignal(context, error);
3706
+ }
3707
+ function abortContextSignal(context, error) {
3708
+ abortControllers.get(context)?.abort(error);
3709
+ }
3710
+ function createTestContext(test, runner) {
3711
+ const context = function() {
3712
+ throw new Error("done() callback is deprecated, use promise instead");
3713
+ };
3714
+ let abortController = abortControllers.get(context);
3715
+ if (!abortController) {
3716
+ abortController = new AbortController();
3717
+ abortControllers.set(context, abortController);
3718
+ }
3719
+ context.signal = abortController.signal;
3720
+ context.task = test;
3721
+ context.skip = (condition, note) => {
3722
+ if (condition === false) return;
3723
+ test.result ??= { state: "skip" };
3724
+ test.result.pending = true;
3725
+ throw new PendingError("test is skipped; abort execution", test, typeof condition === "string" ? condition : note);
3726
+ };
3727
+ context.annotate = ((message, type, attachment) => {
3728
+ if (test.result && test.result.state !== "run") throw new Error(`Cannot annotate tests outside of the test run. The test "${test.name}" finished running with the "${test.result.state}" state already.`);
3729
+ const annotation = {
3730
+ message,
3731
+ type: typeof type === "object" || type === void 0 ? "notice" : type
3732
+ };
3733
+ const annotationAttachment = typeof type === "object" ? type : attachment;
3734
+ if (annotationAttachment) {
3735
+ annotation.attachment = annotationAttachment;
3736
+ manageArtifactAttachment(annotation.attachment);
3737
+ }
3738
+ return recordAsyncOperation(test, recordArtifact(test, {
3739
+ type: "internal:annotation",
3740
+ annotation
3741
+ }).then(async ({ annotation }) => {
3742
+ if (!runner.onTestAnnotate) throw new Error(`Test runner doesn't support test annotations.`);
3743
+ await finishSendTasksUpdate(runner);
3744
+ const resolvedAnnotation = await runner.onTestAnnotate(test, annotation);
3745
+ test.annotations.push(resolvedAnnotation);
3746
+ return resolvedAnnotation;
3747
+ }));
3748
+ });
3749
+ context.onTestFailed = (handler, timeout) => {
3750
+ test.onFailed ||= [];
3751
+ test.onFailed.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
3752
+ };
3753
+ context.onTestFinished = (handler, timeout) => {
3754
+ test.onFinished ||= [];
3755
+ test.onFinished.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
3756
+ };
3757
+ return runner.extendTaskContext?.(context) || context;
3758
+ }
3759
+ function makeTimeoutError(isHook, timeout, stackTraceError) {
3760
+ const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.\nIf this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
3761
+ const error = new Error(message);
3762
+ if (stackTraceError?.stack) error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message);
3763
+ return error;
3764
+ }
3765
+ globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
3766
+ globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
3767
+ Date.now;
3768
+ const { clearTimeout, setTimeout: setTimeout$1 } = getSafeTimers();
3769
+ const packs = /* @__PURE__ */ new Map();
3770
+ const eventsPacks = [];
3771
+ const pendingTasksUpdates = [];
3772
+ function sendTasksUpdate(runner) {
3773
+ if (packs.size) {
3774
+ const taskPacks = Array.from(packs).map(([id, task]) => {
3775
+ return [
3776
+ id,
3777
+ task[0],
3778
+ task[1]
3779
+ ];
3780
+ });
3781
+ const p = runner.onTaskUpdate?.(taskPacks, eventsPacks);
3782
+ if (p) {
3783
+ pendingTasksUpdates.push(p);
3784
+ p.then(() => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p), 1), () => {});
3785
+ }
3786
+ eventsPacks.length = 0;
3787
+ packs.clear();
3788
+ }
3789
+ }
3790
+ async function finishSendTasksUpdate(runner) {
3791
+ sendTasksUpdate(runner);
3792
+ await Promise.all(pendingTasksUpdates);
3793
+ }
3794
+ /**
3795
+ * @experimental
3796
+ * @advanced
3797
+ *
3798
+ * Records a custom test artifact during test execution.
3799
+ *
3800
+ * This function allows you to attach structured data, files, or metadata to a test.
3801
+ *
3802
+ * Vitest automatically injects the source location where the artifact was created and manages any attachments you include.
3803
+ *
3804
+ * **Note:** artifacts must be recorded before the task is reported. Any artifacts recorded after that will not be included in the task.
3805
+ *
3806
+ * @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests
3807
+ * @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase}
3808
+ *
3809
+ * @returns A promise that resolves to the recorded artifact with location injected
3810
+ *
3811
+ * @throws {Error} If the test runner doesn't support artifacts
3812
+ *
3813
+ * @example
3814
+ * ```ts
3815
+ * // In a custom assertion
3816
+ * async function toHaveValidSchema(this: MatcherState, actual: unknown) {
3817
+ * const validation = validateSchema(actual)
3818
+ *
3819
+ * await recordArtifact(this.task, {
3820
+ * type: 'my-plugin:schema-validation',
3821
+ * passed: validation.valid,
3822
+ * errors: validation.errors,
3823
+ * })
3824
+ *
3825
+ * return { pass: validation.valid, message: () => '...' }
3826
+ * }
3827
+ * ```
3828
+ */
3829
+ async function recordArtifact(task, artifact) {
3830
+ const runner = getRunner();
3831
+ const stack = findTestFileStackTrace(task.file.filepath, (/* @__PURE__ */ new Error("STACK_TRACE")).stack);
3832
+ if (stack) {
3833
+ artifact.location = {
3834
+ file: stack.file,
3835
+ line: stack.line,
3836
+ column: stack.column
3837
+ };
3838
+ if (artifact.type === "internal:annotation") artifact.annotation.location = artifact.location;
3839
+ }
3840
+ if (Array.isArray(artifact.attachments)) for (const attachment of artifact.attachments) manageArtifactAttachment(attachment);
3841
+ if (artifact.type === "internal:annotation") return artifact;
3842
+ if (!runner.onTestArtifactRecord) throw new Error(`Test runner doesn't support test artifacts.`);
3843
+ await finishSendTasksUpdate(runner);
3844
+ const resolvedArtifact = await runner.onTestArtifactRecord(task, artifact);
3845
+ task.artifacts.push(resolvedArtifact);
3846
+ return resolvedArtifact;
3847
+ }
3848
+ const table = [];
3849
+ for (let i = 65; i < 91; i++) table.push(String.fromCharCode(i));
3850
+ for (let i = 97; i < 123; i++) table.push(String.fromCharCode(i));
3851
+ for (let i = 0; i < 10; i++) table.push(i.toString(10));
3852
+ table.push("+", "/");
3853
+ function encodeUint8Array(bytes) {
3854
+ let base64 = "";
3855
+ const len = bytes.byteLength;
3856
+ for (let i = 0; i < len; i += 3) if (len === i + 1) {
3857
+ const a = (bytes[i] & 252) >> 2;
3858
+ const b = (bytes[i] & 3) << 4;
3859
+ base64 += table[a];
3860
+ base64 += table[b];
3861
+ base64 += "==";
3862
+ } else if (len === i + 2) {
3863
+ const a = (bytes[i] & 252) >> 2;
3864
+ const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
3865
+ const c = (bytes[i + 1] & 15) << 2;
3866
+ base64 += table[a];
3867
+ base64 += table[b];
3868
+ base64 += table[c];
3869
+ base64 += "=";
3870
+ } else {
3871
+ const a = (bytes[i] & 252) >> 2;
3872
+ const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
3873
+ const c = (bytes[i + 1] & 15) << 2 | (bytes[i + 2] & 192) >> 6;
3874
+ const d = bytes[i + 2] & 63;
3875
+ base64 += table[a];
3876
+ base64 += table[b];
3877
+ base64 += table[c];
3878
+ base64 += table[d];
3879
+ }
3880
+ return base64;
3881
+ }
3882
+ /**
3883
+ * Records an async operation associated with a test task.
3884
+ *
3885
+ * This function tracks promises that should be awaited before a test completes.
3886
+ * The promise is automatically removed from the test's promise list once it settles.
3887
+ */
3888
+ function recordAsyncOperation(test, promise) {
3889
+ promise = promise.finally(() => {
3890
+ if (!test.promises) return;
3891
+ const index = test.promises.indexOf(promise);
3892
+ if (index !== -1) test.promises.splice(index, 1);
3893
+ });
3894
+ if (!test.promises) test.promises = [];
3895
+ test.promises.push(promise);
3896
+ return promise;
3897
+ }
3898
+ /**
3899
+ * Validates and prepares a test attachment for serialization.
3900
+ *
3901
+ * This function ensures attachments have either `body` or `path` set (but not both), and converts `Uint8Array` bodies to base64-encoded strings for easier serialization.
3902
+ *
3903
+ * @param attachment - The attachment to validate and prepare
3904
+ *
3905
+ * @throws {TypeError} If neither `body` nor `path` is provided
3906
+ * @throws {TypeError} If both `body` and `path` are provided
3907
+ */
3908
+ function manageArtifactAttachment(attachment) {
3909
+ if (attachment.body == null && !attachment.path) throw new TypeError(`Test attachment requires "body" or "path" to be set. Both are missing.`);
3910
+ if (attachment.body && attachment.path) throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`);
3911
+ if (attachment.path && attachment.bodyEncoding) throw new TypeError(`Test attachment with "path" should not have "bodyEncoding" specified.`);
3912
+ if (attachment.body instanceof Uint8Array) attachment.body = encodeUint8Array(attachment.body);
3913
+ if (attachment.body != null) attachment.bodyEncoding ??= "base64";
3914
+ }
3915
+ //#endregion
3916
+ export { format$1 as A, getCallLastIndex as C, noop as D, isObject as E, y as M, ordinal as O, deepClone as S, getType as T, parseSingleStack as _, createTaskCollector as a, assertTypes as b, getCurrentTest as c, getNames as d, getTestName as f, parseErrorStacktrace as g, matchesTags as h, createChainable as i, plugins as j, stringify as k, getFn as l, it as m, beforeAll as n, describe as o, getTests as p, beforeEach as r, getCurrentSuite as s, afterAll as t, getHooks as u, delay as v, getOwnProperties as w, createSimpleStackTrace as x, getSafeTimers as y };
3917
+
3918
+ //# sourceMappingURL=utils-CiH_DjFW.mjs.map